@wormhole-foundation/wormhole-connect 0.3.19-beta.3-development → 0.3.19-beta.5-development
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/assets/{ccip-B8sh0red.js → ccip-De5bB7ry.js} +1 -1
- package/dist/assets/{evm-B3YdeaCI.js → evm-DJTN7n-6.js} +4 -4
- package/dist/assets/{index-moDeJTxm.js → index-CdA027fm.js} +1 -1
- package/dist/assets/{index-1ZJmfQkw.js → index-D8xdfMo8.js} +2 -2
- package/dist/assets/{index.es-CXmj0UJy.js → index.es-DsPAzXeV.js} +2 -2
- package/dist/main.js +7 -7
- package/dist/src/components/ManualAddressInput.d.ts.map +1 -1
- package/dist/src/routes/cosmosGateway/cosmosGateway.d.ts +2 -0
- package/dist/src/routes/cosmosGateway/cosmosGateway.d.ts.map +1 -1
- package/dist/src/routes/porticoBridge/porticoBridge.d.ts +2 -0
- package/dist/src/routes/porticoBridge/porticoBridge.d.ts.map +1 -1
- package/dist/src/routes/sdkv2/route.d.ts +1 -1
- package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
- package/dist/src/routes/tbtc/tbtc.d.ts +2 -0
- package/dist/src/routes/tbtc/tbtc.d.ts.map +1 -1
- package/lib/{algorand-BDR3KPTJ.js → algorand-BizCMnCe.js} +1 -1
- package/lib/{algorand-CNPRWbNB.mjs → algorand-CZC9cPKi.mjs} +4 -4
- package/lib/{aptos-BPs26BCC.mjs → aptos-B4ng1XsR.mjs} +1 -1
- package/lib/{aptos-t3uXFwih.mjs → aptos-CRkEBLid.mjs} +4 -4
- package/lib/{aptos-tCZHrDAP.js → aptos-CXyHqFt8.js} +2 -2
- package/lib/{aptos-Br9Q1n2N.js → aptos-i8WEm-Fe.js} +1 -1
- package/lib/{browser-33Nc32cs.mjs → browser-CIwNo6kY.mjs} +2 -2
- package/lib/{browser-Cz60hQ-L.js → browser-DEzmpMBm.js} +1 -1
- package/lib/{ccip-CtmuOQGX.js → ccip-6omn1tDF.js} +1 -1
- package/lib/{ccip-CE49B2YD.mjs → ccip-LzzuUWf7.mjs} +1 -1
- package/lib/{chain-BT07YJHt.js → chain-BteoJHpg.js} +1 -1
- package/lib/{chain-CbwtJlkc.mjs → chain-Cc-vL0Ji.mjs} +1 -1
- package/lib/{cosmos-LlwNYP69.mjs → cosmos-5NiZ8EbB.mjs} +3 -3
- package/lib/{cosmos-t65H2NQC.js → cosmos-DM4Lrmu1.js} +1 -1
- package/lib/{cosmwasm-CiJ3I3AY.js → cosmwasm-8FJsT7LT.js} +2 -2
- package/lib/{cosmwasm-CbTKetWD.mjs → cosmwasm-BHEBPmf7.mjs} +6 -6
- package/lib/{create-Chqnlpoq.js → create-48Wkagqs.js} +1 -1
- package/lib/{create-HNw0Emrd.mjs → create-BIAJIVSg.mjs} +1 -1
- package/lib/{ens-validation.es6-BaZUabxu.js → ens-validation.es6-Bw--s4Qc.js} +1 -1
- package/lib/{ens-validation.es6-CyEOHc9J.mjs → ens-validation.es6-DQFhqeC0.mjs} +2 -2
- package/lib/{evm-lHNM4jqm.mjs → evm-B5hnoH2O.mjs} +6 -6
- package/lib/{evm-CjvzIUCn.mjs → evm-Dd33ef5o.mjs} +6 -6
- package/lib/{evm-CNC7JHe1.js → evm-JNEgzI8_.js} +4 -4
- package/lib/{evm-3AGyBI-h.js → evm-OwiMOsDg.js} +2 -2
- package/lib/{index-BWsL77BI.mjs → index-10BWvX1N.mjs} +3 -3
- package/lib/{index-DPNt5r2L.js → index-670AMJe5.js} +1 -1
- package/lib/{index-C4kvGnSA.mjs → index-B03MiI2p.mjs} +2 -2
- package/lib/{index-BpuXk_6h.js → index-B9pFbfyU.js} +1 -1
- package/lib/{index-35qsyZLz.js → index-BDi5PNJc.js} +1 -1
- package/lib/{index-BCSt_UXY.js → index-BFIX3imu.js} +1 -1
- package/lib/{index-CACyup9A.js → index-BHUxBugG.js} +1 -1
- package/lib/{index-DVVJw5ml.js → index-BHWhOqWI.js} +1 -1
- package/lib/{index-ztQgUCWf.js → index-BJPmRnHn.js} +1 -1
- package/lib/{index-BCnyHegg.mjs → index-Bg59b-Bk.mjs} +4 -4
- package/lib/{index-CbCfazgA.mjs → index-By8Yxkcx.mjs} +5 -5
- package/lib/{index-Tl7zYqHL.js → index-C1oy9Lkm.js} +6 -6
- package/lib/{index-DJzhcNDU.mjs → index-CHqEmT8z.mjs} +6 -6
- package/lib/{index-Bk7wdRtH.mjs → index-CMKVJZ8E.mjs} +3 -3
- package/lib/{index-DRTx-Ru8.mjs → index-CNbmckF9.mjs} +4 -4
- package/lib/{index-D1dHZqit.mjs → index-CU3qSQjR.mjs} +4 -4
- package/lib/{index-CjyrCdi_.mjs → index-CVjCpWVm.mjs} +1 -1
- package/lib/{index-BBtf8VGl.js → index-CYRY8C8f.js} +1 -1
- package/lib/{index-DfJLd65b.mjs → index-Cx7DnGQ7.mjs} +4 -4
- package/lib/{index-CdSy2Lfd.mjs → index-D4oa5qLu.mjs} +85 -62
- package/lib/{index-zKUpU-3R.mjs → index-D7DR5q91.mjs} +4 -4
- package/lib/{index-BH5gBrJu.mjs → index-D83yFXT3.mjs} +3 -3
- package/lib/{index-B6m0ovID.mjs → index-D8SeaoGs.mjs} +2 -2
- package/lib/{index-DGRaAUXo.mjs → index-D8l7OdtE.mjs} +2 -2
- package/lib/{index-Dbwiqljw.js → index-DETB2K9l.js} +1 -1
- package/lib/{index-abvwfKBf.js → index-DGfMxIjQ.js} +1 -1
- package/lib/{index-l_e-RUun.js → index-DLpTO2U3.js} +1 -1
- package/lib/{index-CokIAiMa.mjs → index-DX18kVfL.mjs} +4 -4
- package/lib/{index-dJMYtBle.mjs → index-DX6w1JtB.mjs} +4 -4
- package/lib/{index-B9L2kltl.mjs → index-DbMbSuyg.mjs} +4 -4
- package/lib/{index-DCPwTd_i.js → index-DfYaeaDv.js} +1 -1
- package/lib/{index-0t31FGKV.js → index-DjmghqSr.js} +1 -1
- package/lib/{index-UOSBfEgg.js → index-DlRC-hs-.js} +1 -1
- package/lib/{index-Cp5np38p.mjs → index-G7Dlm7ed.mjs} +1 -1
- package/lib/{index-Bp0NhDcb.js → index-Hyeca4Ym.js} +1 -1
- package/lib/{index-DVH-ZIP6.mjs → index-ROBBwabT.mjs} +4 -4
- package/lib/{index-CO9tmWap.js → index-WhcobQtR.js} +1 -1
- package/lib/{index-DrncQYMG.js → index-X-BikqCf.js} +1 -1
- package/lib/{index-BqGvvv6N.js → index-ZCZHbA1F.js} +1 -1
- package/lib/{index-Cofatf_w.js → index-isN8Fo1n.js} +1 -1
- package/lib/{index-B9gw1I6s.js → index-j8isX5f9.js} +1 -1
- package/lib/{index-CGLAoOXl.mjs → index-jlt17KkN.mjs} +4 -4
- package/lib/{index-BS1tjK_Z.mjs → index-mtuCwj6Z.mjs} +5 -5
- package/lib/{index-Bfw-brA6.js → index-oVIYJXdI.js} +1 -1
- package/lib/{index-CYap2RXm.js → index-tvG-rfJZ.js} +1 -1
- package/lib/{index-DvUq-nIQ.mjs → index-ybRLAtD8.mjs} +5 -5
- package/lib/{index.es-494n2GDU.js → index.es-B33YjOZu.js} +2 -2
- package/lib/{index.es-DnXnnX-i.mjs → index.es-BON8c55F.mjs} +4 -4
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-9p7NdjLu.mjs → libsodium-wrappers-DTuXKVrZ.mjs} +1 -1
- package/lib/{libsodium-wrappers-Dechaffz.js → libsodium-wrappers-VihnPAqR.js} +1 -1
- package/lib/{sei-SWKTnPTF.mjs → sei-C6N03jzv.mjs} +2 -2
- package/lib/{sei-DORxBQd-.js → sei-DTeCXpXl.js} +1 -1
- package/lib/{solana-Bd9eRY8E.js → solana--YauUjmQ.js} +2 -2
- package/lib/{solana-T2pgCVfU.mjs → solana-BMm013WW.mjs} +6 -6
- package/lib/{solana-DvbMa7B_.mjs → solana-DdaraOHp.mjs} +3 -3
- package/lib/{solana-KhBV5LOd.js → solana-T3yS-Q_9.js} +1 -1
- package/lib/{solanaEmbed.esm-CnKFJhsj.js → solanaEmbed.esm-DMwXbxXO.js} +1 -1
- package/lib/{solanaEmbed.esm-8eZSo5K2.mjs → solanaEmbed.esm-D_lKLzGu.mjs} +2 -2
- package/lib/src/components/ManualAddressInput.d.ts.map +1 -1
- package/lib/src/routes/cosmosGateway/cosmosGateway.d.ts +2 -0
- package/lib/src/routes/cosmosGateway/cosmosGateway.d.ts.map +1 -1
- package/lib/src/routes/porticoBridge/porticoBridge.d.ts +2 -0
- package/lib/src/routes/porticoBridge/porticoBridge.d.ts.map +1 -1
- package/lib/src/routes/sdkv2/route.d.ts +1 -1
- package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
- package/lib/src/routes/tbtc/tbtc.d.ts +2 -0
- package/lib/src/routes/tbtc/tbtc.d.ts.map +1 -1
- package/lib/{sui-DDu4a1uc.mjs → sui-Btvc4SGv.mjs} +4 -4
- package/lib/{sui-CjRGl9Gg.mjs → sui-CXyWZ2Gp.mjs} +1 -1
- package/lib/{sui-B382sZz0.js → sui-DWLiZoeB.js} +1 -1
- package/lib/{sui-DwH1wYGH.js → sui-DbQOBpeH.js} +2 -2
- package/lib/{unsignedTransaction-BbAfXtog.mjs → unsignedTransaction-CtPR6znR.mjs} +2 -2
- package/lib/{unsignedTransaction-mu6HJcHt.js → unsignedTransaction-DZq5iThY.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var w0=Object.defineProperty;var T0=(r,e,t)=>e in r?w0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var u=(r,e,t)=>(T0(r,typeof e!="symbol"?e+"":e,t),t),Pt=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var b=(r,e,t)=>(Pt(r,e,"read from private field"),t?t.call(r):e.get(r)),x=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},T=(r,e,t,n)=>(Pt(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var jt=(r,e,t,n)=>({set _(s){T(r,e,s,t)},get _(){return b(r,e,n)}}),A=(r,e,t)=>(Pt(r,e,"access private method"),t);const E0=require("./chain-BT07YJHt.js"),Te=require("./evm-3AGyBI-h.js"),x0=require("./create-Chqnlpoq.js"),Rt=require("./index-Tl7zYqHL.js");class Rn{constructor(e,t,n,s,i=!1){u(this,"transaction");u(this,"network");u(this,"chain");u(this,"description");u(this,"parallelizable");this.transaction=e,this.network=t,this.chain=n,this.description=s,this.parallelizable=i}}class at{constructor(e,t,n,s){u(this,"network");u(this,"chain");u(this,"provider");u(this,"contracts");u(this,"chainId");u(this,"coreAddress");u(this,"core");u(this,"coreIface");this.network=e,this.chain=t,this.provider=n,this.contracts=s,this.chainId=Rt.networkChainToNativeChainId.get(e,t),this.coreIface=et.createInterface();const i=this.contracts.coreBridge;if(!i)throw new Error("Core bridge address not found");this.coreAddress=i,this.core=et.connect(i,n)}async getMessageFee(){return await this.core.messageFee.staticCall()}async getGuardianSetIndex(){return Number(await this.core.getCurrentGuardianSetIndex.staticCall())}async getGuardianSet(e){const t=await this.core.getGuardianSet(e);return{index:e,keys:t[0],expiry:t[1]}}static async fromRpc(e,t){const[n,s]=await Te.EvmPlatform.chainFromRpc(e),i=t[s];if(i.network!==n)throw new Error(`Network mismatch: ${i.network} != ${n}`);return new at(n,s,e,i.contracts)}async*publishMessage(e,t,n,s){const i=new Te.EvmAddress(e).toString(),a=await this.core.publishMessage.populateTransaction(n,t,s);yield this.createUnsignedTx(Te.addFrom(a,i),"WormholeCore.publishMessage")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){const t=await this.provider.getTransactionReceipt(e);return t===null?[]:t.logs.filter(n=>n.address===this.coreAddress).map(n=>{const{topics:s,data:i}=n,a=this.coreIface.parseLog({topics:s.slice(),data:i});if(a===null)return;const o=new Te.EvmAddress(a.args.sender);return{chain:this.chain,emitter:o.toUniversalAddress(),sequence:a.args.sequence}}).filter(Rt.isWormholeMessageId)}async parseMessages(e){const t=await this.provider.getTransactionReceipt(e);if(t===null)throw new Error("Could not get transaction receipt");const n=await this.getGuardianSetIndex();return t.logs.filter(s=>s.address===this.coreAddress).map(s=>{const{topics:i,data:a}=s,o=this.coreIface.parseLog({topics:i.slice(),data:a});if(o===null)return null;const c=new Te.EvmAddress(o.args.sender);return x0.createVAA("Uint8Array",{guardianSet:n,timestamp:0,emitterChain:this.chain,emitterAddress:c.toUniversalAddress(),consistencyLevel:Number(o.args.consistencyLevel),sequence:BigInt(o.args.sequence),nonce:Number(o.args.nonce),signatures:[],payload:Rt.hex.decode(o.args.payload)})}).filter(s=>!!s)}createUnsignedTx(e,t,n=!1){return new Rn(Te.addChainId(e,this.chainId),this.network,this.chain,t,n)}}const N0="6.12.1";function v0(r,e,t){const n=e.split("|").map(i=>i.trim());for(let i=0;i<n.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof r===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=r,s}async function Bt(r){const e=Object.keys(r);return(await Promise.all(e.map(n=>Promise.resolve(r[n])))).reduce((n,s,i)=>(n[e[i]]=s,n),{})}function w(r,e,t){for(let n in e){let s=e[n];const i=t?t[n]:null;i&&v0(s,i,n),Object.defineProperty(r,n,{enumerable:!0,value:s,writable:!1})}}function Le(r){if(r==null)return"null";if(Array.isArray(r))return"[ "+r.map(Le).join(", ")+" ]";if(r instanceof Uint8Array){const e="0123456789abcdef";let t="0x";for(let n=0;n<r.length;n++)t+=e[r[n]>>4],t+=e[r[n]&15];return t}if(typeof r=="object"&&typeof r.toJSON=="function")return Le(r.toJSON());switch(typeof r){case"boolean":case"symbol":return r.toString();case"bigint":return BigInt(r).toString();case"number":return r.toString();case"string":return JSON.stringify(r);case"object":{const e=Object.keys(r);return e.sort(),"{ "+e.map(t=>`${Le(t)}: ${Le(r[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function He(r,e){return r&&r.code===e}function Sn(r){return He(r,"CALL_EXCEPTION")}function Xe(r,e,t){let n=r;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${Le(t)}`);for(const a in t){if(a==="shortMessage")continue;const o=t[a];i.push(a+"="+Le(o))}}i.push(`code=${e}`),i.push(`version=${N0}`),i.length&&(r+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(r);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(r);break;default:s=new Error(r)}return w(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&w(s,{shortMessage:n}),s}function g(r,e,t,n){if(!r)throw Xe(e,t,n)}function d(r,e,t,n){g(r,e,"INVALID_ARGUMENT",{argument:t,value:n})}function Un(r,e,t){t==null&&(t=""),t&&(t=": "+t),g(r>=e,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:r,expectedCount:e}),g(r<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:r,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((r,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");r.push(e)}catch{}return r},[]);function Ht(r,e,t){if(t==null&&(t=""),r!==e){let n=t,s="new";t&&(n+=".",s+=" "+t),g(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function Cn(r,e,t){if(r instanceof Uint8Array)return t?new Uint8Array(r):r;if(typeof r=="string"&&r.match(/^0x([0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((r.length-2)/2);let s=2;for(let i=0;i<n.length;i++)n[i]=parseInt(r.substring(s,s+2),16),s+=2;return n}d(!1,"invalid BytesLike value",e||"value",r)}function z(r,e){return Cn(r,e,!1)}function ee(r,e){return Cn(r,e,!0)}function ie(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&r.length!==2+2*e||e===!0&&r.length%2!==0)}function O0(r){return ie(r,!0)||r instanceof Uint8Array}const en="0123456789abcdef";function I(r){const e=z(r);let t="0x";for(let n=0;n<e.length;n++){const s=e[n];t+=en[(s&240)>>4]+en[s&15]}return t}function Pe(r){return"0x"+r.map(e=>I(e).substring(2)).join("")}function Ee(r,e,t){const n=z(r);return t!=null&&t>n.length&&g(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:t}),I(n.slice(e??0,t??n.length))}function Bn(r,e,t){const n=z(r);g(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),t?s.set(n,e-n.length):s.set(n,0),I(s)}function A0(r,e){return Bn(r,e,!0)}function k0(r,e){return Bn(r,e,!1)}const Nt=BigInt(0),K=BigInt(1),Fe=9007199254740991;function I0(r,e){const t=vt(r,"value"),n=BigInt(be(e,"width"));if(g(t>>n===Nt,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:r}),t>>n-K){const s=(K<<n)-K;return-((~t&s)+K)}return t}function P0(r,e){let t=le(r,"value");const n=BigInt(be(e,"width")),s=K<<n-K;if(t<Nt){t=-t,g(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:r});const i=(K<<n)-K;return(~t&i)+K}else g(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:r});return t}function ot(r,e){const t=vt(r,"value"),n=BigInt(be(e,"bits"));return t&(K<<n)-K}function le(r,e){switch(typeof r){case"bigint":return r;case"number":return d(Number.isInteger(r),"underflow",e||"value",r),d(r>=-Fe&&r<=Fe,"overflow",e||"value",r),BigInt(r);case"string":try{if(r==="")throw new Error("empty string");return r[0]==="-"&&r[1]!=="-"?-BigInt(r.substring(1)):BigInt(r)}catch(t){d(!1,`invalid BigNumberish string: ${t.message}`,e||"value",r)}}d(!1,"invalid BigNumberish value",e||"value",r)}function vt(r,e){const t=le(r,e);return g(t>=Nt,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:r}),t}const tn="0123456789abcdef";function Ln(r){if(r instanceof Uint8Array){let e="0x0";for(const t of r)e+=tn[t>>4],e+=tn[t&15];return BigInt(e)}return le(r)}function be(r,e){switch(typeof r){case"bigint":return d(r>=-Fe&&r<=Fe,"overflow",e||"value",r),Number(r);case"number":return d(Number.isInteger(r),"underflow",e||"value",r),d(r>=-Fe&&r<=Fe,"overflow",e||"value",r),r;case"string":try{if(r==="")throw new Error("empty string");return be(BigInt(r),e)}catch(t){d(!1,`invalid numeric string: ${t.message}`,e||"value",r)}}d(!1,"invalid numeric value",e||"value",r)}function R0(r){return be(Ln(r))}function Fn(r,e){let n=vt(r,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const s=be(e,"width");for(g(s*2>=n.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:r});n.length<s*2;)n="0"+n}return"0x"+n}function S0(r){const e=vt(r,"value");if(e===Nt)return new Uint8Array([]);let t=e.toString(16);t.length%2&&(t="0"+t);const n=new Uint8Array(t.length/2);for(let s=0;s<n.length;s++){const i=s*2;n[s]=parseInt(t.substring(i,i+2),16)}return n}var _e;class U0{constructor(e,t,n){u(this,"filter");u(this,"emitter");x(this,_e,void 0);T(this,_e,t),w(this,{emitter:e,filter:n})}async removeListener(){b(this,_e)!=null&&await this.emitter.off(this.filter,b(this,_e))}}_e=new WeakMap;function C0(r,e,t,n,s){d(!1,`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}function _n(r,e,t,n,s){if(r==="BAD_PREFIX"||r==="UNEXPECTED_CONTINUE"){let i=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)i++;return i}return r==="OVERRUN"?t.length-e-1:0}function B0(r,e,t,n,s){return r==="OVERLONG"?(d(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),n.push(s),0):(n.push(65533),_n(r,e,t))}const L0=Object.freeze({error:C0,ignore:_n,replace:B0});function F0(r,e){e==null&&(e=L0.error);const t=z(r,"bytes"),n=[];let s=0;for(;s<t.length;){const i=t[s++];if(!(i>>7)){n.push(i);continue}let a=null,o=null;if((i&224)===192)a=1,o=127;else if((i&240)===224)a=2,o=2047;else if((i&248)===240)a=3,o=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,t,n):s+=e("BAD_PREFIX",s-1,t,n);continue}if(s-1+a>=t.length){s+=e("OVERRUN",s-1,t,n);continue}let c=i&(1<<8-a-1)-1;for(let f=0;f<a;f++){let l=t[s];if((l&192)!=128){s+=e("MISSING_CONTINUE",s,t,n),c=null;break}c=c<<6|l&63,s++}if(c!==null){if(c>1114111){s+=e("OUT_OF_RANGE",s-1-a,t,n,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-a,t,n,c);continue}if(c<=o){s+=e("OVERLONG",s-1-a,t,n,c);continue}n.push(c)}}return n}function Mn(r,e){d(typeof r=="string","invalid string value","str",r);let t=[];for(let n=0;n<r.length;n++){const s=r.charCodeAt(n);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){n++;const i=r.charCodeAt(n);d(n<r.length&&(i&64512)===56320,"invalid surrogate pair","str",r);const a=65536+((s&1023)<<10)+(i&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function _0(r){return r.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function M0(r,e){return _0(F0(r,e))}function nn(r){const e=[];for(;r;)e.unshift(r&255),r>>=8;return e}function $n(r){if(Array.isArray(r)){let n=[];if(r.forEach(function(i){n=n.concat($n(i))}),n.length<=55)return n.unshift(192+n.length),n;const s=nn(n.length);return s.unshift(247+s.length),s.concat(n)}const e=Array.prototype.slice.call(z(r,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=nn(e.length);return t.unshift(183+t.length),t.concat(e)}const rn="0123456789abcdef";function $0(r){let e="0x";for(const t of $n(r))e+=rn[t>>4],e+=rn[t&15];return e}const B=32,Lt=new Uint8Array(B),D0=["then"],ct={};function ze(r,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${r}`);throw t.error=e,t}var pe;const xe=class xe extends Array{constructor(...t){const n=t[0];let s=t[1],i=(t[2]||[]).slice(),a=!0;n!==ct&&(s=t,i=[],a=!1);super(s.length);x(this,pe,void 0);s.forEach((c,f)=>{this[f]=c});const o=i.reduce((c,f)=>(typeof f=="string"&&c.set(f,(c.get(f)||0)+1),c),new Map);if(T(this,pe,Object.freeze(s.map((c,f)=>{const l=i[f];return l!=null&&o.get(l)===1?l:null}))),!!a)return Object.freeze(this),new Proxy(this,{get:(c,f,l)=>{if(typeof f=="string"){if(f.match(/^[0-9]+$/)){const h=be(f,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const m=c[h];return m instanceof Error&&ze(`index ${h}`,m),m}if(D0.indexOf(f)>=0)return Reflect.get(c,f,l);const p=c[f];if(p instanceof Function)return function(...h){return p.apply(this===l?c:this,h)};if(!(f in c))return c.getValue.apply(this===l?c:this,[f])}return Reflect.get(c,f,l)}})}toArray(t){const n=[];return this.forEach((s,i)=>{s instanceof Error&&ze(`index ${i}`,s),t&&s instanceof xe&&(s=s.toArray(t)),n.push(s)}),n}toObject(t){return b(this,pe).reduce((n,s,i)=>{if(g(s!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),!(s in n)){let a=this.getValue(s);t&&a instanceof xe&&(a=a.toObject(t)),n[s]=a}return n},{})}slice(t,n){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const s=[],i=[];for(let a=t;a<n;a++)s.push(this[a]),i.push(b(this,pe)[a]);return new xe(ct,s,i)}filter(t,n){const s=[],i=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&ze(`index ${a}`,o),t.call(n,o,a,this)&&(s.push(o),i.push(b(this,pe)[a]))}return new xe(ct,s,i)}map(t,n){const s=[];for(let i=0;i<this.length;i++){const a=this[i];a instanceof Error&&ze(`index ${i}`,a),s.push(t.call(n,a,i,this))}return s}getValue(t){const n=b(this,pe).indexOf(t);if(n===-1)return;const s=this[n];return s instanceof Error&&ze(`property ${JSON.stringify(t)}`,s.error),s}static fromItems(t,n){return new xe(ct,t,n)}};pe=new WeakMap;let mt=xe;function sn(r){let e=S0(r);return g(e.length<=B,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:B,offset:e.length}),e.length!==B&&(e=ee(Pe([Lt.slice(e.length%B),e]))),e}class de{constructor(e,t,n,s){u(this,"name");u(this,"type");u(this,"localName");u(this,"dynamic");w(this,{name:e,type:t,localName:n,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){d(!1,e,this.localName,t)}}var se,Oe,Me,dt;class Ft{constructor(){x(this,Me);x(this,se,void 0);x(this,Oe,void 0);T(this,se,[]),T(this,Oe,0)}get data(){return Pe(b(this,se))}get length(){return b(this,Oe)}appendWriter(e){return A(this,Me,dt).call(this,ee(e.data))}writeBytes(e){let t=ee(e);const n=t.length%B;return n&&(t=ee(Pe([t,Lt.slice(n)]))),A(this,Me,dt).call(this,t)}writeValue(e){return A(this,Me,dt).call(this,sn(e))}writeUpdatableValue(){const e=b(this,se).length;return b(this,se).push(Lt),T(this,Oe,b(this,Oe)+B),t=>{b(this,se)[e]=sn(t)}}}se=new WeakMap,Oe=new WeakMap,Me=new WeakSet,dt=function(e){return b(this,se).push(e),T(this,Oe,b(this,Oe)+e.length),e.length};var F,G,Ae,ke,he,tt,Mt,Tt,Dn;const qt=class qt{constructor(e,t,n){x(this,tt);x(this,Tt);u(this,"allowLoose");x(this,F,void 0);x(this,G,void 0);x(this,Ae,void 0);x(this,ke,void 0);x(this,he,void 0);w(this,{allowLoose:!!t}),T(this,F,ee(e)),T(this,Ae,0),T(this,ke,null),T(this,he,n??1024),T(this,G,0)}get data(){return I(b(this,F))}get dataLength(){return b(this,F).length}get consumed(){return b(this,G)}get bytes(){return new Uint8Array(b(this,F))}subReader(e){const t=new qt(b(this,F).slice(b(this,G)+e),this.allowLoose,b(this,he));return T(t,ke,this),t}readBytes(e,t){let n=A(this,Tt,Dn).call(this,0,e,!!t);return A(this,tt,Mt).call(this,e),T(this,G,b(this,G)+n.length),n.slice(0,e)}readValue(){return Ln(this.readBytes(B))}readIndex(){return R0(this.readBytes(B))}};F=new WeakMap,G=new WeakMap,Ae=new WeakMap,ke=new WeakMap,he=new WeakMap,tt=new WeakSet,Mt=function(e){var t;if(b(this,ke))return A(t=b(this,ke),tt,Mt).call(t,e);T(this,Ae,b(this,Ae)+e),g(b(this,he)<1||b(this,Ae)<=b(this,he)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${b(this,he)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:ee(b(this,F)),offset:b(this,G),length:e,info:{bytesRead:b(this,Ae),dataLength:this.dataLength}})},Tt=new WeakSet,Dn=function(e,t,n){let s=Math.ceil(t/B)*B;return b(this,G)+s>b(this,F).length&&(this.allowLoose&&n&&b(this,G)+t<=b(this,F).length?s=t:g(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:ee(b(this,F)),length:b(this,F).length,offset:b(this,G)+s})),b(this,F).slice(b(this,G),b(this,G)+s)};let _t=qt;function an(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Gn(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function on(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function G0(r,e){Gn(r);const t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const V0=r=>r instanceof Uint8Array,H0=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),z0=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!z0)throw new Error("Non little-endian hardware is not supported");function J0(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Vn(r){if(typeof r=="string"&&(r=J0(r)),!V0(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}class K0{clone(){return this._cloneInto()}}function W0(r){const e=n=>r().update(Vn(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}const ft=BigInt(2**32-1),cn=BigInt(32);function X0(r,e=!1){return e?{h:Number(r&ft),l:Number(r>>cn&ft)}:{h:Number(r>>cn&ft)|0,l:Number(r&ft)|0}}function Y0(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){const{h:i,l:a}=X0(r[s],e);[t[s],n[s]]=[i,a]}return[t,n]}const Z0=(r,e,t)=>r<<t|e>>>32-t,q0=(r,e,t)=>e<<t|r>>>32-t,Q0=(r,e,t)=>e<<t-32|r>>>64-t,j0=(r,e,t)=>r<<t-32|e>>>64-t,[Hn,zn,Jn]=[[],[],[]],er=BigInt(0),Je=BigInt(1),tr=BigInt(2),nr=BigInt(7),rr=BigInt(256),sr=BigInt(113);for(let r=0,e=Je,t=1,n=0;r<24;r++){[t,n]=[n,(2*t+3*n)%5],Hn.push(2*(5*n+t)),zn.push((r+1)*(r+2)/2%64);let s=er;for(let i=0;i<7;i++)e=(e<<Je^(e>>nr)*sr)%rr,e&tr&&(s^=Je<<(Je<<BigInt(i))-Je);Jn.push(s)}const[ir,ar]=Y0(Jn,!0),fn=(r,e,t)=>t>32?Q0(r,e,t):Z0(r,e,t),un=(r,e,t)=>t>32?j0(r,e,t):q0(r,e,t);function or(r,e=24){const t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)t[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,f=t[c],l=t[c+1],p=fn(f,l,1)^t[o],h=un(f,l,1)^t[o+1];for(let m=0;m<50;m+=10)r[a+m]^=p,r[a+m+1]^=h}let s=r[2],i=r[3];for(let a=0;a<24;a++){const o=zn[a],c=fn(s,i,o),f=un(s,i,o),l=Hn[a];s=r[l],i=r[l+1],r[l]=c,r[l+1]=f}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)t[o]=r[a+o];for(let o=0;o<10;o++)r[a+o]^=~t[(o+2)%10]&t[(o+4)%10]}r[0]^=ir[n],r[1]^=ar[n]}t.fill(0)}class zt extends K0{constructor(e,t,n,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,an(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=H0(this.state)}keccak(){or(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){on(this);const{blockLen:t,state:n}=this;e=Vn(e);const s=e.length;for(let i=0;i<s;){const a=Math.min(t-this.pos,s-i);for(let o=0;o<a;o++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:s}=this;e[n]^=t,t&128&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){on(this,!1),Gn(e),this.finish();const t=this.state,{blockLen:n}=this;for(let s=0,i=e.length;s<i;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,i-s);e.set(t.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return an(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(G0(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:s,rounds:i,enableXOF:a}=this;return e||(e=new zt(t,n,s,a,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=s,e.enableXOF=a,e.destroyed=this.destroyed,e}}const cr=(r,e,t)=>W0(()=>new zt(e,r,t)),fr=cr(1,136,256/8);let Kn=!1;const Wn=function(r){return fr(r)};let Xn=Wn;function ce(r){const e=z(r,"data");return I(Xn(e))}ce._=Wn;ce.lock=function(){Kn=!0};ce.register=function(r){if(Kn)throw new TypeError("keccak256 is locked");Xn=r};Object.freeze(ce);const ur=BigInt(0),lr=BigInt(36);function ln(r){r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const n=z(ce(t));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(n[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const Jt={};for(let r=0;r<10;r++)Jt[String(r)]=String(r);for(let r=0;r<26;r++)Jt[String.fromCharCode(65+r)]=String(10+r);const bn=15;function br(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(n=>Jt[n]).join("");for(;e.length>=bn;){let n=e.substring(0,bn);e=parseInt(n,10)%97+e.substring(n.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const dr=function(){const r={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];r[t]=BigInt(e)}return r}();function pr(r){r=r.toLowerCase();let e=ur;for(let t=0;t<r.length;t++)e=e*lr+dr[r[t]];return e}function fe(r){if(d(typeof r=="string","invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/)){r.startsWith("0x")||(r="0x"+r);const e=ln(r);return d(!r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===r,"bad address checksum","address",r),e}if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){d(r.substring(2,4)===br(r),"bad icap checksum","address",r);let e=pr(r.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return ln("0x"+e)}d(!1,"invalid address","address",r)}function hr(r){const e=fe(r.from);let n=le(r.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,fe(Ee(ce($0([e,n])),12))}function Yn(r){return r&&typeof r.getAddress=="function"}async function St(r,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(g(typeof r!="string","unconfigured name","UNCONFIGURED_NAME",{value:r}),d(!1,"invalid AddressLike value; did not resolve to a value address","target",r)),fe(t)}function Ye(r,e){if(typeof r=="string")return r.match(/^0x[0-9a-f]{40}$/i)?fe(r):(g(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),St(r,e.resolveName(r)));if(Yn(r))return St(r,r.getAddress());if(r&&typeof r.then=="function")return St(r,r);d(!1,"unsupported addressable value","target",r)}const te={};function y(r,e){let t=!1;return e<0&&(t=!0,e*=-1),new C(te,`${t?"":"u"}int${e}`,r,{signed:t,width:e})}function E(r,e){return new C(te,`bytes${e||""}`,r,{size:e})}const dn=Symbol.for("_ethers_typed");var Ie;const ne=class ne{constructor(e,t,n,s){u(this,"type");u(this,"value");x(this,Ie,void 0);u(this,"_typedSymbol");s==null&&(s=null),Ht(te,e,"Typed"),w(this,{_typedSymbol:dn,type:t,value:n}),T(this,Ie,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return b(this,Ie)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return b(this,Ie)===!0?-1:b(this,Ie)===!1?this.value.length:null}static from(e,t){return new ne(te,e,t)}static uint8(e){return y(e,8)}static uint16(e){return y(e,16)}static uint24(e){return y(e,24)}static uint32(e){return y(e,32)}static uint40(e){return y(e,40)}static uint48(e){return y(e,48)}static uint56(e){return y(e,56)}static uint64(e){return y(e,64)}static uint72(e){return y(e,72)}static uint80(e){return y(e,80)}static uint88(e){return y(e,88)}static uint96(e){return y(e,96)}static uint104(e){return y(e,104)}static uint112(e){return y(e,112)}static uint120(e){return y(e,120)}static uint128(e){return y(e,128)}static uint136(e){return y(e,136)}static uint144(e){return y(e,144)}static uint152(e){return y(e,152)}static uint160(e){return y(e,160)}static uint168(e){return y(e,168)}static uint176(e){return y(e,176)}static uint184(e){return y(e,184)}static uint192(e){return y(e,192)}static uint200(e){return y(e,200)}static uint208(e){return y(e,208)}static uint216(e){return y(e,216)}static uint224(e){return y(e,224)}static uint232(e){return y(e,232)}static uint240(e){return y(e,240)}static uint248(e){return y(e,248)}static uint256(e){return y(e,256)}static uint(e){return y(e,256)}static int8(e){return y(e,-8)}static int16(e){return y(e,-16)}static int24(e){return y(e,-24)}static int32(e){return y(e,-32)}static int40(e){return y(e,-40)}static int48(e){return y(e,-48)}static int56(e){return y(e,-56)}static int64(e){return y(e,-64)}static int72(e){return y(e,-72)}static int80(e){return y(e,-80)}static int88(e){return y(e,-88)}static int96(e){return y(e,-96)}static int104(e){return y(e,-104)}static int112(e){return y(e,-112)}static int120(e){return y(e,-120)}static int128(e){return y(e,-128)}static int136(e){return y(e,-136)}static int144(e){return y(e,-144)}static int152(e){return y(e,-152)}static int160(e){return y(e,-160)}static int168(e){return y(e,-168)}static int176(e){return y(e,-176)}static int184(e){return y(e,-184)}static int192(e){return y(e,-192)}static int200(e){return y(e,-200)}static int208(e){return y(e,-208)}static int216(e){return y(e,-216)}static int224(e){return y(e,-224)}static int232(e){return y(e,-232)}static int240(e){return y(e,-240)}static int248(e){return y(e,-248)}static int256(e){return y(e,-256)}static int(e){return y(e,-256)}static bytes1(e){return E(e,1)}static bytes2(e){return E(e,2)}static bytes3(e){return E(e,3)}static bytes4(e){return E(e,4)}static bytes5(e){return E(e,5)}static bytes6(e){return E(e,6)}static bytes7(e){return E(e,7)}static bytes8(e){return E(e,8)}static bytes9(e){return E(e,9)}static bytes10(e){return E(e,10)}static bytes11(e){return E(e,11)}static bytes12(e){return E(e,12)}static bytes13(e){return E(e,13)}static bytes14(e){return E(e,14)}static bytes15(e){return E(e,15)}static bytes16(e){return E(e,16)}static bytes17(e){return E(e,17)}static bytes18(e){return E(e,18)}static bytes19(e){return E(e,19)}static bytes20(e){return E(e,20)}static bytes21(e){return E(e,21)}static bytes22(e){return E(e,22)}static bytes23(e){return E(e,23)}static bytes24(e){return E(e,24)}static bytes25(e){return E(e,25)}static bytes26(e){return E(e,26)}static bytes27(e){return E(e,27)}static bytes28(e){return E(e,28)}static bytes29(e){return E(e,29)}static bytes30(e){return E(e,30)}static bytes31(e){return E(e,31)}static bytes32(e){return E(e,32)}static address(e){return new ne(te,"address",e)}static bool(e){return new ne(te,"bool",!!e)}static bytes(e){return new ne(te,"bytes",e)}static string(e){return new ne(te,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new ne(te,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===dn}static dereference(e,t){if(ne.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}};Ie=new WeakMap;let C=ne;class yr extends de{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=C.dereference(t,"string");try{n=fe(n)}catch(s){return this._throwError(s.message,t)}return e.writeValue(n)}decode(e){return fe(Fn(e.readValue(),20))}}class mr extends de{constructor(t){super(t.name,t.type,"_",t.dynamic);u(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,n){return this.coder.encode(t,n)}decode(t){return this.coder.decode(t)}}function Zn(r,e,t){let n=[];if(Array.isArray(t))n=t;else if(t&&typeof t=="object"){let c={};n=e.map(f=>{const l=f.localName;return g(l,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:f},value:t}),g(!c[l],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:f},value:t}),c[l]=!0,t[l]})}else d(!1,"invalid tuple value","tuple",t);d(e.length===n.length,"types/value length mismatch","tuple",t);let s=new Ft,i=new Ft,a=[];e.forEach((c,f)=>{let l=n[f];if(c.dynamic){let p=i.length;c.encode(i,l);let h=s.writeUpdatableValue();a.push(m=>{h(m+p)})}else c.encode(s,l)}),a.forEach(c=>{c(s.length)});let o=r.appendWriter(s);return o+=r.appendWriter(i),o}function qn(r,e){let t=[],n=[],s=r.subReader(0);return e.forEach(i=>{let a=null;if(i.dynamic){let o=r.readIndex(),c=s.subReader(o);try{a=i.decode(c)}catch(f){if(He(f,"BUFFER_OVERRUN"))throw f;a=f,a.baseType=i.name,a.name=i.localName,a.type=i.type}}else try{a=i.decode(r)}catch(o){if(He(o,"BUFFER_OVERRUN"))throw o;a=o,a.baseType=i.name,a.name=i.localName,a.type=i.type}if(a==null)throw new Error("investigate");t.push(a),n.push(i.localName||null)}),mt.fromItems(t,n)}class gr extends de{constructor(t,n,s){const i=t.type+"["+(n>=0?n:"")+"]",a=n===-1||t.dynamic;super("array",i,s,a);u(this,"coder");u(this,"length");w(this,{coder:t,length:n})}defaultValue(){const t=this.coder.defaultValue(),n=[];for(let s=0;s<this.length;s++)n.push(t);return n}encode(t,n){const s=C.dereference(n,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,t.writeValue(s.length)),Un(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let a=[];for(let o=0;o<s.length;o++)a.push(this.coder);return Zn(t,a,s)}decode(t){let n=this.length;n===-1&&(n=t.readIndex(),g(n*B<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:n*B,length:t.dataLength}));let s=[];for(let i=0;i<n;i++)s.push(new mr(this.coder));return qn(t,s)}}class wr extends de{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const n=C.dereference(t,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class Qn extends de{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=ee(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class Tr extends Qn{constructor(e){super("bytes",e)}decode(e){return I(super.decode(e))}}class Er extends de{constructor(t,n){let s="bytes"+String(t);super(s,s,n,!1);u(this,"size");w(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,n){let s=ee(C.dereference(n,this.type));return s.length!==this.size&&this._throwError("incorrect data length",n),t.writeBytes(s)}decode(t){return I(t.readBytes(this.size))}}const xr=new Uint8Array([]);class Nr extends de{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(xr)}decode(e){return e.readBytes(0),null}}const vr=BigInt(0),Or=BigInt(1),Ar=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class kr extends de{constructor(t,n,s){const i=(n?"int":"uint")+t*8;super(i,i,s,!1);u(this,"size");u(this,"signed");w(this,{size:t,signed:n},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,n){let s=le(C.dereference(n,this.type)),i=ot(Ar,B*8);if(this.signed){let a=ot(i,this.size*8-1);(s>a||s<-(a+Or))&&this._throwError("value out-of-bounds",n),s=P0(s,8*B)}else(s<vr||s>ot(i,this.size*8))&&this._throwError("value out-of-bounds",n);return t.writeValue(s)}decode(t){let n=ot(t.readValue(),this.size*8);return this.signed&&(n=I0(n,this.size*8)),n}}class Ir extends Qn{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Mn(C.dereference(t,"string")))}decode(e){return M0(super.decode(e))}}class ut extends de{constructor(t,n){let s=!1;const i=[];t.forEach(o=>{o.dynamic&&(s=!0),i.push(o.type)});const a="tuple("+i.join(",")+")";super("tuple",a,n,s);u(this,"coders");w(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(s=>{t.push(s.defaultValue())});const n=this.coders.reduce((s,i)=>{const a=i.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});return this.coders.forEach((s,i)=>{let a=s.localName;!a||n[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[i]))}),Object.freeze(t)}encode(t,n){const s=C.dereference(n,"tuple");return Zn(t,this.coders,s)}decode(t){return qn(t,this.coders)}}function Ze(r){return ce(Mn(r))}function Ut(r,e){return{address:fe(r),storageKeys:e.map((t,n)=>(d(ie(t,32),"invalid slot",`storageKeys[${n}]`,t),t.toLowerCase()))}}function Pr(r){if(Array.isArray(r))return r.map((t,n)=>Array.isArray(t)?(d(t.length===2,"invalid slot set",`value[${n}]`,t),Ut(t[0],t[1])):(d(t!=null&&typeof t=="object","invalid address-slot set","value",r),Ut(t.address,t.storageKeys)));d(r!=null&&typeof r=="object","invalid access list","value",r);const e=Object.keys(r).map(t=>{const n=r[t].reduce((s,i)=>(s[i]=!0,s),{});return Ut(t,Object.keys(n).sort())});return e.sort((t,n)=>t.address.localeCompare(n.address)),e}function L(r){const e=new Set;return r.forEach(t=>e.add(t)),Object.freeze(e)}const Rr="external public payable override",Sr=L(Rr.split(" ")),jn="constant external internal payable private public pure view override",Ur=L(jn.split(" ")),e0="constructor error event fallback function receive struct",t0=L(e0.split(" ")),n0="calldata memory storage payable indexed",Cr=L(n0.split(" ")),Br="tuple returns",Lr=[e0,n0,Br,jn].join(" "),Fr=L(Lr.split(" ")),_r={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Mr=new RegExp("^(\\s*)"),$r=new RegExp("^([0-9]+)"),Dr=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),r0=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),s0=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var R,J,nt,$t;const Et=class Et{constructor(e){x(this,nt);x(this,R,void 0);x(this,J,void 0);T(this,R,0),T(this,J,e.slice())}get offset(){return b(this,R)}get length(){return b(this,J).length-b(this,R)}clone(){return new Et(b(this,J))}reset(){T(this,R,0)}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=A(this,nt,$t).call(this,b(this,R)+1,e.match+1);return T(this,R,e.match+1),t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;b(this,R)<e.match-1;){const n=this.peek().linkNext;t.push(A(this,nt,$t).call(this,b(this,R)+1,n)),T(this,R,n)}return T(this,R,e.match+1),t}peek(){if(b(this,R)>=b(this,J).length)throw new Error("out-of-bounds");return b(this,J)[b(this,R)]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return jt(this,R)._++,e}toString(){const e=[];for(let t=b(this,R);t<b(this,J).length;t++){const n=b(this,J)[t];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}};R=new WeakMap,J=new WeakMap,nt=new WeakSet,$t=function(e=0,t=0){return new Et(b(this,J).slice(e,t).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let W=Et;function ge(r){const e=[],t=a=>{const o=i<r.length?JSON.stringify(r[i]):"$EOI";throw new Error(`invalid token ${o} at ${i}: ${a}`)};let n=[],s=[],i=0;for(;i<r.length;){let a=r.substring(i),o=a.match(Mr);o&&(i+=o[1].length,a=r.substring(i));const c={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(c);let f=_r[a[0]]||"";if(f){if(c.type=f,c.text=a[0],i++,f==="OPEN_PAREN")n.push(e.length-1),s.push(e.length-1);else if(f=="CLOSE_PAREN")n.length===0&&t("no matching open bracket"),c.match=n.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if(f==="COMMA")c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(f==="OPEN_BRACKET")c.type="BRACKET";else if(f==="CLOSE_BRACKET"){let l=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const p=e.pop().text;l=p+l,e[e.length-1].value=be(p)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=l}continue}if(o=a.match(Dr),o){if(c.text=o[1],i+=c.text.length,Fr.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(s0)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match($r),o){c.text=o[1],c.type="NUMBER",i+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${i}`)}return new W(e.map(a=>Object.freeze(a)))}function pn(r,e){let t=[];for(const n in e.keys())r.has(n)&&t.push(n);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Ot(r,e){if(e.peekKeyword(t0)){const t=e.pop().text;if(t!==r)throw new Error(`expected ${r}, got ${t}`)}return e.popType("ID")}function ue(r,e){const t=new Set;for(;;){const n=r.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(r.pop(),t.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);t.add(n)}return Object.freeze(t)}function i0(r){let e=ue(r,Ur);return pn(e,L("constant payable nonpayable".split(" "))),pn(e,L("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function oe(r,e){return r.popParams().map(t=>S.from(t,e))}function a0(r){if(r.peekType("AT")){if(r.pop(),r.peekType("NUMBER"))return le(r.pop().text);throw new Error("invalid gas")}return null}function Se(r){if(r.length)throw new Error(`unexpected tokens at offset ${r.offset}: ${r.toString()}`)}const Gr=new RegExp(/^(.*)\[([0-9]*)\]$/);function hn(r){const e=r.match(s0);if(d(e,"invalid type","type",r),r==="uint")return"uint256";if(r==="int")return"int256";if(e[2]){const t=parseInt(e[2]);d(t!==0&&t<=32,"invalid bytes length","type",r)}else if(e[3]){const t=parseInt(e[3]);d(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",r)}return r}const k={},M=Symbol.for("_ethers_internal"),yn="_ParamTypeInternal",mn="_ErrorInternal",gn="_EventInternal",wn="_ConstructorInternal",Tn="_FallbackInternal",En="_FunctionInternal",xn="_StructInternal";var $e,pt;const V=class V{constructor(e,t,n,s,i,a,o,c){x(this,$e);u(this,"name");u(this,"type");u(this,"baseType");u(this,"indexed");u(this,"components");u(this,"arrayLength");u(this,"arrayChildren");if(Ht(e,k,"ParamType"),Object.defineProperty(this,M,{value:yn}),a&&(a=Object.freeze(a.slice())),s==="array"){if(o==null||c==null)throw new Error("")}else if(o!=null||c!=null)throw new Error("");if(s==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");w(this,{name:t,type:n,baseType:s,indexed:i,components:a,arrayLength:o,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=n,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(s=>n.arrayChildren.walk(s,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((s,i)=>n.components[i].walk(s,t))}return t(this.type,e)}async walkAsync(e,t){const n=[],s=[e];return A(this,$e,pt).call(this,n,e,t,i=>{s[0]=i}),n.length&&await Promise.all(n),s[0]}static from(e,t){if(V.isParamType(e))return e;if(typeof e=="string")try{return V.from(ge(e),t)}catch{d(!1,"invalid param type","obj",e)}else if(e instanceof W){let o="",c="",f=null;ue(e,L(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",f=e.popParams().map(O=>V.from(O)),o=`tuple(${f.map(O=>O.format()).join(",")})`):(o=hn(e.popType("TYPE")),c=o);let l=null,p=null;for(;e.length&&e.peekType("BRACKET");){const O=e.pop();l=new V(k,"",o,c,null,f,p,l),p=O.value,o+=O.text,c="array",f=null}let h=null;if(ue(e,Cr).has("indexed")){if(!t)throw new Error("");h=!0}const v=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new V(k,v,o,c,h,f,p,l)}const n=e.name;d(!n||typeof n=="string"&&n.match(r0),"invalid name","obj.name",n);let s=e.indexed;s!=null&&(d(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,a=i.match(Gr);if(a){const o=parseInt(a[2]||"-1"),c=V.from({type:a[1],components:e.components});return new V(k,n||"",i,"array",s,null,o,c)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const o=e.components!=null?e.components.map(f=>V.from(f)):null;return new V(k,n||"",i,"tuple",s,o,null,null)}return i=hn(e.type),new V(k,n||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[M]===yn}};$e=new WeakSet,pt=function(e,t,n,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,o=t.slice();o.forEach((c,f)=>{var l;A(l=a,$e,pt).call(l,e,c,n,p=>{o[f]=p})}),s(o);return}if(this.isTuple()){const a=this.components;let o;if(Array.isArray(t))o=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");o=a.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in t))throw new Error(`missing value for component ${c.name}`);return t[c.name]})}if(o.length!==this.components.length)throw new Error("array is wrong length");o.forEach((c,f)=>{var l;A(l=a[f],$e,pt).call(l,e,c,n,p=>{o[f]=p})}),s(o);return}const i=n(this.type,t);i.then?e.push(async function(){s(await i)}()):s(i)};let S=V;class Ue{constructor(e,t,n){u(this,"type");u(this,"inputs");Ht(e,k,"Fragment"),n=Object.freeze(n.slice()),w(this,{type:t,inputs:n})}static from(e){if(typeof e=="string"){try{Ue.from(JSON.parse(e))}catch{}return Ue.from(ge(e))}if(e instanceof W)switch(e.peekKeyword(t0)){case"constructor":return ae.from(e);case"error":return _.from(e);case"event":return Q.from(e);case"fallback":case"receive":return re.from(e);case"function":return j.from(e);case"struct":return Re.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return ae.from(e);case"error":return _.from(e);case"event":return Q.from(e);case"fallback":case"receive":return re.from(e);case"function":return j.from(e);case"struct":return Re.from(e)}g(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}d(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return ae.isFragment(e)}static isError(e){return _.isFragment(e)}static isEvent(e){return Q.isFragment(e)}static isFunction(e){return j.isFragment(e)}static isStruct(e){return Re.isFragment(e)}}class At extends Ue{constructor(t,n,s,i){super(t,n,i);u(this,"name");d(typeof s=="string"&&s.match(r0),"invalid identifier","name",s),i=Object.freeze(i.slice()),w(this,{name:s})}}function qe(r,e){return"("+e.map(t=>t.format(r)).join(r==="full"?", ":",")+")"}class _ extends At{constructor(e,t,n){super(e,"error",t,n),Object.defineProperty(this,M,{value:mn})}get selector(){return Ze(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+qe(e,this.inputs)),t.join(" ")}static from(e){if(_.isFragment(e))return e;if(typeof e=="string")return _.from(ge(e));if(e instanceof W){const t=Ot("error",e),n=oe(e);return Se(e),new _(k,t,n)}return new _(k,e.name,e.inputs?e.inputs.map(S.from):[])}static isFragment(e){return e&&e[M]===mn}}class Q extends At{constructor(t,n,s,i){super(t,"event",n,s);u(this,"anonymous");Object.defineProperty(this,M,{value:gn}),w(this,{anonymous:i})}get topicHash(){return Ze(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const n=[];return t!=="sighash"&&n.push("event"),n.push(this.name+qe(t,this.inputs)),t!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(t,n){return n=(n||[]).map(i=>S.from(i)),new Q(k,t,n,!1).topicHash}static from(t){if(Q.isFragment(t))return t;if(typeof t=="string")try{return Q.from(ge(t))}catch{d(!1,"invalid event fragment","obj",t)}else if(t instanceof W){const n=Ot("event",t),s=oe(t,!0),i=!!ue(t,L(["anonymous"])).has("anonymous");return Se(t),new Q(k,n,s,i)}return new Q(k,t.name,t.inputs?t.inputs.map(n=>S.from(n,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[M]===gn}}class ae extends Ue{constructor(t,n,s,i,a){super(t,n,s);u(this,"payable");u(this,"gas");Object.defineProperty(this,M,{value:wn}),w(this,{payable:i,gas:a})}format(t){if(g(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const n=[`constructor${qe(t,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(t){if(ae.isFragment(t))return t;if(typeof t=="string")try{return ae.from(ge(t))}catch{d(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof W){ue(t,L(["constructor"]));const n=oe(t),s=!!ue(t,Sr).has("payable"),i=a0(t);return Se(t),new ae(k,"constructor",n,s,i)}return new ae(k,"constructor",t.inputs?t.inputs.map(S.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[M]===wn}}class re extends Ue{constructor(t,n,s){super(t,"fallback",n);u(this,"payable");Object.defineProperty(this,M,{value:Tn}),w(this,{payable:s})}format(t){const n=this.inputs.length===0?"receive":"fallback";if(t==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:s})}return`${n}()${this.payable?" payable":""}`}static from(t){if(re.isFragment(t))return t;if(typeof t=="string")try{return re.from(ge(t))}catch{d(!1,"invalid fallback fragment","obj",t)}else if(t instanceof W){const n=t.toString(),s=t.peekKeyword(L(["fallback","receive"]));if(d(s,"type must be fallback or receive","obj",n),t.popKeyword(L(["fallback","receive"]))==="receive"){const c=oe(t);return d(c.length===0,"receive cannot have arguments","obj.inputs",c),ue(t,L(["payable"])),Se(t),new re(k,[],!0)}let a=oe(t);a.length?d(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(c=>c.format("minimal")).join(", ")):a=[S.from("bytes")];const o=i0(t);if(d(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),ue(t,L(["returns"])).has("returns")){const c=oe(t);d(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(f=>f.format("minimal")).join(", "))}return Se(t),new re(k,a,o==="payable")}if(t.type==="receive")return new re(k,[],!0);if(t.type==="fallback"){const n=[S.from("bytes")],s=t.stateMutability==="payable";return new re(k,n,s)}d(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[M]===Tn}}class j extends At{constructor(t,n,s,i,a,o){super(t,"function",n,i);u(this,"constant");u(this,"outputs");u(this,"stateMutability");u(this,"payable");u(this,"gas");Object.defineProperty(this,M,{value:En}),a=Object.freeze(a.slice()),w(this,{constant:s==="view"||s==="pure",gas:o,outputs:a,payable:s==="payable",stateMutability:s})}get selector(){return Ze(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t))),outputs:this.outputs.map(s=>JSON.parse(s.format(t)))});const n=[];return t!=="sighash"&&n.push("function"),n.push(this.name+qe(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(qe(t,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(t,n){return n=(n||[]).map(i=>S.from(i)),new j(k,t,"view",n,[],null).selector}static from(t){if(j.isFragment(t))return t;if(typeof t=="string")try{return j.from(ge(t))}catch{d(!1,"invalid function fragment","obj",t)}else if(t instanceof W){const s=Ot("function",t),i=oe(t),a=i0(t);let o=[];ue(t,L(["returns"])).has("returns")&&(o=oe(t));const c=a0(t);return Se(t),new j(k,s,a,i,o,c)}let n=t.stateMutability;return n==null&&(n="payable",typeof t.constant=="boolean"?(n="view",t.constant||(n="payable",typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable")),new j(k,t.name,n,t.inputs?t.inputs.map(S.from):[],t.outputs?t.outputs.map(S.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[M]===En}}class Re extends At{constructor(e,t,n){super(e,"struct",t,n),Object.defineProperty(this,M,{value:xn})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Re.from(ge(e))}catch{d(!1,"invalid struct fragment","obj",e)}else if(e instanceof W){const t=Ot("struct",e),n=oe(e);return Se(e),new Re(k,t,n)}return new Re(k,e.name,e.inputs?e.inputs.map(S.from):[])}static isFragment(e){return e&&e[M]===xn}}const X=new Map;X.set(0,"GENERIC_PANIC");X.set(1,"ASSERT_FALSE");X.set(17,"OVERFLOW");X.set(18,"DIVIDE_BY_ZERO");X.set(33,"ENUM_RANGE_ERROR");X.set(34,"BAD_STORAGE_DATA");X.set(49,"STACK_UNDERFLOW");X.set(50,"ARRAY_RANGE_ERROR");X.set(65,"OUT_OF_MEMORY");X.set(81,"UNINITIALIZED_FUNCTION_CALL");const Vr=new RegExp(/^bytes([0-9]*)$/),Hr=new RegExp(/^(u?int)([0-9]*)$/);let Ct=null,Nn=1024;function zr(r,e,t,n){let s="missing revert data",i=null;const a=null;let o=null;if(t){s="execution reverted";const f=z(t);if(t=I(t),f.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(f.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(I(f.slice(0,4))==="0x08c379a0")try{i=n.decode(["string"],f.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(I(f.slice(0,4))==="0x4e487b71")try{const l=Number(n.decode(["uint256"],f.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[l]},i=`Panic due to ${X.get(l)||"UNKNOWN"}(${l})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?fe(e.to):null,data:e.data||"0x"};return e.from&&(c.from=fe(e.from)),Xe(s,"CALL_EXCEPTION",{action:r,data:t,reason:i,transaction:c,invocation:a,revert:o})}var ye,Be;const xt=class xt{constructor(){x(this,ye)}getDefaultValue(e){const t=e.map(s=>A(this,ye,Be).call(this,S.from(s)));return new ut(t,"_").defaultValue()}encode(e,t){Un(t.length,e.length,"types/values length mismatch");const n=e.map(a=>A(this,ye,Be).call(this,S.from(a))),s=new ut(n,"_"),i=new Ft;return s.encode(i,t),i.data}decode(e,t,n){const s=e.map(a=>A(this,ye,Be).call(this,S.from(a)));return new ut(s,"_").decode(new _t(t,n,Nn))}static _setDefaultMaxInflation(e){d(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Nn=e}static defaultAbiCoder(){return Ct==null&&(Ct=new xt),Ct}static getBuiltinCallException(e,t,n){return zr(e,t,n,xt.defaultAbiCoder())}};ye=new WeakSet,Be=function(e){if(e.isArray())return new gr(A(this,ye,Be).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new ut(e.components.map(n=>A(this,ye,Be).call(this,n)),e.name);switch(e.baseType){case"address":return new yr(e.name);case"bool":return new wr(e.name);case"string":return new Ir(e.name);case"bytes":return new Tr(e.name);case"":return new Nr(e.name)}let t=e.type.match(Hr);if(t){let n=parseInt(t[2]||"256");return d(n!==0&&n<=256&&n%8===0,"invalid "+t[1]+" bit length","param",e),new kr(n/8,t[1]==="int",e.name)}if(t=e.type.match(Vr),t){let n=parseInt(t[1]);return d(n!==0&&n<=32,"invalid bytes length","param",e),new Er(n,e.name)}d(!1,"invalid type","type",e.type)};let gt=xt;class Jr{constructor(e,t,n){u(this,"fragment");u(this,"name");u(this,"signature");u(this,"topic");u(this,"args");const s=e.name,i=e.format();w(this,{fragment:e,name:s,signature:i,topic:t,args:n})}}class Kr{constructor(e,t,n,s){u(this,"fragment");u(this,"name");u(this,"args");u(this,"signature");u(this,"selector");u(this,"value");const i=e.name,a=e.format();w(this,{fragment:e,name:i,args:n,signature:a,selector:t,value:s})}}class Wr{constructor(e,t,n){u(this,"fragment");u(this,"name");u(this,"args");u(this,"signature");u(this,"selector");const s=e.name,i=e.format();w(this,{fragment:e,name:s,args:n,signature:i,selector:t})}}class vn{constructor(e){u(this,"hash");u(this,"_isIndexed");w(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const On={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},An={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:r=>`reverted with reason string ${JSON.stringify(r)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:r=>{let e="unknown panic code";return r>=0&&r<=255&&On[r.toString()]&&(e=On[r.toString()]),`reverted with panic code 0x${r.toString(16)} (${e})`}}};var Y,Z,q,U,De,ht,Ge,yt;const Ne=class Ne{constructor(e){x(this,De);x(this,Ge);u(this,"fragments");u(this,"deploy");u(this,"fallback");u(this,"receive");x(this,Y,void 0);x(this,Z,void 0);x(this,q,void 0);x(this,U,void 0);let t=[];typeof e=="string"?t=JSON.parse(e):t=e,T(this,q,new Map),T(this,Y,new Map),T(this,Z,new Map);const n=[];for(const a of t)try{n.push(Ue.from(a))}catch(o){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,o.message)}w(this,{fragments:Object.freeze(n)});let s=null,i=!1;T(this,U,this.getAbiCoder()),this.fragments.forEach((a,o)=>{let c;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}w(this,{deploy:a});return;case"fallback":a.inputs.length===0?i=!0:(d(!s||a.payable!==s.payable,"conflicting fallback fragments",`fragments[${o}]`,a),s=a,i=s.payable);return;case"function":c=b(this,q);break;case"event":c=b(this,Z);break;case"error":c=b(this,Y);break;default:return}const f=a.format();c.has(f)||c.set(f,a)}),this.deploy||w(this,{deploy:ae.from("constructor()")}),w(this,{fallback:s,receive:i})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return gt.defaultAbiCoder()}getFunctionName(e){const t=A(this,De,ht).call(this,e,null,!1);return d(t,"no matching function","key",e),t.name}hasFunction(e){return!!A(this,De,ht).call(this,e,null,!1)}getFunction(e,t){return A(this,De,ht).call(this,e,t||null,!0)}forEachFunction(e){const t=Array.from(b(this,q).keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(b(this,q).get(s),n)}}getEventName(e){const t=A(this,Ge,yt).call(this,e,null,!1);return d(t,"no matching event","key",e),t.name}hasEvent(e){return!!A(this,Ge,yt).call(this,e,null,!1)}getEvent(e,t){return A(this,Ge,yt).call(this,e,t||null,!0)}forEachEvent(e){const t=Array.from(b(this,Z).keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(b(this,Z).get(s),n)}}getError(e,t){if(ie(e)){const s=e.toLowerCase();if(An[s])return _.from(An[s].signature);for(const i of b(this,Y).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,a]of b(this,Y))i.split("(")[0]===e&&s.push(a);if(s.length===0)return e==="Error"?_.from("error Error(string)"):e==="Panic"?_.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(a=>JSON.stringify(a.format())).join(", ");d(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=_.from(e).format(),e==="Error(string)")return _.from("error Error(string)");if(e==="Panic(uint256)")return _.from("error Panic(uint256)");const n=b(this,Y).get(e);return n||null}forEachError(e){const t=Array.from(b(this,Y).keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(b(this,Y).get(s),n)}}_decodeParams(e,t){return b(this,U).decode(e,t)}_encodeParams(e,t){return b(this,U).encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);d(n,"unknown error","fragment",e),e=n}return d(Ee(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Ee(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);d(n,"unknown error","fragment",e),e=n}return Pe([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);d(n,"unknown function","fragment",e),e=n}return d(Ee(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Ee(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);d(n,"unknown function","fragment",e),e=n}return Pe([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){if(typeof e=="string"){const i=this.getFunction(e);d(i,"unknown function","fragment",e),e=i}let n="invalid length for result data";const s=ee(t);if(s.length%32===0)try{return b(this,U).decode(e.outputs,s)}catch{n="could not decode result data"}g(!1,n,"BAD_DATA",{value:I(s),info:{method:e.name,signature:e.format()}})}makeError(e,t){const n=z(e,"data"),s=gt.getBuiltinCallException("call",t,n);if(s.message.startsWith("execution reverted (unknown custom error)")){const o=I(n.slice(0,4)),c=this.getError(o);if(c)try{const f=b(this,U).decode(c.inputs,n.slice(4));s.revert={name:c.name,signature:c.format(),args:f},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const a=this.parseTransaction(t);return a&&(s.invocation={method:a.name,signature:a.signature,args:a.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const n=this.getFunction(e);d(n,"unknown function","fragment",e),e=n}return I(b(this,U).encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const i=this.getEvent(e);d(i,"unknown event","eventFragment",e),e=i}g(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const n=[];e.anonymous||n.push(e.topicHash);const s=(i,a)=>i.type==="string"?Ze(a):i.type==="bytes"?ce(I(a)):(i.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":i.type.match(/^u?int/)?a=Fn(a):i.type.match(/^bytes/)?a=k0(a,32):i.type==="address"&&b(this,U).encode(["address"],[a]),A0(I(a),32));for(t.forEach((i,a)=>{const o=e.inputs[a];if(!o.indexed){d(i==null,"cannot filter non-indexed parameters; must be null","contract."+o.name,i);return}i==null?n.push(null):o.baseType==="array"||o.baseType==="tuple"?d(!1,"filtering with tuples or arrays not supported","contract."+o.name,i):Array.isArray(i)?n.push(i.map(c=>s(o,c))):n.push(s(o,i))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,t){if(typeof e=="string"){const a=this.getEvent(e);d(a,"unknown event","eventFragment",e),e=a}const n=[],s=[],i=[];return e.anonymous||n.push(e.topicHash),d(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((a,o)=>{const c=t[o];if(a.indexed)if(a.type==="string")n.push(Ze(c));else if(a.type==="bytes")n.push(ce(c));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(b(this,U).encode([a.type],[c]))}else s.push(a),i.push(c)}),{data:b(this,U).encode(s,i),topics:n}}decodeEventLog(e,t,n){if(typeof e=="string"){const m=this.getEvent(e);d(m,"unknown event","eventFragment",e),e=m}if(n!=null&&!e.anonymous){const m=e.topicHash;d(ie(n[0],32)&&n[0].toLowerCase()===m,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const s=[],i=[],a=[];e.inputs.forEach((m,v)=>{m.indexed?m.type==="string"||m.type==="bytes"||m.baseType==="tuple"||m.baseType==="array"?(s.push(S.from({type:"bytes32",name:m.name})),a.push(!0)):(s.push(m),a.push(!1)):(i.push(m),a.push(!1))});const o=n!=null?b(this,U).decode(s,Pe(n)):null,c=b(this,U).decode(i,t,!0),f=[],l=[];let p=0,h=0;return e.inputs.forEach((m,v)=>{let O=null;if(m.indexed)if(o==null)O=new vn(null);else if(a[v])O=new vn(o[h++]);else try{O=o[h++]}catch(P){O=P}else try{O=c[p++]}catch(P){O=P}f.push(O),l.push(m.name||null)}),mt.fromItems(f,l)}parseTransaction(e){const t=z(e.data,"tx.data"),n=le(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(I(t.slice(0,4)));if(!s)return null;const i=b(this,U).decode(s.inputs,t.slice(4));return new Kr(s,s.selector,i,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Jr(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=I(e),n=this.getError(Ee(t,0,4));if(!n)return null;const s=b(this,U).decode(n.inputs,Ee(t,4));return new Wr(n,n.selector,s)}static from(e){return e instanceof Ne?e:typeof e=="string"?new Ne(JSON.parse(e)):typeof e.formatJson=="function"?new Ne(e.formatJson()):typeof e.format=="function"?new Ne(e.format("json")):new Ne(e)}};Y=new WeakMap,Z=new WeakMap,q=new WeakMap,U=new WeakMap,De=new WeakSet,ht=function(e,t,n){if(ie(e)){const i=e.toLowerCase();for(const a of b(this,q).values())if(i===a.selector)return a;return null}if(e.indexOf("(")===-1){const i=[];for(const[a,o]of b(this,q))a.split("(")[0]===e&&i.push(o);if(t){const a=t.length>0?t[t.length-1]:null;let o=t.length,c=!0;C.isTyped(a)&&a.type==="overrides"&&(c=!1,o--);for(let f=i.length-1;f>=0;f--){const l=i[f].inputs.length;l!==o&&(!c||l!==o-1)&&i.splice(f,1)}for(let f=i.length-1;f>=0;f--){const l=i[f].inputs;for(let p=0;p<t.length;p++)if(C.isTyped(t[p])){if(p>=l.length){if(t[p].type==="overrides")continue;i.splice(f,1);break}if(t[p].type!==l[p].baseType){i.splice(f,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const a=t[t.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&n){const a=i.map(o=>JSON.stringify(o.format())).join(", ");d(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return i[0]}const s=b(this,q).get(j.from(e).format());return s||null},Ge=new WeakSet,yt=function(e,t,n){if(ie(e)){const i=e.toLowerCase();for(const a of b(this,Z).values())if(i===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const i=[];for(const[a,o]of b(this,Z))a.split("(")[0]===e&&i.push(o);if(t){for(let a=i.length-1;a>=0;a--)i[a].inputs.length<t.length&&i.splice(a,1);for(let a=i.length-1;a>=0;a--){const o=i[a].inputs;for(let c=0;c<t.length;c++)if(C.isTyped(t[c])&&t[c].type!==o[c].baseType){i.splice(a,1);break}}}if(i.length===0)return null;if(i.length>1&&n){const a=i.map(o=>JSON.stringify(o.format())).join(", ");d(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return i[0]}const s=b(this,Z).get(Q.from(e).format());return s||null};let Qe=Ne;const o0=BigInt(0);function H(r){return r==null?null:r.toString()}function Xr(r){const e={};r.to&&(e.to=r.to),r.from&&(e.from=r.from),r.data&&(e.data=I(r.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in r)||r[s]==null||(e[s]=le(r[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in r)||r[s]==null||(e[s]=be(r[s],`request.${s}`));return r.accessList&&(e.accessList=Pr(r.accessList)),"blockTag"in r&&(e.blockTag=r.blockTag),"enableCcipRead"in r&&(e.enableCcipRead=!!r.enableCcipRead),"customData"in r&&(e.customData=r.customData),"blobVersionedHashes"in r&&r.blobVersionedHashes&&(e.blobVersionedHashes=r.blobVersionedHashes.slice()),"kzg"in r&&(e.kzg=r.kzg),"blobs"in r&&r.blobs&&(e.blobs=r.blobs.map(s=>O0(s)?I(s):Object.assign({},s))),e}class kt{constructor(e,t){u(this,"provider");u(this,"transactionHash");u(this,"blockHash");u(this,"blockNumber");u(this,"removed");u(this,"address");u(this,"data");u(this,"topics");u(this,"index");u(this,"transactionIndex");this.provider=t;const n=Object.freeze(e.topics.slice());w(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:n,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:n,data:s,index:i,removed:a,topics:o,transactionHash:c,transactionIndex:f}=this;return{_type:"log",address:e,blockHash:t,blockNumber:n,data:s,index:i,removed:a,topics:o,transactionHash:c,transactionIndex:f}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return g(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return g(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return g(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return Zr(this)}}var rt;class Yr{constructor(e,t){u(this,"provider");u(this,"to");u(this,"from");u(this,"contractAddress");u(this,"hash");u(this,"index");u(this,"blockHash");u(this,"blockNumber");u(this,"logsBloom");u(this,"gasUsed");u(this,"blobGasUsed");u(this,"cumulativeGasUsed");u(this,"gasPrice");u(this,"blobGasPrice");u(this,"type");u(this,"status");u(this,"root");x(this,rt,void 0);T(this,rt,Object.freeze(e.logs.map(s=>new kt(s,t))));let n=o0;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),w(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return b(this,rt)}toJSON(){const{to:e,from:t,contractAddress:n,hash:s,index:i,blockHash:a,blockNumber:o,logsBloom:c,logs:f,status:l,root:p}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:o,contractAddress:n,cumulativeGasUsed:H(this.cumulativeGasUsed),from:t,gasPrice:H(this.gasPrice),blobGasUsed:H(this.blobGasUsed),blobGasPrice:H(this.blobGasPrice),gasUsed:H(this.gasUsed),hash:s,index:i,logs:f,logsBloom:c,root:p,status:l,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return f0(this)}reorderedEvent(e){return g(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),c0(this,e)}}rt=new WeakMap;var me;const Qt=class Qt{constructor(e,t){u(this,"provider");u(this,"blockNumber");u(this,"blockHash");u(this,"index");u(this,"hash");u(this,"type");u(this,"to");u(this,"from");u(this,"nonce");u(this,"gasLimit");u(this,"gasPrice");u(this,"maxPriorityFeePerGas");u(this,"maxFeePerGas");u(this,"maxFeePerBlobGas");u(this,"data");u(this,"value");u(this,"chainId");u(this,"signature");u(this,"accessList");u(this,"blobVersionedHashes");x(this,me,void 0);this.provider=t,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,T(this,me,-1)}toJSON(){const{blockNumber:e,blockHash:t,index:n,hash:s,type:i,to:a,from:o,nonce:c,data:f,signature:l,accessList:p,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:p,blockNumber:e,blockHash:t,blobVersionedHashes:h,chainId:H(this.chainId),data:f,from:o,gasLimit:H(this.gasLimit),gasPrice:H(this.gasPrice),hash:s,maxFeePerGas:H(this.maxFeePerGas),maxPriorityFeePerGas:H(this.maxPriorityFeePerGas),maxFeePerBlobGas:H(this.maxFeePerBlobGas),nonce:c,signature:l,to:a,index:n,type:i,value:H(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const n=await this.getTransaction();n&&(e=n.blockNumber)}if(e==null)return null;const t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:n}=await Bt({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:n-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const n=e??1,s=t??0;let i=b(this,me),a=-1,o=i===-1;const c=async()=>{if(o)return null;const{blockNumber:h,nonce:m}=await Bt({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(m<this.nonce){i=h;return}if(o)return null;const v=await this.getTransaction();if(!(v&&v.blockNumber!=null))for(a===-1&&(a=i-3,a<b(this,me)&&(a=b(this,me)));a<=h;){if(o)return null;const O=await this.provider.getBlock(a,!0);if(O==null)return;for(const P of O)if(P===this.hash)return;for(let P=0;P<O.length;P++){const N=await O.getTransaction(P);if(N.from===this.from&&N.nonce===this.nonce){if(o)return null;const $=await this.provider.getTransactionReceipt(N.hash);if($==null||h-$.blockNumber+1<n)return;let we="replaced";N.data===this.data&&N.to===this.to&&N.value===this.value?we="repriced":N.data==="0x"&&N.from===N.to&&N.value===o0&&(we="cancelled"),g(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:we==="replaced"||we==="cancelled",reason:we,replacement:N.replaceableTransaction(i),hash:N.hash,receipt:$})}}a++}},f=h=>{if(h==null||h.status!==0)return h;g(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:h.to,from:h.from,data:""},receipt:h})},l=await this.provider.getTransactionReceipt(this.hash);if(n===0)return f(l);if(l){if(await l.confirmations()>=n)return f(l)}else if(await c(),n===0)return null;return await new Promise((h,m)=>{const v=[],O=()=>{v.forEach(N=>N())};if(v.push(()=>{o=!0}),s>0){const N=setTimeout(()=>{O(),m(Xe("wait for transaction timeout","TIMEOUT"))},s);v.push(()=>{clearTimeout(N)})}const P=async N=>{if(await N.confirmations()>=n){O();try{h(f(N))}catch($){m($)}}};if(v.push(()=>{this.provider.off(this.hash,P)}),this.provider.on(this.hash,P),i>=0){const N=async()=>{try{await c()}catch($){if(He($,"TRANSACTION_REPLACED")){O(),m($);return}}o||this.provider.once("block",N)};v.push(()=>{this.provider.off("block",N)}),this.provider.once("block",N)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return g(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),f0(this)}reorderedEvent(e){return g(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),g(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),c0(this,e)}replaceableTransaction(e){d(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new Qt(this,this.provider);return T(t,me,e),t}};me=new WeakMap;let Dt=Qt;function c0(r,e){return{orphan:"reorder-transaction",tx:r,other:e}}function f0(r){return{orphan:"drop-transaction",tx:r}}function Zr(r){return{orphan:"drop-log",log:{transactionHash:r.transactionHash,blockHash:r.blockHash,blockNumber:r.blockNumber,address:r.address,data:r.data,topics:Object.freeze(r.topics.slice()),index:r.index}}}class Kt extends kt{constructor(t,n,s){super(t,t.provider);u(this,"interface");u(this,"fragment");u(this,"args");const i=n.decodeEventLog(s,t.data,t.topics);w(this,{args:i,fragment:s,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class u0 extends kt{constructor(t,n){super(t,t.provider);u(this,"error");w(this,{error:n})}}var Ve;class qr extends Yr{constructor(t,n,s){super(s,n);x(this,Ve,void 0);T(this,Ve,t)}get logs(){return super.logs.map(t=>{const n=t.topics.length?b(this,Ve).getEvent(t.topics[0]):null;if(n)try{return new Kt(t,b(this,Ve),n)}catch(s){return new u0(t,s)}return t})}}Ve=new WeakMap;var st;class Wt extends Dt{constructor(t,n,s){super(s,n);x(this,st,void 0);T(this,st,t)}async wait(t,n){const s=await super.wait(t,n);return s==null?null:new qr(b(this,st),this.provider,s)}}st=new WeakMap;class l0 extends U0{constructor(t,n,s,i){super(t,n,s);u(this,"log");w(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Qr extends l0{constructor(e,t,n,s,i){super(e,t,n,new Kt(i,e.interface,s));const a=e.interface.decodeEventLog(s,this.log.data,this.log.topics);w(this,{args:a,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const kn=BigInt(0);function b0(r){return r&&typeof r.call=="function"}function d0(r){return r&&typeof r.estimateGas=="function"}function It(r){return r&&typeof r.resolveName=="function"}function p0(r){return r&&typeof r.sendTransaction=="function"}function h0(r){if(r!=null){if(It(r))return r;if(r.provider)return r.provider}}var it;class jr{constructor(e,t,n){x(this,it,void 0);u(this,"fragment");if(w(this,{fragment:t}),t.inputs.length<n.length)throw new Error("too many arguments");const s=Ce(e.runner,"resolveName"),i=It(s)?s:null;T(this,it,async function(){const a=await Promise.all(t.inputs.map((o,c)=>n[c]==null?null:o.walkAsync(n[c],(l,p)=>l==="address"?Array.isArray(p)?Promise.all(p.map(h=>Ye(h,i))):Ye(p,i):p)));return e.interface.encodeFilterTopics(t,a)}())}getTopicFilter(){return b(this,it)}}it=new WeakMap;function Ce(r,e){return r==null?null:typeof r[e]=="function"?r:r.provider&&typeof r.provider[e]=="function"?r.provider:null}function ve(r){return r==null?null:r.provider||null}async function Xt(r,e){const t=C.dereference(r,"overrides");d(typeof t=="object","invalid overrides parameter","overrides",r);const n=Xr(t);return d(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),d(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function y0(r,e,t){const n=Ce(r,"resolveName"),s=It(n)?n:null;return await Promise.all(e.map((i,a)=>i.walkAsync(t[a],(o,c)=>(c=C.dereference(c,o),o==="address"?Ye(c,s):c))))}function es(r){const e=async function(a){const o=await Xt(a,["data"]);o.to=await r.getAddress(),o.from&&(o.from=await Ye(o.from,h0(r.runner)));const c=r.interface,f=le(o.value||kn,"overrides.value")===kn,l=(o.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!l&&!f&&d(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),d(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data);const p=c.receive||c.fallback&&c.fallback.payable;return d(p||f,"cannot send value to non-payable fallback","overrides.value",o.value),d(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data),o},t=async function(a){const o=Ce(r.runner,"call");g(b0(o),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(a);try{return await o.call(c)}catch(f){throw Sn(f)&&f.data?r.interface.makeError(f.data,c):f}},n=async function(a){const o=r.runner;g(p0(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),f=ve(r.runner);return new Wt(r.interface,f,c)},s=async function(a){const o=Ce(r.runner,"estimateGas");return g(d0(o),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await o.estimateGas(await e(a))},i=async a=>await n(a);return w(i,{_contract:r,estimateGas:s,populateTransaction:e,send:n,staticCall:t}),i}function ts(r,e){const t=function(...f){const l=r.interface.getFunction(e,f);return g(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:f}}),l},n=async function(...f){const l=t(...f);let p={};if(l.inputs.length+1===f.length&&(p=await Xt(f.pop()),p.from&&(p.from=await Ye(p.from,h0(r.runner)))),l.inputs.length!==f.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const h=await y0(r.runner,l.inputs,f);return Object.assign({},p,await Bt({to:r.getAddress(),data:r.interface.encodeFunctionData(l,h)}))},s=async function(...f){const l=await o(...f);return l.length===1?l[0]:l},i=async function(...f){const l=r.runner;g(p0(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const p=await l.sendTransaction(await n(...f)),h=ve(r.runner);return new Wt(r.interface,h,p)},a=async function(...f){const l=Ce(r.runner,"estimateGas");return g(d0(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await n(...f))},o=async function(...f){const l=Ce(r.runner,"call");g(b0(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const p=await n(...f);let h="0x";try{h=await l.call(p)}catch(v){throw Sn(v)&&v.data?r.interface.makeError(v.data,p):v}const m=t(...f);return r.interface.decodeFunctionResult(m,h)},c=async(...f)=>t(...f).constant?await s(...f):await i(...f);return w(c,{name:r.interface.getFunctionName(e),_contract:r,_key:e,getFragment:t,estimateGas:a,populateTransaction:n,send:i,staticCall:s,staticCallResult:o}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const f=r.interface.getFunction(e);return g(f,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),f}}),c}function ns(r,e){const t=function(...s){const i=r.interface.getEvent(e,s);return g(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},n=function(...s){return new jr(r,t(...s),s)};return w(n,{name:r.interface.getEventName(e),_contract:r,_key:e,getFragment:t}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=r.interface.getEvent(e);return g(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),n}const wt=Symbol.for("_ethersInternal_contract"),m0=new WeakMap;function rs(r,e){m0.set(r[wt],e)}function D(r){return m0.get(r[wt])}function ss(r){return r&&typeof r=="object"&&"getTopicFilter"in r&&typeof r.getTopicFilter=="function"&&r.fragment}async function Yt(r,e){let t,n=null;if(Array.isArray(e)){const i=function(a){if(ie(a,32))return a;const o=r.interface.getEvent(a);return d(o,"unknown fragment","name",a),o.topicHash};t=e.map(a=>a==null?null:Array.isArray(a)?a.map(i):i(a))}else e==="*"?t=[null]:typeof e=="string"?ie(e,32)?t=[e]:(n=r.interface.getEvent(e),d(n,"unknown fragment","event",e),t=[n.topicHash]):ss(e)?t=await e.getTopicFilter():"fragment"in e?(n=e.fragment,t=[n.topicHash]):d(!1,"unknown event name","event",e);t=t.map(i=>{if(i==null)return null;if(Array.isArray(i)){const a=Array.from(new Set(i.map(o=>o.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return i.toLowerCase()});const s=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:n,tag:s,topics:t}}async function Ke(r,e){const{subs:t}=D(r);return t.get((await Yt(r,e)).tag)||null}async function In(r,e,t){const n=ve(r.runner);g(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:a}=await Yt(r,t),{addr:o,subs:c}=D(r);let f=c.get(i);if(!f){const p={address:o||r,topics:a},h=P=>{let N=s;if(N==null)try{N=r.interface.getEvent(P.topics[0])}catch{}if(N){const $=N,we=s?r.interface.decodeEventLog(s,P.data,P.topics):[];Vt(r,t,we,g0=>new Qr(r,g0,t,$,P))}else Vt(r,t,[],$=>new l0(r,$,t,P))};let m=[];f={tag:i,listeners:[],start:()=>{m.length||m.push(n.on(p,h))},stop:async()=>{if(m.length==0)return;let P=m;m=[],await Promise.all(P),n.off(p,h)}},c.set(i,f)}return f}let Gt=Promise.resolve();async function is(r,e,t,n){await Gt;const s=await Ke(r,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:a,once:o})=>{const c=Array.from(t);n&&c.push(n(o?null:a));try{a.call(r,...c)}catch{}return!o}),s.listeners.length===0&&(s.stop(),D(r).subs.delete(s.tag)),i>0}async function Vt(r,e,t,n){try{await Gt}catch{}const s=is(r,e,t,n);return Gt=s,await s}const lt=["then"];var ls;const We=class We{constructor(e,t,n,s){u(this,"target");u(this,"interface");u(this,"runner");u(this,"filters");u(this,ls);u(this,"fallback");d(typeof e=="string"||Yn(e),"invalid value for Contract target","target",e),n==null&&(n=null);const i=Qe.from(t);w(this,{target:e,runner:n,interface:i}),Object.defineProperty(this,wt,{value:{}});let a,o=null,c=null;if(s){const p=ve(n);c=new Wt(this.interface,p,s)}let f=new Map;if(typeof e=="string")if(ie(e))o=e,a=Promise.resolve(e);else{const p=Ce(n,"resolveName");if(!It(p))throw Xe("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=p.resolveName(e).then(h=>{if(h==null)throw Xe("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return D(this).addr=h,h})}else a=e.getAddress().then(p=>{if(p==null)throw new Error("TODO");return D(this).addr=p,p});rs(this,{addrPromise:a,addr:o,deployTx:c,subs:f});const l=new Proxy({},{get:(p,h,m)=>{if(typeof h=="symbol"||lt.indexOf(h)>=0)return Reflect.get(p,h,m);try{return this.getEvent(h)}catch(v){if(!He(v,"INVALID_ARGUMENT")||v.argument!=="key")throw v}},has:(p,h)=>lt.indexOf(h)>=0?Reflect.has(p,h):Reflect.has(p,h)||this.interface.hasEvent(String(h))});return w(this,{filters:l}),w(this,{fallback:i.receive||i.fallback?es(this):null}),new Proxy(this,{get:(p,h,m)=>{if(typeof h=="symbol"||h in p||lt.indexOf(h)>=0)return Reflect.get(p,h,m);try{return p.getFunction(h)}catch(v){if(!He(v,"INVALID_ARGUMENT")||v.argument!=="key")throw v}},has:(p,h)=>typeof h=="symbol"||h in p||lt.indexOf(h)>=0?Reflect.has(p,h):p.interface.hasFunction(h)})}connect(e){return new We(this.target,this.interface,e)}attach(e){return new We(e,this.interface,this.runner)}async getAddress(){return await D(this).addrPromise}async getDeployedCode(){const e=ve(this.runner);g(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=ve(this.runner);return g(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);n.once("block",a)}catch(o){i(o)}};a()})}deploymentTransaction(){return D(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),ts(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),ns(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,n){t==null&&(t=0),n==null&&(n="latest");const{addr:s,addrPromise:i}=D(this),a=s||await i,{fragment:o,topics:c}=await Yt(this,e),f={address:a,topics:c,fromBlock:t,toBlock:n},l=ve(this.runner);return g(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(f)).map(p=>{let h=o;if(h==null)try{h=this.interface.getEvent(p.topics[0])}catch{}if(h)try{return new Kt(p,this.interface,h)}catch(m){return new u0(p,m)}return new kt(p,l)})}async on(e,t){const n=await In(this,"on",e);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(e,t){const n=await In(this,"once",e);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(e,...t){return await Vt(this,e,t,null)}async listenerCount(e){if(e){const s=await Ke(this,e);return s?s.listeners.length:0}const{subs:t}=D(this);let n=0;for(const{listeners:s}of t.values())n+=s.length;return n}async listeners(e){if(e){const s=await Ke(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:t}=D(this);let n=[];for(const{listeners:s}of t.values())n=n.concat(s.map(({listener:i})=>i));return n}async off(e,t){const n=await Ke(this,e);if(!n)return this;if(t){const s=n.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&n.listeners.splice(s,1)}return(t==null||n.listeners.length===0)&&(n.stop(),D(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const t=await Ke(this,e);if(!t)return this;t.stop(),D(this).subs.delete(t.tag)}else{const{subs:t}=D(this);for(const{tag:n,stop:s}of t.values())s(),t.delete(n)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends We{constructor(s,i=null){super(s,e,i)}}return t}static from(e,t,n){return n==null&&(n=null),new this(e,t,n)}};ls=wt;let je=We;function as(){return je}class os extends as(){}class Zt{constructor(e,t,n){u(this,"interface");u(this,"bytecode");u(this,"runner");const s=Qe.from(e);t instanceof Uint8Array||(typeof t=="object"&&(t=t.object),t.startsWith("0x")||(t="0x"+t)),t=I(z(t)),w(this,{bytecode:t,interface:s,runner:n||null})}attach(e){return new je(e,this.interface,this.runner)}async getDeployTransaction(...e){let t={};const n=this.interface.deploy;if(n.inputs.length+1===e.length&&(t=await Xt(e.pop())),n.inputs.length!==e.length)throw new Error("incorrect number of arguments to constructor");const s=await y0(this.runner,n.inputs,e),i=Pe([this.bytecode,this.interface.encodeDeploy(s)]);return Object.assign({},t,{data:i})}async deploy(...e){const t=await this.getDeployTransaction(...e);g(this.runner&&typeof this.runner.sendTransaction=="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const n=await this.runner.sendTransaction(t),s=hr(n);return new je(s,this.interface,this.runner,n)}connect(e){return new Zt(this.interface,this.bytecode,e)}static fromSolidity(e,t){d(e!=null,"bad compiler output","output",e),typeof e=="string"&&(e=JSON.parse(e));const n=e.abi;let s="";return e.bytecode?s=e.bytecode:e.evm&&e.evm.bytecode&&(s=e.evm.bytecode),new this(n,s,t)}}const bt=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldContract",type:"address"},{indexed:!0,internalType:"address",name:"newContract",type:"address"}],name:"ContractUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint32",name:"index",type:"uint32"}],name:"GuardianSetAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint64",name:"sequence",type:"uint64"},{indexed:!1,internalType:"uint32",name:"nonce",type:"uint32"},{indexed:!1,internalType:"bytes",name:"payload",type:"bytes"},{indexed:!1,internalType:"uint8",name:"consistencyLevel",type:"uint8"}],name:"LogMessagePublished",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"chainId",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"evmChainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentGuardianSetIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"index",type:"uint32"}],name:"getGuardianSet",outputs:[{components:[{internalType:"address[]",name:"keys",type:"address[]"},{internalType:"uint32",name:"expirationTime",type:"uint32"}],internalType:"struct Structs.GuardianSet",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getGuardianSetExpiry",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"}],name:"governanceActionIsConsumed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"governanceChainId",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"governanceContract",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isFork",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"impl",type:"address"}],name:"isInitialized",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"messageFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"emitter",type:"address"}],name:"nextSequence",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"encodedVM",type:"bytes"}],name:"parseAndVerifyVM",outputs:[{components:[{internalType:"uint8",name:"version",type:"uint8"},{internalType:"uint32",name:"timestamp",type:"uint32"},{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"uint16",name:"emitterChainId",type:"uint16"},{internalType:"bytes32",name:"emitterAddress",type:"bytes32"},{internalType:"uint64",name:"sequence",type:"uint64"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint32",name:"guardianSetIndex",type:"uint32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{internalType:"bytes32",name:"hash",type:"bytes32"}],internalType:"struct Structs.VM",name:"vm",type:"tuple"},{internalType:"bool",name:"valid",type:"bool"},{internalType:"string",name:"reason",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"encodedUpgrade",type:"bytes"}],name:"parseContractUpgrade",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{internalType:"address",name:"newContract",type:"address"}],internalType:"struct GovernanceStructs.ContractUpgrade",name:"cu",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedUpgrade",type:"bytes"}],name:"parseGuardianSetUpgrade",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{components:[{internalType:"address[]",name:"keys",type:"address[]"},{internalType:"uint32",name:"expirationTime",type:"uint32"}],internalType:"struct Structs.GuardianSet",name:"newGuardianSet",type:"tuple"},{internalType:"uint32",name:"newGuardianSetIndex",type:"uint32"}],internalType:"struct GovernanceStructs.GuardianSetUpgrade",name:"gsu",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedRecoverChainId",type:"bytes"}],name:"parseRecoverChainId",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint256",name:"evmChainId",type:"uint256"},{internalType:"uint16",name:"newChainId",type:"uint16"}],internalType:"struct GovernanceStructs.RecoverChainId",name:"rci",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedSetMessageFee",type:"bytes"}],name:"parseSetMessageFee",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{internalType:"uint256",name:"messageFee",type:"uint256"}],internalType:"struct GovernanceStructs.SetMessageFee",name:"smf",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedTransferFees",type:"bytes"}],name:"parseTransferFees",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"}],internalType:"struct GovernanceStructs.TransferFees",name:"tf",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedVM",type:"bytes"}],name:"parseVM",outputs:[{components:[{internalType:"uint8",name:"version",type:"uint8"},{internalType:"uint32",name:"timestamp",type:"uint32"},{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"uint16",name:"emitterChainId",type:"uint16"},{internalType:"bytes32",name:"emitterAddress",type:"bytes32"},{internalType:"uint64",name:"sequence",type:"uint64"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint32",name:"guardianSetIndex",type:"uint32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{internalType:"bytes32",name:"hash",type:"bytes32"}],internalType:"struct Structs.VM",name:"vm",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"}],name:"publishMessage",outputs:[{internalType:"uint64",name:"sequence",type:"uint64"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"numGuardians",type:"uint256"}],name:"quorum",outputs:[{internalType:"uint256",name:"numSignaturesRequiredForQuorum",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitContractUpgrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitNewGuardianSet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitRecoverChainId",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitSetMessageFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitTransferFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{components:[{internalType:"address[]",name:"keys",type:"address[]"},{internalType:"uint32",name:"expirationTime",type:"uint32"}],internalType:"struct Structs.GuardianSet",name:"guardianSet",type:"tuple"}],name:"verifySignatures",outputs:[{internalType:"bool",name:"valid",type:"bool"},{internalType:"string",name:"reason",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{components:[{internalType:"uint8",name:"version",type:"uint8"},{internalType:"uint32",name:"timestamp",type:"uint32"},{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"uint16",name:"emitterChainId",type:"uint16"},{internalType:"bytes32",name:"emitterAddress",type:"bytes32"},{internalType:"uint64",name:"sequence",type:"uint64"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint32",name:"guardianSetIndex",type:"uint32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{internalType:"bytes32",name:"hash",type:"bytes32"}],internalType:"struct Structs.VM",name:"vm",type:"tuple"}],name:"verifyVM",outputs:[{internalType:"bool",name:"valid",type:"bool"},{internalType:"string",name:"reason",type:"string"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],Pn="0x60808060405234610016576130a2908161001c8239f35b600080fdfe60806040526004361015610018575b366120d257612105565b60003560e01c80630319e59c146101e857806304ca84cf146101e3578063178149e7146101de5780631a90a219146101d95780631cfe7951146101d45780632c3c02a4146101cf5780634cf842b5146101ca5780634fdc60fa146101c5578063515f3247146101c05780635cb8cae2146101bb57806364d42b17146101b65780636606b4e0146101b15780638129fc1c146101ac578063875be02a146101a757806393df337e146101a25780639a8a05921461019d578063a0cce1b314610198578063a9e1189314610193578063b172b2221461018e578063b19a437e14610189578063c0fd8bde14610184578063cb4cfea81461017f578063d60b347f1461017a578063e039f22414610175578063eb8d3f1214610170578063f42bc6411461016b578063f8ce560a14610166578063f951975a146101615763fbe3c2cd0361000e576112d5565b61129d565b611277565b611203565b6111dd565b6111bc565b61117d565b611137565b6110d2565b610f96565b610f78565b610f50565b610d51565b610d2f565b610c78565b610b50565b610913565b6107c5565b6107a7565b6106d4565b61068e565b61063f565b6105fc565b61059b565b610577565b610559565b610476565b610409565b610363565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761021e57604052565b6101ed565b604081019081106001600160401b0382111761021e57604052565b60a081019081106001600160401b0382111761021e57604052565b606081019081106001600160401b0382111761021e57604052565b90601f801991011681019081106001600160401b0382111761021e57604052565b6040519061016082018281106001600160401b0382111761021e57604052565b604051906102c282610223565b565b6001600160401b03811161021e57601f01601f191660200190565b9291926102eb826102c4565b916102f96040519384610274565b829481845281830111610316578281602093846000960137010152565b600080fd5b9080601f8301121561031657816020610336933591016102df565b90565b602060031982011261031657600435906001600160401b038211610316576103369160040161031b565b346103165760a061037b61037636610339565b611dc4565b6080604051918051835260ff602082015116602084015261ffff60408201511660408401526060810151606084015201516080820152f35b906040810191805190604083528151809452606083019360208093019060005b8181106103ec5750505081015163ffffffff1691015290565b82516001600160a01b0316875295840195918401916001016103d3565b346103165761041f61041a36610339565b611b9f565b6040518091602082528051602083015260ff602082015116604083015261ffff604082015116606083015263ffffffff6080610469606084015160a08387015260c08601906103b3565b9201511660a08301520390f35b346103165761048436610339565b600854461461052757610513606061049e6105259361287e565b6104b06104aa8261185b565b906113b0565b61050a6104c060e0830151611e9d565b916104d163436f7265845114611459565b61050461014060408501926104e8468551146115ab565b015160005260056020526040600020600160ff19825416179055565b51612ca6565b015161ffff1690565b61ffff1661ffff196000541617600055565b005b60405162461bcd60e51b815260206004820152600a6024820152696e6f74206120666f726b60b01b6044820152606490fd5b34610316576000366003190112610316576020600754604051908152f35b3461031657600036600319011261031657602063ffffffff60035416604051908152f35b346103165760203660031901126103165760206105c8600435600052600560205260ff6040600020541690565b6040519015158152f35b600435906001600160a01b038216820361031657565b35906001600160a01b038216820361031657565b34610316576020366003190112610316576001600160a01b0361061d6105d2565b16600052600460205260206001600160401b0360406000205416604051908152f35b3461031657608061065761065236610339565b611a0c565b604051908051825260ff602082015116602083015261ffff6040820151166040830152606060018060a01b03910151166060820152f35b346103165760806106a66106a136610339565b611ce1565b6060604051918051835260ff602082015116602084015261ffff604082015116604084015201516060820152f35b34610316576106e236610339565b60085446036107735761076e60606106fc6105259361287e565b6107086104aa8261185b565b61076061014061071b60e0840151611a0c565b9261072c63436f72658551146113e0565b6104e861073e604086015161ffff1690565b61ffff61075861075160005461ffff1690565b61ffff1690565b91161461141d565b01516001600160a01b031690565b61163e565b60405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420666f726b60a01b6044820152606490fd5b34610316576000366003190112610316576020600854604051908152f35b34610316576105256108d96107e16107dc36610339565b61287e565b6107ed6104aa8261185b565b6108cf6107fd60e0830151611b9f565b61080d63436f7265825114611459565b61084b61081f604083015161ffff1690565b61ffff61083261075160005461ffff1690565b911690811490816108f8575b81156108ef575b50611496565b6108a9610140608060608401936108668551515115156114d2565b01946104e8610879875163ffffffff1690565b63ffffffff6108a161089861089360035463ffffffff1690565b611534565b63ffffffff1690565b911614611549565b6108c06108bb60035463ffffffff1690565b612b24565b51825163ffffffff1690612c1b565b5163ffffffff1690565b63ffffffff1663ffffffff196003541617600355565b90501538610845565b905061090d61090960085446141590565b1590565b9061083e565b34610316576000806003193601126109cc577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b03168082526006602052604082205460ff16610991576001600160a01b03166000908152600660205260409020805460ff1916600117905561098e611f42565b80f35b60405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606490fd5b80fd5b6044359060ff8216820361031657565b359060ff8216820361031657565b6004359063ffffffff8216820361031657565b359063ffffffff8216820361031657565b359061ffff8216820361031657565b35906001600160401b038216820361031657565b6001600160401b03811161021e5760051b60200190565b81601f8201121561031657803590610a6282610a34565b92604092610a7284519586610274565b808552602091828087019260071b85010193818511610316578301915b848310610a9f5750505050505090565b60808383031261031657836080918751610ab881610203565b853581528286013583820152610acf8987016109df565b898201526060610ae08188016109df565b90820152815201920191610a8f565b60005b838110610b025750506000910152565b8181015183820152602001610af2565b90602091610b2b81518092818552858086019101610aef565b601f01601f1916010190565b6040906103369392151581528160208201520190610b12565b346103165760031960203682011261031657600435906001600160401b03908183116103165761016090833603011261031657610b8b610295565b90610b98836004016109df565b8252610ba660248401610a00565b6020830152610bb760448401610a00565b6040830152610bc860648401610a11565b606083015260848301356080830152610be360a48401610a20565b60a0830152610bf460c484016109df565b60c083015260e483013581811161031657610c15906004369186010161031b565b60e0830152610c276101048401610a00565b61010083015261012483013590811161031657610c6492610c516101449260043691840101610a4b565b61012084015201356101408201526123f9565b90610c7460405192839283610b37565b0390f35b3461031657610ce2610140610c8f6107dc36610339565b610c9b6104aa8261185b565b6104e8610cab60e0830151611dc4565b610cbb63436f7265825114611459565b604081015161ffff1690600095869586958695869561ffff610832610751895461ffff1690565b6080810151606090610d0c90610d009081906001600160a01b031681565b6001600160a01b031690565b91015190828215610d26575bf115610d215780f35b61159f565b506108fc610d18565b3461031657600036600319011261031657602061ffff60005416604051908152f35b3461031657600319606036820112610316576001600160401b0360243581811161031657610d83903690600401610a4b565b604435928284116103165760409084360301126103165760405191610da783610223565b8360040135908111610316578301923660238501121561031657600484013593610dd085610a34565b90610dde6040519283610274565b85825260209560248784019160051b8301019136831161031657602401905b828210610e26575050506024610c649592610e1a92865201610a00565b9083015260043561268d565b878091610e32846105e8565b815201910190610dfd565b90815180825260208080930193019160005b828110610e5d575050505090565b835180518652808301518684015260408082015160ff90811691880191909152606091820151169086015260809094019392810192600101610e4f565b805160ff1682529060208281015163ffffffff169082015260408281015163ffffffff169082015260608281015161ffff169082015260808201516080820152610ef460a083015160a08301906001600160401b03169052565b60c08281015160ff1690820152610f42610f1d60e08401516101608060e0860152840190610b12565b6101008481015163ffffffff1690840152610120808501519084830390850152610e3d565b916101408091015191015290565b3461031657610c74610f646107dc36610339565b604051918291602083526020830190610e9a565b34610316576000366003190112610316576020600154604051908152f35b606036600319011261031657610faa6109ed565b6001600160401b0360243581811161031657610fca90369060040161031b565b91610fd36109cf565b91600754340361107457336000526004602052806040600020541692600184019482861161106f57610c74957f6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b293336000526004602052604060002091166001600160401b031982541617905561105260405192839233968885611f06565b0390a26040516001600160401b0390911681529081906020820190565b61151e565b60405162461bcd60e51b815260206004820152600b60248201526a696e76616c69642066656560a81b6044820152606490fd5b6110bd6103369492606083526060830190610e9a565b92151560208201526040818403910152610b12565b34610316576020366003190112610316576001600160401b03600435818111610316573660238201121561031657806004013591821161031657366024838301011161031657610c7491602461112892016121c5565b604093919351938493846110a7565b3461031657608061114f61114a36610339565b611e9d565b61ffff6060604051928051845260ff6020820151166020850152604081015160408501520151166060820152f35b34610316576020366003190112610316576001600160a01b0361119e6105d2565b166000526006602052602060ff604060002054166040519015158152f35b34610316576000366003190112610316576020600854604051904614158152f35b3461031657600036600319011261031657602060035463ffffffff60405191831c168152f35b346103165760606112166107dc36610339565b6112226104aa8261185b565b61126561014061123560e0840151611ce1565b9261124663436f72658551146113e0565b61ffff806040860151169060005416148061126c575b6104e89061141d565b0151600755005b50600854461461125c565b34610316576020366003190112610316576020611295600435612ac1565b604051908152f35b3461031657602036600319011261031657610c746112c16112bc6109ed565b611314565b6040519182916020835260208301906103b3565b3461031657600036600319011261031657602061ffff60005460101c16604051908152f35b6040519061130782610223565b6000602083606081520152565b63ffffffff906113226112fa565b50166000526020600281526040600020906040519161134083610223565b6040518083835491828152019083600052846000209060005b8181106113935750505061033693928261137a611387946001940382610274565b8652015463ffffffff1690565b63ffffffff1690830152565b82546001600160a01b031684529286019260019283019201611359565b156113b85750565b60405162461bcd60e51b8152602060048201529081906113dc906024830190610b12565b0390fd5b156113e757565b60405162461bcd60e51b815260206004820152600e60248201526d496e76616c6964204d6f64756c6560901b6044820152606490fd5b1561142457565b60405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21021b430b4b760991b6044820152606490fd5b1561146057565b60405162461bcd60e51b815260206004820152600e60248201526d696e76616c6964204d6f64756c6560901b6044820152606490fd5b1561149d57565b60405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b21021b430b4b760991b6044820152606490fd5b156114d957565b60405162461bcd60e51b815260206004820152601960248201527f6e657720677561726469616e2073657420697320656d707479000000000000006044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b90600163ffffffff8093160191821161106f57565b1561155057565b60405162461bcd60e51b815260206004820152602160248201527f696e646578206d75737420696e63726561736520696e207374657073206f66206044820152603160f81b6064820152608490fd5b6040513d6000823e3d90fd5b156115b257565b60405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21022ab269021b430b4b760791b6044820152606490fd5b60405190602082018281106001600160401b0382111761021e5760405260008252565b3d15611639573d9061161f826102c4565b9161162d6040519384610274565b82523d6000602084013e565b606090565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc908154813b1561170d577f2e4cc16c100f0b55e2df82ab0b1a7e294aa9cbd01b48fbaf622683fbc0507a499060018060a01b039081841694856bffffffffffffffffffffffff60a01b8316179055611707604051600080968192897fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a263204a7f0760e21b6020820190815260048252906116fb81610223565b51915af46104aa61160e565b169180a3565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b6040519061177582610259565b6022825261195d60f21b6040837f6e6f74207369676e65642062792063757272656e7420677561726469616e207360208201520152565b604051906117b982610223565b60168252753bb937b7339033b7bb32b93730b731b29031b430b4b760511b6020830152565b604051906117eb82610223565b601982527f77726f6e6720676f7665726e616e636520636f6e7472616374000000000000006020830152565b6040519061182482610259565b6022825261195960f21b6040837f676f7665726e616e636520616374696f6e20616c726561647920636f6e73756d60208201520152565b611864816123f9565b9015611924575061010081015163ffffffff1663ffffffff61188e61089860035463ffffffff1690565b91160361191857606081015161ffff1661ffff6118b561075160005461ffff9060101c1690565b91160361190c57608081015160015403611900576101406118e6910151600052600560205260ff6040600020541690565b6118f5576001906103366115eb565b600090610336611817565b506000906103366117de565b506000906103366117ac565b50600090610336611768565b600092909150565b6040519061193982610203565b60006060838281528260208201528260408201520152565b906020820180921161106f57565b906001820180921161106f57565b906002820180921161106f57565b906004820180921161106f57565b906014820180921161106f57565b906008820180921161106f57565b90601f820180921161106f57565b9190820180921161106f57565b156119c757565b60405162461bcd60e51b815260206004820152601760248201527f696e76616c696420436f6e7472616374557067726164650000000000000000006044820152606490fd5b90611a1561192c565b91611a1f81613030565b8352611a3e600160ff611a3184612e51565b16806020870152146119c0565b61ffff611a4a82612ee8565b1660408401526043815110611a79576043818101516001600160a01b0316606085015290516102c291146119c0565b60405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606490fd5b60405190611ac38261023e565b6000608083828152826020820152826040820152611adf6112fa565b60608201520152565b15611aef57565b60405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420477561726469616e536574557067726164650000000000006044820152606490fd5b90611b3e82610a34565b611b4b6040519182610274565b8281528092611b5c601f1991610a34565b0190602036910137565b600019811461106f5760010190565b8051821015611b895760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b90611ba8611ab6565b91611bb281613030565b8352611bdb600260ff611bd4611bc785612e51565b60ff166020880181905290565b1614611ae8565b611bf2611be782612ee8565b61ffff166040850152565b611c0b611bfe82612fac565b63ffffffff166080850152565b611c1481612ebc565b60ff6028911691611c2483611b34565b92611c2d6102b5565b93845260006020850152606086019384526000935b818510611c575750506102c292505114611ae8565b909192611c8e81611c89611c6e611c949488612df5565b611c7a89875151611b75565b6001600160a01b039091169052565b611989565b94611b66565b93929190611c42565b15611ca457565b60405162461bcd60e51b8152602060048201526015602482015274696e76616c6964205365744d65737361676546656560581b6044820152606490fd5b90611cea61192c565b91611cf481613030565b8352611d13600360ff611d0684612e51565b1680602087015214611c9d565b61ffff611d1f82612ee8565b1660408401526043815110611d4457604381816102c293015160608601525114611c9d565b60405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b6044820152606490fd5b15611d8857565b60405162461bcd60e51b8152602060048201526014602482015273696e76616c6964205472616e736665724665657360601b6044820152606490fd5b9060405191611dd28361023e565b60008352602083019060008252604084019060008252606085019160008352611e20600460808801956000875288611e0986613030565b905260ff611e1686612e51565b1680915214611d81565b61ffff611e2c83612ee8565b1690526043815110611d44576102c29260639260438301519052611e4f82613040565b90525114611d81565b15611e5f57565b60405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a5908149958dbdd995c90da185a5b925960521b6044820152606490fd5b90611ea661192c565b91611eb081613030565b8352611ecf600560ff611ec284612e51565b1680602087015214611e58565b6041815110611d445760438160416102c29301516040860152611eff611ef482612f34565b61ffff166060870152565b5114611e58565b92611f3b9063ffffffff6060946001600160401b0360ff95999899168752166020860152608060408601526080850190610b12565b9416910152565b60085415611f4c57565b61ffff611f5c60005461ffff1690565b1660028103611f7057506102c26001612ca6565b60048103611f8357506102c26038612ca6565b60058103611f9657506102c26089612ca6565b60068103611faa57506102c261a86a612ca6565b60078103611fbe57506102c261a516612ca6565b60098103611fd457506102c2634e454152612ca6565b600a8103611fe757506102c260fa612ca6565b600b8103611ffb57506102c26102ae612ca6565b600c810361200f57506102c2610313612ca6565b600d810361202357506102c2612019612ca6565b600e810361203757506102c261a4ec612ca6565b6010810361204b57506102c2610504612ca6565b6011810361206157506102c2630e9ac0d6612ca6565b6017810361207557506102c261a4b1612ca6565b6018810361208857506102c2600a612ca6565b601903612099576102c26064612ca6565b60405162461bcd60e51b81526020600482015260116024820152702ab735b737bbb71031b430b4b71034b21760791b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a1d5b9cdd5c1c1bdc9d195960aa1b6044820152606490fd5b60405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201526b63636570742061737365747360a01b6064820152608490fd5b6040519061016082018281106001600160401b0382111761021e57604052816101406000918281528260208201528260408201528260608201528260808201528260a08201528260c0820152606060e08201528261010082015260606101208201520152565b6107dc906121dd926121d561215f565b5036916102df565b906121e782612325565b9091565b94929060339796949263ffffffff60e01b809260e01b16875260e01b16600486015261ffff60f01b9060f01b166008850152600a8401526001600160401b0360c01b9060c01b16602a83015260ff60f81b9060f81b1660328201526122598251809360208685019101610aef565b010190565b6040519061226b82610223565b601a82527f766d2e6861736820646f65736e2774206d6174636820626f64790000000000006020830152565b604051906122a482610223565b60148252731a5b9d985b1a590819dd585c991a585b881cd95d60621b6020830152565b604051906122d482610223565b601882527f677561726469616e2073657420686173206578706972656400000000000000006020830152565b6040519061230d82610223565b60098252686e6f2071756f72756d60b81b6020830152565b610100810161233b6112bc825163ffffffff1690565b90815151156123eb575163ffffffff1661235d61089860035463ffffffff1690565b63ffffffff809216141590816123ce575b506123c1576101208201805151612386835151612ac1565b116123b35761014061239c93015190519061268d565b90156123ae57506001906103366115eb565b600091565b505050600090610336612300565b50506000906103366122c7565b90506123e1602083015163ffffffff1690565b429116103861236e565b505050600090610336612297565b6101008101906124106112bc835163ffffffff1690565b90612422602082015163ffffffff1690565b604082015163ffffffff169061243d606084015161ffff1690565b9161247a608085015161245a60a08701516001600160401b031690565b60c087015160ff169060e0880151926040519788966020880198896121eb565b039161248e601f1993848101835282610274565b519020906124b860405191826124ac60208201958660209181520190565b03908101835282610274565b5190209261014082019384510361255e578251511561254f575163ffffffff166124ea61089860035463ffffffff1690565b63ffffffff80921614159081612532575b506125245761012001805151612512835151612ac1565b116123b35761239c925190519061268d565b5050506000906103366122c7565b9050612545602084015163ffffffff1690565b42911610386124fb565b50505050600090610336612297565b5050505060009061033661225e565b1561257457565b60405162461bcd60e51b815260206004820152601f60248201527f65637265636f766572206661696c65642077697468207369676e6174757265006044820152606490fd5b156125c057565b60405162461bcd60e51b815260206004820152602360248201527f7369676e617475726520696e6469636573206d75737420626520617363656e64604482015262696e6760e81b6064820152608490fd5b1561261857565b60405162461bcd60e51b815260206004820152601c60248201527f677561726469616e20696e646578206f7574206f6620626f756e6473000000006044820152606490fd5b6040519061266a82610223565b60148252731593481cda59db985d1d5c99481a5b9d985b1a5960621b6020830152565b825151919260009291835b85518110156127b2576126ab8187611b75565b51604060006126bd8284015160ff1690565b8351602080860151945188815260ff93909316838201526040830191909152606082019390935281805260809060015afa15610d215760005160609190612723906001600160a01b03169761271389151561256d565b8415908115612795575b506125b9565b0194612771610d00612764612739895160ff1690565b986127488960ff8c1610612611565b61275e6127588951925160ff1690565b60ff1690565b90611b75565b516001600160a01b031690565b036127845761277f90611b66565b612698565b50505050505060009061033661265d565b90506127a48484015160ff1690565b60ff9182169116113861271d565b5050505050506001906103366115eb565b156127ca57565b60405162461bcd60e51b815260206004820152601760248201527f564d2076657273696f6e20696e636f6d70617469626c650000000000000000006044820152606490fd5b9061281982610a34565b6128266040519182610274565b8281528092612837601f1991610a34565b019060005b82811061284857505050565b60209061285361192c565b8282850101520161283c565b60ff601b9116019060ff821161106f57565b9190820391821161106f57565b9061288761215f565b9161289b61289482612e9c565b60ff168452565b6128b4600160ff6128ad865160ff1690565b16146127c3565b6128ce6128c082612f60565b63ffffffff16610100850152565b6128da61275882612eac565b6006906128e68161280f565b9061012086019182526000915b818310612a205750505090612a086129ec6129ca6129b661299961297f87612929612922612a199a8a51612871565b828a612d69565b602081519101206040516129578161294960208201948560209181520190565b03601f198101835282610274565b5190206101408c015261297a61296d828a612fbc565b63ffffffff1660208d0152565b61197b565b61297a61298c8289612fbc565b63ffffffff1660408c0152565b6129b16129a68288612f44565b61ffff1660608b0152565b61196d565b6129c08186613050565b6080890152611951565b6129e76129d78286612fd8565b6001600160401b031660a0890152565b611997565b612a036129f98285612ecc565b60ff1660c0880152565b61195f565b612a13818351612871565b91612d69565b60e0830152565b909192612ab4612a92612a73612a5784612a03612a40612aba978c612ecc565b6060612a4d8c8b51611b75565b51019060ff169052565b612a61818a613050565b612a6c898851611b75565b5152611951565b612a7d8189613050565b6020612a8a898851611b75565b510152611951565b612a03612aa7612aa2838a612ecc565b61285f565b6040612a4d898851611b75565b93611b66565b91906128f3565b610100811015612aea578060011b908082046002149015171561106f576003610336910461195f565b60405162461bcd60e51b8152602060048201526012602482015271746f6f206d616e7920677561726469616e7360701b6044820152606490fd5b63ffffffff62015180814216019080821161106f576102c29216600052600260205260016040600020019063ffffffff1663ffffffff19825416179055565b9080519081516001600160401b03811161021e5768010000000000000000811161021e578354818555808210612bf2575b506020809301612ba985600052602060002090565b60005b838110612bd7575050505001516001909101805463ffffffff191663ffffffff909216919091179055565b82516001600160a01b03168282015591850191600101612bac565b6000858152826020822092830192015b828110612c10575050612b94565b818155600101612c02565b9081515160005b818110612c485750509063ffffffff6102c2921660005260026020526040600020612b63565b83516001600160a01b0390612c5e908390611b75565b511615612c7357612c6e90611b66565b612c22565b60405162461bcd60e51b815260206004820152600b60248201526a496e76616c6964206b657960a81b6044820152606490fd5b468103612cb257600855565b60405162461bcd60e51b81526020600482015260126024820152711a5b9d985b1a5908195d9b50da185a5b925960721b6044820152606490fd5b15612cf357565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b15612d3057565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b91612d7e81612d77816119a5565b1015612cec565b612d948351612d8d83856119b3565b1115612d29565b80612dad57505050604051600081526020810160405290565b60405192601f821692831560051b80858701019484860193010101905b808410612de25750508252601f01601f191660405290565b9092835181526020809101930190612dca565b908151601482019081831161106f5710612e1457016020015160601c90565b60405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606490fd5b6021815110612e61576021015190565b60405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606490fd5b6001815110612e61576001015190565b6006815110612e61576006015190565b6028815110612e61576028015190565b908151600182019081831161106f5710612e6157016001015190565b6023815110612ef8576023015190565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606490fd5b6043815110612ef8576043015190565b908151600282019081831161106f5710612ef857016002015190565b6005815110612f70576005015190565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7433325f6f75744f66426f756e647360601b6044820152606490fd5b6027815110612f70576027015190565b908151600482019081831161106f5710612f7057016004015190565b908151600882019081831161106f5710612ff457016008015190565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b6044820152606490fd5b6020815110611a79576020015190565b6063815110611a79576063015190565b908151602082019081831161106f5710611a795701602001519056fea2646970667358221220e01f3fc19a7b6f650a08aafb55409b8aa16f0ebf4a5804ec4ce7df76358d349364736f6c63430008130033",cs=r=>r.length>1;class et extends Zt{constructor(...e){cs(e)?super(...e):super(bt,Pn,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static createInterface(){return new Qe(bt)}static connect(e,t){return new os(e,bt,t)}}u(et,"bytecode",Pn),u(et,"abi",bt);const fs=Object.freeze(Object.defineProperty({__proto__:null,Implementation__factory:et},Symbol.toStringTag,{value:"Module"}));E0.registerProtocol(Te._platform,"WormholeCore",at);const us=Object.freeze(Object.defineProperty({__proto__:null,EvmWormholeCore:at,ethers_contracts:fs},Symbol.toStringTag,{value:"Module"}));exports.EvmUnsignedTransaction=Rn;exports.EvmWormholeCore=at;exports.index=us;
|
|
1
|
+
"use strict";var w0=Object.defineProperty;var T0=(r,e,t)=>e in r?w0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var u=(r,e,t)=>(T0(r,typeof e!="symbol"?e+"":e,t),t),Pt=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var b=(r,e,t)=>(Pt(r,e,"read from private field"),t?t.call(r):e.get(r)),x=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},T=(r,e,t,n)=>(Pt(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t);var jt=(r,e,t,n)=>({set _(s){T(r,e,s,t)},get _(){return b(r,e,n)}}),A=(r,e,t)=>(Pt(r,e,"access private method"),t);const E0=require("./chain-BteoJHpg.js"),Te=require("./evm-OwiMOsDg.js"),x0=require("./create-48Wkagqs.js"),Rt=require("./index-C1oy9Lkm.js");class Rn{constructor(e,t,n,s,i=!1){u(this,"transaction");u(this,"network");u(this,"chain");u(this,"description");u(this,"parallelizable");this.transaction=e,this.network=t,this.chain=n,this.description=s,this.parallelizable=i}}class at{constructor(e,t,n,s){u(this,"network");u(this,"chain");u(this,"provider");u(this,"contracts");u(this,"chainId");u(this,"coreAddress");u(this,"core");u(this,"coreIface");this.network=e,this.chain=t,this.provider=n,this.contracts=s,this.chainId=Rt.networkChainToNativeChainId.get(e,t),this.coreIface=et.createInterface();const i=this.contracts.coreBridge;if(!i)throw new Error("Core bridge address not found");this.coreAddress=i,this.core=et.connect(i,n)}async getMessageFee(){return await this.core.messageFee.staticCall()}async getGuardianSetIndex(){return Number(await this.core.getCurrentGuardianSetIndex.staticCall())}async getGuardianSet(e){const t=await this.core.getGuardianSet(e);return{index:e,keys:t[0],expiry:t[1]}}static async fromRpc(e,t){const[n,s]=await Te.EvmPlatform.chainFromRpc(e),i=t[s];if(i.network!==n)throw new Error(`Network mismatch: ${i.network} != ${n}`);return new at(n,s,e,i.contracts)}async*publishMessage(e,t,n,s){const i=new Te.EvmAddress(e).toString(),a=await this.core.publishMessage.populateTransaction(n,t,s);yield this.createUnsignedTx(Te.addFrom(a,i),"WormholeCore.publishMessage")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){const t=await this.provider.getTransactionReceipt(e);return t===null?[]:t.logs.filter(n=>n.address===this.coreAddress).map(n=>{const{topics:s,data:i}=n,a=this.coreIface.parseLog({topics:s.slice(),data:i});if(a===null)return;const o=new Te.EvmAddress(a.args.sender);return{chain:this.chain,emitter:o.toUniversalAddress(),sequence:a.args.sequence}}).filter(Rt.isWormholeMessageId)}async parseMessages(e){const t=await this.provider.getTransactionReceipt(e);if(t===null)throw new Error("Could not get transaction receipt");const n=await this.getGuardianSetIndex();return t.logs.filter(s=>s.address===this.coreAddress).map(s=>{const{topics:i,data:a}=s,o=this.coreIface.parseLog({topics:i.slice(),data:a});if(o===null)return null;const c=new Te.EvmAddress(o.args.sender);return x0.createVAA("Uint8Array",{guardianSet:n,timestamp:0,emitterChain:this.chain,emitterAddress:c.toUniversalAddress(),consistencyLevel:Number(o.args.consistencyLevel),sequence:BigInt(o.args.sequence),nonce:Number(o.args.nonce),signatures:[],payload:Rt.hex.decode(o.args.payload)})}).filter(s=>!!s)}createUnsignedTx(e,t,n=!1){return new Rn(Te.addChainId(e,this.chainId),this.network,this.chain,t,n)}}const N0="6.12.1";function v0(r,e,t){const n=e.split("|").map(i=>i.trim());for(let i=0;i<n.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof r===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=r,s}async function Bt(r){const e=Object.keys(r);return(await Promise.all(e.map(n=>Promise.resolve(r[n])))).reduce((n,s,i)=>(n[e[i]]=s,n),{})}function w(r,e,t){for(let n in e){let s=e[n];const i=t?t[n]:null;i&&v0(s,i,n),Object.defineProperty(r,n,{enumerable:!0,value:s,writable:!1})}}function Le(r){if(r==null)return"null";if(Array.isArray(r))return"[ "+r.map(Le).join(", ")+" ]";if(r instanceof Uint8Array){const e="0123456789abcdef";let t="0x";for(let n=0;n<r.length;n++)t+=e[r[n]>>4],t+=e[r[n]&15];return t}if(typeof r=="object"&&typeof r.toJSON=="function")return Le(r.toJSON());switch(typeof r){case"boolean":case"symbol":return r.toString();case"bigint":return BigInt(r).toString();case"number":return r.toString();case"string":return JSON.stringify(r);case"object":{const e=Object.keys(r);return e.sort(),"{ "+e.map(t=>`${Le(t)}: ${Le(r[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function He(r,e){return r&&r.code===e}function Sn(r){return He(r,"CALL_EXCEPTION")}function Xe(r,e,t){let n=r;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${Le(t)}`);for(const a in t){if(a==="shortMessage")continue;const o=t[a];i.push(a+"="+Le(o))}}i.push(`code=${e}`),i.push(`version=${N0}`),i.length&&(r+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(r);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(r);break;default:s=new Error(r)}return w(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&w(s,{shortMessage:n}),s}function g(r,e,t,n){if(!r)throw Xe(e,t,n)}function d(r,e,t,n){g(r,e,"INVALID_ARGUMENT",{argument:t,value:n})}function Un(r,e,t){t==null&&(t=""),t&&(t=": "+t),g(r>=e,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:r,expectedCount:e}),g(r<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:r,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((r,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");r.push(e)}catch{}return r},[]);function Ht(r,e,t){if(t==null&&(t=""),r!==e){let n=t,s="new";t&&(n+=".",s+=" "+t),g(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function Cn(r,e,t){if(r instanceof Uint8Array)return t?new Uint8Array(r):r;if(typeof r=="string"&&r.match(/^0x([0-9a-f][0-9a-f])*$/i)){const n=new Uint8Array((r.length-2)/2);let s=2;for(let i=0;i<n.length;i++)n[i]=parseInt(r.substring(s,s+2),16),s+=2;return n}d(!1,"invalid BytesLike value",e||"value",r)}function z(r,e){return Cn(r,e,!1)}function ee(r,e){return Cn(r,e,!0)}function ie(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&r.length!==2+2*e||e===!0&&r.length%2!==0)}function O0(r){return ie(r,!0)||r instanceof Uint8Array}const en="0123456789abcdef";function I(r){const e=z(r);let t="0x";for(let n=0;n<e.length;n++){const s=e[n];t+=en[(s&240)>>4]+en[s&15]}return t}function Pe(r){return"0x"+r.map(e=>I(e).substring(2)).join("")}function Ee(r,e,t){const n=z(r);return t!=null&&t>n.length&&g(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:t}),I(n.slice(e??0,t??n.length))}function Bn(r,e,t){const n=z(r);g(e>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),t?s.set(n,e-n.length):s.set(n,0),I(s)}function A0(r,e){return Bn(r,e,!0)}function k0(r,e){return Bn(r,e,!1)}const Nt=BigInt(0),K=BigInt(1),Fe=9007199254740991;function I0(r,e){const t=vt(r,"value"),n=BigInt(be(e,"width"));if(g(t>>n===Nt,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:r}),t>>n-K){const s=(K<<n)-K;return-((~t&s)+K)}return t}function P0(r,e){let t=le(r,"value");const n=BigInt(be(e,"width")),s=K<<n-K;if(t<Nt){t=-t,g(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:r});const i=(K<<n)-K;return(~t&i)+K}else g(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:r});return t}function ot(r,e){const t=vt(r,"value"),n=BigInt(be(e,"bits"));return t&(K<<n)-K}function le(r,e){switch(typeof r){case"bigint":return r;case"number":return d(Number.isInteger(r),"underflow",e||"value",r),d(r>=-Fe&&r<=Fe,"overflow",e||"value",r),BigInt(r);case"string":try{if(r==="")throw new Error("empty string");return r[0]==="-"&&r[1]!=="-"?-BigInt(r.substring(1)):BigInt(r)}catch(t){d(!1,`invalid BigNumberish string: ${t.message}`,e||"value",r)}}d(!1,"invalid BigNumberish value",e||"value",r)}function vt(r,e){const t=le(r,e);return g(t>=Nt,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:r}),t}const tn="0123456789abcdef";function Ln(r){if(r instanceof Uint8Array){let e="0x0";for(const t of r)e+=tn[t>>4],e+=tn[t&15];return BigInt(e)}return le(r)}function be(r,e){switch(typeof r){case"bigint":return d(r>=-Fe&&r<=Fe,"overflow",e||"value",r),Number(r);case"number":return d(Number.isInteger(r),"underflow",e||"value",r),d(r>=-Fe&&r<=Fe,"overflow",e||"value",r),r;case"string":try{if(r==="")throw new Error("empty string");return be(BigInt(r),e)}catch(t){d(!1,`invalid numeric string: ${t.message}`,e||"value",r)}}d(!1,"invalid numeric value",e||"value",r)}function R0(r){return be(Ln(r))}function Fn(r,e){let n=vt(r,"value").toString(16);if(e==null)n.length%2&&(n="0"+n);else{const s=be(e,"width");for(g(s*2>=n.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:r});n.length<s*2;)n="0"+n}return"0x"+n}function S0(r){const e=vt(r,"value");if(e===Nt)return new Uint8Array([]);let t=e.toString(16);t.length%2&&(t="0"+t);const n=new Uint8Array(t.length/2);for(let s=0;s<n.length;s++){const i=s*2;n[s]=parseInt(t.substring(i,i+2),16)}return n}var _e;class U0{constructor(e,t,n){u(this,"filter");u(this,"emitter");x(this,_e,void 0);T(this,_e,t),w(this,{emitter:e,filter:n})}async removeListener(){b(this,_e)!=null&&await this.emitter.off(this.filter,b(this,_e))}}_e=new WeakMap;function C0(r,e,t,n,s){d(!1,`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}function _n(r,e,t,n,s){if(r==="BAD_PREFIX"||r==="UNEXPECTED_CONTINUE"){let i=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)i++;return i}return r==="OVERRUN"?t.length-e-1:0}function B0(r,e,t,n,s){return r==="OVERLONG"?(d(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),n.push(s),0):(n.push(65533),_n(r,e,t))}const L0=Object.freeze({error:C0,ignore:_n,replace:B0});function F0(r,e){e==null&&(e=L0.error);const t=z(r,"bytes"),n=[];let s=0;for(;s<t.length;){const i=t[s++];if(!(i>>7)){n.push(i);continue}let a=null,o=null;if((i&224)===192)a=1,o=127;else if((i&240)===224)a=2,o=2047;else if((i&248)===240)a=3,o=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,t,n):s+=e("BAD_PREFIX",s-1,t,n);continue}if(s-1+a>=t.length){s+=e("OVERRUN",s-1,t,n);continue}let c=i&(1<<8-a-1)-1;for(let f=0;f<a;f++){let l=t[s];if((l&192)!=128){s+=e("MISSING_CONTINUE",s,t,n),c=null;break}c=c<<6|l&63,s++}if(c!==null){if(c>1114111){s+=e("OUT_OF_RANGE",s-1-a,t,n,c);continue}if(c>=55296&&c<=57343){s+=e("UTF16_SURROGATE",s-1-a,t,n,c);continue}if(c<=o){s+=e("OVERLONG",s-1-a,t,n,c);continue}n.push(c)}}return n}function Mn(r,e){d(typeof r=="string","invalid string value","str",r);let t=[];for(let n=0;n<r.length;n++){const s=r.charCodeAt(n);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){n++;const i=r.charCodeAt(n);d(n<r.length&&(i&64512)===56320,"invalid surrogate pair","str",r);const a=65536+((s&1023)<<10)+(i&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function _0(r){return r.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function M0(r,e){return _0(F0(r,e))}function nn(r){const e=[];for(;r;)e.unshift(r&255),r>>=8;return e}function $n(r){if(Array.isArray(r)){let n=[];if(r.forEach(function(i){n=n.concat($n(i))}),n.length<=55)return n.unshift(192+n.length),n;const s=nn(n.length);return s.unshift(247+s.length),s.concat(n)}const e=Array.prototype.slice.call(z(r,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=nn(e.length);return t.unshift(183+t.length),t.concat(e)}const rn="0123456789abcdef";function $0(r){let e="0x";for(const t of $n(r))e+=rn[t>>4],e+=rn[t&15];return e}const B=32,Lt=new Uint8Array(B),D0=["then"],ct={};function ze(r,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${r}`);throw t.error=e,t}var pe;const xe=class xe extends Array{constructor(...t){const n=t[0];let s=t[1],i=(t[2]||[]).slice(),a=!0;n!==ct&&(s=t,i=[],a=!1);super(s.length);x(this,pe,void 0);s.forEach((c,f)=>{this[f]=c});const o=i.reduce((c,f)=>(typeof f=="string"&&c.set(f,(c.get(f)||0)+1),c),new Map);if(T(this,pe,Object.freeze(s.map((c,f)=>{const l=i[f];return l!=null&&o.get(l)===1?l:null}))),!!a)return Object.freeze(this),new Proxy(this,{get:(c,f,l)=>{if(typeof f=="string"){if(f.match(/^[0-9]+$/)){const h=be(f,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const m=c[h];return m instanceof Error&&ze(`index ${h}`,m),m}if(D0.indexOf(f)>=0)return Reflect.get(c,f,l);const p=c[f];if(p instanceof Function)return function(...h){return p.apply(this===l?c:this,h)};if(!(f in c))return c.getValue.apply(this===l?c:this,[f])}return Reflect.get(c,f,l)}})}toArray(t){const n=[];return this.forEach((s,i)=>{s instanceof Error&&ze(`index ${i}`,s),t&&s instanceof xe&&(s=s.toArray(t)),n.push(s)}),n}toObject(t){return b(this,pe).reduce((n,s,i)=>{if(g(s!=null,"value at index ${ index } unnamed","UNSUPPORTED_OPERATION",{operation:"toObject()"}),!(s in n)){let a=this.getValue(s);t&&a instanceof xe&&(a=a.toObject(t)),n[s]=a}return n},{})}slice(t,n){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),n==null&&(n=this.length),n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);const s=[],i=[];for(let a=t;a<n;a++)s.push(this[a]),i.push(b(this,pe)[a]);return new xe(ct,s,i)}filter(t,n){const s=[],i=[];for(let a=0;a<this.length;a++){const o=this[a];o instanceof Error&&ze(`index ${a}`,o),t.call(n,o,a,this)&&(s.push(o),i.push(b(this,pe)[a]))}return new xe(ct,s,i)}map(t,n){const s=[];for(let i=0;i<this.length;i++){const a=this[i];a instanceof Error&&ze(`index ${i}`,a),s.push(t.call(n,a,i,this))}return s}getValue(t){const n=b(this,pe).indexOf(t);if(n===-1)return;const s=this[n];return s instanceof Error&&ze(`property ${JSON.stringify(t)}`,s.error),s}static fromItems(t,n){return new xe(ct,t,n)}};pe=new WeakMap;let mt=xe;function sn(r){let e=S0(r);return g(e.length<=B,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:B,offset:e.length}),e.length!==B&&(e=ee(Pe([Lt.slice(e.length%B),e]))),e}class de{constructor(e,t,n,s){u(this,"name");u(this,"type");u(this,"localName");u(this,"dynamic");w(this,{name:e,type:t,localName:n,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){d(!1,e,this.localName,t)}}var se,Oe,Me,dt;class Ft{constructor(){x(this,Me);x(this,se,void 0);x(this,Oe,void 0);T(this,se,[]),T(this,Oe,0)}get data(){return Pe(b(this,se))}get length(){return b(this,Oe)}appendWriter(e){return A(this,Me,dt).call(this,ee(e.data))}writeBytes(e){let t=ee(e);const n=t.length%B;return n&&(t=ee(Pe([t,Lt.slice(n)]))),A(this,Me,dt).call(this,t)}writeValue(e){return A(this,Me,dt).call(this,sn(e))}writeUpdatableValue(){const e=b(this,se).length;return b(this,se).push(Lt),T(this,Oe,b(this,Oe)+B),t=>{b(this,se)[e]=sn(t)}}}se=new WeakMap,Oe=new WeakMap,Me=new WeakSet,dt=function(e){return b(this,se).push(e),T(this,Oe,b(this,Oe)+e.length),e.length};var F,G,Ae,ke,he,tt,Mt,Tt,Dn;const qt=class qt{constructor(e,t,n){x(this,tt);x(this,Tt);u(this,"allowLoose");x(this,F,void 0);x(this,G,void 0);x(this,Ae,void 0);x(this,ke,void 0);x(this,he,void 0);w(this,{allowLoose:!!t}),T(this,F,ee(e)),T(this,Ae,0),T(this,ke,null),T(this,he,n??1024),T(this,G,0)}get data(){return I(b(this,F))}get dataLength(){return b(this,F).length}get consumed(){return b(this,G)}get bytes(){return new Uint8Array(b(this,F))}subReader(e){const t=new qt(b(this,F).slice(b(this,G)+e),this.allowLoose,b(this,he));return T(t,ke,this),t}readBytes(e,t){let n=A(this,Tt,Dn).call(this,0,e,!!t);return A(this,tt,Mt).call(this,e),T(this,G,b(this,G)+n.length),n.slice(0,e)}readValue(){return Ln(this.readBytes(B))}readIndex(){return R0(this.readBytes(B))}};F=new WeakMap,G=new WeakMap,Ae=new WeakMap,ke=new WeakMap,he=new WeakMap,tt=new WeakSet,Mt=function(e){var t;if(b(this,ke))return A(t=b(this,ke),tt,Mt).call(t,e);T(this,Ae,b(this,Ae)+e),g(b(this,he)<1||b(this,Ae)<=b(this,he)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${b(this,he)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:ee(b(this,F)),offset:b(this,G),length:e,info:{bytesRead:b(this,Ae),dataLength:this.dataLength}})},Tt=new WeakSet,Dn=function(e,t,n){let s=Math.ceil(t/B)*B;return b(this,G)+s>b(this,F).length&&(this.allowLoose&&n&&b(this,G)+t<=b(this,F).length?s=t:g(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:ee(b(this,F)),length:b(this,F).length,offset:b(this,G)+s})),b(this,F).slice(b(this,G),b(this,G)+s)};let _t=qt;function an(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Gn(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function on(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function G0(r,e){Gn(r);const t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const V0=r=>r instanceof Uint8Array,H0=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),z0=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!z0)throw new Error("Non little-endian hardware is not supported");function J0(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Vn(r){if(typeof r=="string"&&(r=J0(r)),!V0(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}class K0{clone(){return this._cloneInto()}}function W0(r){const e=n=>r().update(Vn(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}const ft=BigInt(2**32-1),cn=BigInt(32);function X0(r,e=!1){return e?{h:Number(r&ft),l:Number(r>>cn&ft)}:{h:Number(r>>cn&ft)|0,l:Number(r&ft)|0}}function Y0(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){const{h:i,l:a}=X0(r[s],e);[t[s],n[s]]=[i,a]}return[t,n]}const Z0=(r,e,t)=>r<<t|e>>>32-t,q0=(r,e,t)=>e<<t|r>>>32-t,Q0=(r,e,t)=>e<<t-32|r>>>64-t,j0=(r,e,t)=>r<<t-32|e>>>64-t,[Hn,zn,Jn]=[[],[],[]],er=BigInt(0),Je=BigInt(1),tr=BigInt(2),nr=BigInt(7),rr=BigInt(256),sr=BigInt(113);for(let r=0,e=Je,t=1,n=0;r<24;r++){[t,n]=[n,(2*t+3*n)%5],Hn.push(2*(5*n+t)),zn.push((r+1)*(r+2)/2%64);let s=er;for(let i=0;i<7;i++)e=(e<<Je^(e>>nr)*sr)%rr,e&tr&&(s^=Je<<(Je<<BigInt(i))-Je);Jn.push(s)}const[ir,ar]=Y0(Jn,!0),fn=(r,e,t)=>t>32?Q0(r,e,t):Z0(r,e,t),un=(r,e,t)=>t>32?j0(r,e,t):q0(r,e,t);function or(r,e=24){const t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let a=0;a<10;a++)t[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,c=(a+2)%10,f=t[c],l=t[c+1],p=fn(f,l,1)^t[o],h=un(f,l,1)^t[o+1];for(let m=0;m<50;m+=10)r[a+m]^=p,r[a+m+1]^=h}let s=r[2],i=r[3];for(let a=0;a<24;a++){const o=zn[a],c=fn(s,i,o),f=un(s,i,o),l=Hn[a];s=r[l],i=r[l+1],r[l]=c,r[l+1]=f}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)t[o]=r[a+o];for(let o=0;o<10;o++)r[a+o]^=~t[(o+2)%10]&t[(o+4)%10]}r[0]^=ir[n],r[1]^=ar[n]}t.fill(0)}class zt extends K0{constructor(e,t,n,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,an(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=H0(this.state)}keccak(){or(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){on(this);const{blockLen:t,state:n}=this;e=Vn(e);const s=e.length;for(let i=0;i<s;){const a=Math.min(t-this.pos,s-i);for(let o=0;o<a;o++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:s}=this;e[n]^=t,t&128&&n===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){on(this,!1),Gn(e),this.finish();const t=this.state,{blockLen:n}=this;for(let s=0,i=e.length;s<i;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,i-s);e.set(t.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return an(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(G0(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:s,rounds:i,enableXOF:a}=this;return e||(e=new zt(t,n,s,a,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=s,e.enableXOF=a,e.destroyed=this.destroyed,e}}const cr=(r,e,t)=>W0(()=>new zt(e,r,t)),fr=cr(1,136,256/8);let Kn=!1;const Wn=function(r){return fr(r)};let Xn=Wn;function ce(r){const e=z(r,"data");return I(Xn(e))}ce._=Wn;ce.lock=function(){Kn=!0};ce.register=function(r){if(Kn)throw new TypeError("keccak256 is locked");Xn=r};Object.freeze(ce);const ur=BigInt(0),lr=BigInt(36);function ln(r){r=r.toLowerCase();const e=r.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const n=z(ce(t));for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(n[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const Jt={};for(let r=0;r<10;r++)Jt[String(r)]=String(r);for(let r=0;r<26;r++)Jt[String.fromCharCode(65+r)]=String(10+r);const bn=15;function br(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(n=>Jt[n]).join("");for(;e.length>=bn;){let n=e.substring(0,bn);e=parseInt(n,10)%97+e.substring(n.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const dr=function(){const r={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];r[t]=BigInt(e)}return r}();function pr(r){r=r.toLowerCase();let e=ur;for(let t=0;t<r.length;t++)e=e*lr+dr[r[t]];return e}function fe(r){if(d(typeof r=="string","invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/)){r.startsWith("0x")||(r="0x"+r);const e=ln(r);return d(!r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===r,"bad address checksum","address",r),e}if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){d(r.substring(2,4)===br(r),"bad icap checksum","address",r);let e=pr(r.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return ln("0x"+e)}d(!1,"invalid address","address",r)}function hr(r){const e=fe(r.from);let n=le(r.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,fe(Ee(ce($0([e,n])),12))}function Yn(r){return r&&typeof r.getAddress=="function"}async function St(r,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(g(typeof r!="string","unconfigured name","UNCONFIGURED_NAME",{value:r}),d(!1,"invalid AddressLike value; did not resolve to a value address","target",r)),fe(t)}function Ye(r,e){if(typeof r=="string")return r.match(/^0x[0-9a-f]{40}$/i)?fe(r):(g(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),St(r,e.resolveName(r)));if(Yn(r))return St(r,r.getAddress());if(r&&typeof r.then=="function")return St(r,r);d(!1,"unsupported addressable value","target",r)}const te={};function y(r,e){let t=!1;return e<0&&(t=!0,e*=-1),new C(te,`${t?"":"u"}int${e}`,r,{signed:t,width:e})}function E(r,e){return new C(te,`bytes${e||""}`,r,{size:e})}const dn=Symbol.for("_ethers_typed");var Ie;const ne=class ne{constructor(e,t,n,s){u(this,"type");u(this,"value");x(this,Ie,void 0);u(this,"_typedSymbol");s==null&&(s=null),Ht(te,e,"Typed"),w(this,{_typedSymbol:dn,type:t,value:n}),T(this,Ie,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return b(this,Ie)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return b(this,Ie)===!0?-1:b(this,Ie)===!1?this.value.length:null}static from(e,t){return new ne(te,e,t)}static uint8(e){return y(e,8)}static uint16(e){return y(e,16)}static uint24(e){return y(e,24)}static uint32(e){return y(e,32)}static uint40(e){return y(e,40)}static uint48(e){return y(e,48)}static uint56(e){return y(e,56)}static uint64(e){return y(e,64)}static uint72(e){return y(e,72)}static uint80(e){return y(e,80)}static uint88(e){return y(e,88)}static uint96(e){return y(e,96)}static uint104(e){return y(e,104)}static uint112(e){return y(e,112)}static uint120(e){return y(e,120)}static uint128(e){return y(e,128)}static uint136(e){return y(e,136)}static uint144(e){return y(e,144)}static uint152(e){return y(e,152)}static uint160(e){return y(e,160)}static uint168(e){return y(e,168)}static uint176(e){return y(e,176)}static uint184(e){return y(e,184)}static uint192(e){return y(e,192)}static uint200(e){return y(e,200)}static uint208(e){return y(e,208)}static uint216(e){return y(e,216)}static uint224(e){return y(e,224)}static uint232(e){return y(e,232)}static uint240(e){return y(e,240)}static uint248(e){return y(e,248)}static uint256(e){return y(e,256)}static uint(e){return y(e,256)}static int8(e){return y(e,-8)}static int16(e){return y(e,-16)}static int24(e){return y(e,-24)}static int32(e){return y(e,-32)}static int40(e){return y(e,-40)}static int48(e){return y(e,-48)}static int56(e){return y(e,-56)}static int64(e){return y(e,-64)}static int72(e){return y(e,-72)}static int80(e){return y(e,-80)}static int88(e){return y(e,-88)}static int96(e){return y(e,-96)}static int104(e){return y(e,-104)}static int112(e){return y(e,-112)}static int120(e){return y(e,-120)}static int128(e){return y(e,-128)}static int136(e){return y(e,-136)}static int144(e){return y(e,-144)}static int152(e){return y(e,-152)}static int160(e){return y(e,-160)}static int168(e){return y(e,-168)}static int176(e){return y(e,-176)}static int184(e){return y(e,-184)}static int192(e){return y(e,-192)}static int200(e){return y(e,-200)}static int208(e){return y(e,-208)}static int216(e){return y(e,-216)}static int224(e){return y(e,-224)}static int232(e){return y(e,-232)}static int240(e){return y(e,-240)}static int248(e){return y(e,-248)}static int256(e){return y(e,-256)}static int(e){return y(e,-256)}static bytes1(e){return E(e,1)}static bytes2(e){return E(e,2)}static bytes3(e){return E(e,3)}static bytes4(e){return E(e,4)}static bytes5(e){return E(e,5)}static bytes6(e){return E(e,6)}static bytes7(e){return E(e,7)}static bytes8(e){return E(e,8)}static bytes9(e){return E(e,9)}static bytes10(e){return E(e,10)}static bytes11(e){return E(e,11)}static bytes12(e){return E(e,12)}static bytes13(e){return E(e,13)}static bytes14(e){return E(e,14)}static bytes15(e){return E(e,15)}static bytes16(e){return E(e,16)}static bytes17(e){return E(e,17)}static bytes18(e){return E(e,18)}static bytes19(e){return E(e,19)}static bytes20(e){return E(e,20)}static bytes21(e){return E(e,21)}static bytes22(e){return E(e,22)}static bytes23(e){return E(e,23)}static bytes24(e){return E(e,24)}static bytes25(e){return E(e,25)}static bytes26(e){return E(e,26)}static bytes27(e){return E(e,27)}static bytes28(e){return E(e,28)}static bytes29(e){return E(e,29)}static bytes30(e){return E(e,30)}static bytes31(e){return E(e,31)}static bytes32(e){return E(e,32)}static address(e){return new ne(te,"address",e)}static bool(e){return new ne(te,"bool",!!e)}static bytes(e){return new ne(te,"bytes",e)}static string(e){return new ne(te,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new ne(te,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===dn}static dereference(e,t){if(ne.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}};Ie=new WeakMap;let C=ne;class yr extends de{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=C.dereference(t,"string");try{n=fe(n)}catch(s){return this._throwError(s.message,t)}return e.writeValue(n)}decode(e){return fe(Fn(e.readValue(),20))}}class mr extends de{constructor(t){super(t.name,t.type,"_",t.dynamic);u(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,n){return this.coder.encode(t,n)}decode(t){return this.coder.decode(t)}}function Zn(r,e,t){let n=[];if(Array.isArray(t))n=t;else if(t&&typeof t=="object"){let c={};n=e.map(f=>{const l=f.localName;return g(l,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:f},value:t}),g(!c[l],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:f},value:t}),c[l]=!0,t[l]})}else d(!1,"invalid tuple value","tuple",t);d(e.length===n.length,"types/value length mismatch","tuple",t);let s=new Ft,i=new Ft,a=[];e.forEach((c,f)=>{let l=n[f];if(c.dynamic){let p=i.length;c.encode(i,l);let h=s.writeUpdatableValue();a.push(m=>{h(m+p)})}else c.encode(s,l)}),a.forEach(c=>{c(s.length)});let o=r.appendWriter(s);return o+=r.appendWriter(i),o}function qn(r,e){let t=[],n=[],s=r.subReader(0);return e.forEach(i=>{let a=null;if(i.dynamic){let o=r.readIndex(),c=s.subReader(o);try{a=i.decode(c)}catch(f){if(He(f,"BUFFER_OVERRUN"))throw f;a=f,a.baseType=i.name,a.name=i.localName,a.type=i.type}}else try{a=i.decode(r)}catch(o){if(He(o,"BUFFER_OVERRUN"))throw o;a=o,a.baseType=i.name,a.name=i.localName,a.type=i.type}if(a==null)throw new Error("investigate");t.push(a),n.push(i.localName||null)}),mt.fromItems(t,n)}class gr extends de{constructor(t,n,s){const i=t.type+"["+(n>=0?n:"")+"]",a=n===-1||t.dynamic;super("array",i,s,a);u(this,"coder");u(this,"length");w(this,{coder:t,length:n})}defaultValue(){const t=this.coder.defaultValue(),n=[];for(let s=0;s<this.length;s++)n.push(t);return n}encode(t,n){const s=C.dereference(n,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,t.writeValue(s.length)),Un(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let a=[];for(let o=0;o<s.length;o++)a.push(this.coder);return Zn(t,a,s)}decode(t){let n=this.length;n===-1&&(n=t.readIndex(),g(n*B<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:n*B,length:t.dataLength}));let s=[];for(let i=0;i<n;i++)s.push(new mr(this.coder));return qn(t,s)}}class wr extends de{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const n=C.dereference(t,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class Qn extends de{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=ee(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class Tr extends Qn{constructor(e){super("bytes",e)}decode(e){return I(super.decode(e))}}class Er extends de{constructor(t,n){let s="bytes"+String(t);super(s,s,n,!1);u(this,"size");w(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,n){let s=ee(C.dereference(n,this.type));return s.length!==this.size&&this._throwError("incorrect data length",n),t.writeBytes(s)}decode(t){return I(t.readBytes(this.size))}}const xr=new Uint8Array([]);class Nr extends de{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(xr)}decode(e){return e.readBytes(0),null}}const vr=BigInt(0),Or=BigInt(1),Ar=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class kr extends de{constructor(t,n,s){const i=(n?"int":"uint")+t*8;super(i,i,s,!1);u(this,"size");u(this,"signed");w(this,{size:t,signed:n},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,n){let s=le(C.dereference(n,this.type)),i=ot(Ar,B*8);if(this.signed){let a=ot(i,this.size*8-1);(s>a||s<-(a+Or))&&this._throwError("value out-of-bounds",n),s=P0(s,8*B)}else(s<vr||s>ot(i,this.size*8))&&this._throwError("value out-of-bounds",n);return t.writeValue(s)}decode(t){let n=ot(t.readValue(),this.size*8);return this.signed&&(n=I0(n,this.size*8)),n}}class Ir extends Qn{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Mn(C.dereference(t,"string")))}decode(e){return M0(super.decode(e))}}class ut extends de{constructor(t,n){let s=!1;const i=[];t.forEach(o=>{o.dynamic&&(s=!0),i.push(o.type)});const a="tuple("+i.join(",")+")";super("tuple",a,n,s);u(this,"coders");w(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(s=>{t.push(s.defaultValue())});const n=this.coders.reduce((s,i)=>{const a=i.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});return this.coders.forEach((s,i)=>{let a=s.localName;!a||n[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[i]))}),Object.freeze(t)}encode(t,n){const s=C.dereference(n,"tuple");return Zn(t,this.coders,s)}decode(t){return qn(t,this.coders)}}function Ze(r){return ce(Mn(r))}function Ut(r,e){return{address:fe(r),storageKeys:e.map((t,n)=>(d(ie(t,32),"invalid slot",`storageKeys[${n}]`,t),t.toLowerCase()))}}function Pr(r){if(Array.isArray(r))return r.map((t,n)=>Array.isArray(t)?(d(t.length===2,"invalid slot set",`value[${n}]`,t),Ut(t[0],t[1])):(d(t!=null&&typeof t=="object","invalid address-slot set","value",r),Ut(t.address,t.storageKeys)));d(r!=null&&typeof r=="object","invalid access list","value",r);const e=Object.keys(r).map(t=>{const n=r[t].reduce((s,i)=>(s[i]=!0,s),{});return Ut(t,Object.keys(n).sort())});return e.sort((t,n)=>t.address.localeCompare(n.address)),e}function L(r){const e=new Set;return r.forEach(t=>e.add(t)),Object.freeze(e)}const Rr="external public payable override",Sr=L(Rr.split(" ")),jn="constant external internal payable private public pure view override",Ur=L(jn.split(" ")),e0="constructor error event fallback function receive struct",t0=L(e0.split(" ")),n0="calldata memory storage payable indexed",Cr=L(n0.split(" ")),Br="tuple returns",Lr=[e0,n0,Br,jn].join(" "),Fr=L(Lr.split(" ")),_r={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Mr=new RegExp("^(\\s*)"),$r=new RegExp("^([0-9]+)"),Dr=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),r0=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),s0=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var R,J,nt,$t;const Et=class Et{constructor(e){x(this,nt);x(this,R,void 0);x(this,J,void 0);T(this,R,0),T(this,J,e.slice())}get offset(){return b(this,R)}get length(){return b(this,J).length-b(this,R)}clone(){return new Et(b(this,J))}reset(){T(this,R,0)}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=A(this,nt,$t).call(this,b(this,R)+1,e.match+1);return T(this,R,e.match+1),t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;b(this,R)<e.match-1;){const n=this.peek().linkNext;t.push(A(this,nt,$t).call(this,b(this,R)+1,n)),T(this,R,n)}return T(this,R,e.match+1),t}peek(){if(b(this,R)>=b(this,J).length)throw new Error("out-of-bounds");return b(this,J)[b(this,R)]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return jt(this,R)._++,e}toString(){const e=[];for(let t=b(this,R);t<b(this,J).length;t++){const n=b(this,J)[t];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}};R=new WeakMap,J=new WeakMap,nt=new WeakSet,$t=function(e=0,t=0){return new Et(b(this,J).slice(e,t).map(n=>Object.freeze(Object.assign({},n,{match:n.match-e,linkBack:n.linkBack-e,linkNext:n.linkNext-e}))))};let W=Et;function ge(r){const e=[],t=a=>{const o=i<r.length?JSON.stringify(r[i]):"$EOI";throw new Error(`invalid token ${o} at ${i}: ${a}`)};let n=[],s=[],i=0;for(;i<r.length;){let a=r.substring(i),o=a.match(Mr);o&&(i+=o[1].length,a=r.substring(i));const c={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(c);let f=_r[a[0]]||"";if(f){if(c.type=f,c.text=a[0],i++,f==="OPEN_PAREN")n.push(e.length-1),s.push(e.length-1);else if(f=="CLOSE_PAREN")n.length===0&&t("no matching open bracket"),c.match=n.pop(),e[c.match].match=e.length-1,c.depth--,c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1;else if(f==="COMMA")c.linkBack=s.pop(),e[c.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(f==="OPEN_BRACKET")c.type="BRACKET";else if(f==="CLOSE_BRACKET"){let l=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const p=e.pop().text;l=p+l,e[e.length-1].value=be(p)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=l}continue}if(o=a.match(Dr),o){if(c.text=o[1],i+=c.text.length,Fr.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(s0)){c.type="TYPE";continue}c.type="ID";continue}if(o=a.match($r),o){c.text=o[1],c.type="NUMBER",i+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(a[0])} at position ${i}`)}return new W(e.map(a=>Object.freeze(a)))}function pn(r,e){let t=[];for(const n in e.keys())r.has(n)&&t.push(n);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Ot(r,e){if(e.peekKeyword(t0)){const t=e.pop().text;if(t!==r)throw new Error(`expected ${r}, got ${t}`)}return e.popType("ID")}function ue(r,e){const t=new Set;for(;;){const n=r.peekType("KEYWORD");if(n==null||e&&!e.has(n))break;if(r.pop(),t.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);t.add(n)}return Object.freeze(t)}function i0(r){let e=ue(r,Ur);return pn(e,L("constant payable nonpayable".split(" "))),pn(e,L("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function oe(r,e){return r.popParams().map(t=>S.from(t,e))}function a0(r){if(r.peekType("AT")){if(r.pop(),r.peekType("NUMBER"))return le(r.pop().text);throw new Error("invalid gas")}return null}function Se(r){if(r.length)throw new Error(`unexpected tokens at offset ${r.offset}: ${r.toString()}`)}const Gr=new RegExp(/^(.*)\[([0-9]*)\]$/);function hn(r){const e=r.match(s0);if(d(e,"invalid type","type",r),r==="uint")return"uint256";if(r==="int")return"int256";if(e[2]){const t=parseInt(e[2]);d(t!==0&&t<=32,"invalid bytes length","type",r)}else if(e[3]){const t=parseInt(e[3]);d(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",r)}return r}const k={},M=Symbol.for("_ethers_internal"),yn="_ParamTypeInternal",mn="_ErrorInternal",gn="_EventInternal",wn="_ConstructorInternal",Tn="_FallbackInternal",En="_FunctionInternal",xn="_StructInternal";var $e,pt;const V=class V{constructor(e,t,n,s,i,a,o,c){x(this,$e);u(this,"name");u(this,"type");u(this,"baseType");u(this,"indexed");u(this,"components");u(this,"arrayLength");u(this,"arrayChildren");if(Ht(e,k,"ParamType"),Object.defineProperty(this,M,{value:yn}),a&&(a=Object.freeze(a.slice())),s==="array"){if(o==null||c==null)throw new Error("")}else if(o!=null||c!=null)throw new Error("");if(s==="tuple"){if(a==null)throw new Error("")}else if(a!=null)throw new Error("");w(this,{name:t,type:n,baseType:s,indexed:i,components:a,arrayLength:o,arrayChildren:c})}format(e){if(e==null&&(e="sighash"),e==="json"){const n=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=n,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(n=>n.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(s=>n.arrayChildren.walk(s,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((s,i)=>n.components[i].walk(s,t))}return t(this.type,e)}async walkAsync(e,t){const n=[],s=[e];return A(this,$e,pt).call(this,n,e,t,i=>{s[0]=i}),n.length&&await Promise.all(n),s[0]}static from(e,t){if(V.isParamType(e))return e;if(typeof e=="string")try{return V.from(ge(e),t)}catch{d(!1,"invalid param type","obj",e)}else if(e instanceof W){let o="",c="",f=null;ue(e,L(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(c="tuple",f=e.popParams().map(O=>V.from(O)),o=`tuple(${f.map(O=>O.format()).join(",")})`):(o=hn(e.popType("TYPE")),c=o);let l=null,p=null;for(;e.length&&e.peekType("BRACKET");){const O=e.pop();l=new V(k,"",o,c,null,f,p,l),p=O.value,o+=O.text,c="array",f=null}let h=null;if(ue(e,Cr).has("indexed")){if(!t)throw new Error("");h=!0}const v=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new V(k,v,o,c,h,f,p,l)}const n=e.name;d(!n||typeof n=="string"&&n.match(r0),"invalid name","obj.name",n);let s=e.indexed;s!=null&&(d(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,a=i.match(Gr);if(a){const o=parseInt(a[2]||"-1"),c=V.from({type:a[1],components:e.components});return new V(k,n||"",i,"array",s,null,o,c)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const o=e.components!=null?e.components.map(f=>V.from(f)):null;return new V(k,n||"",i,"tuple",s,o,null,null)}return i=hn(e.type),new V(k,n||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[M]===yn}};$e=new WeakSet,pt=function(e,t,n,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const a=this.arrayChildren,o=t.slice();o.forEach((c,f)=>{var l;A(l=a,$e,pt).call(l,e,c,n,p=>{o[f]=p})}),s(o);return}if(this.isTuple()){const a=this.components;let o;if(Array.isArray(t))o=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");o=a.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in t))throw new Error(`missing value for component ${c.name}`);return t[c.name]})}if(o.length!==this.components.length)throw new Error("array is wrong length");o.forEach((c,f)=>{var l;A(l=a[f],$e,pt).call(l,e,c,n,p=>{o[f]=p})}),s(o);return}const i=n(this.type,t);i.then?e.push(async function(){s(await i)}()):s(i)};let S=V;class Ue{constructor(e,t,n){u(this,"type");u(this,"inputs");Ht(e,k,"Fragment"),n=Object.freeze(n.slice()),w(this,{type:t,inputs:n})}static from(e){if(typeof e=="string"){try{Ue.from(JSON.parse(e))}catch{}return Ue.from(ge(e))}if(e instanceof W)switch(e.peekKeyword(t0)){case"constructor":return ae.from(e);case"error":return _.from(e);case"event":return Q.from(e);case"fallback":case"receive":return re.from(e);case"function":return j.from(e);case"struct":return Re.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return ae.from(e);case"error":return _.from(e);case"event":return Q.from(e);case"fallback":case"receive":return re.from(e);case"function":return j.from(e);case"struct":return Re.from(e)}g(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}d(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return ae.isFragment(e)}static isError(e){return _.isFragment(e)}static isEvent(e){return Q.isFragment(e)}static isFunction(e){return j.isFragment(e)}static isStruct(e){return Re.isFragment(e)}}class At extends Ue{constructor(t,n,s,i){super(t,n,i);u(this,"name");d(typeof s=="string"&&s.match(r0),"invalid identifier","name",s),i=Object.freeze(i.slice()),w(this,{name:s})}}function qe(r,e){return"("+e.map(t=>t.format(r)).join(r==="full"?", ":",")+")"}class _ extends At{constructor(e,t,n){super(e,"error",t,n),Object.defineProperty(this,M,{value:mn})}get selector(){return Ze(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});const t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+qe(e,this.inputs)),t.join(" ")}static from(e){if(_.isFragment(e))return e;if(typeof e=="string")return _.from(ge(e));if(e instanceof W){const t=Ot("error",e),n=oe(e);return Se(e),new _(k,t,n)}return new _(k,e.name,e.inputs?e.inputs.map(S.from):[])}static isFragment(e){return e&&e[M]===mn}}class Q extends At{constructor(t,n,s,i){super(t,"event",n,s);u(this,"anonymous");Object.defineProperty(this,M,{value:gn}),w(this,{anonymous:i})}get topicHash(){return Ze(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const n=[];return t!=="sighash"&&n.push("event"),n.push(this.name+qe(t,this.inputs)),t!=="sighash"&&this.anonymous&&n.push("anonymous"),n.join(" ")}static getTopicHash(t,n){return n=(n||[]).map(i=>S.from(i)),new Q(k,t,n,!1).topicHash}static from(t){if(Q.isFragment(t))return t;if(typeof t=="string")try{return Q.from(ge(t))}catch{d(!1,"invalid event fragment","obj",t)}else if(t instanceof W){const n=Ot("event",t),s=oe(t,!0),i=!!ue(t,L(["anonymous"])).has("anonymous");return Se(t),new Q(k,n,s,i)}return new Q(k,t.name,t.inputs?t.inputs.map(n=>S.from(n,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[M]===gn}}class ae extends Ue{constructor(t,n,s,i,a){super(t,n,s);u(this,"payable");u(this,"gas");Object.defineProperty(this,M,{value:wn}),w(this,{payable:i,gas:a})}format(t){if(g(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const n=[`constructor${qe(t,this.inputs)}`];return this.payable&&n.push("payable"),this.gas!=null&&n.push(`@${this.gas.toString()}`),n.join(" ")}static from(t){if(ae.isFragment(t))return t;if(typeof t=="string")try{return ae.from(ge(t))}catch{d(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof W){ue(t,L(["constructor"]));const n=oe(t),s=!!ue(t,Sr).has("payable"),i=a0(t);return Se(t),new ae(k,"constructor",n,s,i)}return new ae(k,"constructor",t.inputs?t.inputs.map(S.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[M]===wn}}class re extends Ue{constructor(t,n,s){super(t,"fallback",n);u(this,"payable");Object.defineProperty(this,M,{value:Tn}),w(this,{payable:s})}format(t){const n=this.inputs.length===0?"receive":"fallback";if(t==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:n,stateMutability:s})}return`${n}()${this.payable?" payable":""}`}static from(t){if(re.isFragment(t))return t;if(typeof t=="string")try{return re.from(ge(t))}catch{d(!1,"invalid fallback fragment","obj",t)}else if(t instanceof W){const n=t.toString(),s=t.peekKeyword(L(["fallback","receive"]));if(d(s,"type must be fallback or receive","obj",n),t.popKeyword(L(["fallback","receive"]))==="receive"){const c=oe(t);return d(c.length===0,"receive cannot have arguments","obj.inputs",c),ue(t,L(["payable"])),Se(t),new re(k,[],!0)}let a=oe(t);a.length?d(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(c=>c.format("minimal")).join(", ")):a=[S.from("bytes")];const o=i0(t);if(d(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),ue(t,L(["returns"])).has("returns")){const c=oe(t);d(c.length===1&&c[0].type==="bytes","invalid fallback outputs","obj.outputs",c.map(f=>f.format("minimal")).join(", "))}return Se(t),new re(k,a,o==="payable")}if(t.type==="receive")return new re(k,[],!0);if(t.type==="fallback"){const n=[S.from("bytes")],s=t.stateMutability==="payable";return new re(k,n,s)}d(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[M]===Tn}}class j extends At{constructor(t,n,s,i,a,o){super(t,"function",n,i);u(this,"constant");u(this,"outputs");u(this,"stateMutability");u(this,"payable");u(this,"gas");Object.defineProperty(this,M,{value:En}),a=Object.freeze(a.slice()),w(this,{constant:s==="view"||s==="pure",gas:o,outputs:a,payable:s==="payable",stateMutability:s})}get selector(){return Ze(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t))),outputs:this.outputs.map(s=>JSON.parse(s.format(t)))});const n=[];return t!=="sighash"&&n.push("function"),n.push(this.name+qe(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&n.push(this.stateMutability),this.outputs&&this.outputs.length&&(n.push("returns"),n.push(qe(t,this.outputs))),this.gas!=null&&n.push(`@${this.gas.toString()}`)),n.join(" ")}static getSelector(t,n){return n=(n||[]).map(i=>S.from(i)),new j(k,t,"view",n,[],null).selector}static from(t){if(j.isFragment(t))return t;if(typeof t=="string")try{return j.from(ge(t))}catch{d(!1,"invalid function fragment","obj",t)}else if(t instanceof W){const s=Ot("function",t),i=oe(t),a=i0(t);let o=[];ue(t,L(["returns"])).has("returns")&&(o=oe(t));const c=a0(t);return Se(t),new j(k,s,a,i,o,c)}let n=t.stateMutability;return n==null&&(n="payable",typeof t.constant=="boolean"?(n="view",t.constant||(n="payable",typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(n="nonpayable")),new j(k,t.name,n,t.inputs?t.inputs.map(S.from):[],t.outputs?t.outputs.map(S.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[M]===En}}class Re extends At{constructor(e,t,n){super(e,"struct",t,n),Object.defineProperty(this,M,{value:xn})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Re.from(ge(e))}catch{d(!1,"invalid struct fragment","obj",e)}else if(e instanceof W){const t=Ot("struct",e),n=oe(e);return Se(e),new Re(k,t,n)}return new Re(k,e.name,e.inputs?e.inputs.map(S.from):[])}static isFragment(e){return e&&e[M]===xn}}const X=new Map;X.set(0,"GENERIC_PANIC");X.set(1,"ASSERT_FALSE");X.set(17,"OVERFLOW");X.set(18,"DIVIDE_BY_ZERO");X.set(33,"ENUM_RANGE_ERROR");X.set(34,"BAD_STORAGE_DATA");X.set(49,"STACK_UNDERFLOW");X.set(50,"ARRAY_RANGE_ERROR");X.set(65,"OUT_OF_MEMORY");X.set(81,"UNINITIALIZED_FUNCTION_CALL");const Vr=new RegExp(/^bytes([0-9]*)$/),Hr=new RegExp(/^(u?int)([0-9]*)$/);let Ct=null,Nn=1024;function zr(r,e,t,n){let s="missing revert data",i=null;const a=null;let o=null;if(t){s="execution reverted";const f=z(t);if(t=I(t),f.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(f.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(I(f.slice(0,4))==="0x08c379a0")try{i=n.decode(["string"],f.slice(4))[0],o={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(I(f.slice(0,4))==="0x4e487b71")try{const l=Number(n.decode(["uint256"],f.slice(4))[0]);o={signature:"Panic(uint256)",name:"Panic",args:[l]},i=`Panic due to ${X.get(l)||"UNKNOWN"}(${l})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const c={to:e.to?fe(e.to):null,data:e.data||"0x"};return e.from&&(c.from=fe(e.from)),Xe(s,"CALL_EXCEPTION",{action:r,data:t,reason:i,transaction:c,invocation:a,revert:o})}var ye,Be;const xt=class xt{constructor(){x(this,ye)}getDefaultValue(e){const t=e.map(s=>A(this,ye,Be).call(this,S.from(s)));return new ut(t,"_").defaultValue()}encode(e,t){Un(t.length,e.length,"types/values length mismatch");const n=e.map(a=>A(this,ye,Be).call(this,S.from(a))),s=new ut(n,"_"),i=new Ft;return s.encode(i,t),i.data}decode(e,t,n){const s=e.map(a=>A(this,ye,Be).call(this,S.from(a)));return new ut(s,"_").decode(new _t(t,n,Nn))}static _setDefaultMaxInflation(e){d(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),Nn=e}static defaultAbiCoder(){return Ct==null&&(Ct=new xt),Ct}static getBuiltinCallException(e,t,n){return zr(e,t,n,xt.defaultAbiCoder())}};ye=new WeakSet,Be=function(e){if(e.isArray())return new gr(A(this,ye,Be).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new ut(e.components.map(n=>A(this,ye,Be).call(this,n)),e.name);switch(e.baseType){case"address":return new yr(e.name);case"bool":return new wr(e.name);case"string":return new Ir(e.name);case"bytes":return new Tr(e.name);case"":return new Nr(e.name)}let t=e.type.match(Hr);if(t){let n=parseInt(t[2]||"256");return d(n!==0&&n<=256&&n%8===0,"invalid "+t[1]+" bit length","param",e),new kr(n/8,t[1]==="int",e.name)}if(t=e.type.match(Vr),t){let n=parseInt(t[1]);return d(n!==0&&n<=32,"invalid bytes length","param",e),new Er(n,e.name)}d(!1,"invalid type","type",e.type)};let gt=xt;class Jr{constructor(e,t,n){u(this,"fragment");u(this,"name");u(this,"signature");u(this,"topic");u(this,"args");const s=e.name,i=e.format();w(this,{fragment:e,name:s,signature:i,topic:t,args:n})}}class Kr{constructor(e,t,n,s){u(this,"fragment");u(this,"name");u(this,"args");u(this,"signature");u(this,"selector");u(this,"value");const i=e.name,a=e.format();w(this,{fragment:e,name:i,args:n,signature:a,selector:t,value:s})}}class Wr{constructor(e,t,n){u(this,"fragment");u(this,"name");u(this,"args");u(this,"signature");u(this,"selector");const s=e.name,i=e.format();w(this,{fragment:e,name:s,args:n,signature:i,selector:t})}}class vn{constructor(e){u(this,"hash");u(this,"_isIndexed");w(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const On={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},An={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:r=>`reverted with reason string ${JSON.stringify(r)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:r=>{let e="unknown panic code";return r>=0&&r<=255&&On[r.toString()]&&(e=On[r.toString()]),`reverted with panic code 0x${r.toString(16)} (${e})`}}};var Y,Z,q,U,De,ht,Ge,yt;const Ne=class Ne{constructor(e){x(this,De);x(this,Ge);u(this,"fragments");u(this,"deploy");u(this,"fallback");u(this,"receive");x(this,Y,void 0);x(this,Z,void 0);x(this,q,void 0);x(this,U,void 0);let t=[];typeof e=="string"?t=JSON.parse(e):t=e,T(this,q,new Map),T(this,Y,new Map),T(this,Z,new Map);const n=[];for(const a of t)try{n.push(Ue.from(a))}catch(o){console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`,o.message)}w(this,{fragments:Object.freeze(n)});let s=null,i=!1;T(this,U,this.getAbiCoder()),this.fragments.forEach((a,o)=>{let c;switch(a.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}w(this,{deploy:a});return;case"fallback":a.inputs.length===0?i=!0:(d(!s||a.payable!==s.payable,"conflicting fallback fragments",`fragments[${o}]`,a),s=a,i=s.payable);return;case"function":c=b(this,q);break;case"event":c=b(this,Z);break;case"error":c=b(this,Y);break;default:return}const f=a.format();c.has(f)||c.set(f,a)}),this.deploy||w(this,{deploy:ae.from("constructor()")}),w(this,{fallback:s,receive:i})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return gt.defaultAbiCoder()}getFunctionName(e){const t=A(this,De,ht).call(this,e,null,!1);return d(t,"no matching function","key",e),t.name}hasFunction(e){return!!A(this,De,ht).call(this,e,null,!1)}getFunction(e,t){return A(this,De,ht).call(this,e,t||null,!0)}forEachFunction(e){const t=Array.from(b(this,q).keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(b(this,q).get(s),n)}}getEventName(e){const t=A(this,Ge,yt).call(this,e,null,!1);return d(t,"no matching event","key",e),t.name}hasEvent(e){return!!A(this,Ge,yt).call(this,e,null,!1)}getEvent(e,t){return A(this,Ge,yt).call(this,e,t||null,!0)}forEachEvent(e){const t=Array.from(b(this,Z).keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(b(this,Z).get(s),n)}}getError(e,t){if(ie(e)){const s=e.toLowerCase();if(An[s])return _.from(An[s].signature);for(const i of b(this,Y).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,a]of b(this,Y))i.split("(")[0]===e&&s.push(a);if(s.length===0)return e==="Error"?_.from("error Error(string)"):e==="Panic"?_.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(a=>JSON.stringify(a.format())).join(", ");d(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=_.from(e).format(),e==="Error(string)")return _.from("error Error(string)");if(e==="Panic(uint256)")return _.from("error Panic(uint256)");const n=b(this,Y).get(e);return n||null}forEachError(e){const t=Array.from(b(this,Y).keys());t.sort((n,s)=>n.localeCompare(s));for(let n=0;n<t.length;n++){const s=t[n];e(b(this,Y).get(s),n)}}_decodeParams(e,t){return b(this,U).decode(e,t)}_encodeParams(e,t){return b(this,U).encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);d(n,"unknown error","fragment",e),e=n}return d(Ee(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Ee(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const n=this.getError(e);d(n,"unknown error","fragment",e),e=n}return Pe([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);d(n,"unknown function","fragment",e),e=n}return d(Ee(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Ee(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const n=this.getFunction(e);d(n,"unknown function","fragment",e),e=n}return Pe([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){if(typeof e=="string"){const i=this.getFunction(e);d(i,"unknown function","fragment",e),e=i}let n="invalid length for result data";const s=ee(t);if(s.length%32===0)try{return b(this,U).decode(e.outputs,s)}catch{n="could not decode result data"}g(!1,n,"BAD_DATA",{value:I(s),info:{method:e.name,signature:e.format()}})}makeError(e,t){const n=z(e,"data"),s=gt.getBuiltinCallException("call",t,n);if(s.message.startsWith("execution reverted (unknown custom error)")){const o=I(n.slice(0,4)),c=this.getError(o);if(c)try{const f=b(this,U).decode(c.inputs,n.slice(4));s.revert={name:c.name,signature:c.format(),args:f},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const a=this.parseTransaction(t);return a&&(s.invocation={method:a.name,signature:a.signature,args:a.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const n=this.getFunction(e);d(n,"unknown function","fragment",e),e=n}return I(b(this,U).encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const i=this.getEvent(e);d(i,"unknown event","eventFragment",e),e=i}g(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const n=[];e.anonymous||n.push(e.topicHash);const s=(i,a)=>i.type==="string"?Ze(a):i.type==="bytes"?ce(I(a)):(i.type==="bool"&&typeof a=="boolean"?a=a?"0x01":"0x00":i.type.match(/^u?int/)?a=Fn(a):i.type.match(/^bytes/)?a=k0(a,32):i.type==="address"&&b(this,U).encode(["address"],[a]),A0(I(a),32));for(t.forEach((i,a)=>{const o=e.inputs[a];if(!o.indexed){d(i==null,"cannot filter non-indexed parameters; must be null","contract."+o.name,i);return}i==null?n.push(null):o.baseType==="array"||o.baseType==="tuple"?d(!1,"filtering with tuples or arrays not supported","contract."+o.name,i):Array.isArray(i)?n.push(i.map(c=>s(o,c))):n.push(s(o,i))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,t){if(typeof e=="string"){const a=this.getEvent(e);d(a,"unknown event","eventFragment",e),e=a}const n=[],s=[],i=[];return e.anonymous||n.push(e.topicHash),d(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((a,o)=>{const c=t[o];if(a.indexed)if(a.type==="string")n.push(Ze(c));else if(a.type==="bytes")n.push(ce(c));else{if(a.baseType==="tuple"||a.baseType==="array")throw new Error("not implemented");n.push(b(this,U).encode([a.type],[c]))}else s.push(a),i.push(c)}),{data:b(this,U).encode(s,i),topics:n}}decodeEventLog(e,t,n){if(typeof e=="string"){const m=this.getEvent(e);d(m,"unknown event","eventFragment",e),e=m}if(n!=null&&!e.anonymous){const m=e.topicHash;d(ie(n[0],32)&&n[0].toLowerCase()===m,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}const s=[],i=[],a=[];e.inputs.forEach((m,v)=>{m.indexed?m.type==="string"||m.type==="bytes"||m.baseType==="tuple"||m.baseType==="array"?(s.push(S.from({type:"bytes32",name:m.name})),a.push(!0)):(s.push(m),a.push(!1)):(i.push(m),a.push(!1))});const o=n!=null?b(this,U).decode(s,Pe(n)):null,c=b(this,U).decode(i,t,!0),f=[],l=[];let p=0,h=0;return e.inputs.forEach((m,v)=>{let O=null;if(m.indexed)if(o==null)O=new vn(null);else if(a[v])O=new vn(o[h++]);else try{O=o[h++]}catch(P){O=P}else try{O=c[p++]}catch(P){O=P}f.push(O),l.push(m.name||null)}),mt.fromItems(f,l)}parseTransaction(e){const t=z(e.data,"tx.data"),n=le(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(I(t.slice(0,4)));if(!s)return null;const i=b(this,U).decode(s.inputs,t.slice(4));return new Kr(s,s.selector,i,n)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Jr(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=I(e),n=this.getError(Ee(t,0,4));if(!n)return null;const s=b(this,U).decode(n.inputs,Ee(t,4));return new Wr(n,n.selector,s)}static from(e){return e instanceof Ne?e:typeof e=="string"?new Ne(JSON.parse(e)):typeof e.formatJson=="function"?new Ne(e.formatJson()):typeof e.format=="function"?new Ne(e.format("json")):new Ne(e)}};Y=new WeakMap,Z=new WeakMap,q=new WeakMap,U=new WeakMap,De=new WeakSet,ht=function(e,t,n){if(ie(e)){const i=e.toLowerCase();for(const a of b(this,q).values())if(i===a.selector)return a;return null}if(e.indexOf("(")===-1){const i=[];for(const[a,o]of b(this,q))a.split("(")[0]===e&&i.push(o);if(t){const a=t.length>0?t[t.length-1]:null;let o=t.length,c=!0;C.isTyped(a)&&a.type==="overrides"&&(c=!1,o--);for(let f=i.length-1;f>=0;f--){const l=i[f].inputs.length;l!==o&&(!c||l!==o-1)&&i.splice(f,1)}for(let f=i.length-1;f>=0;f--){const l=i[f].inputs;for(let p=0;p<t.length;p++)if(C.isTyped(t[p])){if(p>=l.length){if(t[p].type==="overrides")continue;i.splice(f,1);break}if(t[p].type!==l[p].baseType){i.splice(f,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const a=t[t.length-1];(a==null||Array.isArray(a)||typeof a!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&n){const a=i.map(o=>JSON.stringify(o.format())).join(", ");d(!1,`ambiguous function description (i.e. matches ${a})`,"key",e)}return i[0]}const s=b(this,q).get(j.from(e).format());return s||null},Ge=new WeakSet,yt=function(e,t,n){if(ie(e)){const i=e.toLowerCase();for(const a of b(this,Z).values())if(i===a.topicHash)return a;return null}if(e.indexOf("(")===-1){const i=[];for(const[a,o]of b(this,Z))a.split("(")[0]===e&&i.push(o);if(t){for(let a=i.length-1;a>=0;a--)i[a].inputs.length<t.length&&i.splice(a,1);for(let a=i.length-1;a>=0;a--){const o=i[a].inputs;for(let c=0;c<t.length;c++)if(C.isTyped(t[c])&&t[c].type!==o[c].baseType){i.splice(a,1);break}}}if(i.length===0)return null;if(i.length>1&&n){const a=i.map(o=>JSON.stringify(o.format())).join(", ");d(!1,`ambiguous event description (i.e. matches ${a})`,"key",e)}return i[0]}const s=b(this,Z).get(Q.from(e).format());return s||null};let Qe=Ne;const o0=BigInt(0);function H(r){return r==null?null:r.toString()}function Xr(r){const e={};r.to&&(e.to=r.to),r.from&&(e.from=r.from),r.data&&(e.data=I(r.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in r)||r[s]==null||(e[s]=le(r[s],`request.${s}`));const n="type,nonce".split(/,/);for(const s of n)!(s in r)||r[s]==null||(e[s]=be(r[s],`request.${s}`));return r.accessList&&(e.accessList=Pr(r.accessList)),"blockTag"in r&&(e.blockTag=r.blockTag),"enableCcipRead"in r&&(e.enableCcipRead=!!r.enableCcipRead),"customData"in r&&(e.customData=r.customData),"blobVersionedHashes"in r&&r.blobVersionedHashes&&(e.blobVersionedHashes=r.blobVersionedHashes.slice()),"kzg"in r&&(e.kzg=r.kzg),"blobs"in r&&r.blobs&&(e.blobs=r.blobs.map(s=>O0(s)?I(s):Object.assign({},s))),e}class kt{constructor(e,t){u(this,"provider");u(this,"transactionHash");u(this,"blockHash");u(this,"blockNumber");u(this,"removed");u(this,"address");u(this,"data");u(this,"topics");u(this,"index");u(this,"transactionIndex");this.provider=t;const n=Object.freeze(e.topics.slice());w(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:n,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:n,data:s,index:i,removed:a,topics:o,transactionHash:c,transactionIndex:f}=this;return{_type:"log",address:e,blockHash:t,blockNumber:n,data:s,index:i,removed:a,topics:o,transactionHash:c,transactionIndex:f}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return g(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return g(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return g(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return Zr(this)}}var rt;class Yr{constructor(e,t){u(this,"provider");u(this,"to");u(this,"from");u(this,"contractAddress");u(this,"hash");u(this,"index");u(this,"blockHash");u(this,"blockNumber");u(this,"logsBloom");u(this,"gasUsed");u(this,"blobGasUsed");u(this,"cumulativeGasUsed");u(this,"gasPrice");u(this,"blobGasPrice");u(this,"type");u(this,"status");u(this,"root");x(this,rt,void 0);T(this,rt,Object.freeze(e.logs.map(s=>new kt(s,t))));let n=o0;e.effectiveGasPrice!=null?n=e.effectiveGasPrice:e.gasPrice!=null&&(n=e.gasPrice),w(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:n,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return b(this,rt)}toJSON(){const{to:e,from:t,contractAddress:n,hash:s,index:i,blockHash:a,blockNumber:o,logsBloom:c,logs:f,status:l,root:p}=this;return{_type:"TransactionReceipt",blockHash:a,blockNumber:o,contractAddress:n,cumulativeGasUsed:H(this.cumulativeGasUsed),from:t,gasPrice:H(this.gasPrice),blobGasUsed:H(this.blobGasUsed),blobGasPrice:H(this.blobGasPrice),gasUsed:H(this.gasUsed),hash:s,index:i,logs:f,logsBloom:c,root:p,status:l,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return f0(this)}reorderedEvent(e){return g(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),c0(this,e)}}rt=new WeakMap;var me;const Qt=class Qt{constructor(e,t){u(this,"provider");u(this,"blockNumber");u(this,"blockHash");u(this,"index");u(this,"hash");u(this,"type");u(this,"to");u(this,"from");u(this,"nonce");u(this,"gasLimit");u(this,"gasPrice");u(this,"maxPriorityFeePerGas");u(this,"maxFeePerGas");u(this,"maxFeePerBlobGas");u(this,"data");u(this,"value");u(this,"chainId");u(this,"signature");u(this,"accessList");u(this,"blobVersionedHashes");x(this,me,void 0);this.provider=t,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,T(this,me,-1)}toJSON(){const{blockNumber:e,blockHash:t,index:n,hash:s,type:i,to:a,from:o,nonce:c,data:f,signature:l,accessList:p,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:p,blockNumber:e,blockHash:t,blobVersionedHashes:h,chainId:H(this.chainId),data:f,from:o,gasLimit:H(this.gasLimit),gasPrice:H(this.gasPrice),hash:s,maxFeePerGas:H(this.maxFeePerGas),maxPriorityFeePerGas:H(this.maxPriorityFeePerGas),maxFeePerBlobGas:H(this.maxFeePerBlobGas),nonce:c,signature:l,to:a,index:n,type:i,value:H(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const n=await this.getTransaction();n&&(e=n.blockNumber)}if(e==null)return null;const t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:n}=await Bt({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:n-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const n=e??1,s=t??0;let i=b(this,me),a=-1,o=i===-1;const c=async()=>{if(o)return null;const{blockNumber:h,nonce:m}=await Bt({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(m<this.nonce){i=h;return}if(o)return null;const v=await this.getTransaction();if(!(v&&v.blockNumber!=null))for(a===-1&&(a=i-3,a<b(this,me)&&(a=b(this,me)));a<=h;){if(o)return null;const O=await this.provider.getBlock(a,!0);if(O==null)return;for(const P of O)if(P===this.hash)return;for(let P=0;P<O.length;P++){const N=await O.getTransaction(P);if(N.from===this.from&&N.nonce===this.nonce){if(o)return null;const $=await this.provider.getTransactionReceipt(N.hash);if($==null||h-$.blockNumber+1<n)return;let we="replaced";N.data===this.data&&N.to===this.to&&N.value===this.value?we="repriced":N.data==="0x"&&N.from===N.to&&N.value===o0&&(we="cancelled"),g(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:we==="replaced"||we==="cancelled",reason:we,replacement:N.replaceableTransaction(i),hash:N.hash,receipt:$})}}a++}},f=h=>{if(h==null||h.status!==0)return h;g(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:h.to,from:h.from,data:""},receipt:h})},l=await this.provider.getTransactionReceipt(this.hash);if(n===0)return f(l);if(l){if(await l.confirmations()>=n)return f(l)}else if(await c(),n===0)return null;return await new Promise((h,m)=>{const v=[],O=()=>{v.forEach(N=>N())};if(v.push(()=>{o=!0}),s>0){const N=setTimeout(()=>{O(),m(Xe("wait for transaction timeout","TIMEOUT"))},s);v.push(()=>{clearTimeout(N)})}const P=async N=>{if(await N.confirmations()>=n){O();try{h(f(N))}catch($){m($)}}};if(v.push(()=>{this.provider.off(this.hash,P)}),this.provider.on(this.hash,P),i>=0){const N=async()=>{try{await c()}catch($){if(He($,"TRANSACTION_REPLACED")){O(),m($);return}}o||this.provider.once("block",N)};v.push(()=>{this.provider.off("block",N)}),this.provider.once("block",N)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return g(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),f0(this)}reorderedEvent(e){return g(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),g(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),c0(this,e)}replaceableTransaction(e){d(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new Qt(this,this.provider);return T(t,me,e),t}};me=new WeakMap;let Dt=Qt;function c0(r,e){return{orphan:"reorder-transaction",tx:r,other:e}}function f0(r){return{orphan:"drop-transaction",tx:r}}function Zr(r){return{orphan:"drop-log",log:{transactionHash:r.transactionHash,blockHash:r.blockHash,blockNumber:r.blockNumber,address:r.address,data:r.data,topics:Object.freeze(r.topics.slice()),index:r.index}}}class Kt extends kt{constructor(t,n,s){super(t,t.provider);u(this,"interface");u(this,"fragment");u(this,"args");const i=n.decodeEventLog(s,t.data,t.topics);w(this,{args:i,fragment:s,interface:n})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class u0 extends kt{constructor(t,n){super(t,t.provider);u(this,"error");w(this,{error:n})}}var Ve;class qr extends Yr{constructor(t,n,s){super(s,n);x(this,Ve,void 0);T(this,Ve,t)}get logs(){return super.logs.map(t=>{const n=t.topics.length?b(this,Ve).getEvent(t.topics[0]):null;if(n)try{return new Kt(t,b(this,Ve),n)}catch(s){return new u0(t,s)}return t})}}Ve=new WeakMap;var st;class Wt extends Dt{constructor(t,n,s){super(s,n);x(this,st,void 0);T(this,st,t)}async wait(t,n){const s=await super.wait(t,n);return s==null?null:new qr(b(this,st),this.provider,s)}}st=new WeakMap;class l0 extends U0{constructor(t,n,s,i){super(t,n,s);u(this,"log");w(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Qr extends l0{constructor(e,t,n,s,i){super(e,t,n,new Kt(i,e.interface,s));const a=e.interface.decodeEventLog(s,this.log.data,this.log.topics);w(this,{args:a,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const kn=BigInt(0);function b0(r){return r&&typeof r.call=="function"}function d0(r){return r&&typeof r.estimateGas=="function"}function It(r){return r&&typeof r.resolveName=="function"}function p0(r){return r&&typeof r.sendTransaction=="function"}function h0(r){if(r!=null){if(It(r))return r;if(r.provider)return r.provider}}var it;class jr{constructor(e,t,n){x(this,it,void 0);u(this,"fragment");if(w(this,{fragment:t}),t.inputs.length<n.length)throw new Error("too many arguments");const s=Ce(e.runner,"resolveName"),i=It(s)?s:null;T(this,it,async function(){const a=await Promise.all(t.inputs.map((o,c)=>n[c]==null?null:o.walkAsync(n[c],(l,p)=>l==="address"?Array.isArray(p)?Promise.all(p.map(h=>Ye(h,i))):Ye(p,i):p)));return e.interface.encodeFilterTopics(t,a)}())}getTopicFilter(){return b(this,it)}}it=new WeakMap;function Ce(r,e){return r==null?null:typeof r[e]=="function"?r:r.provider&&typeof r.provider[e]=="function"?r.provider:null}function ve(r){return r==null?null:r.provider||null}async function Xt(r,e){const t=C.dereference(r,"overrides");d(typeof t=="object","invalid overrides parameter","overrides",r);const n=Xr(t);return d(n.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),d(n.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function y0(r,e,t){const n=Ce(r,"resolveName"),s=It(n)?n:null;return await Promise.all(e.map((i,a)=>i.walkAsync(t[a],(o,c)=>(c=C.dereference(c,o),o==="address"?Ye(c,s):c))))}function es(r){const e=async function(a){const o=await Xt(a,["data"]);o.to=await r.getAddress(),o.from&&(o.from=await Ye(o.from,h0(r.runner)));const c=r.interface,f=le(o.value||kn,"overrides.value")===kn,l=(o.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!l&&!f&&d(!1,"cannot send data to receive or send value to non-payable fallback","overrides",a),d(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data);const p=c.receive||c.fallback&&c.fallback.payable;return d(p||f,"cannot send value to non-payable fallback","overrides.value",o.value),d(c.fallback||l,"cannot send data to receive-only contract","overrides.data",o.data),o},t=async function(a){const o=Ce(r.runner,"call");g(b0(o),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const c=await e(a);try{return await o.call(c)}catch(f){throw Sn(f)&&f.data?r.interface.makeError(f.data,c):f}},n=async function(a){const o=r.runner;g(p0(o),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const c=await o.sendTransaction(await e(a)),f=ve(r.runner);return new Wt(r.interface,f,c)},s=async function(a){const o=Ce(r.runner,"estimateGas");return g(d0(o),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await o.estimateGas(await e(a))},i=async a=>await n(a);return w(i,{_contract:r,estimateGas:s,populateTransaction:e,send:n,staticCall:t}),i}function ts(r,e){const t=function(...f){const l=r.interface.getFunction(e,f);return g(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:f}}),l},n=async function(...f){const l=t(...f);let p={};if(l.inputs.length+1===f.length&&(p=await Xt(f.pop()),p.from&&(p.from=await Ye(p.from,h0(r.runner)))),l.inputs.length!==f.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const h=await y0(r.runner,l.inputs,f);return Object.assign({},p,await Bt({to:r.getAddress(),data:r.interface.encodeFunctionData(l,h)}))},s=async function(...f){const l=await o(...f);return l.length===1?l[0]:l},i=async function(...f){const l=r.runner;g(p0(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const p=await l.sendTransaction(await n(...f)),h=ve(r.runner);return new Wt(r.interface,h,p)},a=async function(...f){const l=Ce(r.runner,"estimateGas");return g(d0(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await n(...f))},o=async function(...f){const l=Ce(r.runner,"call");g(b0(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const p=await n(...f);let h="0x";try{h=await l.call(p)}catch(v){throw Sn(v)&&v.data?r.interface.makeError(v.data,p):v}const m=t(...f);return r.interface.decodeFunctionResult(m,h)},c=async(...f)=>t(...f).constant?await s(...f):await i(...f);return w(c,{name:r.interface.getFunctionName(e),_contract:r,_key:e,getFragment:t,estimateGas:a,populateTransaction:n,send:i,staticCall:s,staticCallResult:o}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{const f=r.interface.getFunction(e);return g(f,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),f}}),c}function ns(r,e){const t=function(...s){const i=r.interface.getEvent(e,s);return g(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},n=function(...s){return new jr(r,t(...s),s)};return w(n,{name:r.interface.getEventName(e),_contract:r,_key:e,getFragment:t}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=r.interface.getEvent(e);return g(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),n}const wt=Symbol.for("_ethersInternal_contract"),m0=new WeakMap;function rs(r,e){m0.set(r[wt],e)}function D(r){return m0.get(r[wt])}function ss(r){return r&&typeof r=="object"&&"getTopicFilter"in r&&typeof r.getTopicFilter=="function"&&r.fragment}async function Yt(r,e){let t,n=null;if(Array.isArray(e)){const i=function(a){if(ie(a,32))return a;const o=r.interface.getEvent(a);return d(o,"unknown fragment","name",a),o.topicHash};t=e.map(a=>a==null?null:Array.isArray(a)?a.map(i):i(a))}else e==="*"?t=[null]:typeof e=="string"?ie(e,32)?t=[e]:(n=r.interface.getEvent(e),d(n,"unknown fragment","event",e),t=[n.topicHash]):ss(e)?t=await e.getTopicFilter():"fragment"in e?(n=e.fragment,t=[n.topicHash]):d(!1,"unknown event name","event",e);t=t.map(i=>{if(i==null)return null;if(Array.isArray(i)){const a=Array.from(new Set(i.map(o=>o.toLowerCase())).values());return a.length===1?a[0]:(a.sort(),a)}return i.toLowerCase()});const s=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:n,tag:s,topics:t}}async function Ke(r,e){const{subs:t}=D(r);return t.get((await Yt(r,e)).tag)||null}async function In(r,e,t){const n=ve(r.runner);g(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:a}=await Yt(r,t),{addr:o,subs:c}=D(r);let f=c.get(i);if(!f){const p={address:o||r,topics:a},h=P=>{let N=s;if(N==null)try{N=r.interface.getEvent(P.topics[0])}catch{}if(N){const $=N,we=s?r.interface.decodeEventLog(s,P.data,P.topics):[];Vt(r,t,we,g0=>new Qr(r,g0,t,$,P))}else Vt(r,t,[],$=>new l0(r,$,t,P))};let m=[];f={tag:i,listeners:[],start:()=>{m.length||m.push(n.on(p,h))},stop:async()=>{if(m.length==0)return;let P=m;m=[],await Promise.all(P),n.off(p,h)}},c.set(i,f)}return f}let Gt=Promise.resolve();async function is(r,e,t,n){await Gt;const s=await Ke(r,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:a,once:o})=>{const c=Array.from(t);n&&c.push(n(o?null:a));try{a.call(r,...c)}catch{}return!o}),s.listeners.length===0&&(s.stop(),D(r).subs.delete(s.tag)),i>0}async function Vt(r,e,t,n){try{await Gt}catch{}const s=is(r,e,t,n);return Gt=s,await s}const lt=["then"];var ls;const We=class We{constructor(e,t,n,s){u(this,"target");u(this,"interface");u(this,"runner");u(this,"filters");u(this,ls);u(this,"fallback");d(typeof e=="string"||Yn(e),"invalid value for Contract target","target",e),n==null&&(n=null);const i=Qe.from(t);w(this,{target:e,runner:n,interface:i}),Object.defineProperty(this,wt,{value:{}});let a,o=null,c=null;if(s){const p=ve(n);c=new Wt(this.interface,p,s)}let f=new Map;if(typeof e=="string")if(ie(e))o=e,a=Promise.resolve(e);else{const p=Ce(n,"resolveName");if(!It(p))throw Xe("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});a=p.resolveName(e).then(h=>{if(h==null)throw Xe("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return D(this).addr=h,h})}else a=e.getAddress().then(p=>{if(p==null)throw new Error("TODO");return D(this).addr=p,p});rs(this,{addrPromise:a,addr:o,deployTx:c,subs:f});const l=new Proxy({},{get:(p,h,m)=>{if(typeof h=="symbol"||lt.indexOf(h)>=0)return Reflect.get(p,h,m);try{return this.getEvent(h)}catch(v){if(!He(v,"INVALID_ARGUMENT")||v.argument!=="key")throw v}},has:(p,h)=>lt.indexOf(h)>=0?Reflect.has(p,h):Reflect.has(p,h)||this.interface.hasEvent(String(h))});return w(this,{filters:l}),w(this,{fallback:i.receive||i.fallback?es(this):null}),new Proxy(this,{get:(p,h,m)=>{if(typeof h=="symbol"||h in p||lt.indexOf(h)>=0)return Reflect.get(p,h,m);try{return p.getFunction(h)}catch(v){if(!He(v,"INVALID_ARGUMENT")||v.argument!=="key")throw v}},has:(p,h)=>typeof h=="symbol"||h in p||lt.indexOf(h)>=0?Reflect.has(p,h):p.interface.hasFunction(h)})}connect(e){return new We(this.target,this.interface,e)}attach(e){return new We(e,this.interface,this.runner)}async getAddress(){return await D(this).addrPromise}async getDeployedCode(){const e=ve(this.runner);g(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const n=ve(this.runner);return g(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const a=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);n.once("block",a)}catch(o){i(o)}};a()})}deploymentTransaction(){return D(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),ts(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),ns(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,n){t==null&&(t=0),n==null&&(n="latest");const{addr:s,addrPromise:i}=D(this),a=s||await i,{fragment:o,topics:c}=await Yt(this,e),f={address:a,topics:c,fromBlock:t,toBlock:n},l=ve(this.runner);return g(l,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await l.getLogs(f)).map(p=>{let h=o;if(h==null)try{h=this.interface.getEvent(p.topics[0])}catch{}if(h)try{return new Kt(p,this.interface,h)}catch(m){return new u0(p,m)}return new kt(p,l)})}async on(e,t){const n=await In(this,"on",e);return n.listeners.push({listener:t,once:!1}),n.start(),this}async once(e,t){const n=await In(this,"once",e);return n.listeners.push({listener:t,once:!0}),n.start(),this}async emit(e,...t){return await Vt(this,e,t,null)}async listenerCount(e){if(e){const s=await Ke(this,e);return s?s.listeners.length:0}const{subs:t}=D(this);let n=0;for(const{listeners:s}of t.values())n+=s.length;return n}async listeners(e){if(e){const s=await Ke(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:t}=D(this);let n=[];for(const{listeners:s}of t.values())n=n.concat(s.map(({listener:i})=>i));return n}async off(e,t){const n=await Ke(this,e);if(!n)return this;if(t){const s=n.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&n.listeners.splice(s,1)}return(t==null||n.listeners.length===0)&&(n.stop(),D(this).subs.delete(n.tag)),this}async removeAllListeners(e){if(e){const t=await Ke(this,e);if(!t)return this;t.stop(),D(this).subs.delete(t.tag)}else{const{subs:t}=D(this);for(const{tag:n,stop:s}of t.values())s(),t.delete(n)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends We{constructor(s,i=null){super(s,e,i)}}return t}static from(e,t,n){return n==null&&(n=null),new this(e,t,n)}};ls=wt;let je=We;function as(){return je}class os extends as(){}class Zt{constructor(e,t,n){u(this,"interface");u(this,"bytecode");u(this,"runner");const s=Qe.from(e);t instanceof Uint8Array||(typeof t=="object"&&(t=t.object),t.startsWith("0x")||(t="0x"+t)),t=I(z(t)),w(this,{bytecode:t,interface:s,runner:n||null})}attach(e){return new je(e,this.interface,this.runner)}async getDeployTransaction(...e){let t={};const n=this.interface.deploy;if(n.inputs.length+1===e.length&&(t=await Xt(e.pop())),n.inputs.length!==e.length)throw new Error("incorrect number of arguments to constructor");const s=await y0(this.runner,n.inputs,e),i=Pe([this.bytecode,this.interface.encodeDeploy(s)]);return Object.assign({},t,{data:i})}async deploy(...e){const t=await this.getDeployTransaction(...e);g(this.runner&&typeof this.runner.sendTransaction=="function","factory runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const n=await this.runner.sendTransaction(t),s=hr(n);return new je(s,this.interface,this.runner,n)}connect(e){return new Zt(this.interface,this.bytecode,e)}static fromSolidity(e,t){d(e!=null,"bad compiler output","output",e),typeof e=="string"&&(e=JSON.parse(e));const n=e.abi;let s="";return e.bytecode?s=e.bytecode:e.evm&&e.evm.bytecode&&(s=e.evm.bytecode),new this(n,s,t)}}const bt=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldContract",type:"address"},{indexed:!0,internalType:"address",name:"newContract",type:"address"}],name:"ContractUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint32",name:"index",type:"uint32"}],name:"GuardianSetAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint64",name:"sequence",type:"uint64"},{indexed:!1,internalType:"uint32",name:"nonce",type:"uint32"},{indexed:!1,internalType:"bytes",name:"payload",type:"bytes"},{indexed:!1,internalType:"uint8",name:"consistencyLevel",type:"uint8"}],name:"LogMessagePublished",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"chainId",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"evmChainId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentGuardianSetIndex",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"index",type:"uint32"}],name:"getGuardianSet",outputs:[{components:[{internalType:"address[]",name:"keys",type:"address[]"},{internalType:"uint32",name:"expirationTime",type:"uint32"}],internalType:"struct Structs.GuardianSet",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getGuardianSetExpiry",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"}],name:"governanceActionIsConsumed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"governanceChainId",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"governanceContract",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isFork",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"impl",type:"address"}],name:"isInitialized",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"messageFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"emitter",type:"address"}],name:"nextSequence",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"encodedVM",type:"bytes"}],name:"parseAndVerifyVM",outputs:[{components:[{internalType:"uint8",name:"version",type:"uint8"},{internalType:"uint32",name:"timestamp",type:"uint32"},{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"uint16",name:"emitterChainId",type:"uint16"},{internalType:"bytes32",name:"emitterAddress",type:"bytes32"},{internalType:"uint64",name:"sequence",type:"uint64"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint32",name:"guardianSetIndex",type:"uint32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{internalType:"bytes32",name:"hash",type:"bytes32"}],internalType:"struct Structs.VM",name:"vm",type:"tuple"},{internalType:"bool",name:"valid",type:"bool"},{internalType:"string",name:"reason",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"encodedUpgrade",type:"bytes"}],name:"parseContractUpgrade",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{internalType:"address",name:"newContract",type:"address"}],internalType:"struct GovernanceStructs.ContractUpgrade",name:"cu",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedUpgrade",type:"bytes"}],name:"parseGuardianSetUpgrade",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{components:[{internalType:"address[]",name:"keys",type:"address[]"},{internalType:"uint32",name:"expirationTime",type:"uint32"}],internalType:"struct Structs.GuardianSet",name:"newGuardianSet",type:"tuple"},{internalType:"uint32",name:"newGuardianSetIndex",type:"uint32"}],internalType:"struct GovernanceStructs.GuardianSetUpgrade",name:"gsu",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedRecoverChainId",type:"bytes"}],name:"parseRecoverChainId",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint256",name:"evmChainId",type:"uint256"},{internalType:"uint16",name:"newChainId",type:"uint16"}],internalType:"struct GovernanceStructs.RecoverChainId",name:"rci",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedSetMessageFee",type:"bytes"}],name:"parseSetMessageFee",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{internalType:"uint256",name:"messageFee",type:"uint256"}],internalType:"struct GovernanceStructs.SetMessageFee",name:"smf",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedTransferFees",type:"bytes"}],name:"parseTransferFees",outputs:[{components:[{internalType:"bytes32",name:"module",type:"bytes32"},{internalType:"uint8",name:"action",type:"uint8"},{internalType:"uint16",name:"chain",type:"uint16"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes32",name:"recipient",type:"bytes32"}],internalType:"struct GovernanceStructs.TransferFees",name:"tf",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"encodedVM",type:"bytes"}],name:"parseVM",outputs:[{components:[{internalType:"uint8",name:"version",type:"uint8"},{internalType:"uint32",name:"timestamp",type:"uint32"},{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"uint16",name:"emitterChainId",type:"uint16"},{internalType:"bytes32",name:"emitterAddress",type:"bytes32"},{internalType:"uint64",name:"sequence",type:"uint64"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint32",name:"guardianSetIndex",type:"uint32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{internalType:"bytes32",name:"hash",type:"bytes32"}],internalType:"struct Structs.VM",name:"vm",type:"tuple"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"}],name:"publishMessage",outputs:[{internalType:"uint64",name:"sequence",type:"uint64"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"numGuardians",type:"uint256"}],name:"quorum",outputs:[{internalType:"uint256",name:"numSignaturesRequiredForQuorum",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitContractUpgrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitNewGuardianSet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitRecoverChainId",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitSetMessageFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"_vm",type:"bytes"}],name:"submitTransferFees",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{components:[{internalType:"address[]",name:"keys",type:"address[]"},{internalType:"uint32",name:"expirationTime",type:"uint32"}],internalType:"struct Structs.GuardianSet",name:"guardianSet",type:"tuple"}],name:"verifySignatures",outputs:[{internalType:"bool",name:"valid",type:"bool"},{internalType:"string",name:"reason",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{components:[{internalType:"uint8",name:"version",type:"uint8"},{internalType:"uint32",name:"timestamp",type:"uint32"},{internalType:"uint32",name:"nonce",type:"uint32"},{internalType:"uint16",name:"emitterChainId",type:"uint16"},{internalType:"bytes32",name:"emitterAddress",type:"bytes32"},{internalType:"uint64",name:"sequence",type:"uint64"},{internalType:"uint8",name:"consistencyLevel",type:"uint8"},{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"uint32",name:"guardianSetIndex",type:"uint32"},{components:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"uint8",name:"guardianIndex",type:"uint8"}],internalType:"struct Structs.Signature[]",name:"signatures",type:"tuple[]"},{internalType:"bytes32",name:"hash",type:"bytes32"}],internalType:"struct Structs.VM",name:"vm",type:"tuple"}],name:"verifyVM",outputs:[{internalType:"bool",name:"valid",type:"bool"},{internalType:"string",name:"reason",type:"string"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],Pn="0x60808060405234610016576130a2908161001c8239f35b600080fdfe60806040526004361015610018575b366120d257612105565b60003560e01c80630319e59c146101e857806304ca84cf146101e3578063178149e7146101de5780631a90a219146101d95780631cfe7951146101d45780632c3c02a4146101cf5780634cf842b5146101ca5780634fdc60fa146101c5578063515f3247146101c05780635cb8cae2146101bb57806364d42b17146101b65780636606b4e0146101b15780638129fc1c146101ac578063875be02a146101a757806393df337e146101a25780639a8a05921461019d578063a0cce1b314610198578063a9e1189314610193578063b172b2221461018e578063b19a437e14610189578063c0fd8bde14610184578063cb4cfea81461017f578063d60b347f1461017a578063e039f22414610175578063eb8d3f1214610170578063f42bc6411461016b578063f8ce560a14610166578063f951975a146101615763fbe3c2cd0361000e576112d5565b61129d565b611277565b611203565b6111dd565b6111bc565b61117d565b611137565b6110d2565b610f96565b610f78565b610f50565b610d51565b610d2f565b610c78565b610b50565b610913565b6107c5565b6107a7565b6106d4565b61068e565b61063f565b6105fc565b61059b565b610577565b610559565b610476565b610409565b610363565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761021e57604052565b6101ed565b604081019081106001600160401b0382111761021e57604052565b60a081019081106001600160401b0382111761021e57604052565b606081019081106001600160401b0382111761021e57604052565b90601f801991011681019081106001600160401b0382111761021e57604052565b6040519061016082018281106001600160401b0382111761021e57604052565b604051906102c282610223565b565b6001600160401b03811161021e57601f01601f191660200190565b9291926102eb826102c4565b916102f96040519384610274565b829481845281830111610316578281602093846000960137010152565b600080fd5b9080601f8301121561031657816020610336933591016102df565b90565b602060031982011261031657600435906001600160401b038211610316576103369160040161031b565b346103165760a061037b61037636610339565b611dc4565b6080604051918051835260ff602082015116602084015261ffff60408201511660408401526060810151606084015201516080820152f35b906040810191805190604083528151809452606083019360208093019060005b8181106103ec5750505081015163ffffffff1691015290565b82516001600160a01b0316875295840195918401916001016103d3565b346103165761041f61041a36610339565b611b9f565b6040518091602082528051602083015260ff602082015116604083015261ffff604082015116606083015263ffffffff6080610469606084015160a08387015260c08601906103b3565b9201511660a08301520390f35b346103165761048436610339565b600854461461052757610513606061049e6105259361287e565b6104b06104aa8261185b565b906113b0565b61050a6104c060e0830151611e9d565b916104d163436f7265845114611459565b61050461014060408501926104e8468551146115ab565b015160005260056020526040600020600160ff19825416179055565b51612ca6565b015161ffff1690565b61ffff1661ffff196000541617600055565b005b60405162461bcd60e51b815260206004820152600a6024820152696e6f74206120666f726b60b01b6044820152606490fd5b34610316576000366003190112610316576020600754604051908152f35b3461031657600036600319011261031657602063ffffffff60035416604051908152f35b346103165760203660031901126103165760206105c8600435600052600560205260ff6040600020541690565b6040519015158152f35b600435906001600160a01b038216820361031657565b35906001600160a01b038216820361031657565b34610316576020366003190112610316576001600160a01b0361061d6105d2565b16600052600460205260206001600160401b0360406000205416604051908152f35b3461031657608061065761065236610339565b611a0c565b604051908051825260ff602082015116602083015261ffff6040820151166040830152606060018060a01b03910151166060820152f35b346103165760806106a66106a136610339565b611ce1565b6060604051918051835260ff602082015116602084015261ffff604082015116604084015201516060820152f35b34610316576106e236610339565b60085446036107735761076e60606106fc6105259361287e565b6107086104aa8261185b565b61076061014061071b60e0840151611a0c565b9261072c63436f72658551146113e0565b6104e861073e604086015161ffff1690565b61ffff61075861075160005461ffff1690565b61ffff1690565b91161461141d565b01516001600160a01b031690565b61163e565b60405162461bcd60e51b815260206004820152600c60248201526b696e76616c696420666f726b60a01b6044820152606490fd5b34610316576000366003190112610316576020600854604051908152f35b34610316576105256108d96107e16107dc36610339565b61287e565b6107ed6104aa8261185b565b6108cf6107fd60e0830151611b9f565b61080d63436f7265825114611459565b61084b61081f604083015161ffff1690565b61ffff61083261075160005461ffff1690565b911690811490816108f8575b81156108ef575b50611496565b6108a9610140608060608401936108668551515115156114d2565b01946104e8610879875163ffffffff1690565b63ffffffff6108a161089861089360035463ffffffff1690565b611534565b63ffffffff1690565b911614611549565b6108c06108bb60035463ffffffff1690565b612b24565b51825163ffffffff1690612c1b565b5163ffffffff1690565b63ffffffff1663ffffffff196003541617600355565b90501538610845565b905061090d61090960085446141590565b1590565b9061083e565b34610316576000806003193601126109cc577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b03168082526006602052604082205460ff16610991576001600160a01b03166000908152600660205260409020805460ff1916600117905561098e611f42565b80f35b60405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606490fd5b80fd5b6044359060ff8216820361031657565b359060ff8216820361031657565b6004359063ffffffff8216820361031657565b359063ffffffff8216820361031657565b359061ffff8216820361031657565b35906001600160401b038216820361031657565b6001600160401b03811161021e5760051b60200190565b81601f8201121561031657803590610a6282610a34565b92604092610a7284519586610274565b808552602091828087019260071b85010193818511610316578301915b848310610a9f5750505050505090565b60808383031261031657836080918751610ab881610203565b853581528286013583820152610acf8987016109df565b898201526060610ae08188016109df565b90820152815201920191610a8f565b60005b838110610b025750506000910152565b8181015183820152602001610af2565b90602091610b2b81518092818552858086019101610aef565b601f01601f1916010190565b6040906103369392151581528160208201520190610b12565b346103165760031960203682011261031657600435906001600160401b03908183116103165761016090833603011261031657610b8b610295565b90610b98836004016109df565b8252610ba660248401610a00565b6020830152610bb760448401610a00565b6040830152610bc860648401610a11565b606083015260848301356080830152610be360a48401610a20565b60a0830152610bf460c484016109df565b60c083015260e483013581811161031657610c15906004369186010161031b565b60e0830152610c276101048401610a00565b61010083015261012483013590811161031657610c6492610c516101449260043691840101610a4b565b61012084015201356101408201526123f9565b90610c7460405192839283610b37565b0390f35b3461031657610ce2610140610c8f6107dc36610339565b610c9b6104aa8261185b565b6104e8610cab60e0830151611dc4565b610cbb63436f7265825114611459565b604081015161ffff1690600095869586958695869561ffff610832610751895461ffff1690565b6080810151606090610d0c90610d009081906001600160a01b031681565b6001600160a01b031690565b91015190828215610d26575bf115610d215780f35b61159f565b506108fc610d18565b3461031657600036600319011261031657602061ffff60005416604051908152f35b3461031657600319606036820112610316576001600160401b0360243581811161031657610d83903690600401610a4b565b604435928284116103165760409084360301126103165760405191610da783610223565b8360040135908111610316578301923660238501121561031657600484013593610dd085610a34565b90610dde6040519283610274565b85825260209560248784019160051b8301019136831161031657602401905b828210610e26575050506024610c649592610e1a92865201610a00565b9083015260043561268d565b878091610e32846105e8565b815201910190610dfd565b90815180825260208080930193019160005b828110610e5d575050505090565b835180518652808301518684015260408082015160ff90811691880191909152606091820151169086015260809094019392810192600101610e4f565b805160ff1682529060208281015163ffffffff169082015260408281015163ffffffff169082015260608281015161ffff169082015260808201516080820152610ef460a083015160a08301906001600160401b03169052565b60c08281015160ff1690820152610f42610f1d60e08401516101608060e0860152840190610b12565b6101008481015163ffffffff1690840152610120808501519084830390850152610e3d565b916101408091015191015290565b3461031657610c74610f646107dc36610339565b604051918291602083526020830190610e9a565b34610316576000366003190112610316576020600154604051908152f35b606036600319011261031657610faa6109ed565b6001600160401b0360243581811161031657610fca90369060040161031b565b91610fd36109cf565b91600754340361107457336000526004602052806040600020541692600184019482861161106f57610c74957f6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b293336000526004602052604060002091166001600160401b031982541617905561105260405192839233968885611f06565b0390a26040516001600160401b0390911681529081906020820190565b61151e565b60405162461bcd60e51b815260206004820152600b60248201526a696e76616c69642066656560a81b6044820152606490fd5b6110bd6103369492606083526060830190610e9a565b92151560208201526040818403910152610b12565b34610316576020366003190112610316576001600160401b03600435818111610316573660238201121561031657806004013591821161031657366024838301011161031657610c7491602461112892016121c5565b604093919351938493846110a7565b3461031657608061114f61114a36610339565b611e9d565b61ffff6060604051928051845260ff6020820151166020850152604081015160408501520151166060820152f35b34610316576020366003190112610316576001600160a01b0361119e6105d2565b166000526006602052602060ff604060002054166040519015158152f35b34610316576000366003190112610316576020600854604051904614158152f35b3461031657600036600319011261031657602060035463ffffffff60405191831c168152f35b346103165760606112166107dc36610339565b6112226104aa8261185b565b61126561014061123560e0840151611ce1565b9261124663436f72658551146113e0565b61ffff806040860151169060005416148061126c575b6104e89061141d565b0151600755005b50600854461461125c565b34610316576020366003190112610316576020611295600435612ac1565b604051908152f35b3461031657602036600319011261031657610c746112c16112bc6109ed565b611314565b6040519182916020835260208301906103b3565b3461031657600036600319011261031657602061ffff60005460101c16604051908152f35b6040519061130782610223565b6000602083606081520152565b63ffffffff906113226112fa565b50166000526020600281526040600020906040519161134083610223565b6040518083835491828152019083600052846000209060005b8181106113935750505061033693928261137a611387946001940382610274565b8652015463ffffffff1690565b63ffffffff1690830152565b82546001600160a01b031684529286019260019283019201611359565b156113b85750565b60405162461bcd60e51b8152602060048201529081906113dc906024830190610b12565b0390fd5b156113e757565b60405162461bcd60e51b815260206004820152600e60248201526d496e76616c6964204d6f64756c6560901b6044820152606490fd5b1561142457565b60405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21021b430b4b760991b6044820152606490fd5b1561146057565b60405162461bcd60e51b815260206004820152600e60248201526d696e76616c6964204d6f64756c6560901b6044820152606490fd5b1561149d57565b60405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b21021b430b4b760991b6044820152606490fd5b156114d957565b60405162461bcd60e51b815260206004820152601960248201527f6e657720677561726469616e2073657420697320656d707479000000000000006044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b90600163ffffffff8093160191821161106f57565b1561155057565b60405162461bcd60e51b815260206004820152602160248201527f696e646578206d75737420696e63726561736520696e207374657073206f66206044820152603160f81b6064820152608490fd5b6040513d6000823e3d90fd5b156115b257565b60405162461bcd60e51b815260206004820152601160248201527034b73b30b634b21022ab269021b430b4b760791b6044820152606490fd5b60405190602082018281106001600160401b0382111761021e5760405260008252565b3d15611639573d9061161f826102c4565b9161162d6040519384610274565b82523d6000602084013e565b606090565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc908154813b1561170d577f2e4cc16c100f0b55e2df82ab0b1a7e294aa9cbd01b48fbaf622683fbc0507a499060018060a01b039081841694856bffffffffffffffffffffffff60a01b8316179055611707604051600080968192897fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a263204a7f0760e21b6020820190815260048252906116fb81610223565b51915af46104aa61160e565b169180a3565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b6040519061177582610259565b6022825261195d60f21b6040837f6e6f74207369676e65642062792063757272656e7420677561726469616e207360208201520152565b604051906117b982610223565b60168252753bb937b7339033b7bb32b93730b731b29031b430b4b760511b6020830152565b604051906117eb82610223565b601982527f77726f6e6720676f7665726e616e636520636f6e7472616374000000000000006020830152565b6040519061182482610259565b6022825261195960f21b6040837f676f7665726e616e636520616374696f6e20616c726561647920636f6e73756d60208201520152565b611864816123f9565b9015611924575061010081015163ffffffff1663ffffffff61188e61089860035463ffffffff1690565b91160361191857606081015161ffff1661ffff6118b561075160005461ffff9060101c1690565b91160361190c57608081015160015403611900576101406118e6910151600052600560205260ff6040600020541690565b6118f5576001906103366115eb565b600090610336611817565b506000906103366117de565b506000906103366117ac565b50600090610336611768565b600092909150565b6040519061193982610203565b60006060838281528260208201528260408201520152565b906020820180921161106f57565b906001820180921161106f57565b906002820180921161106f57565b906004820180921161106f57565b906014820180921161106f57565b906008820180921161106f57565b90601f820180921161106f57565b9190820180921161106f57565b156119c757565b60405162461bcd60e51b815260206004820152601760248201527f696e76616c696420436f6e7472616374557067726164650000000000000000006044820152606490fd5b90611a1561192c565b91611a1f81613030565b8352611a3e600160ff611a3184612e51565b16806020870152146119c0565b61ffff611a4a82612ee8565b1660408401526043815110611a79576043818101516001600160a01b0316606085015290516102c291146119c0565b60405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b6044820152606490fd5b60405190611ac38261023e565b6000608083828152826020820152826040820152611adf6112fa565b60608201520152565b15611aef57565b60405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420477561726469616e536574557067726164650000000000006044820152606490fd5b90611b3e82610a34565b611b4b6040519182610274565b8281528092611b5c601f1991610a34565b0190602036910137565b600019811461106f5760010190565b8051821015611b895760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b90611ba8611ab6565b91611bb281613030565b8352611bdb600260ff611bd4611bc785612e51565b60ff166020880181905290565b1614611ae8565b611bf2611be782612ee8565b61ffff166040850152565b611c0b611bfe82612fac565b63ffffffff166080850152565b611c1481612ebc565b60ff6028911691611c2483611b34565b92611c2d6102b5565b93845260006020850152606086019384526000935b818510611c575750506102c292505114611ae8565b909192611c8e81611c89611c6e611c949488612df5565b611c7a89875151611b75565b6001600160a01b039091169052565b611989565b94611b66565b93929190611c42565b15611ca457565b60405162461bcd60e51b8152602060048201526015602482015274696e76616c6964205365744d65737361676546656560581b6044820152606490fd5b90611cea61192c565b91611cf481613030565b8352611d13600360ff611d0684612e51565b1680602087015214611c9d565b61ffff611d1f82612ee8565b1660408401526043815110611d4457604381816102c293015160608601525114611c9d565b60405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b6044820152606490fd5b15611d8857565b60405162461bcd60e51b8152602060048201526014602482015273696e76616c6964205472616e736665724665657360601b6044820152606490fd5b9060405191611dd28361023e565b60008352602083019060008252604084019060008252606085019160008352611e20600460808801956000875288611e0986613030565b905260ff611e1686612e51565b1680915214611d81565b61ffff611e2c83612ee8565b1690526043815110611d44576102c29260639260438301519052611e4f82613040565b90525114611d81565b15611e5f57565b60405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a5908149958dbdd995c90da185a5b925960521b6044820152606490fd5b90611ea661192c565b91611eb081613030565b8352611ecf600560ff611ec284612e51565b1680602087015214611e58565b6041815110611d445760438160416102c29301516040860152611eff611ef482612f34565b61ffff166060870152565b5114611e58565b92611f3b9063ffffffff6060946001600160401b0360ff95999899168752166020860152608060408601526080850190610b12565b9416910152565b60085415611f4c57565b61ffff611f5c60005461ffff1690565b1660028103611f7057506102c26001612ca6565b60048103611f8357506102c26038612ca6565b60058103611f9657506102c26089612ca6565b60068103611faa57506102c261a86a612ca6565b60078103611fbe57506102c261a516612ca6565b60098103611fd457506102c2634e454152612ca6565b600a8103611fe757506102c260fa612ca6565b600b8103611ffb57506102c26102ae612ca6565b600c810361200f57506102c2610313612ca6565b600d810361202357506102c2612019612ca6565b600e810361203757506102c261a4ec612ca6565b6010810361204b57506102c2610504612ca6565b6011810361206157506102c2630e9ac0d6612ca6565b6017810361207557506102c261a4b1612ca6565b6018810361208857506102c2600a612ca6565b601903612099576102c26064612ca6565b60405162461bcd60e51b81526020600482015260116024820152702ab735b737bbb71031b430b4b71034b21760791b6044820152606490fd5b60405162461bcd60e51b815260206004820152600b60248201526a1d5b9cdd5c1c1bdc9d195960aa1b6044820152606490fd5b60405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201526b63636570742061737365747360a01b6064820152608490fd5b6040519061016082018281106001600160401b0382111761021e57604052816101406000918281528260208201528260408201528260608201528260808201528260a08201528260c0820152606060e08201528261010082015260606101208201520152565b6107dc906121dd926121d561215f565b5036916102df565b906121e782612325565b9091565b94929060339796949263ffffffff60e01b809260e01b16875260e01b16600486015261ffff60f01b9060f01b166008850152600a8401526001600160401b0360c01b9060c01b16602a83015260ff60f81b9060f81b1660328201526122598251809360208685019101610aef565b010190565b6040519061226b82610223565b601a82527f766d2e6861736820646f65736e2774206d6174636820626f64790000000000006020830152565b604051906122a482610223565b60148252731a5b9d985b1a590819dd585c991a585b881cd95d60621b6020830152565b604051906122d482610223565b601882527f677561726469616e2073657420686173206578706972656400000000000000006020830152565b6040519061230d82610223565b60098252686e6f2071756f72756d60b81b6020830152565b610100810161233b6112bc825163ffffffff1690565b90815151156123eb575163ffffffff1661235d61089860035463ffffffff1690565b63ffffffff809216141590816123ce575b506123c1576101208201805151612386835151612ac1565b116123b35761014061239c93015190519061268d565b90156123ae57506001906103366115eb565b600091565b505050600090610336612300565b50506000906103366122c7565b90506123e1602083015163ffffffff1690565b429116103861236e565b505050600090610336612297565b6101008101906124106112bc835163ffffffff1690565b90612422602082015163ffffffff1690565b604082015163ffffffff169061243d606084015161ffff1690565b9161247a608085015161245a60a08701516001600160401b031690565b60c087015160ff169060e0880151926040519788966020880198896121eb565b039161248e601f1993848101835282610274565b519020906124b860405191826124ac60208201958660209181520190565b03908101835282610274565b5190209261014082019384510361255e578251511561254f575163ffffffff166124ea61089860035463ffffffff1690565b63ffffffff80921614159081612532575b506125245761012001805151612512835151612ac1565b116123b35761239c925190519061268d565b5050506000906103366122c7565b9050612545602084015163ffffffff1690565b42911610386124fb565b50505050600090610336612297565b5050505060009061033661225e565b1561257457565b60405162461bcd60e51b815260206004820152601f60248201527f65637265636f766572206661696c65642077697468207369676e6174757265006044820152606490fd5b156125c057565b60405162461bcd60e51b815260206004820152602360248201527f7369676e617475726520696e6469636573206d75737420626520617363656e64604482015262696e6760e81b6064820152608490fd5b1561261857565b60405162461bcd60e51b815260206004820152601c60248201527f677561726469616e20696e646578206f7574206f6620626f756e6473000000006044820152606490fd5b6040519061266a82610223565b60148252731593481cda59db985d1d5c99481a5b9d985b1a5960621b6020830152565b825151919260009291835b85518110156127b2576126ab8187611b75565b51604060006126bd8284015160ff1690565b8351602080860151945188815260ff93909316838201526040830191909152606082019390935281805260809060015afa15610d215760005160609190612723906001600160a01b03169761271389151561256d565b8415908115612795575b506125b9565b0194612771610d00612764612739895160ff1690565b986127488960ff8c1610612611565b61275e6127588951925160ff1690565b60ff1690565b90611b75565b516001600160a01b031690565b036127845761277f90611b66565b612698565b50505050505060009061033661265d565b90506127a48484015160ff1690565b60ff9182169116113861271d565b5050505050506001906103366115eb565b156127ca57565b60405162461bcd60e51b815260206004820152601760248201527f564d2076657273696f6e20696e636f6d70617469626c650000000000000000006044820152606490fd5b9061281982610a34565b6128266040519182610274565b8281528092612837601f1991610a34565b019060005b82811061284857505050565b60209061285361192c565b8282850101520161283c565b60ff601b9116019060ff821161106f57565b9190820391821161106f57565b9061288761215f565b9161289b61289482612e9c565b60ff168452565b6128b4600160ff6128ad865160ff1690565b16146127c3565b6128ce6128c082612f60565b63ffffffff16610100850152565b6128da61275882612eac565b6006906128e68161280f565b9061012086019182526000915b818310612a205750505090612a086129ec6129ca6129b661299961297f87612929612922612a199a8a51612871565b828a612d69565b602081519101206040516129578161294960208201948560209181520190565b03601f198101835282610274565b5190206101408c015261297a61296d828a612fbc565b63ffffffff1660208d0152565b61197b565b61297a61298c8289612fbc565b63ffffffff1660408c0152565b6129b16129a68288612f44565b61ffff1660608b0152565b61196d565b6129c08186613050565b6080890152611951565b6129e76129d78286612fd8565b6001600160401b031660a0890152565b611997565b612a036129f98285612ecc565b60ff1660c0880152565b61195f565b612a13818351612871565b91612d69565b60e0830152565b909192612ab4612a92612a73612a5784612a03612a40612aba978c612ecc565b6060612a4d8c8b51611b75565b51019060ff169052565b612a61818a613050565b612a6c898851611b75565b5152611951565b612a7d8189613050565b6020612a8a898851611b75565b510152611951565b612a03612aa7612aa2838a612ecc565b61285f565b6040612a4d898851611b75565b93611b66565b91906128f3565b610100811015612aea578060011b908082046002149015171561106f576003610336910461195f565b60405162461bcd60e51b8152602060048201526012602482015271746f6f206d616e7920677561726469616e7360701b6044820152606490fd5b63ffffffff62015180814216019080821161106f576102c29216600052600260205260016040600020019063ffffffff1663ffffffff19825416179055565b9080519081516001600160401b03811161021e5768010000000000000000811161021e578354818555808210612bf2575b506020809301612ba985600052602060002090565b60005b838110612bd7575050505001516001909101805463ffffffff191663ffffffff909216919091179055565b82516001600160a01b03168282015591850191600101612bac565b6000858152826020822092830192015b828110612c10575050612b94565b818155600101612c02565b9081515160005b818110612c485750509063ffffffff6102c2921660005260026020526040600020612b63565b83516001600160a01b0390612c5e908390611b75565b511615612c7357612c6e90611b66565b612c22565b60405162461bcd60e51b815260206004820152600b60248201526a496e76616c6964206b657960a81b6044820152606490fd5b468103612cb257600855565b60405162461bcd60e51b81526020600482015260126024820152711a5b9d985b1a5908195d9b50da185a5b925960721b6044820152606490fd5b15612cf357565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b15612d3057565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b91612d7e81612d77816119a5565b1015612cec565b612d948351612d8d83856119b3565b1115612d29565b80612dad57505050604051600081526020810160405290565b60405192601f821692831560051b80858701019484860193010101905b808410612de25750508252601f01601f191660405290565b9092835181526020809101930190612dca565b908151601482019081831161106f5710612e1457016020015160601c90565b60405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b6044820152606490fd5b6021815110612e61576021015190565b60405162461bcd60e51b8152602060048201526013602482015272746f55696e74385f6f75744f66426f756e647360681b6044820152606490fd5b6001815110612e61576001015190565b6006815110612e61576006015190565b6028815110612e61576028015190565b908151600182019081831161106f5710612e6157016001015190565b6023815110612ef8576023015190565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b6044820152606490fd5b6043815110612ef8576043015190565b908151600282019081831161106f5710612ef857016002015190565b6005815110612f70576005015190565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7433325f6f75744f66426f756e647360601b6044820152606490fd5b6027815110612f70576027015190565b908151600482019081831161106f5710612f7057016004015190565b908151600882019081831161106f5710612ff457016008015190565b60405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b6044820152606490fd5b6020815110611a79576020015190565b6063815110611a79576063015190565b908151602082019081831161106f5710611a795701602001519056fea2646970667358221220e01f3fc19a7b6f650a08aafb55409b8aa16f0ebf4a5804ec4ce7df76358d349364736f6c63430008130033",cs=r=>r.length>1;class et extends Zt{constructor(...e){cs(e)?super(...e):super(bt,Pn,e[0])}getDeployTransaction(e){return super.getDeployTransaction(e||{})}deploy(e){return super.deploy(e||{})}connect(e){return super.connect(e)}static createInterface(){return new Qe(bt)}static connect(e,t){return new os(e,bt,t)}}u(et,"bytecode",Pn),u(et,"abi",bt);const fs=Object.freeze(Object.defineProperty({__proto__:null,Implementation__factory:et},Symbol.toStringTag,{value:"Module"}));E0.registerProtocol(Te._platform,"WormholeCore",at);const us=Object.freeze(Object.defineProperty({__proto__:null,EvmWormholeCore:at,ethers_contracts:fs},Symbol.toStringTag,{value:"Module"}));exports.EvmUnsignedTransaction=Rn;exports.EvmWormholeCore=at;exports.index=us;
|