"use strict";(self.webpackChunkfrog=self.webpackChunkfrog||[]).push([[5481],{8051:(e,t,s)=>{s.d(t,{_y:()=>O,R$:()=>E,FR:()=>I,cP:()=>T});var r=s(35273),n=s(30031),i=s(41442),o=s(82314),a=s(8177),c=s(88081),l=s(57339),h=s(87303),u=s(36212),d=s(27033),p=s(26976),g=s(16131),m=s(75942),b=s(64170),f=s(41441);class w{#e;#t;#s;#r;#n;#i;constructor(e){this.#e=e,this.#t=null,this.#s=this.#o.bind(this),this.#r=!1,this.#n=null,this.#i=!1}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}async#o(e){try{null==this.#t&&(this.#t=this._subscribe(this.#e));let e=null;try{e=await this.#t}catch(e){if(!(0,l.bJ)(e,"UNSUPPORTED_OPERATION")||"eth_newFilter"!==e.operation)throw e}if(null==e)return this.#t=null,void this.#e._recoverSubscriber(this,this._recover(this.#e));const t=await this.#e.getNetwork();if(this.#n||(this.#n=t),this.#n.chainId!==t.chainId)throw new Error("chaid changed");if(this.#i)return;const s=await this.#e.send("eth_getFilterChanges",[e]);await this._emitResults(this.#e,s)}catch(e){}this.#e.once("block",this.#s)}#a(){const e=this.#t;e&&(this.#t=null,e.then((e=>{this.#e.destroyed||this.#e.send("eth_uninstallFilter",[e])})))}start(){this.#r||(this.#r=!0,this.#o(-2))}stop(){this.#r&&(this.#r=!1,this.#i=!0,this.#a(),this.#e.off("block",this.#s))}pause(e){e&&this.#a(),this.#e.off("block",this.#s)}resume(){this.start()}}class y extends w{#c;constructor(e,t){var s;super(e),this.#c=(s=t,JSON.parse(JSON.stringify(s)))}_recover(e){return new f.MY(e,this.#c)}async _subscribe(e){return await e.send("eth_newFilter",[this.#c])}async _emitResults(e,t){for(const s of t)e.emit(this.#c,e._wrapLog(s,e._network))}}class k extends w{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const s of t)e.emit("pending",s)}}const v="bigint,boolean,function,number,string,symbol".split(/,/g);function N(e){if(null==e||v.indexOf(typeof e)>=0)return e;if("function"==typeof e.getAddress)return e;if(Array.isArray(e))return e.map(N);if("object"==typeof e)return Object.keys(e).reduce(((t,s)=>(t[s]=e[s],t)),{});throw new Error(`should not happen: ${e} (${typeof e})`)}function P(e){return new Promise((t=>{setTimeout(t,e)}))}function R(e){return e?e.toLowerCase():e}function _(e){return e&&"number"==typeof e.pollingInterval}const x={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class T extends m.Z{address;constructor(e,t){super(e),t=(0,n.b)(t),(0,c.n)(this,{address:t})}connect(e){(0,l.vA)(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(e){return await this.populateCall(e)}async sendUncheckedTransaction(e){const t=N(e),s=[];if(t.from){const r=t.from;s.push((async()=>{const s=await(0,i.tG)(r,this.provider);(0,l.MR)(null!=s&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),t.from=s})())}else t.from=this.address;if(null==t.gasLimit&&s.push((async()=>{t.gasLimit=await this.provider.estimateGas({...t,from:this.address})})()),null!=t.to){const e=t.to;s.push((async()=>{t.to=await(0,i.tG)(e,this.provider)})())}s.length&&await Promise.all(s);const r=this.provider.getRpcTransaction(t);return this.provider.send("eth_sendTransaction",[r])}async sendTransaction(e){const t=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(e);return await new Promise(((e,r)=>{const n=[1e3,100];let i=0;const o=async()=>{try{const r=await this.provider.getTransaction(s);if(null!=r)return void e(r.replaceableTransaction(t))}catch(e){if((0,l.bJ)(e,"CANCELLED")||(0,l.bJ)(e,"BAD_DATA")||(0,l.bJ)(e,"NETWORK_ERROR")||(0,l.bJ)(e,"UNSUPPORTED_OPERATION"))return null==e.info&&(e.info={}),e.info.sendTransactionHash=s,void r(e);if((0,l.bJ)(e,"INVALID_ARGUMENT")&&(i++,null==e.info&&(e.info={}),e.info.sendTransactionHash=s,i>10))return void r(e);this.provider.emit("error",(0,l.xz)("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:e}))}this.provider._setTimeout((()=>{o()}),n.pop()||4e3)};o()}))}async signTransaction(e){const t=N(e);if(t.from){const s=await(0,i.tG)(t.from,this.provider);(0,l.MR)(null!=s&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",e),t.from=s}else t.from=this.address;const s=this.provider.getRpcTransaction(t);return await this.provider.send("eth_signTransaction",[s])}async signMessage(e){const t="string"==typeof e?(0,h.YW)(e):e;return await this.provider.send("personal_sign",[(0,u.c$)(t),this.address.toLowerCase()])}async signTypedData(e,t,s){const r=N(s),n=await o.z.resolveNames(e,t,r,(async e=>{const t=await(0,i.tG)(e);return(0,l.MR)(null!=t,"TypedData does not support null address","value",e),t}));return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(o.z.getPayload(n.domain,t,n.value))])}async unlock(e){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),e,null])}async _legacySignMessage(e){const t="string"==typeof e?(0,h.YW)(e):e;return await this.provider.send("eth_sign",[this.address.toLowerCase(),(0,u.c$)(t)])}}class E extends g.Q{#l;#h;#u;#d;#p;#n;#g;#m(){if(this.#d)return;const e=1===this._getOption("batchMaxCount")?0:this._getOption("batchStallTime");this.#d=setTimeout((()=>{this.#d=null;const e=this.#u;for(this.#u=[];e.length;){const t=[e.shift()];for(;e.length&&t.length!==this.#l.batchMaxCount;){t.push(e.shift());if(JSON.stringify(t.map((e=>e.payload))).length>this.#l.batchMaxSize){e.unshift(t.pop());break}}(async()=>{const e=1===t.length?t[0].payload:t.map((e=>e.payload));this.emit("debug",{action:"sendRpcPayload",payload:e});try{const s=await this._send(e);this.emit("debug",{action:"receiveRpcResult",result:s});for(const{resolve:e,reject:r,payload:n}of t){if(this.destroyed){r((0,l.xz)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:n.method}));continue}const t=s.filter((e=>e.id===n.id))[0];if(null!=t)"error"in t?r(this.getRpcError(n,t)):e(t.result);else{const e=(0,l.xz)("missing response for request","BAD_DATA",{value:s,info:{payload:n}});this.emit("error",e),r(e)}}}catch(e){this.emit("debug",{action:"receiveRpcError",error:e});for(const{reject:s}of t)s(e)}})()}}),e)}constructor(e,t){super(e,t),this.#h=1,this.#l=Object.assign({},x,t||{}),this.#u=[],this.#d=null,this.#n=null,this.#g=null;{let e=null;const t=new Promise((t=>{e=t}));this.#p={promise:t,resolve:e}}const s=this._getOption("staticNetwork");"boolean"==typeof s?((0,l.MR)(!s||"any"!==e,"staticNetwork cannot be used on special network 'any'","options",t),s&&null!=e&&(this.#n=b.l.from(e))):s&&((0,l.MR)(null==e||s.matches(e),"staticNetwork MUST match network object","options",t),this.#n=s)}_getOption(e){return this.#l[e]}get _network(){return(0,l.vA)(this.#n,"network is not available yet","NETWORK_ERROR"),this.#n}async _perform(e){if("call"===e.method||"estimateGas"===e.method){let t=e.transaction;if(t&&null!=t.type&&(0,d.Ab)(t.type)&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const s=await this.getFeeData();null==s.maxFeePerGas&&null==s.maxPriorityFeePerGas&&(e=Object.assign({},e,{transaction:Object.assign({},t,{type:void 0})}))}}const t=this.getRpcRequest(e);return null!=t?await this.send(t.method,t.args):super._perform(e)}async _detectNetwork(){const e=this._getOption("staticNetwork");if(e){if(!0!==e)return e;if(this.#n)return this.#n}return this.#g?await this.#g:this.ready?(this.#g=(async()=>{try{const e=b.l.from((0,d.Ab)(await this.send("eth_chainId",[])));return this.#g=null,e}catch(e){throw this.#g=null,e}})(),await this.#g):(this.#g=(async()=>{const e={id:this.#h++,method:"eth_chainId",params:[],jsonrpc:"2.0"};let t;this.emit("debug",{action:"sendRpcPayload",payload:e});try{t=(await this._send(e))[0],this.#g=null}catch(e){throw this.#g=null,this.emit("debug",{action:"receiveRpcError",error:e}),e}if(this.emit("debug",{action:"receiveRpcResult",result:t}),"result"in t)return b.l.from((0,d.Ab)(t.result));throw this.getRpcError(e,t)})(),await this.#g)}_start(){null!=this.#p&&null!=this.#p.resolve&&(this.#p.resolve(),this.#p=null,(async()=>{for(;null==this.#n&&!this.destroyed;)try{this.#n=await this._detectNetwork()}catch(e){if(this.destroyed)break;this.emit("error",(0,l.xz)("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:e}})),await P(1e3)}this.#m()})())}async _waitUntilReady(){if(null!=this.#p)return await this.#p.promise}_getSubscriber(e){return"pending"===e.type?new k(this):"event"===e.type?this._getOption("polling")?new f.MY(this,e.filter):new y(this,e.filter):"orphan"===e.type&&"drop-log"===e.filter.orphan?new g.J("orphan"):super._getSubscriber(e)}get ready(){return null==this.#p}getRpcTransaction(e){const t={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((s=>{if(null==e[s])return;let r=s;"gasLimit"===s&&(r="gas"),t[r]=(0,d.nD)((0,d.Ab)(e[s],`tx.${s}`))})),["from","to","data"].forEach((s=>{null!=e[s]&&(t[s]=(0,u.c$)(e[s]))})),e.accessList&&(t.accessList=(0,a.$)(e.accessList)),e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.map((e=>e.toLowerCase()))),t}getRpcRequest(e){switch(e.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[R(e.address),e.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[R(e.address),e.blockTag]};case"getCode":return{method:"eth_getCode",args:[R(e.address),e.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[R(e.address),"0x"+e.position.toString(16),e.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[e.signedTransaction]};case"getBlock":if("blockTag"in e)return{method:"eth_getBlockByNumber",args:[e.blockTag,!!e.includeTransactions]};if("blockHash"in e)return{method:"eth_getBlockByHash",args:[e.blockHash,!!e.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[e.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[e.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(e.transaction),e.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(e.transaction)]};case"getLogs":return e.filter&&null!=e.filter.address&&(Array.isArray(e.filter.address)?e.filter.address=e.filter.address.map(R):e.filter.address=R(e.filter.address)),{method:"eth_getLogs",args:[e.filter]}}return null}getRpcError(e,t){const{method:s}=e,{error:n}=t;if("eth_estimateGas"===s&&n.message){const t=n.message;if(!t.match(/revert/i)&&t.match(/insufficient funds/i))return(0,l.xz)("insufficient funds","INSUFFICIENT_FUNDS",{transaction:e.params[0],info:{payload:e,error:n}})}if("eth_call"===s||"eth_estimateGas"===s){const t=A(n),i=r.y.getBuiltinCallException("eth_call"===s?"call":"estimateGas",e.params[0],t?t.data:null);return i.info={error:n,payload:e},i}const i=JSON.stringify(function(e){const t=[];return S(e,t),t}(n));if("string"==typeof n.message&&n.message.match(/user denied|ethers-user-denied/i)){const t={eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"};return(0,l.xz)("user rejected action","ACTION_REJECTED",{action:t[s]||"unknown",reason:"rejected",info:{payload:e,error:n}})}if("eth_sendRawTransaction"===s||"eth_sendTransaction"===s){const t=e.params[0];if(i.match(/insufficient funds|base fee exceeds gas limit/i))return(0,l.xz)("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:t,info:{error:n}});if(i.match(/nonce/i)&&i.match(/too low/i))return(0,l.xz)("nonce has already been used","NONCE_EXPIRED",{transaction:t,info:{error:n}});if(i.match(/replacement transaction/i)&&i.match(/underpriced/i))return(0,l.xz)("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:t,info:{error:n}});if(i.match(/only replay-protected/i))return(0,l.xz)("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:t,info:{error:n}}})}let o=!!i.match(/the method .* does not exist/i);return o||n&&n.details&&n.details.startsWith("Unauthorized method:")&&(o=!0),o?(0,l.xz)("unsupported operation","UNSUPPORTED_OPERATION",{operation:e.method,info:{error:n,payload:e}}):(0,l.xz)("could not coalesce error","UNKNOWN_ERROR",{error:n,payload:e})}send(e,t){if(this.destroyed)return Promise.reject((0,l.xz)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e}));const s=this.#h++,r=new Promise(((r,n)=>{this.#u.push({resolve:r,reject:n,payload:{method:e,params:t,id:s,jsonrpc:"2.0"}})}));return this.#m(),r}async getSigner(e){null==e&&(e=0);const t=this.send("eth_accounts",[]);if("number"==typeof e){const s=await t;if(e>=s.length)throw new Error("no such account");return new T(this,s[e])}const{accounts:s}=await(0,c.k)({network:this.getNetwork(),accounts:t});e=(0,n.b)(e);for(const t of s)if((0,n.b)(t)===e)return new T(this,e);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map((e=>new T(this,e)))}destroy(){this.#d&&(clearTimeout(this.#d),this.#d=null);for(const{payload:e,reject:t}of this.#u)t((0,l.xz)("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:e.method}));this.#u=[],super.destroy()}}class O extends E{#b;constructor(e,t){super(e,t);let s=this._getOption("pollingInterval");null==s&&(s=x.pollingInterval),this.#b=s}_getSubscriber(e){const t=super._getSubscriber(e);return _(t)&&(t.pollingInterval=this.#b),t}get pollingInterval(){return this.#b}set pollingInterval(e){if(!Number.isInteger(e)||e<0)throw new Error("invalid interval");this.#b=e,this._forEachSubscriber((e=>{_(e)&&(e.pollingInterval=this.#b)}))}}class I extends O{#f;constructor(e,t,s){null==e&&(e="http://localhost:8545"),super(t,s),this.#f="string"==typeof e?new p.ui(e):e.clone()}_getConnection(){return this.#f.clone()}async send(e,t){return await this._start(),await super.send(e,t)}async _send(e){const t=this._getConnection();t.body=JSON.stringify(e),t.setHeader("content-type","application/json");const s=await t.send();s.assertOk();let r=s.bodyJson;return Array.isArray(r)||(r=[r]),r}}function A(e){if(null==e)return null;if("string"==typeof e.message&&e.message.match(/revert/i)&&(0,u.Lo)(e.data))return{message:e.message,data:e.data};if("object"==typeof e){for(const t in e){const s=A(e[t]);if(s)return s}return null}if("string"==typeof e)try{return A(JSON.parse(e))}catch(e){}return null}function S(e,t){if(null!=e){if("string"==typeof e.message&&t.push(e.message),"object"==typeof e)for(const s in e)S(e[s],t);if("string"==typeof e)try{return S(JSON.parse(e),t)}catch(e){}}}},41441:(e,t,s)=>{function r(e){return JSON.parse(JSON.stringify(e))}s.d(t,{AC:()=>c,MY:()=>l,bs:()=>n,l8:()=>o,wF:()=>a});class n{#e;#s;#w;#y;constructor(e){this.#e=e,this.#s=null,this.#w=4e3,this.#y=-2}get pollingInterval(){return this.#w}set pollingInterval(e){this.#w=e}async#o(){try{const e=await this.#e.getBlockNumber();if(-2===this.#y)return void(this.#y=e);if(e!==this.#y){for(let t=this.#y+1;t<=e;t++){if(null==this.#s)return;await this.#e.emit("block",t)}this.#y=e}}catch(e){}null!=this.#s&&(this.#s=this.#e._setTimeout(this.#o.bind(this),this.#w))}start(){this.#s||(this.#s=this.#e._setTimeout(this.#o.bind(this),this.#w),this.#o())}stop(){this.#s&&(this.#e._clearTimeout(this.#s),this.#s=null)}pause(e){this.stop(),e&&(this.#y=-2)}resume(){this.start()}}class i{#e;#o;#r;constructor(e){this.#e=e,this.#r=!1,this.#o=e=>{this._poll(e,this.#e)}}async _poll(e,t){throw new Error("sub-classes must override this")}start(){this.#r||(this.#r=!0,this.#o(-2),this.#e.on("block",this.#o))}stop(){this.#r&&(this.#r=!1,this.#e.off("block",this.#o))}pause(e){this.stop()}resume(){this.start()}}class o extends i{#k;#v;constructor(e,t){super(e),this.#k=t,this.#v=-2}pause(e){e&&(this.#v=-2),super.pause(e)}async _poll(e,t){const s=await t.getBlock(this.#k);null!=s&&(-2===this.#v?this.#v=s.number:s.number>this.#v&&(t.emit(this.#k,s.number),this.#v=s.number))}}class a extends i{#N;constructor(e,t){super(e),this.#N=r(t)}async _poll(e,t){throw new Error("@TODO")}}class c extends i{#P;constructor(e,t){super(e),this.#P=t}async _poll(e,t){const s=await t.getTransactionReceipt(this.#P);s&&t.emit(this.#P,s)}}class l{#e;#N;#s;#r;#y;constructor(e,t){this.#e=e,this.#N=r(t),this.#s=this.#o.bind(this),this.#r=!1,this.#y=-2}async#o(e){if(-2===this.#y)return;const t=r(this.#N);t.fromBlock=this.#y+1,t.toBlock=e;const s=await this.#e.getLogs(t);if(0!==s.length)for(const e of s)this.#e.emit(this.#N,e),this.#y=e.blockNumber;else this.#y{this.#y=e})),this.#e.on("block",this.#s))}stop(){this.#r&&(this.#r=!1,this.#e.off("block",this.#s))}pause(e){this.stop(),e&&(this.#y=-2)}resume(){this.start()}}},43948:(e,t,s)=>{s.d(t,{J9:()=>u,VS:()=>d,eB:()=>p,tG:()=>g,uI:()=>b,z5:()=>m});var r=s(88081),n=s(36212),i=s(27033),o=s(57339),a=s(8177);const c=BigInt(0);function l(e){return null==e?null:e}function h(e){return null==e?null:e.toString()}class u{gasPrice;maxFeePerGas;maxPriorityFeePerGas;constructor(e,t,s){(0,r.n)(this,{gasPrice:l(e),maxFeePerGas:l(t),maxPriorityFeePerGas:l(s)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:s}=this;return{_type:"FeeData",gasPrice:h(e),maxFeePerGas:h(t),maxPriorityFeePerGas:h(s)}}}function d(e){const t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=(0,n.c$)(e.data));const s="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const r of s)r in e&&null!=e[r]&&(t[r]=(0,i.Ab)(e[r],`request.${r}`));const r="type,nonce".split(/,/);for(const s of r)s in e&&null!=e[s]&&(t[s]=(0,i.WZ)(e[s],`request.${s}`));return e.accessList&&(t.accessList=(0,a.$)(e.accessList)),"blockTag"in e&&(t.blockTag=e.blockTag),"enableCcipRead"in e&&(t.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(t.customData=e.customData),"blobVersionedHashes"in e&&e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.slice()),"kzg"in e&&(t.kzg=e.kzg),"blobs"in e&&e.blobs&&(t.blobs=e.blobs.map((e=>(0,n.f)(e)?(0,n.c$)(e):Object.assign({},e)))),t}class p{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#R;constructor(e,t){this.#R=e.transactions.map((e=>"string"!=typeof e?new b(e,t):e)),(0,r.n)(this,{provider:t,hash:l(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:l(e.prevRandao),extraData:e.extraData,baseFeePerGas:l(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return this.#R.map((e=>"string"==typeof e?e:e.hash))}get prefetchedTransactions(){const e=this.#R.slice();return 0===e.length?[]:((0,o.vA)("object"==typeof e[0],"transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:t,extraData:s,gasLimit:r,gasUsed:n,hash:i,miner:o,prevRandao:a,nonce:c,number:l,parentHash:u,parentBeaconBlockRoot:d,stateRoot:p,receiptsRoot:g,timestamp:m,transactions:b}=this;return{_type:"Block",baseFeePerGas:h(e),difficulty:h(t),extraData:s,gasLimit:h(r),gasUsed:h(n),blobGasUsed:h(this.blobGasUsed),excessBlobGas:h(this.excessBlobGas),hash:i,miner:o,prevRandao:a,nonce:c,number:l,parentHash:u,timestamp:m,parentBeaconBlockRoot:d,stateRoot:p,receiptsRoot:g,transactions:b}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>enew g(e,t))));let s=c;null!=e.effectiveGasPrice?s=e.effectiveGasPrice:null!=e.gasPrice&&(s=e.gasPrice),(0,r.n)(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:s,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return this.#_}toJSON(){const{to:e,from:t,contractAddress:s,hash:r,index:n,blockHash:i,blockNumber:o,logsBloom:a,logs:c,status:l,root:u}=this;return{_type:"TransactionReceipt",blockHash:i,blockNumber:o,contractAddress:s,cumulativeGasUsed:h(this.cumulativeGasUsed),from:t,gasPrice:h(this.gasPrice),blobGasUsed:h(this.blobGasUsed),blobGasPrice:h(this.blobGasPrice),gasUsed:h(this.gasUsed),hash:r,index:n,logs:c,logsBloom:a,root:u,status:l,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e{if(l)return null;const{blockNumber:e,nonce:t}=await(0,r.k)({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(t{if(null==e||0!==e.status)return e;(0,o.vA)(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:e.to,from:e.from,data:""},receipt:e})},d=await this.provider.getTransactionReceipt(this.hash);if(0===s)return u(d);if(d){if(await d.confirmations()>=s)return u(d)}else if(await h(),0===s)return null;const p=new Promise(((e,t)=>{const r=[],a=()=>{r.forEach((e=>e()))};if(r.push((()=>{l=!0})),n>0){const e=setTimeout((()=>{a(),t((0,o.xz)("wait for transaction timeout","TIMEOUT"))}),n);r.push((()=>{clearTimeout(e)}))}const c=async r=>{if(await r.confirmations()>=s){a();try{e(u(r))}catch(e){t(e)}}};if(r.push((()=>{this.provider.off(this.hash,c)})),this.provider.on(this.hash,c),i>=0){const e=async()=>{try{await h()}catch(e){if((0,o.bJ)(e,"TRANSACTION_REPLACED"))return a(),void t(e)}l||this.provider.once("block",e)};r.push((()=>{this.provider.off("block",e)})),this.provider.once("block",e)}}));return await p}isMined(){return null!=this.blockHash}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}removedEvent(){return(0,o.vA)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),w(this)}reorderedEvent(e){return(0,o.vA)(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),(0,o.vA)(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),f(this,e)}replaceableTransaction(e){(0,o.MR)(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new b(this,this.provider);return t.#x=e,t}}function f(e,t){return{orphan:"reorder-transaction",tx:e,other:t}}function w(e){return{orphan:"drop-transaction",tx:e}}},58906:(e,t,s)=>{s.d(t,{k:()=>i});var r=s(57339),n=s(8051);class i extends n._y{#T;constructor(e,t,s){const n=Object.assign({},null!=s?s:{},{batchMaxCount:1});(0,r.MR)(e&&e.request,"invalid EIP-1193 provider","ethereum",e),super(t,n),this.#T=async(t,s)=>{const r={method:t,params:s};this.emit("debug",{action:"sendEip1193Request",payload:r});try{const t=await e.request(r);return this.emit("debug",{action:"receiveEip1193Result",result:t}),t}catch(e){const t=new Error(e.message);throw t.code=e.code,t.data=e.data,t.payload=r,this.emit("debug",{action:"receiveEip1193Error",error:t}),t}}}async send(e,t){return await this._start(),await super.send(e,t)}async _send(e){(0,r.MR)(!Array.isArray(e),"EIP-1193 does not support batch request","payload",e);try{const t=await this.#T(e.method,e.params||[]);return[{id:e.id,result:t}]}catch(t){return[{id:e.id,error:{code:t.code,data:t.data,message:t.message}}]}}getRpcError(e,t){switch((t=JSON.parse(JSON.stringify(t))).error.code||-1){case 4001:t.error.message=`ethers-user-denied: ${t.error.message}`;break;case 4200:t.error.message=`ethers-unsupported: ${t.error.message}`}return super.getRpcError(e,t)}async hasSigner(e){null==e&&(e=0);const t=await this.send("eth_accounts",[]);return"number"==typeof e?t.length>e:(e=e.toLowerCase(),0!==t.filter((t=>t.toLowerCase()===e)).length)}async getSigner(e){if(null==e&&(e=0),!await this.hasSigner(e))try{await this.#T("eth_requestAccounts",[])}catch(e){const t=e.payload;throw this.getRpcError(t,{id:t.id,error:e})}return await super.getSigner(e)}}},64170:(e,t,s)=>{s.d(t,{l:()=>d});var r=s(8177),n=s(27033),i=s(57339),o=s(88081);class a{name;constructor(e){(0,o.n)(this,{name:e})}clone(){return new a(this.name)}}class c extends a{effectiveBlock;txBase;txCreate;txDataZero;txDataNonzero;txAccessListStorageKey;txAccessListAddress;constructor(e,t){null==e&&(e=0),super(`org.ethers.network.plugins.GasCost#${e||0}`);const s={effectiveBlock:e};function r(e,r){let n=(t||{})[e];null==n&&(n=r),(0,i.MR)("number"==typeof n,`invalud value for ${e}`,"costs",t),s[e]=n}r("txBase",21e3),r("txCreate",32e3),r("txDataZero",4),r("txDataNonzero",16),r("txAccessListStorageKey",1900),r("txAccessListAddress",2400),(0,o.n)(this,s)}clone(){return new c(this.effectiveBlock,this)}}class l extends a{address;targetNetwork;constructor(e,t){super("org.ethers.plugins.network.Ens"),(0,o.n)(this,{address:e||"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",targetNetwork:null==t?1:t})}clone(){return new l(this.address,this.targetNetwork)}}class h extends a{#E;#O;get url(){return this.#E}get processFunc(){return this.#O}constructor(e,t){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"),this.#E=e,this.#O=t}clone(){return this}}const u=new Map;class d{#I;#A;#S;constructor(e,t){this.#I=e,this.#A=(0,n.Ab)(t),this.#S=new Map}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return this.#I}set name(e){this.#I=e}get chainId(){return this.#A}set chainId(e){this.#A=(0,n.Ab)(e,"chainId")}matches(e){if(null==e)return!1;if("string"==typeof e){try{return this.chainId===(0,n.Ab)(e)}catch(e){}return this.name===e}if("number"==typeof e||"bigint"==typeof e){try{return this.chainId===(0,n.Ab)(e)}catch(e){}return!1}if("object"==typeof e){if(null!=e.chainId){try{return this.chainId===(0,n.Ab)(e.chainId)}catch(e){}return!1}return null!=e.name&&this.name===e.name}return!1}get plugins(){return Array.from(this.#S.values())}attachPlugin(e){if(this.#S.get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return this.#S.set(e.name,e.clone()),this}getPlugin(e){return this.#S.get(e)||null}getPlugins(e){return this.plugins.filter((t=>t.name.split("#")[0]===e))}clone(){const e=new d(this.name,this.chainId);return this.plugins.forEach((t=>{e.attachPlugin(t.clone())})),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new c;let s=t.txBase;if(null==e.to&&(s+=t.txCreate),e.data)for(let r=2;r{r.attachPlugin(e)})),r};d.register(e,r),d.register(t,r),s.altNames&&s.altNames.forEach((e=>{d.register(e,r)}))}m=!0,e("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),e("ropsten",3,{ensNetwork:3}),e("rinkeby",4,{ensNetwork:4}),e("goerli",5,{ensNetwork:5}),e("kovan",42,{ensNetwork:42}),e("sepolia",11155111,{ensNetwork:11155111}),e("holesky",17e3,{ensNetwork:17e3}),e("classic",61,{}),e("classicKotti",6,{}),e("arbitrum",42161,{ensNetwork:1}),e("arbitrum-goerli",421613,{}),e("arbitrum-sepolia",421614,{}),e("base",8453,{ensNetwork:1}),e("base-goerli",84531,{}),e("base-sepolia",84532,{}),e("bnb",56,{ensNetwork:1}),e("bnbt",97,{}),e("linea",59144,{ensNetwork:1}),e("linea-goerli",59140,{}),e("linea-sepolia",59141,{}),e("matic",137,{ensNetwork:1,plugins:[g("https://gasstation.polygon.technology/v2")]}),e("matic-amoy",80002,{}),e("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[g("https://gasstation-testnet.polygon.technology/v2")]}),e("optimism",10,{ensNetwork:1,plugins:[]}),e("optimism-goerli",420,{}),e("optimism-sepolia",11155420,{}),e("xdai",100,{ensNetwork:1})}(),null==e)return d.from("mainnet");if("number"==typeof e&&(e=BigInt(e)),"string"==typeof e||"bigint"==typeof e){const t=u.get(e);if(t)return t();if("bigint"==typeof e)return new d("unknown",e);(0,i.MR)(!1,"unknown network","network",e)}if("function"==typeof e.clone){return e.clone()}if("object"==typeof e){(0,i.MR)("string"==typeof e.name&&"number"==typeof e.chainId,"invalid network object name or chainId","network",e);const t=new d(e.name,e.chainId);return(e.ensAddress||null!=e.ensNetwork)&&t.attachPlugin(new l(e.ensAddress,e.ensNetwork)),t}(0,i.MR)(!1,"invalid network","network",e)}static register(e,t){"number"==typeof e&&(e=BigInt(e));const s=u.get(e);s&&(0,i.MR)(!1,`conflicting network for ${JSON.stringify(s.name)}`,"nameOrChainId",e),u.set(e,t)}}function p(e,t){const s=String(e);if(!s.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${e}`);const r=s.split(".");if(1===r.length&&r.push(""),2!==r.length)throw new Error(`invalid gwei value: ${e}`);for(;r[1].length9){let e=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||e++,r[1]=e.toString()}return BigInt(r[0]+r[1])}function g(e){return new h(e,(async(e,t,s)=>{let r;s.setHeader("User-Agent","ethers");try{const[t,n]=await Promise.all([s.send(),e()]);r=t;const i=r.bodyJson.standard;return{gasPrice:n.gasPrice,maxFeePerGas:p(i.maxFee,9),maxPriorityFeePerGas:p(i.maxPriorityFee,9)}}catch(e){(0,i.vA)(!1,`error encountered with polygon gas station (${JSON.stringify(s.url)})`,"SERVER_ERROR",{request:s,response:r,error:e})}}))}let m=!1},93878:(e,t,s)=>{s.d(t,{p:()=>y});var r=s(57339),n=s(88081),i=s(26976),o=s(86684),a=s(64170),c=s(8051);const l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}().WebSocket;var h=s(16131);class u{#e;#N;get filter(){return JSON.parse(this.#N)}#G;#B;#U;constructor(e,t){this.#e=e,this.#N=JSON.stringify(t),this.#G=null,this.#B=null,this.#U=null}start(){this.#G=this.#e.send("eth_subscribe",this.filter).then((e=>(this.#e._register(e,this),e)))}stop(){this.#G.then((e=>{this.#e.destroyed||this.#e.send("eth_unsubscribe",[e])})),this.#G=null}pause(e){(0,r.vA)(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),this.#B=!!e}resume(){this.#B=null}_handleMessage(e){if(null!=this.#G&&null===this.#B){let t=this.#U;t=null==t?this._emit(this.#e,e):t.then((async()=>{await this._emit(this.#e,e)})),this.#U=t.then((()=>{this.#U===t&&(this.#U=null)}))}}async _emit(e,t){throw new Error("sub-classes must implemente this; _emit")}}class d extends u{constructor(e){super(e,["newHeads"])}async _emit(e,t){e.emit("block",parseInt(t.number))}}class p extends u{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,t){e.emit("pending",t)}}class g extends u{#F;get logFilter(){return JSON.parse(this.#F)}constructor(e,t){super(e,["logs",t]),this.#F=JSON.stringify(t)}async _emit(e,t){e.emit(this.logFilter,e._wrapLog(t,e._network))}}class m extends c.R${#D;#C;#L;constructor(e,t){const s=Object.assign({},null!=t?t:{});(0,r.MR)(null==s.batchMaxCount||1===s.batchMaxCount,"sockets-based providers do not support batches","options.batchMaxCount",t),s.batchMaxCount=1,null==s.staticNetwork&&(s.staticNetwork=!0),super(e,s),this.#D=new Map,this.#C=new Map,this.#L=new Map}_getSubscriber(e){switch(e.type){case"close":return new h.J("close");case"block":return new d(this);case"pending":return new p(this);case"event":return new g(this,e.filter);case"orphan":if("drop-log"===e.filter.orphan)return new h.J("drop-log")}return super._getSubscriber(e)}_register(e,t){this.#C.set(e,t);const s=this.#L.get(e);if(s){for(const e of s)t._handleMessage(e);this.#L.delete(e)}}async _send(e){(0,r.MR)(!Array.isArray(e),"WebSocket does not support batch send","payload",e);const t=new Promise(((t,s)=>{this.#D.set(e.id,{payload:e,resolve:t,reject:s})}));return await this._waitUntilReady(),await this._write(JSON.stringify(e)),[await t]}async _processMessage(e){const t=JSON.parse(e);if(t&&"object"==typeof t&&"id"in t){const e=this.#D.get(t.id);if(null==e)return void this.emit("error",(0,r.xz)("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:t}));this.#D.delete(t.id),e.resolve(t)}else{if(!t||"eth_subscription"!==t.method)return void this.emit("error",(0,r.xz)("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:t}));{const e=t.params.subscription,s=this.#C.get(e);if(s)s._handleMessage(t.params.result);else{let s=this.#L.get(e);null==s&&(s=[],this.#L.set(e,s)),s.push(t.params.result)}}}}async _write(e){throw new Error("sub-classes must override this")}}class b extends m{#f;#H;get websocket(){if(null==this.#H)throw new Error("websocket closed");return this.#H}constructor(e,t,s){super(t,s),"string"==typeof e?(this.#f=()=>new l(e),this.#H=this.#f()):"function"==typeof e?(this.#f=e,this.#H=e()):(this.#f=null,this.#H=e),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(e){}},this.websocket.onmessage=e=>{this._processMessage(e.data)}}async _write(e){this.websocket.send(e)}async destroy(){null!=this.#H&&(this.#H.close(),this.#H=null),super.destroy()}}const f="84842078b09946638c03157f83405213";class w extends b{projectId;projectSecret;constructor(e,t){const s=new y(e,t),i=s._getConnection();(0,r.vA)(!i.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});super(i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),s._network),(0,n.n)(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===f}}class y extends c.FR{projectId;projectSecret;constructor(e,t,s){null==e&&(e="mainnet");const r=a.l.from(e);null==t&&(t=f),null==s&&(s=null);super(y.getRequest(r,t,s),r,{staticNetwork:r}),(0,n.n)(this,{projectId:t,projectSecret:s})}_getProvider(e){try{return new y(e,this.projectId,this.projectSecret)}catch(e){}return super._getProvider(e)}isCommunityResource(){return this.projectId===f}static getWebSocketProvider(e,t){return new w(e,t)}static getRequest(e,t,s){null==t&&(t=f),null==s&&(s=null);const n=new i.ui(`https://${function(e){switch(e){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}(0,r.MR)(!1,"unsupported network","network",e)}(e.name)}/v3/${t}`);return n.allowGzip=!0,s&&n.setCredentials("",s),t===f&&(n.retryFunc=async(e,t,s)=>((0,o.Z)("InfuraProvider"),!0)),n}}}}]);