1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[475],{18541:(t,e,r)=>{var n,i;r.d(e,{Vy:()=>d});let o=!1,s=!1,l={debug:1,default:2,info:2,warning:3,error:4,off:5},a=l.default,c=null,u=function(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw Error("bad normalize")}catch(r){t.push(e)}}),t.length)throw Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw Error("broken implementation")}catch(t){return t.message}return null}();!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(n||(n={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(i||(i={}));let h="0123456789abcdef";class d{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){let r=t.toLowerCase();null==l[r]&&this.throwArgumentError("invalid log level name","logLevel",t),a>l[r]||console.log.apply(console,e)}debug(...t){this._log(d.levels.DEBUG,t)}info(...t){this._log(d.levels.INFO,t)}warn(...t){this._log(d.levels.WARNING,t)}makeError(t,e,r){if(s)return this.makeError("censored error",e,{});e||(e=d.errors.UNKNOWN_ERROR),r||(r={});let n=[];Object.keys(r).forEach(t=>{let e=r[t];try{if(e instanceof Uint8Array){let r="";for(let t=0;t<e.length;t++)r+=h[e[t]>>4],r+=h[15&e[t]];n.push(t+"=Uint8Array(0x"+r+")")}else n.push(t+"="+JSON.stringify(e))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}}),n.push(`code=${e}`),n.push(`version=${this.version}`);let o=t,l="";switch(e){case i.NUMERIC_FAULT:{l="NUMERIC_FAULT";let e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":l+="-"+e;break;case"negative-power":case"negative-width":l+="-unsupported";break;case"unbound-bitwise-result":l+="-unbound-result"}break}case i.CALL_EXCEPTION:case i.INSUFFICIENT_FUNDS:case i.MISSING_NEW:case i.NONCE_EXPIRED:case i.REPLACEMENT_UNDERPRICED:case i.TRANSACTION_REPLACED:case i.UNPREDICTABLE_GAS_LIMIT:l=e}l&&(t+=" [ See: https://links.ethers.org/v5-errors-"+l+" ]"),n.length&&(t+=" ("+n.join(", ")+")");let a=Error(t);return a.reason=o,a.code=e,Object.keys(r).forEach(function(t){a[t]=r[t]}),a}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,d.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),u&&this.throwError("platform missing String.prototype.normalize",d.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:u})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=0x1fffffffffffff)&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,d.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,d.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||null==t)&&this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",d.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||null==t)&&this.throwError("missing new",d.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return c||(c=new d("logger/5.6.0")),c}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o){if(!t)return;this.globalLogger().throwError("error censorship permanent",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}s=!!t,o=!!e}static setLogLevel(t){let e=l[t.toLowerCase()];if(null==e)return void d.globalLogger().warn("invalid log level - "+t);a=e}static from(t){return new d(t)}}d.errors=i,d.levels=n},41703:(t,e,r)=>{r.d(e,{j:()=>tV});var n=r(86675),i=r(18541);let o="providers/5.6.4";var s=r(38253),l=r(22619),a=r(8548),c=r(21333),u=r(74492);let h="hash/5.6.0";var d=r(67922);function f(t){return(0,u.S)((0,d.YW)(t))}let m=new i.Vy(h),g=new Uint8Array(32);g.fill(0);let p=l.gH.from(-1),y=l.gH.from(0),v=l.gH.from(1),E=l.gH.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),b=(0,a.bj)(v.toHexString(),32),_=(0,a.bj)(y.toHexString(),32),k={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},w=["name","version","chainId","verifyingContract","salt"];function N(t){return function(e){return"string"!=typeof e&&m.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}let R={name:N("name"),version:N("version"),chainId:function(t){try{return l.gH.from(t).toString()}catch(t){}return m.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return(0,c.bv)(t).toLowerCase()}catch(t){}return m.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{let e=(0,a.k9)(t);if(32!==e.length)throw Error("bad length");return(0,a.c$)(e)}catch(t){}return m.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function I(t){{let e=t.match(/^(u?)int(\d*)$/);if(e){let r=""===e[1],n=parseInt(e[2]||"256");(n%8!=0||n>256||e[2]&&e[2]!==String(n))&&m.throwArgumentError("invalid numeric width","type",t);let i=E.mask(r?n-1:n),o=r?i.add(v).mul(p):y;return function(e){let r=l.gH.from(e);return(r.lt(o)||r.gt(i))&&m.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),(0,a.bj)(r.toTwos(256).toHexString(),32)}}}{let e=t.match(/^bytes(\d+)$/);if(e){let r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&m.throwArgumentError("invalid bytes width","type",t),function(e){(0,a.k9)(e).length!==r&&m.throwArgumentError(`invalid length for ${t}`,"value",e);let n=(0,a.k9)(e),i=n.length%32;return i?(0,a.qn)([n,g.slice(i)]):(0,a.c$)(n)}}}switch(t){case"address":return function(t){return(0,a.bj)((0,c.bv)(t),32)};case"bool":return function(t){return t?b:_};case"bytes":return function(t){return(0,u.S)(t)};case"string":return function(t){return f(t)}}return null}function T(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class A{constructor(t){(0,n.yY)(this,"types",Object.freeze((0,n.A4)(t))),(0,n.yY)(this,"_encoderCache",{}),(0,n.yY)(this,"_types",{});let e={},r={},i={};for(let n in Object.keys(t).forEach(t=>{e[t]={},r[t]=[],i[t]={}}),t){let i={};
1t[n].forEach(o=>{i[o.name]&&m.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",t),i[o.name]=!0;let s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&m.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t),I(s)||(r[s]||m.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),r[s].push(n),e[n][s]=!0)})}let o=Object.keys(r).filter(t=>0===r[t].length);for(let s in 0===o.length?m.throwArgumentError("missing primary type","types",t):o.length>1&&m.throwArgumentError(`ambiguous primary types or unused types: ${o.map(t=>JSON.stringify(t)).join(", ")}`,"types",t),(0,n.yY)(this,"primaryType",o[0]),!function n(o,s){s[o]&&m.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{r[t]&&(n(t,s),Object.keys(s).forEach(e=>{i[e][t]=!0}))}),delete s[o]}(this.primaryType,{}),i){let e=Object.keys(i[s]);e.sort(),this._types[s]=T(s,t[s])+e.map(e=>T(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{let e=I(t);if(e)return e}let e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){let t=e[1],r=this.getEncoder(t),n=parseInt(e[3]);return e=>{n>=0&&e.length!==n&&m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(r);return this._types[t]&&(i=i.map(u.S)),(0,u.S)((0,a.qn)(i))}}let r=this.types[t];if(r){let e=f(this._types[t]);return t=>{let n=r.map(({name:e,type:r})=>{let n=this.getEncoder(r)(t[e]);return this._types[r]?(0,u.S)(n):n});return n.unshift(e),(0,a.qn)(n)}}return m.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){let e=this._types[t];return e||m.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return(0,u.S)(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(I(t))return r(t,e);let n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){let t=n[1],i=parseInt(n[3]);return i>=0&&e.length!==i&&m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,r))}let i=this.types[t];return i?i.reduce((t,{name:n,type:i})=>(t[n]=this._visit(i,e[n],r),t),{}):m.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new A(t)}static getPrimaryType(t){return A.from(t).primaryType}static hashStruct(t,e,r){return A.from(e).hashStruct(t,r)}static hashDomain(t){let e=[];for(let r in t){let n=k[r];n||m.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:n})}return e.sort((t,e)=>w.indexOf(t.name)-w.indexOf(e.name)),A.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return(0,a.qn)(["0x1901",A.hashDomain(t),A.from(e).hash(r)])}static hash(t,e,r){return(0,u.S)(A.encode(t,e,r))}static resolveNames(t,e,r,i){var o,s,l,c;return o=this,s=void 0,l=void 0,c=function*(){t=(0,n.Ic)(t);let o={};t.verifyingContract&&!(0,a.Lo)(t.verifyingContract,20)&&(o[t.verifyingContract]="0x");let s=A.from(e);for(let t in s.visit(r,(t,e)=>("address"!==t||(0,a.Lo)(e,20)||(o[e]="0x"),e)),o)o[t]=yield i(t);return t.verifyingContract&&o[t.verifyingContract]&&(t.verifyingContract=o[t.verifyingContract]),r=s.visit(r,(t,e)=>"address"===t&&o[e]?o[e]:e),{domain:t,value:r}},new(l||(l=Promise))(function(t,e){function r(t){try{i(c.next(t))}catch(t){e(t)}}function n(t){try{i(c.throw(t))}catch(t){e(t)}}function i(e){var i;e.done?t(e.value):((i=e.value)instanceof l?i:new l(function(t){t(i)})).then(r,n)}i((c=c.apply(o,s||[])).next())})}static getPayload(t,e,r){A.hashDomain(t);let i={},o=[];w.forEach(e=>{let r=t[e];null!=r&&(i[e]=R[e](r),o.push({name:e,type:k[e]}))});let s=A.from(e),c=(0,n.Ic)(e);return c.EIP712Domain?m.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):c.EIP712Domain=o,s.encode(r),{types:c,domain:i,primaryType:s.primaryType,message:s.visit(r,(t,e)=>{if(t.match(/^bytes(\d*)/))return(0,a.c$)((0,a.k9)(e));if(t.match(/^u?int/))return l.gH.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&m.throwArgumentError("invalid string","value",e),e}return m.throwArgumentError("unsupported type","type",t)})}}}var P=r(1433),O=r(20915),x=r(28325),C=r(29476),L=r(84704),S=r(45396);let B=new i.Vy(h),U=new Uint8Array(32);U.fill(0);let F=RegExp("^((.*)\\.)?([^.]+)$");function V(t){"string"!=typeof t&&B.throwArgumentError("invalid ENS name; not a string","name",t);let e=t,r=U;for(;e.length;){let n=e.match(F);(null==n||""===n[2])&&B.throwArgumentError("invalid ENS address; missing component","name",t);let i=(0,d.YW)((0,S.j9)(n[3]));r=(0,u.S)((0,a.xW)([r,(0,u.S)(i)])),e=n[2]||""}return(0,a.c$)(r)}let D=new i.Vy("networks/5.6.2");function H(t){let e=function(e,r){null==r&&(r={});let n=[];if(e.InfuraProvider&&"-"!==r.infura)try{n.push(new e.InfuraProvider(t,r.infura))}catch(t){}if(e.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new e.EtherscanProvider(t,r.etherscan))}catch(t){}
1if(e.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new e.AlchemyProvider(t,r.alchemy))}catch(t){}if(e.PocketProvider&&"-"!==r.pocket)try{let i=new e.PocketProvider(t,r.pocket);i.network&&-1===["goerli","ropsten","rinkeby"].indexOf(i.network.name)&&n.push(i)}catch(t){}if(e.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new e.CloudflareProvider(t))}catch(t){}if(e.AnkrProvider&&"-"!==r.ankr)try{n.push(new e.AnkrProvider(t,r.ankr))}catch(t){}if(0===n.length)return null;if(e.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===t&&(i=2),new e.FallbackProvider(n,i)}return n[0]};return e.renetwork=function(t){return H(t)},e}function $(t,e){let r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(t,e):null};return r.renetwork=function(e){return $(t,e)},r}let j={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:H("homestead")},G={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:H("ropsten")},M={chainId:63,name:"classicMordor",_defaultProvider:$("https://www.ethercluster.com/mordor","classicMordor")},W={unspecified:{chainId:0,name:"unspecified"},homestead:j,mainnet:j,morden:{chainId:2,name:"morden"},ropsten:G,testnet:G,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:H("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:H("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:H("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},classic:{chainId:61,name:"classic",_defaultProvider:$("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:M,classicTestnet:M,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:$("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic"},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism"},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};var q=r(83155),Y=r.n(q);function J(t){return"0x"+Y().sha256().update((0,a.k9)(t)).digest("hex")}new i.Vy("sha2/5.6.0");var X=r(91872),K=r.n(X),z=r(74716);let Z=new i.Vy(o);class Q{constructor(){Z.checkNew(new.target,Q),this.formats=this.getDefaultFormats()}getDefaultFormats(){let t={},e=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),o=this.data.bind(this),s=this.hash.bind(this),l=this.hex.bind(this),a=this.number.bind(this),c=this.type.bind(this),u=t=>this.data(t,!0);return t.transaction={hash:s,type:c,accessList:Q.allowNull(this.accessList.bind(this),null),blockHash:Q.allowNull(s,null),blockNumber:Q.allowNull(a,null),transactionIndex:Q.allowNull(a,null),confirmations:Q.allowNull(a,null),from:e,gasPrice:Q.allowNull(r),maxPriorityFeePerGas:Q.allowNull(r),maxFeePerGas:Q.allowNull(r),gasLimit:r,to:Q.allowNull(e,null),value:r,nonce:a,data:o,r:Q.allowNull(this.uint256),s:Q.allowNull(this.uint256),v:Q.allowNull(a),creates:Q.allowNull(e,null),raw:Q.allowNull(o)},t.transactionRequest={from:Q.allowNull(e),nonce:Q.allowNull(a),gasLimit:Q.allowNull(r),gasPrice:Q.allowNull(r),maxPriorityFeePerGas:Q.allowNull(r),maxFeePerGas:Q.allowNull(r),to:Q.allowNull(e),value:Q.allowNull(r),data:Q.allowNull(u),type:Q.allowNull(a),accessList:Q.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:e,topics:Q.arrayOf(s),data:o,logIndex:a,blockHash:s},t.receipt={to:Q.allowNull(this.address,null),from:Q.allowNull(this.address,null),contractAddress:Q.allowNull(e,null),transactionIndex:a,root:Q.allowNull(l),gasUsed:r,logsBloom:Q.allowNull(o),blockHash:s,transactionHash:s,logs:Q.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Q.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Q.allowNull(r),status:Q.allowNull(a),type:c},t.block={hash:Q.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:Q.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Q.allowNull(e),extraData:o,transactions:Q.allowNull(Q.arrayOf(s)),baseFeePerGas:Q.allowNull(r)},t.blockWithTransactions=(0,n.Ic)(t.block),t.blockWithTransactions.transactions=Q.allowNull(Q.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Q.allowNull(i,void 0),toBlock:Q.allowNull(i,void 0),blockHash:Q.allowNull(s,void 0),address:Q.allowNull(e,void 0),topics:Q.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Q.allowNull(a),blockHash:Q.allowNull(s),transactionIndex:a,removed:Q.allowNull(this.boolean.bind(this)),address:e,data:Q.allowFalsish(o,"0x"),topics:Q.arrayOf(s),transactionHash:s,logIndex:a},t}accessList(t){return(0,P.$2)(t||[])}number(t){return"0x"===t?0:l.gH.from(t).toNumber()}type(t){return"0x"===t||null==t?0:l.gH.from(t).toNumber()}bigNumber(t){return l.gH.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;
1if("false"===t)return!1}throw Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),(0,a.Lo)(t))?t.toLowerCase():Z.throwArgumentError("invalid hash","value",t)}data(t,e){let r=this.hex(t,e);if(r.length%2!=0)throw Error("invalid data; odd-length - "+t);return r}address(t){return(0,c.bv)(t)}callAddress(t){if(!(0,a.Lo)(t,32))return null;let e=(0,c.bv)((0,a.Ab)(t,12));return e===z.L?null:e}contractAddress(t){return(0,c.RZ)(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";if("latest"===t||"pending"===t)return t;if("number"==typeof t||(0,a.Lo)(t))return(0,a.Fh)(t);throw Error("invalid blockTag")}hash(t,e){let r=this.hex(t,e);return 32!==(0,a.cm)(r)?Z.throwArgumentError("invalid hash","value",t):r}difficulty(t){if(null==t)return null;let e=l.gH.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!(0,a.Lo)(t))throw Error("invalid uint256");return(0,a.bj)(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);let r=null!=t._difficulty?t._difficulty:t.difficulty,n=Q.check(e,t);return n._difficulty=null==r?null:l.gH.from(r),n}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Q.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&l.gH.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),(1===t.type||2===t.type)&&null==t.accessList&&(t.accessList=[]);let e=Q.check(this.formats.transaction,t);if(null!=t.chainId){let r=t.chainId;(0,a.Lo)(r)&&(r=l.gH.from(r).toNumber()),e.chainId=r}else{let r=t.networkId;null==r&&null==e.v&&(r=t.chainId),(0,a.Lo)(r)&&(r=l.gH.from(r).toNumber()),"number"!=typeof r&&null!=e.v&&((r=(e.v-35)/2)<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),e.chainId=r}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return(0,P.qg)(t)}receiptLog(t){return Q.check(this.formats.receiptLog,t)}receipt(t){let e=Q.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){let t=l.gH.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&Z.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):Z.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&Z.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map(t=>this.topics(t)):null!=t?this.hash(t,!0):null}filter(t){return Q.check(this.formats.filter,t)}filterLog(t){return Q.check(this.formats.filterLog,t)}static check(t,e){let r={};for(let n in t)try{let i=t[n](e[n]);void 0!==i&&(r[n]=i)}catch(t){throw t.checkKey=n,t.checkValue=e[n],t}return r}static allowNull(t,e){return function(r){return null==r?e:t(r)}}static allowFalsish(t,e){return function(r){return r?t(r):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw Error("not an array");let r=[];return e.forEach(function(e){r.push(t(e))}),r}}}var tt=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function l(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(s,l)}a((n=n.apply(t,e||[])).next())})};let te=new i.Vy(o);function tr(t){return null==t?"null":(32!==(0,a.cm)(t)&&te.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function tn(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map(t=>{if(!Array.isArray(t))return tr(t);{let e={};t.forEach(t=>{e[tr(t)]=!0});let r=Object.keys(e);return r.sort(),r.join("|")}}).join("&")}function ti(t){if("string"==typeof t){if(t=t.toLowerCase(),32===(0,a.cm)(t))return"tx:"+t;if(-1===t.indexOf(":"))return t}else if(Array.isArray(t))return"filter:*:"+tn(t);else if(x.Rj.isForkEvent(t))throw te.warn("not implemented"),Error("not implemented");else if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+tn(t.to
1pics||[]);throw Error("invalid event - "+t)}function to(){return new Date().getTime()}function ts(t){return new Promise(e=>{setTimeout(e,t)})}let tl=["block","network","pending","poll"];class ta{constructor(t,e,r){(0,n.yY)(this,"tag",t),(0,n.yY)(this,"listener",e),(0,n.yY)(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){let t=this.tag.split(":");return"tx"!==t[0]?null:t[1]}get filter(){var t;let e=this.tag.split(":");if("filter"!==e[0])return null;let r=e[1],n=""===(t=e[2])?[]:t.split(/&/g).map(t=>{if(""===t)return[];let e=t.split("|").map(t=>"null"===t?null:t);return 1===e.length?e[0]:e}),i={};return n.length>0&&(i.topics=n),r&&"*"!==r&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||tl.indexOf(this.tag)>=0}}let tc={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function tu(t){return(0,a.bj)(l.gH.from(t).toHexString(),32)}function th(t){return C.zn.encode((0,a.xW)([t,(0,a.Ab)(J(J(t)),0,4)]))}let td=RegExp("^(ipfs)://(.*)$","i"),tf=[RegExp("^(https)://(.*)$","i"),RegExp("^(data):(.*)$","i"),td,RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function tm(t,e){try{return(0,d._v)(tg(t,e))}catch(t){}return null}function tg(t,e){if("0x"===t)return null;let r=l.gH.from((0,a.Ab)(t,e,e+32)).toNumber(),n=l.gH.from((0,a.Ab)(t,r,r+32)).toNumber();return(0,a.Ab)(t,r+32,r+32+n)}function tp(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):te.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function ty(t){let e=(0,a.k9)(t);if(e.length>32)throw Error("internal; should not happen");let r=new Uint8Array(32);return r.set(e,32-e.length),r}function tv(t){let e=[],r=0;for(let n=0;n<t.length;n++)e.push(null),r+=32;for(let n=0;n<t.length;n++){let i=(0,a.k9)(t[n]);e[n]=ty(r),e.push(ty(i.length)),e.push(function(t){if(t.length%32==0)return t;let e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}(i)),r+=32+32*Math.ceil(i.length/32)}return(0,a.qn)(e)}class tE{constructor(t,e,r,i){(0,n.yY)(this,"provider",t),(0,n.yY)(this,"name",r),(0,n.yY)(this,"address",t.formatter.address(e)),(0,n.yY)(this,"_resolvedAddress",i)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(t=>l.gH.from(t).eq(1)).catch(t=>{if(t.code===i.Vy.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t})),this._supportsEip2544}_fetch(t,e){return tt(this,void 0,void 0,function*(){let r={to:this.address,ccipReadEnabled:!0,data:(0,a.qn)([t,V(this.name),e||"0x"])},n=!1;if(yield this.supportsWildcard()){var o;n=!0,r.data=(0,a.qn)(["0x9061b923",tv([(o=this.name,(0,a.c$)((0,a.xW)(o.split(".").map(t=>{let e=(0,d.YW)("_"+(0,S.j9)(t));return e[0]=e.length-1,e})))+"00"),r.data])])}try{let t=yield this.provider.call(r);return(0,a.k9)(t).length%32==4&&te.throwError("resolver threw error",i.Vy.errors.CALL_EXCEPTION,{transaction:r,data:t}),n&&(t=tg(t,0)),t}catch(t){if(t.code===i.Vy.errors.CALL_EXCEPTION)return null;throw t}})}_fetchBytes(t,e){return tt(this,void 0,void 0,function*(){let r=yield this._fetch(t,e);return null!=r?tg(r,0):null})}_getAddress(t,e){let r=tc[String(t)];if(null==r&&te.throwError(`unsupported coin type: ${t}`,i.Vy.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===r.ilk)return this.provider.formatter.address(e);let n=(0,a.k9)(e);if(null!=r.p2pkh){let t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){let e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return th((0,a.xW)([[r.p2pkh],"0x"+t[2]]))}}if(null!=r.p2sh){let t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){let e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return th((0,a.xW)([[r.p2sh],"0x"+t[2]]))}}if(null!=r.prefix){let t=n[1],e=n[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&n.length===2+t&&t>=1&&t<=75){let t=K().toWords(n.slice(2));return t.unshift(e),K().encode(r.prefix,t)}}return null}getAddress(t){return tt(this,void 0,void 0,function*(){if(null==t&&(t=60),60===t)try{let t=yield this._fetch("0x3b3b57de");if("0x"===t||t===L.j)return null;return this.provider.formatter.callAddress(t)}catch(t){if(t.code===i.Vy.errors.CALL_EXCEPTION)return null;throw t}let e=yield this._fetchBytes("0xf1cb7e06",tu(t));if(null==e||"0x"===e)return null;let r=this._getAddress(t,e);return null==r&&te.throwError("invalid or unsupported coin data",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),r})}getAvatar(){return tt(this,void 0,void 0,function*(){let t=[{type:"name",content:this.name}];try{let e=yield this.getText("avatar");if(null==e)return null;for(let r=0;r<tf.length;r++){let n=e.match(tf[r]);if(null==n)continue;let i=n[1].toLowerCase();switch(i){case"https":return t.push({type:"url",content:e}),{linkage:t,url:e};case"data":return t.push({type:"data",content:e}),{linkage:t,url:e};case"ipfs":return t.push({type:"ipfs",content:e}),{linkage:t,url:tp(e)};case"erc721":case"erc1155":{let r="erc721"===i?"0xc87b56dd":"0x0e89341c";t.push({type:i,content:e});let o=this._resolvedAddress||(yield this.getAddress()),s=(n[2]||"").split("/");if(2!==s.length)return null;
1let c=yield this.provider.formatter.address(s[0]),u=(0,a.bj)(l.gH.from(s[1]).toHexString(),32);if("erc721"===i){let e=this.provider.formatter.callAddress((yield this.provider.call({to:c,data:(0,a.qn)(["0x6352211e",u])})));if(o!==e)return null;t.push({type:"owner",content:e})}else if("erc1155"===i){let e=l.gH.from((yield this.provider.call({to:c,data:(0,a.qn)(["0x00fdd58e",(0,a.bj)(o,32),u])})));if(e.isZero())return null;t.push({type:"balance",content:e.toString()})}let h={to:this.provider.formatter.address(s[0]),data:(0,a.qn)([r,u])},d=tm((yield this.provider.call(h)),0);if(null==d)return null;t.push({type:"metadata-url-base",content:d}),"erc1155"===i&&(d=d.replace("{id}",u.substring(2)),t.push({type:"metadata-url-expanded",content:d})),d.match(/^ipfs:/i)&&(d=tp(d)),t.push({type:"metadata-url",content:d});let f=yield(0,O.x6)(d);if(!f)return null;t.push({type:"metadata",content:JSON.stringify(f)});let m=f.image;if("string"!=typeof m)return null;if(m.match(/^(https:\/\/|data:)/i));else{let e=m.match(td);if(null==e)return null;t.push({type:"url-ipfs",content:m}),m=tp(m)}return t.push({type:"url",content:m}),{linkage:t,url:m}}}}}catch(t){}return null})}getContentHash(){return tt(this,void 0,void 0,function*(){let t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;let e=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){let t=parseInt(e[3],16);if(e[4].length===2*t)return"ipfs://"+C.zn.encode("0x"+e[1])}let r=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){let t=parseInt(r[3],16);if(r[4].length===2*t)return"ipns://"+C.zn.encode("0x"+r[1])}let n=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);return n&&64===n[1].length?"bzz://"+n[1]:te.throwError("invalid or unsupported content hash data",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})})}getText(t){return tt(this,void 0,void 0,function*(){let e=(0,d.YW)(t);(e=(0,a.xW)([tu(64),tu(e.length),e])).length%32!=0&&(e=(0,a.xW)([e,(0,a.bj)("0x",32-t.length%32)]));let r=yield this._fetchBytes("0x59d1d43c",(0,a.c$)(e));return null==r||"0x"===r?null:(0,d._v)(r)})}}let tb=null,t_=1;class tk extends x.Kq{constructor(t){if(te.checkNew(new.target,x.Kq),super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),(0,n.yY)(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch(t=>{}),this._ready().catch(t=>{});else{let e=(0,n.$J)(new.target,"getNetwork")(t);e?((0,n.yY)(this,"_network",e),this.emit("network",e,null)):te.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return tt(this,void 0,void 0,function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||te.throwError("no network detected",i.Vy.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:(0,n.yY)(this,"_network",t),this.emit("network",t,null))}return this._network})}get ready(){return(0,O.wt)(()=>this._ready().then(t=>t,t=>{if(t.code!==i.Vy.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))}static getFormatter(){return null==tb&&(tb=new Q),tb}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(let e in W){let r=W[e];if(r.chainId===t)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){let e=W[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}let e=W[t.name];if(!e)return"number"!=typeof t.chainId&&D.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&D.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;if(null==r&&e._defaultProvider){var n;r=(n=e._defaultProvider)&&"function"==typeof n.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider}return{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}(null==t?"homestead":t)}ccipReadFetch(t,e,r){return tt(this,void 0,void 0,function*(){if(this.disableCcipRead||0===r.length)return null;let n=t.to.toLowerCase(),o=e.toLowerCase(),s=[];for(let t=0;t<r.length;t++){let e=r[t],l=e.replace("{sender}",n).replace("{data}",o),a=e.indexOf("{data}")>=0?null:JSON.stringify({data:o,sender:n}),c=yield(0,O.x6)({url:l,errorPassThrough:!0},a,(t,e)=>(t.status=e.statusCode,t));if(c.data)return c.data;let u=c.message||"unknown error";if(c.status>=400&&c.status<500)return te.throwError(`response not found during CCIP fetch: ${u}`,i.Vy.errors.SERVER_ERROR,{url:e,errorMessage:u});s.push(u)}return te.throwError(`error encountered during CCIP fetch: ${s.map(t=>JSON.stringify(t)).join(", ")}`,i.Vy.errors.SERVER_ERROR,{urls:r,errorMessages:s})})}_getInternalBlockNumber(t){return tt(this,void 0,void 0,function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){let e=this._internalBlockNumber;try{let r=yield e;if(to()-r.respTime<=t)return r.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}let e=to(),r=(0,n.k_)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(t=>null,t=>t)}).then(({blockNumber:t,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;let i=to();return(t=l.gH.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:e,respTime:i}});return this._internalBlockNumber=r,r.catch(t=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return tt(this,void 0,void 0,function*(){let t=t_++,e=[],r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}
1catch(t){this.emit("error",t);return}if(this._setFastBlockNumber(r),this.emit("poll",t,r),r===this._lastBlockNumber)return void this.emit("didPoll",t);if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)te.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",te.makeError("network block skew detected",i.Vy.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let t=this._emitted.block+1;t<=r;t++)this.emit("block",t);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(t=>{if("block"===t)return;let e=this._emitted[t];"pending"!==e&&r-e>12&&delete this._emitted[t]})),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach(t=>{switch(t.type){case"tx":{let r=t.hash,n=this.getTransactionReceipt(r).then(t=>(t&&null!=t.blockNumber&&(this._emitted["t:"+r]=t.blockNumber,this.emit(r,t)),null)).catch(t=>{this.emit("error",t)});e.push(n);break}case"filter":if(!t._inflight){t._inflight=!0;let n=t.filter;n.fromBlock=t._lastBlockNumber+1,n.toBlock=r,n.toBlock-this._maxFilterBlockRange>n.fromBlock&&(n.fromBlock=n.toBlock-this._maxFilterBlockRange);let i=this.getLogs(n).then(e=>{t._inflight=!1,0!==e.length&&e.forEach(e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(n,e)})}).catch(e=>{this.emit("error",e),t._inflight=!1});e.push(i)}}}),this._lastBlockNumber=r,Promise.all(e).then(()=>{this.emit("didPoll",t)}).catch(t=>{this.emit("error",t)})})}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return tt(this,void 0,void 0,function*(){return te.throwError("provider does not support network detection",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return tt(this,void 0,void 0,function*(){let t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",e,t),yield ts(0),this._network;let r=te.makeError("underlying network changed",i.Vy.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",r),r}return t})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(t=>{this._setFastBlockNumber(t)},t=>{}),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(t){t&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if("number"!=typeof t||t<=0||parseInt(String(t))!=t)throw Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){let t=to();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(t){(null==this._fastBlockNumber||!(t<this._fastBlockNumber))&&(this._fastQueryDate=to(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,r){return tt(this,void 0,void 0,function*(){return this._waitForTransaction(t,null==e?1:e,r||0,null)})}_waitForTransaction(t,e,r,n){return tt(this,void 0,void 0,function*(){let o=yield this.getTransactionReceipt(t);return(o?o.confirmations:0)>=e?o:new Promise((o,s)=>{let l=[],a=!1,c=function(){return!!a||(a=!0,l.forEach(t=>{t()}),!1)},u=t=>{!(t.confirmations<e)&&(c()||o(t))};if(this.on(t,u),l.push(()=>{this.removeListener(t,u)}),n){let r=n.startBlock,o=null,u=l=>tt(this,void 0,void 0,function*(){a||(yield ts(1e3),this.getTransactionCount(n.from).then(
1h=>tt(this,void 0,void 0,function*(){if(!a){if(h<=n.nonce)r=l;else{{let e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==o&&(o=r-3)<n.startBlock&&(o=n.startBlock);o<=l;){if(a)return;let r=yield this.getBlockWithTransactions(o);for(let o=0;o<r.transactions.length;o++){let l=r.transactions[o];if(l.hash===t)return;if(l.from===n.from&&l.nonce===n.nonce){if(a)return;let r=yield this.waitForTransaction(l.hash,e);if(c())return;let o="replaced";l.data===n.data&&l.to===n.to&&l.value.eq(n.value)?o="repriced":"0x"===l.data&&l.from===l.to&&l.value.isZero()&&(o="cancelled"),s(te.makeError("transaction was replaced",i.Vy.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===o||"cancelled"===o,reason:o,replacement:this._wrapTransaction(l),hash:t,receipt:r}));return}}o++}}a||this.once("block",u)}}),t=>{a||this.once("block",u)}))});if(a)return;this.once("block",u),l.push(()=>{this.removeListener("block",u)})}if("number"==typeof r&&r>0){let t=setTimeout(()=>{c()||s(te.makeError("timeout exceeded",i.Vy.errors.TIMEOUT,{timeout:r}))},r);t.unref&&t.unref(),l.push(()=>{clearTimeout(t)})}})})}getBlockNumber(){return tt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let t=yield this.perform("getGasPrice",{});try{return l.gH.from(t)}catch(e){return te.throwError("bad result from backend",i.Vy.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}})}getBalance(t,e){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield(0,n.k_)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),o=yield this.perform("getBalance",r);try{return l.gH.from(o)}catch(t){return te.throwError("bad result from backend",i.Vy.errors.SERVER_ERROR,{method:"getBalance",params:r,result:o,error:t})}})}getTransactionCount(t,e){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield(0,n.k_)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),o=yield this.perform("getTransactionCount",r);try{return l.gH.from(o).toNumber()}catch(t){return te.throwError("bad result from backend",i.Vy.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:o,error:t})}})}getCode(t,e){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield(0,n.k_)({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),o=yield this.perform("getCode",r);try{return(0,a.c$)(o)}catch(t){return te.throwError("bad result from backend",i.Vy.errors.SERVER_ERROR,{method:"getCode",params:r,result:o,error:t})}})}getStorageAt(t,e,r){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let o=yield(0,n.k_)({address:this._getAddress(t),blockTag:this._getBlockTag(r),position:Promise.resolve(e).then(t=>(0,a.Fh)(t))}),s=yield this.perform("getStorageAt",o);try{return(0,a.c$)(s)}catch(t){return te.throwError("bad result from backend",i.Vy.errors.SERVER_ERROR,{method:"getStorageAt",params:o,result:s,error:t})}})}_wrapTransaction(t,e,r){if(null!=e&&32!==(0,a.cm)(e))throw Error("invalid response - sendTransaction");return null!=e&&t.hash!==e&&te.throwError("Transaction hash mismatch from Provider.sendTransaction.",i.Vy.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),t.wait=(e,n)=>tt(this,void 0,void 0,function*(){let o;null==e&&(e=1),null==n&&(n=0),0!==e&&null!=r&&(o={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:r});let s=yield this._waitForTransaction(t.hash,e,n,o);return null==s&&0===e?null:(this._emitted["t:"+t.hash]=s.blockNumber,0===s.status&&te.throwError("transaction failed",i.Vy.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:s}),s)}),t}sendTransaction(t){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let e=yield Promise.resolve(t).then(t=>(0,a.c$)(t)),r=this.formatter.transaction(t);null==r.confirmations&&(r.confirmations=0);let n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{let t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(r,t,n)}catch(t){throw t.transaction=r,t.transactionHash=r.hash,t}})}_getTransactionRequest(t){return tt(this,void 0,void 0,function*(){let e=yield t,r={};return["from","to"].forEach(t=>
1{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?this._getAddress(t):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?l.gH.from(t):null))}),["type"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>null!=t?t:null))}),e.accessList&&(r.accessList=this.formatter.accessList(e.accessList)),["data"].forEach(t=>{null!=e[t]&&(r[t]=Promise.resolve(e[t]).then(t=>t?(0,a.c$)(t):null))}),this.formatter.transactionRequest((yield(0,n.k_)(r)))})}_getFilter(t){return tt(this,void 0,void 0,function*(){t=yield t;let e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach(r=>{null!=t[r]&&(e[r]=t[r])}),["fromBlock","toBlock"].forEach(r=>{null!=t[r]&&(e[r]=this._getBlockTag(t[r]))}),this.formatter.filter((yield(0,n.k_)(e)))})}_call(t,e,r){return tt(this,void 0,void 0,function*(){r>=10&&te.throwError("CCIP read exceeded maximum redirections",i.Vy.errors.SERVER_ERROR,{redirects:r,transaction:t});let n=t.to,o=yield this.perform("call",{transaction:t,blockTag:e});if(r>=0&&"latest"===e&&null!=n&&"0x556f1830"===o.substring(0,10)&&(0,a.cm)(o)%32==4)try{let s=(0,a.Ab)(o,4),c=(0,a.Ab)(s,0,32);l.gH.from(c).eq(n)||te.throwError("CCIP Read sender did not match",i.Vy.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:o});let u=[],h=l.gH.from((0,a.Ab)(s,32,64)).toNumber(),d=l.gH.from((0,a.Ab)(s,h,h+32)).toNumber(),f=(0,a.Ab)(s,h+32);for(let e=0;e<d;e++){let r=tm(f,32*e);null==r&&te.throwError("CCIP Read contained corrupt URL string",i.Vy.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:o}),u.push(r)}let m=tg(s,64);l.gH.from((0,a.Ab)(s,100,128)).isZero()||te.throwError("CCIP Read callback selector included junk",i.Vy.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:o});let g=(0,a.Ab)(s,96,100),p=tg(s,128),y=yield this.ccipReadFetch(t,m,u);null==y&&te.throwError("CCIP Read disabled or provided no URLs",i.Vy.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:o});let v={to:n,data:(0,a.qn)([g,tv([y,p])])};return this._call(v,e,r+1)}catch(t){if(t.code===i.Vy.errors.SERVER_ERROR)throw t}try{return(0,a.c$)(o)}catch(r){return te.throwError("bad result from backend",i.Vy.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:e},result:o,error:r})}})}call(t,e){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield(0,n.k_)({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)})}estimateGas(t){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let e=yield(0,n.k_)({transaction:this._getTransactionRequest(t)}),r=yield this.perform("estimateGas",e);try{return l.gH.from(r)}catch(t){return te.throwError("bad result from backend",i.Vy.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:r,error:t})}})}_getAddress(t){return tt(this,void 0,void 0,function*(){"string"!=typeof(t=yield t)&&te.throwArgumentError("invalid address or ENS name","name",t);let e=yield this.resolveName(t);return null==e&&te.throwError("ENS name not configured",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e})}_getBlock(t,e){return tt(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;let r=-128,n={includeTransactions:!!e};if((0,a.Lo)(t,32))n.blockHash=t;else try{n.blockTag=yield this._getBlockTag(t),(0,a.Lo)(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(e){te.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return(0,O.wt)(()=>tt(this,void 0,void 0,function*(){let t=yield this.perform("getBlock",n);if(null==t)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(e){let e=null;for(let r=0;r<t.transactions.length;r++){let n=t.transactions[r];if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){null==e&&(e=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=e-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}}let r=this.formatter.blockWithTransactions(t);return r.transactions=r.transactions.map(t=>this._wrapTransaction(t)),r}return this.formatter.block(t)}),{oncePoll:this})})}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return tt(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;let e={transactionHash:this.formatter.hash(t,!0)};return(0,O.wt)(()=>tt(this,void 0,void 0,function*(){let r=yield this.perform("getTransaction",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;let n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return this._wrapTransaction(n)}),{oncePoll:this})})}getTransactionReceipt(t){return tt(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;let e={transactionHash:this.formatter.hash(t,!0)};return(0,O.wt)(()=>tt(this,void 0,void 0,function*(){let r=yield this.perform("getTransactionReceipt",e);if(null==r)return null==this._emitted["t:"+t]?null:void 0;if(null==r.blockHash)return;let n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;t<=0&&(t=1),n.confirmations=t}return n}),{oncePoll:this})})}getLogs(t){return tt(this,void 0,void 0,function*(){yield this.getNetwork();let e=yield(0,n.k_)({filter:this._getFilter(t)}),r=yield this.perform("getLogs",e);return r.forEach(t=>{null==t.removed&&(t.removed=!1)}),Q.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return tt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(t){return tt(this,void 0,void 0,function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&te.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return(e+=t)<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)})}getResolver(t){return tt(this,void 0,void 0,function*(){let e=t;for(;;){if(""===e||"."===e||"eth"!==t&&"eth"===e)return null;let r=yield this._getResolver(e,"getResolver");if(null!=r){let n=new tE(this,r,t);if(e!==t&&!(yield n.supportsWildcard()))return null;return n}e=e.split(".").slice(1).join(".")}})}_getResolver(t,e){return tt(this,void 0,void 0,function*(){null==e&&(e="ENS");let r=yield this.getNetwork();r.ensAddress||te.throwError("network does not support ENS",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:e,network:r.name});try{let e=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+V(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null})}resolveName(t){return tt(this,void 0,void 0,function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if((0,a.Lo)(t))throw e}"string"!=typeof t&&te.throwArgumentError("invalid ENS name","name",t);let e=yield this.getResolver(t);return e?yield e.getAddress():null})}lookupAddress(t){return tt(this,void 0,void 0,function*(){t=yield t;let e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(e,"lookupAddress");if(null==r)return null;let n=tm((yield this.call({to:r,data:"0x691f3431"+V(e).substring(2)})),0);return(yield this.resolveName(n))!=t?null:n})}getAvatar(t){return tt(this,void 0,void 0,function*(){let e=null;if((0,a.Lo)(t)){let r=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;e=new tE(this,n,r);try{let t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==i.Vy.errors.CALL_EXCEPTION)throw t}try{let t=tm((yield this.call({to:n,data:"0x691f3431"+V(r).substring(2)})),0);e=yield this.getResolver(t)}catch(t){if(t.code!==i.Vy.errors.CALL_EXCEPTION)throw t;return null}}else if(!(e=yield this.getResolver(t)))return null;let r=yield e.getAvatar();return null==r?null:r.url})}perform(t,e){return te.throwError(t+" not implemented",i.Vy.errors.NOT_IMPLEMENT
1ED,{operation:t})}_startEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(t){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(t,e,r){let n=new ta(ti(t),e,r);return this._events.push(n),this._startEvent(n),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let r=!1,n=[],i=ti(t);return this._events=this._events.filter(t=>t.tag!==i||(setTimeout(()=>{t.listener.apply(this,e)},0),r=!0,!t.once||(n.push(t),!1))),n.forEach(t=>{this._stopEvent(t)}),r}listenerCount(t){if(!t)return this._events.length;let e=ti(t);return this._events.filter(t=>t.tag===e).length}listeners(t){if(null==t)return this._events.map(t=>t.listener);let e=ti(t);return this._events.filter(t=>t.tag===e).map(t=>t.listener)}off(t,e){if(null==e)return this.removeAllListeners(t);let r=[],n=!1,i=ti(t);return this._events=this._events.filter(t=>t.tag!==i||t.listener!=e||!!n||(n=!0,r.push(t),!1)),r.forEach(t=>{this._stopEvent(t)}),this}removeAllListeners(t){let e=[];
1if(null==t)e=this._events,this._events=[];else{let r=ti(t);this._events=this._events.filter(t=>t.tag!==r||(e.push(t),!1))}return e.forEach(t=>{this._stopEvent(t)}),this}}var tw=function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function l(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(s,l)}a((n=n.apply(t,e||[])).next())})};let tN=new i.Vy(o),tR=["call","estimateGas"];function tI(t,e,r){if("call"===t){let t=function t(e){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")&&(0,a.Lo)(e.data))return{message:e.message,data:e.data};if("object"==typeof e){for(let r in e){let n=t(e[r]);if(n)return n}return null}if("string"==typeof e)try{return t(JSON.parse(e))}catch(t){}return null}(e);if(t)return t.data;tN.throwError("missing revert data in call exception; Transaction reverted without a reason string",i.Vy.errors.CALL_EXCEPTION,{error:e,data:"0x"})}let n=e.message;e.code===i.Vy.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?n=e.error.message:"string"==typeof e.body?n=e.body:"string"==typeof e.responseText&&(n=e.responseText),n=(n||"").toLowerCase();let o=r.transaction||r.signedTransaction;throw n.match(/insufficient funds|base fee exceeds gas limit/)&&tN.throwError("insufficient funds for intrinsic transaction cost",i.Vy.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:o}),n.match(/nonce (is )?too low/)&&tN.throwError("nonce has already been used",i.Vy.errors.NONCE_EXPIRED,{error:e,method:t,transaction:o}),n.match(/replacement transaction underpriced/)&&tN.throwError("replacement fee too low",i.Vy.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:o}),n.match(/only replay-protected/)&&tN.throwError("legacy pre-eip-155 transactions not supported",i.Vy.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:o}),tR.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted/)&&tN.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",i.Vy.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:o}),e}function tT(t){return new Promise(function(e){setTimeout(e,t)})}function tA(t){if(t.error){let e=Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function tP(t){return t?t.toLowerCase():t}let tO={};class tx extends s.l{constructor(t,e,r){if(tN.checkNew(new.target,tx),super(),t!==tO)throw Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");(0,n.yY)(this,"provider",e),null==r&&(r=0),"string"==typeof r?((0,n.yY)(this,"_address",this.provider.formatter.address(r)),(0,n.yY)(this,"_index",null)):"number"==typeof r?((0,n.yY)(this,"_index",r),(0,n.yY)(this,"_address",null)):tN.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(t){return tN.throwError("cannot alter JSON-RPC Signer connection",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new tC(tO,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(t=>(t.length<=this._index&&tN.throwError("unknown account #"+this._index,i.Vy.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index])))}sendUncheckedTransaction(t){t=(0,n.Ic)(t);let e=this.getAddress().then(t=>(t&&(t=t.toLowerCase()),t));if(null==t.gasLimit){let r=(0,n.Ic)(t);r.from=e,t.gasLimit=this.provider.estimateGas(r)}return null!=t.to&&(t.to=Promise.resolve(t.to).then(t=>tw(this,void 0,void 0,function*(){if(null==t)return null;let e=yield this.provider.resolveName(t);return null==e&&tN.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))),(0,n.k_)({tx:(0,n.k_)(t),sender:e}).then(({tx:e,sender:r})=>{null!=e.from?e.from.toLowerCase()!==r&&tN.throwArgumentError("from address mismatch","transaction",t):e.from=r;let n=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then(t=>t,t=>tI("sendTransaction",t,n))})}signTransaction(t){return tN.throwError("signing transactions is unsupported",i.Vy.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return tw(this,void 0,void 0,function*(){let e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(t);try{return yield(0,O.wt)(()=>tw(this,void 0,void 0,function*(){let t=yield this.provider.getTransaction(r);if(null!==t)return this.provider._wrapTransaction(t,r,e)}
1),{oncePoll:this.provider})}catch(t){throw t.transactionHash=r,t}})}signMessage(t){return tw(this,void 0,void 0,function*(){let e="string"==typeof t?(0,d.YW)(t):t,r=yield this.getAddress();return yield this.provider.send("personal_sign",[(0,a.c$)(e),r.toLowerCase()])})}_legacySignMessage(t){return tw(this,void 0,void 0,function*(){let e="string"==typeof t?(0,d.YW)(t):t,r=yield this.getAddress();return yield this.provider.send("eth_sign",[r.toLowerCase(),(0,a.c$)(e)])})}_signTypedData(t,e,r){return tw(this,void 0,void 0,function*(){let n=yield A.resolveNames(t,e,r,t=>this.provider.resolveName(t)),i=yield this.getAddress();return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(A.getPayload(n.domain,e,n.value))])})}unlock(t){return tw(this,void 0,void 0,function*(){let e=this.provider,r=yield this.getAddress();return e.send("personal_unlockAccount",[r.toLowerCase(),t,null])})}}class tC extends tx{sendTransaction(t){return this.sendUncheckedTransaction(t).then(t=>({hash:t,nonce:null,gasLim
1it:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)}))}}let tL={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class tS extends tk{constructor(t,e){tN.checkNew(new.target,tS);let r=e;null==r&&(r=new Promise((t,e)=>{setTimeout(()=>{this.detectNetwork().then(e=>{t(e)},t=>{e(t)})},0)})),super(r),t||(t=(0,n.$J)(this.constructor,"defaultUrl")()),"string"==typeof t?(0,n.yY)(this,"connection",Object.freeze({url:t})):(0,n.yY)(this,"connection",Object.freeze((0,n.Ic)(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return tw(this,void 0,void 0,function*(){yield tT(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){let e=(0,n.$J)(this.constructor,"getNetwork");try{return e(l.gH.from(t).toNumber())}catch(e){return tN.throwError("could not detect network",i.Vy.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return tN.throwError("could not detect network",i.Vy.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(t){return new tx(tO,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(t=>t.map(t=>this.formatter.address(t)))}send(t,e){let r={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,n.A4)(r),provider:this});let i=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(i&&this._cache[t])return this._cache[t];let o=(0,O.x6)(this.connection,JSON.stringify(r),tA).then(t=>(this.emit("debug",{action:"response",request:r,response:t,provider:this}),t),t=>{throw this.emit("debug",{action:"response",error:t,request:r,provider:this}),t});return i&&(this._cache[t]=o,setTimeout(()=>{this._cache[t]=null},0)),o}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[tP(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[tP(e.address),e.blockTag]];case"getCode":return["eth_getCode",[tP(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[tP(e.address),e.position,e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":if(e.blockTag)return["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]];if(e.blockHash)return["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]];break;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[(0,n.$J)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,n.$J)(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=tP(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return tw(this,void 0,void 0,function*(){if("call"===t||"estimateGas"===t){let t=e.transaction;if(t&&null!=t.type&&l.gH.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){let r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((e=(0,n.Ic)(e)).transaction=(0,n.Ic)(t),delete e.transaction.type)}}let r=this.prepareRequest(t,e);null==r&&tN.throwError(t+" not implemented",i.Vy.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(r[0],r[1])}catch(r){return tI(t,r,e)}})}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;let t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then(function(r){return!function n(){t.send("eth_getFilterChanges",[r]).then(function(r){if(t._pendingFilter!=e)return null;let n=Promise.resolve();return r.forEach(function(e){t._emitted["t:"+e.toLowerCase()]="pending",n=n.then(function(){return t.getTransaction(e).then(function(e){return t.emit("pending",e),null})})}),n.then(function(){return tT(1e3)})}).then(function(){return t._pendingFilter!=e?void t.send("eth_uninstallFilter",[r]):(setTimeout(function(){n()},0),null)}
1).catch(t=>{})}(),r}).catch(t=>{})}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){let r=(0,n.Ic)(tL);if(e)for(let t in e)e[t]&&(r[t]=!0);(0,n.qN)(t,r);let i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(e){if(null==t[e])return;let r=(0,a.Fh)(t[e]);"gasLimit"===e&&(e="gas"),i[e]=r}),["from","to","data"].forEach(function(e){null!=t[e]&&(i[e]=(0,a.c$)(t[e]))}),t.accessList&&(i.accessList=(0,P.$2)(t.accessList)),i}}let tB=new i.Vy(o),tU=1;function tF(t,e){let r="Web3LegacyFetcher";return function(t,i){let o={method:t,params:i,id:tU++,jsonrpc:"2.0"};return new Promise((t,i)=>{this.emit("debug",{action:"request",fetcher:r,request:(0,n.A4)(o),provider:this}),e(o,(e,n)=>{if(e)return this.emit("debug",{action:"response",fetcher:r,error:e,request:o,provider:this}),i(e);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:n,provider:this}),n.error){let t=Error(n.error.message);return t.code=n.error.code,t.data=n.error.data,i(t)}t(n.result)})})}}class tV extends tS{constructor(t,e){tB.checkNew(new.target,tV),null==t&&tB.throwArgumentError("missing provider","provider",t);let r=null,i=null,o=null;if("function"==typeof t)r="unknown:",i=t;else{if((r=t.host||t.path||"")||!t.isMetaMask||(r="metamask"),o=t,t.request)""===r&&(r="eip-1193:"),i=function(e,r){null==r&&(r=[]);let i={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:(0,n.A4)(i),provider:this}),t.request(i).then(t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,response:t,provider:this}),t),t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,error:t,provider:this}),t})};else t.sendAsync?i=tF(t,t.sendAsync.bind(t)):t.send?i=tF(t,t.send.bind(t)):tB.throwArgumentError("unsupported provider","provider",t);r||(r="unknown:")}super(r,e),(0,n.yY)(this,"jsonRpcFetchFunc",i),(0,n.yY)(this,"provider",o)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}},74492:(t,e,r)=>{r.d(e,{S:()=>s});var n=r(66190),i=r.n(n),o=r(8548);function s(t){return"0x"+i().keccak_256((0,o.k9)(t))}},86675:(t,e,r)=>{r.d(e,{VY:()=>h,qN:()=>l,A4:()=>u,yY:()=>i,$J:()=>o,k_:()=>s,Ic:()=>a});let n=new(r(18541)).Vy("properties/5.6.0");function i(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function o(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function s(t){var e,r,n,i;return e=this,r=void 0,n=void 0,i=function*(){let e=Object.keys(t).map(e=>Promise.resolve(t[e]).then(t=>({key:e,value:t})));return(yield Promise.all(e)).reduce((t,e)=>(t[e.key]=e.value,t),{})},new(n||(n=Promise))(function(t,o){function s(t){try{a(i.next(t))}catch(t){o(t)}}function l(t){try{a(i.throw(t))}catch(t){o(t)}}function a(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n(function(t){t(r)})).then(s,l)}a((i=i.apply(e,r||[])).next())})}function l(t,e){t&&"object"==typeof t||n.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||n.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function a(t){let e={};for(let r in t)e[r]=t[r];return e}let c={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function u(t){if(function t(e){if(null==e||c[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;let r=Object.keys(e);for(let n=0;n<r.length;n++){let i=null;try{i=e[r[n]]}catch(t){continue}if(!t(i))return!1}return!0}return n.throwArgumentError(`Cannot deepCopy ${typeof e}`,"object",e)}(t))return t;if(Array.isArray(t))return Object.freeze(t.map(t=>u(t)));if("object"==typeof t){let e={};for(let r in t){let n=t[r];void 0!==n&&i(e,r,u(n))}return e}return n.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}class h{constructor(t){for(let e in t)this[e]=u(t[e])}}},87569:(t,e,r)=>{r.d(e,{D:()=>h,l:()=>a});var n=r(8548),i=r(18541);let o=new i.Vy("rlp/5.6.0");function s(t){let e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function l(t,e,r){let n=0;for(let i=0;i<r;i++)n=256*n+t[e+i];return n}function a(t){return(0,n.c$)(function t(e){if(Array.isArray(e)){let r=[];if(e.forEach(function(e){r=r.concat(t(e))}),r.length<=55)return r.unshift(192+r.length),r;let n=s(r.length);return n.unshift(247+n.length),n.concat(r)}(0,n.f)(e)||o.throwArgumentError("RLP object must be BytesLike","object",e);let r=Array.prototype.slice.call((0,n.k9)(e));if(1===r.length&&r[0]<=127)return r;if(r.length<=55)return r.unshift(128+r.length),r;let i=s(r.length);return i.unshift(183+i.length),i.concat(r)}(t))}function c(t,e,r,n){let s=[];for(;r<e+1+n;){let l=u(t,r);s.push(l.result),(r+=l.consumed)>e+1+n&&o.throwError("child data too short",i.Vy.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:s}}function u(t,e){if(0===t.length&&o.throwError("data too short",i.Vy.errors.BUFFER_OVERRUN,{}),t[e]>=248){let r=t[e]-247;e+1+r>t.length&&o.throwError("data short segment too short",i.Vy.errors.BUFFER_OVERRUN,{});let n=l(t,e+1,r);return e+1+r+n>t.length&&o.throwError("data long segment too short",i.Vy.errors.BUFFER_OVERRUN,{}),c(t,e,e+1+r,r+n)}if(t[e]>=192){let r=t[e]-192;return e+1+r>t.length&&o.throwError("data array too short",i.Vy.errors.BUFFER_OVERRUN,{}),c(t,e,e+1,r)}if(t[e]>=184){let r=t[e]-183;e+1+r>t.length&&o.throwError("data array too short",i.Vy.errors.BUFFER_OVERRUN,{});let s=l(t,e+1,r);e+1+r+s>t.length&&o.throwError("data array too short",i.Vy.errors.BUFFER_OVERRUN,{});let a=(0,n.c$)(t.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:a}}if(t[e]>=128){let r=t[e]-128;e+1+r>t.length&&o.throwError("data too short",i.Vy.errors.BUFFER_OVERRUN,{});let s=(0,n.c$)(t.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:(0,n.c$)(t[e])}}function h(t){let e=(0,n.k9)(t),r=u(e,0);return r.consumed!==e.length&&o.throwArgumentError("invalid rlp data","data",t),r.result}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.