3 lines
285 KiB
JavaScript
3 lines
285 KiB
JavaScript
/*! For license information please see 1.js.LICENSE.txt */
|
|
exports.id=1,exports.ids=[1],exports.modules={50:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(591),t)},591:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TruffleColors=void 0,t.TruffleColors={porsche:"#e4a663",turquoise:"#3fe0c5",infura:"#ff6b4a"}},141:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.__experimental_info=t.provider=t.server=t.ServerStatus=t.Server=void 0;const n=s(1),i=s(323),o=r(s(233));var a=s(233);Object.defineProperty(t,"Server",{enumerable:!0,get:function(){return a.Server}}),Object.defineProperty(t,"ServerStatus",{enumerable:!0,get:function(){return a.ServerStatus}});const c={server:e=>new o.default(e),provider:e=>(0,i.initializeFlavor)(e).connector.provider,__experimental_info:()=>({version:"7.9.1",fork:{knownChainIds:Array.from(n.KNOWN_CHAINIDS)}})};t.server=c.server,t.provider=c.provider,t.__experimental_info=c.__experimental_info,t.default=c},323:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initializeFlavor=void 0;const r=s(1),n=s(75);t.initializeFlavor=(e={flavor:"ethereum"})=>{const t=e.flavor||"ethereum";let i;i="chain"in e&&"asyncRequestProcessing"in e.chain?e.chain.asyncRequestProcessing:!("asyncRequestProcessing"in e)||e.asyncRequestProcessing;const o=new r.RequestCoordinator(i?0:1),a=new r.Executor(o),c=function loadFlavorByName(e){return"ethereum"===e?s(85).default:(0,n.load)(e)}(t),l=function getConnector(e,t,s){return e.connect(t,s)}(c,e,a),u=l.connect();return{flavor:c,connector:l,promise:u.then((()=>o.resume()))}}},233:function(e,t,s){"use strict";var r,n,i,o,a,c,l,u,d,f=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},h=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},g=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Server=t.ServerStatus=void 0;const p=g(s(451)),m=s(454);m._cfg&&(0,m._cfg)(new Uint8Array([115,105,108,101,110,116]));const b=s(75),y=s(323),w=g(s(256)),v=g(s(247)),_=g(s(29)),k="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",E=new RegExp(`^(${k}[.]){3}${k}$`),B="127.0.0.1";var P;!function(e){e[e.unknown=0]="unknown",e[e.ready=1]="ready",e[e.opening=2]="opening",e[e.open=4]="open",e[e.openingOrOpen=6]="openingOrOpen",e[e.closing=8]="closing",e[e.closed=16]="closed",e[e.closingOrClosed=24]="closingOrClosed"}(P||(t.ServerStatus=P={}));class Server extends _.default{get provider(){return f(this,l,"f").provider}get status(){return f(this,n,"f")}constructor(e={flavor:"ethereum"}){super(),r.set(this,void 0),n.set(this,P.unknown),i.set(this,null),o.set(this,null),a.set(this,null),c.set(this,null),l.set(this,void 0),u.set(this,null),d.set(this,void 0),h(this,n,P.ready,"f");const{flavor:t,connector:s,promise:g}=(0,y.initializeFlavor)(e);h(this,l,s,"f");let p=b.ServerOptionsConfig.normalize(e);"ethereum"!==t.flavor&&t.options.server&&(p={...p,...t.options.server.normalize(e)}),h(this,r,p,"f");const _=h(this,i,(0,m.App)(),"f");p.server.ws&&h(this,u,new w.default(_,s,p.server),"f"),h(this,o,new v.default(_,s,f(this,r,"f").server),"f"),h(this,d,g,"f")}listen(e,t,s){"function"==typeof t&&(s=t,t=null);const r="function"==typeof s;if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===e.trim().length||+e!=+e>>>0||e>65535){const t=new Error(`Port should be >= 0 and < 65536. Received ${e}.`);return r?process.nextTick(s,t):Promise.reject(t)}const o=+e,l=f(this,n,"f");if(l===P.closing){const e=new Error("Cannot start server while it is closing.");return r?process.nextTick(s,e):Promise.reject(e)}if(0!=(l&P.openingOrOpen)){const e=new Error(`Server is already open, or is opening, on port: ${o}.`);return r?process.nextTick(s,e):Promise.reject(e)}h(this,n,P.opening,"f");const u=f(this,d,"f");h(this,d,null,"f");const g=Promise.allSettled([u,new Promise((e=>{t?f(this,i,"f").listen(t,o,1,e):f(this,i,"f").listen(o,1,e)})).then((e=>{if(!e){h(this,n,P.closed,"f");const e=new Error(`listen EADDRINUSE: address already in use ${t||B}:${o}.`);throw e.code="EADDRINUSE",e}h(this,n,P.open,"f"),h(this,a,e,"f"),h(this,c,t||B,"f")}))]).then((async e=>{const t=[];if("rejected"===e[0].status&&t.push(e[0].reason),"rejected"===e[1].status&&t.push(e[1].reason),0!==t.length){h(this,n,P.unknown,"f");try{await this.close()}catch(e){t.push(e)}throw t.length>1?new p.default(t):t[0]}this.emit("open")}));if(!r)return g;g.then((()=>s(null))).catch(s)}address(){if(f(this,a,"f")){const t=f(this,c,"f");return{address:t,family:(e=t,E.test(e)?"IPv4":"IPv6"),port:(0,m.us_socket_local_port)(f(this,a,"f"))}}return null;var e}async close(){if(f(this,n,"f")===P.opening)throw new Error("Cannot close server while it is opening.");if(0!=(f(this,n,"f")&P.closingOrClosed))throw new Error("Server is already closing or closed.");h(this,n,P.closing,"f");const e=f(this,a,"f");h(this,a,null,"f"),null!==e&&(0,m.us_listen_socket_close)(e),null!==f(this,u,"f")&&f(this,u,"f").close(),null!==f(this,o,"f")&&f(this,o,"f").close(),null!==f(this,l,"f")&&await f(this,l,"f").close(),f(this,i,"f").close&&f(this,i,"f").close(),h(this,n,P.closed,"f"),h(this,i,null,"f"),await this.emit("close")}}t.Server=Server,r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,t.default=Server},247:function(e,t,s){"use strict";var r,n,i,o,a,c=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const d=u(s(817)),f=u(s(818)),h=s(6),g=s(455),noop=()=>{};function prepareCORSResponseHeaders(e,t){const s=t.getHeader("origin"),r=t.getHeader("access-control-request-headers");return t=>{""!==s&&("OPTIONS"===e&&(t.writeHeader("Access-Control-Allow-Methods","POST"),""!==r&&t.writeHeader("Access-Control-Allow-Headers",r),t.writeHeader("Access-Control-Max-Age","600")),t.writeHeader("Access-Control-Allow-Credentials","true"),t.writeHeader("Access-Control-Allow-Origin",s))}}function sendResponse(e,t,s,r,n,i=noop){e.cork((()=>{e.writeStatus(s),i(e),null!=r&&e.writeHeader("Content-Type",r),null!==n?e.end(n,t):e.end(void 0,t)}))}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,t.default=class HttpServer{constructor(e,t,s){r.set(this,void 0),n.set(this,void 0),i.set(this,!1),o.set(this,((e,t)=>{if(l(this,i,"f"))return void e.close();const s=prepareCORSResponseHeaders("POST",t);let o,a=!1;e.onAborted((()=>{a=!0})),e.onData(((c,u)=>{const p=Buffer.from(c);if(u){const c=l(this,r,"f");let u;try{const e=o?Buffer.concat([o,p],o.length+p.length):p;u=c.parse(e)}catch(t){return void sendResponse(e,l(this,i,"f"),f.default.BAD_REQUEST,d.default.PLAIN,"400 Bad Request: "+t.message,s)}c.handle(u,t).then((({value:e})=>e)).then((t=>{if(a)return;const r=c.format(t,u);h.types.isGeneratorObject(r)?function sendChunkedResponse(e,t,s,r,n,i,o=noop){const a=(0,g.getFragmentGenerator)(n,i),{value:c}=a.next();let{value:l,done:u}=a.next();u?sendResponse(e,t,s,r,c,o):e.cork((()=>{for(l of(e.writeStatus(s),o(e),e.writeHeader("Content-Type",r),e.write(c),e.write(l),a))e.write(l);e.end(void 0,t)}))}(e,l(this,i,"f"),f.default.OK,d.default.JSON,r,l(this,n,"f").chunkSize,s):sendResponse(e,l(this,i,"f"),f.default.OK,d.default.JSON,r,s)})).catch((t=>{if(a)return;const r=c.formatError(t,u);sendResponse(e,l(this,i,"f"),f.default.OK,d.default.JSON,r,s)}))}else o=o?Buffer.concat([o,p],o.length+p.length):Buffer.concat([p],p.length)}))})),a.set(this,((e,t)=>{if(l(this,i,"f"))return void e.close();const s=prepareCORSResponseHeaders("OPTIONS",t);sendResponse(e,l(this,i,"f"),f.default.NO_CONTENT,null,null,s)})),c(this,r,t,"f"),c(this,n,s,"f"),e.post(s.rpcEndpoint,l(this,o,"f")).options(s.rpcEndpoint,l(this,a,"f")),e.get("/418",(e=>{l(this,i,"f")?e.close():sendResponse(e,l(this,i,"f"),f.default.IM_A_TEAPOT,d.default.PLAIN,"418 I'm a teapot")})),e.any("/*",((e,t)=>{if(l(this,i,"f"))return void e.close();const s=t.getHeader("connection");s&&"upgrade"===s.toLowerCase()?sendResponse(e,l(this,i,"f"),f.default.BAD_REQUEST,d.default.PLAIN,"400 Bad Request"):sendResponse(e,l(this,i,"f"),f.default.NOT_FOUND,d.default.PLAIN,"404 Not Found")}))}close(){c(this,i,!0,"f")}}},817:(e,t)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.PLAIN="text/plain",e.JSON="application/json"}(s||(s={})),t.default=s},455:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFragmentGenerator=void 0,t.getFragmentGenerator=function*getFragmentGenerator(e,t){let s=Buffer.allocUnsafe(t),r=0;for(const n of e){const{byteLength:e}=n;r>0&&e+r>t&&(yield s.subarray(0,r),s=null,r=0),e<t?(null===s&&(s=Buffer.allocUnsafe(t)),n.copy(s,r,0,e),r+=e):yield n}r>0&&(yield s.subarray(0,r))}},818:(e,t)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.OK="200 ",e.NO_CONTENT="204 ",e.BAD_REQUEST="400 ",e.NOT_FOUND="404 ",e.METHOD_NOT_ALLOWED="405 ",e.IM_A_TEAPOT="418 "}(s||(s={})),t.default=s},816:(e,t)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.CLOSE_NORMAL=1e3]="CLOSE_NORMAL"}(s||(s={})),t.default=s},256:function(e,t,s){"use strict";var r,n=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_PAYLOAD_SIZE=t.sendFragmented=void 0;const o=i(s(816)),a=s(6),c=s(455);function sendFragmented(e,t,s,r){e.cork((()=>{const n=(0,c.getFragmentGenerator)(t,r),{value:i}=n.next();let{value:o,done:a}=n.next();if(a)e.send(i,s);else{e.sendFirstFragment(i,s);for(const t of n)e.sendFragment(o,false),o=t;e.sendLastFragment(o,false)}}))}t.sendFragmented=sendFragmented,t.MAX_PAYLOAD_SIZE=15728640;r=new WeakMap,t.default=class WebsocketServer{constructor(e,s,i){r.set(this,new Map);const o=n(this,r,"f"),c=i.wsBinary,l="auto"===c;e.ws(i.rpcEndpoint,{maxPayloadLength:t.MAX_PAYLOAD_SIZE,idleTimeout:120,open:e=>{e.closed=!1,o.set(e,new Set)},message:async(e,t,r)=>{let n;const u=l?r:c;try{n=s.parse(Buffer.from(t))}catch(t){const r=s.formatError(t,n);return void e.send(r,u)}let d;try{const{value:t}=await s.handle(n,e);if(e.closed)return;const i=t,a=await i;if(e.closed)return;if(d=s.format(a,n),"function"==typeof i.on){const t=i;t.on("message",(t=>{const s=JSON.stringify({jsonrpc:"2.0",method:t.type,params:t.data});e.send(s,r)})),o.get(e).add(t.dispose)}}catch(t){if(e.closed)return;d=s.formatError(t,n)}a.types.isGeneratorObject(d)?sendFragmented(e,d,u,i.chunkSize):e.send(d,u)},drain:e=>{},close:e=>{e.closed=!0,o.get(e).forEach((e=>e())),o.delete(e)}})}close(){n(this,r,"f").forEach(((e,t)=>t.end(o.default.CLOSE_NORMAL,"Server closed by client")))}}},11:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Address=void 0;const r=s(0),n=s(1);class Address extends r.Address{constructor(e){super(e)}static from(e){return new Address(n.Data.toBuffer(e,Address.ByteLength))}static toBuffer(e){return Address.from(e).toBuffer()}static toString(e){return Address.from(e).toString()}toJSON(){return this.toString()}}t.Address=Address,Address.ByteLength=20},39:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(357),t),n(s(729),t),n(s(730),t),n(s(180),t)},728:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockParams=void 0,t.BlockParams={INITIAL_BASE_FEE_PER_GAS:1000000000n,ELASTICITY:2n,BASE_FEE_MAX_CHANGE_DENOMINATOR:8n}},357:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Block=void 0;const r=s(1),n=s(23),i=s(12),o=s(369),a=s(1),c=s(180),l=s(728);class Block{constructor(e,t){if(this._common=t,e){const t=(0,i.decode)(e);let s;this._raw=t[0],this._rawTransactions=t[1]||[],7===t.length?(this._rawWithdrawals=t[3]||[],s=t[4],this._rawTransactionMetaData=t[5]||[],this._size=r.Quantity.toNumber(t[6])):(this._rawWithdrawals=null,s=t[3],this._rawTransactionMetaData=t[4]||[],this._size=r.Quantity.toNumber(t[5])),this.header=(0,o.makeHeader)(this._raw,s)}}static migrate(e){const t=(0,i.decode)(e),s=t.slice(0,3);return s[1]=s[1].map((e=>{if(9===e.length)return e;{const t=e[0][0],s=e.slice(1);return(0,n.encodeWithPrefix)(t,s)}})),(0,c.serialize)(s,t.slice(3,5)).serialized}hash(){return this._hash||(this._hash=r.Data.from((0,a.keccak)((0,i.encode)(this._raw)),32))}getTransactions(){const e=this._common,t=this.hash().toBuffer(),s=this.header.number.toBuffer();return this._rawTransactions.map(((n,i)=>{const[o,a]=this._rawTransactionMetaData[i],l=[o,a,t,s,r.Quantity.toBuffer(i)];return(0,c.blockTransactionFromRaw)(n,e,l)}))}toJSON(e){const t=this.hash(),s=this.getTxFn(e),n=t.toBuffer(),i=this.header,o=i.number.toBuffer(),a=this._common,l=this._rawTransactions.map(((e,t)=>{const[l,u]=this._rawTransactionMetaData[t],d=[l,u,n,o,r.Quantity.toBuffer(t)],f=(0,c.blockTransactionFromRaw)(e,a,d);return f.updateEffectiveGasPrice(i.baseFeePerGas?.toBigInt()),s(f)}));return{hash:t,...i,size:r.Quantity.from(this._size),transactions:l,uncles:[],withdrawals:this._rawWithdrawals?.map(c.convertRawWithdrawals)}}getTxFn(e=!1){return e?e=>e.toJSON(this._common):e=>e.hash}static calcNextBaseFeeBigInt(e){let t;const s=e,r=s.gasLimit.toBigInt()/l.BlockParams.ELASTICITY,n=s.gasUsed.toBigInt(),i=s.baseFeePerGas?s.baseFeePerGas.toBigInt():l.BlockParams.INITIAL_BASE_FEE_PER_GAS;if(r===n)t=i;else if(n>r){const e=i*(n-r)/r/l.BlockParams.BASE_FEE_MAX_CHANGE_DENOMINATOR;t=e>1n?i+e:i+1n}else{t=i-i*(r-n)/r/l.BlockParams.BASE_FEE_MAX_CHANGE_DENOMINATOR}return t}static calcNBlocksMaxBaseFee(e,t){const{BASE_FEE_MAX_CHANGE_DENOMINATOR:s}=l.BlockParams;let r=this.calcNextBaseFeeBigInt(t);for(;--e;)r+=r/s;return r}static calcNextBaseFee(e){const t=e.header;return void 0===t.baseFeePerGas?void 0:this.calcNextBaseFeeBigInt(t)}}t.Block=Block,Block.INITIAL_BASE_FEE_PER_GAS=l.BlockParams.INITIAL_BASE_FEE_PER_GAS},369:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeHeader=void 0;const r=s(1);t.makeHeader=function makeHeader(e,t){return{parentHash:r.Data.from(e[0],32),sha3Uncles:r.Data.from(e[1],32),miner:r.Data.from(e[2],20),stateRoot:r.Data.from(e[3],32),transactionsRoot:r.Data.from(e[4],32),receiptsRoot:r.Data.from(e[5],32),logsBloom:r.Data.from(e[6],256),difficulty:r.Quantity.from(e[7],!1),number:r.Quantity.from(e[8],!1),gasLimit:r.Quantity.from(e[9],!1),gasUsed:r.Quantity.from(e[10],!1),timestamp:r.Quantity.from(e[11],!1),extraData:r.Data.from(e[12]),mixHash:r.Data.from(e[13],32),nonce:r.Data.from(e[14],8),totalDifficulty:r.Quantity.from(t,!1),baseFeePerGas:void 0===e[15]?void 0:r.Quantity.from(e[15],!1),withdrawalsRoot:void 0===e[16]?void 0:r.Data.from(e[16],32)}}},729:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RuntimeBlock=t.getBlockSize=void 0;const r=s(1),n=s(0),i=s(180),o=s(23),a=s(369),c=s(357);t.getBlockSize=function getBlockSize(e,t){return e.length-t.length};t.RuntimeBlock=class RuntimeBlock{constructor(e,t,s,n,i,o,a,c,l,u,d,f){this._common=e,this.header={parentHash:s.toBuffer(),coinbase:n,number:t.toBigInt(),difficulty:c.toBigInt(),totalDifficulty:r.Quantity.toBuffer(l.toBigInt()+c.toBigInt()),gasLimit:i.toBigInt(),gasUsed:o.toBigInt(),timestamp:a.toBigInt(),baseFeePerGas:d,mixHash:u,prevRandao:u,withdrawalsRoot:f,cliqueSigner:()=>n}}finalize(e,t,s,l,u,d,f,h){const{header:g}=this,p=[g.parentHash,n.KECCAK256_RLP_ARRAY,g.coinbase.buf,l,e,t,s,r.Quantity.toBuffer(g.difficulty),r.Quantity.toBuffer(g.number),r.Quantity.toBuffer(g.gasLimit),0n===u?r.BUFFER_EMPTY:r.Quantity.toBuffer(u),r.Quantity.toBuffer(g.timestamp),d.toBuffer(),g.mixHash,r.BUFFER_8_ZERO],m=this._common.isActivatedEIP(4895);void 0!==g.baseFeePerGas&&(p[15]=r.Quantity.toBuffer(g.baseFeePerGas,!1),m&&(p[16]=r.Data.toBuffer(g.withdrawalsRoot)));const{totalDifficulty:b}=g,y=Array(f.length),w=Array(f.length);for(let e=0;e<f.length;e++){const t=f[e];y[e]=9===t.raw.length?t.raw:t.serialized??(0,o.encodeWithPrefix)(t.type.toNumber(),t.raw),w[e]=[t.from.toBuffer(),t.hash.toBuffer()]}const v=m?[p,y,[],[]]:[p,y,[]],{serialized:_,size:k}=(0,i.serialize)(v,[b,w]),E=new c.Block(null,this._common);return E._raw=p,E._rawTransactions=y,E.header=(0,a.makeHeader)(p,b),E._rawWithdrawals=[],E._rawTransactionMetaData=w,E._size=k,{block:E,serialized:_,storageKeys:h,transactions:f}}}},180:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertRawWithdrawals=t.blockTransactionFromRaw=t.serialize=void 0;const r=s(11),n=s(23),i=s(12),o=s(1);t.serialize=function serialize(e,t){const s=(0,i.encodeRange)(e,0,e.length),r=s.length,n=(0,i.encodeLength)(r,192).length+r,a=(0,i.encodeRange)(t,0,2),c=(0,i.encode)((0,o.uintToBuffer)(n));return{serialized:(0,i.digest)([s.output,a.output,[c]],r+a.length+c.length),size:n}},t.blockTransactionFromRaw=function blockTransactionFromRaw(e,t,s){let r,o;return!function isLegacyRawTransaction(e){return 9===e.length}(e)?(o=e[0],r=(0,i.decode)(e.subarray(1))):(o=0,r=e),n.TransactionFactory.fromSafeTypeAndTxData(o,r,t,s)},t.convertRawWithdrawals=function convertRawWithdrawals([e,t,s,n]){return{index:o.Quantity.from(e),validatorIndex:o.Quantity.from(t),address:r.Address.from(s),amount:o.Quantity.from(n)}}},730:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},391:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maybeGetLogs=void 0;var r=s(743);Object.defineProperty(t,"maybeGetLogs",{enumerable:!0,get:function(){return r.maybeGetLogs}})},131:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Handlers=t.bytes=t.address=t.bool=t.string=t.uint256=t.int256=t.fixedBytes=t.WORD_SIZE=void 0;const r=s(1);t.WORD_SIZE=32;const n=-0x10000000000000000000000000000000000000000000000000000000000000000n;function getDynamicDataMarkers(e,s){const r=s+t.WORD_SIZE-4,n=e.readUInt32BE(r)+t.WORD_SIZE;return{start:n,end:n+e.readUInt32BE(n-4)}}function handleBytes(e,t,s){return`0x${e.toString("hex",t,s)}`}t.fixedBytes=function fixedBytes(e){return(t,s)=>handleBytes(t,s,s+e)};t.int256=(e,s)=>{const i=e.subarray(s,s+t.WORD_SIZE),o=(0,r.bufferToBigInt)(i);return 128&i[0]?o|n:o};t.uint256=(e,s)=>(0,r.bufferToBigInt)(e.subarray(s,s+t.WORD_SIZE));t.string=(e,t)=>{const{start:s,end:r}=getDynamicDataMarkers(e,t);return e.toString("utf8",s,r)};t.bool=(e,s)=>0!==e[s+t.WORD_SIZE-1];t.address=(e,s)=>`0x${e.toString("hex",s+12,s+t.WORD_SIZE)}`;t.bytes=(e,t)=>{const{start:s,end:r}=getDynamicDataMarkers(e,t);return handleBytes(e,s,r)},t.Handlers={address:t.address,bool:t.bool,bytes:t.bytes,int256:t.int256,string:t.string,uint256:t.uint256}},743:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maybeGetLogs=void 0;const r=s(131),n=s(744),i=0x636f6e736f6c652e6c6f67n;t.maybeGetLogs=e=>{if("STATICCALL"!==e.opcode.name)return null;const t=e.stack,[s,o,a]=t.slice(-4,-1);if(a!==i)return null;try{const t=Number(o),i=t+Number(s),a=e.memory.subarray(t,i),c=a.readUInt32BE(0),l=n.signatureMap.get(c);if(!l)return null;const u=a.subarray(4);return l.map(((e,t)=>{const s=t*r.WORD_SIZE;return e(u,s)}))}catch{return null}}},744:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signatureMap=void 0;const r=s(131);t.signatureMap=new Map([[1368866505,[]],[741264322,[r.address]],[843419373,[r.bool]],[1093685164,[r.string]],[4163653873,[r.uint256]],[4122065833,[r.uint256]],[199720790,[r.bytes]],[760966329,[r.int256]],[1309416733,[r.int256]],[1847107880,[(0,r.fixedBytes)(1)]],[3921027734,[(0,r.fixedBytes)(2)]],[763578662,[(0,r.fixedBytes)(3)]],[3764340945,[(0,r.fixedBytes)(4)]],[2793701517,[(0,r.fixedBytes)(5)]],[2927928721,[(0,r.fixedBytes)(6)]],[1322614312,[(0,r.fixedBytes)(7)]],[1334060334,[(0,r.fixedBytes)(8)]],[2428341456,[(0,r.fixedBytes)(9)]],[20780939,[(0,r.fixedBytes)(10)]],[67127854,[(0,r.fixedBytes)(11)]],[2258660029,[(0,r.fixedBytes)(12)]],[2488442420,[(0,r.fixedBytes)(13)]],[2456219775,[(0,r.fixedBytes)(14)]],[3667227872,[(0,r.fixedBytes)(15)]],[1717330180,[(0,r.fixedBytes)(16)]],[866084666,[(0,r.fixedBytes)(17)]],[3302112666,[(0,r.fixedBytes)(18)]],[1584093747,[(0,r.fixedBytes)(19)]],[1367925737,[(0,r.fixedBytes)(20)]],[3923391840,[(0,r.fixedBytes)(21)]],[3589990556,[(0,r.fixedBytes)(22)]],[2879508237,[(0,r.fixedBytes)(23)]],[4055063348,[(0,r.fixedBytes)(24)]],[193248344,[(0,r.fixedBytes)(25)]],[4172368369,[(0,r.fixedBytes)(26)]],[976705501,[(0,r.fixedBytes)(27)]],[3358255854,[(0,r.fixedBytes)(28)]],[1265222613,[(0,r.fixedBytes)(29)]],[3994207469,[(0,r.fixedBytes)(30)]],[3263516050,[(0,r.fixedBytes)(31)]],[666357637,[(0,r.fixedBytes)(32)]],[3673216170,[r.address,r.address]],[1974863315,[r.address,r.bool]],[1973388987,[r.address,r.string]],[2198464680,[r.address,r.uint256]],[574869411,[r.address,r.uint256]],[2235320393,[r.bool,r.address]],[705760899,[r.bool,r.bool]],[2414527781,[r.bool,r.string]],[965833939,[r.bool,r.uint256]],[910912146,[r.bool,r.uint256]],[832238387,[r.string,r.address]],[3283441205,[r.string,r.bool]],[1264337527,[r.string,r.string]],[3054400204,[r.string,r.uint256]],[2534451664,[r.string,r.uint256]],[1764191366,[r.uint256,r.address]],[1491830284,[r.uint256,r.address]],[480083635,[r.uint256,r.bool]],[510514412,[r.uint256,r.bool]],[1681903839,[r.uint256,r.string]],[262402885,[r.uint256,r.string]],[4133908826,[r.uint256,r.uint256]],[1812949376,[r.uint256,r.uint256]],[25986242,[r.address,r.address,r.address]],[4070990470,[r.address,r.address,r.bool]],[7426238,[r.address,r.address,r.string]],[402547077,[r.address,r.address,r.uint256]],[1815506290,[r.address,r.address,r.uint256]],[4044790253,[r.address,r.bool,r.address]],[3951234194,[r.address,r.bool,r.bool]],[555898316,[r.address,r.bool,r.string]],[2622462459,[r.address,r.bool,r.uint256]],[742821141,[r.address,r.bool,r.uint256]],[4035396840,[r.address,r.string,r.address]],[3473018801,[r.address,r.string,r.bool]],[4218888805,[r.address,r.string,r.string]],[1742565361,[r.address,r.string,r.uint256]],[484110986,[r.address,r.string,r.uint256]],[2076235848,[r.address,r.uint256,r.address]],[2548867988,[r.address,r.uint256,r.address]],[1736575400,[r.address,r.uint256,r.bool]],[3846889796,[r.address,r.uint256,r.bool]],[2717051050,[r.address,r.uint256,r.string]],[3136907337,[r.address,r.uint256,r.string]],[3063663350,[r.address,r.uint256,r.uint256]],[2273710942,[r.address,r.uint256,r.uint256]],[3530962535,[r.bool,r.address,r.address]],[415876934,[r.bool,r.address,r.bool]],[3734671984,[r.bool,r.address,r.string]],[1601936123,[r.bool,r.address,r.uint256]],[3950005167,[r.bool,r.address,r.uint256]],[276362893,[r.bool,r.bool,r.address]],[1349555864,[r.bool,r.bool,r.bool]],[626391622,[r.bool,r.bool,r.string]],[317855234,[r.bool,r.bool,r.uint256]],[2954061243,[r.bool,r.bool,r.uint256]],[2509355347,[r.bool,r.string,r.address]],[3686056519,[r.bool,r.string,r.bool]],[2960557183,[r.bool,r.string,r.string]],[278130193,[r.bool,r.string,r.uint256]],[3224906412,[r.bool,r.string,r.uint256]],[143587794,[r.bool,r.uint256,r.address]],[3302110471,[r.bool,r.uint256,r.address]],[3906927529,[r.bool,r.uint256,r.bool]],[464374251,[r.bool,r.uint256,r.bool]],[3288086896,[r.bool,r.uint256,r.string]],[3359211184,[r.bool,r.uint256,r.string]],[923808615,[r.bool,r.uint256,r.uint256]],[995886048,[r.bool,r.uint256,r.uint256]],[4243355104,[r.string,r.address,r.address]],[3374145236,[r.string,r.address,r.bool]],[3773410639,[r.string,r.address,r.string]],[220641573,[r.string,r.address,r.uint256]],[130552343,[r.string,r.address,r.uint256]],[2469116728,[r.string,r.bool,r.address]],[2232122070,[r.string,r.bool,r.bool]],[3801674877,[r.string,r.bool,r.string]],[3378075862,[r.string,r.bool,r.uint256]],[689682896,[r.string,r.bool,r.uint256]],[2515337621,[r.string,r.string,r.address]],[2967534005,[r.string,r.string,r.bool]],[753761519,[r.string,r.string,r.string]],[1478619041,[r.string,r.string,r.uint256]],[4083337817,[r.string,r.string,r.uint256]],[478069832,[r.string,r.uint256,r.address]],[3817119609,[r.string,r.uint256,r.address]],[3396809649,[r.string,r.uint256,r.bool]],[4043501061,[r.string,r.uint256,r.bool]],[1500569737,[r.string,r.uint256,r.string]],[2750793529,[r.string,r.uint256,r.string]],[3393701099,[r.string,r.uint256,r.uint256]],[2526862595,[r.string,r.uint256,r.uint256]],[3170737120,[r.uint256,r.address,r.address]],[2104993307,[r.uint256,r.address,r.address]],[2607726658,[r.uint256,r.address,r.bool]],[2060456590,[r.uint256,r.address,r.bool]],[1674265081,[r.uint256,r.address,r.string]],[3464692859,[r.uint256,r.address,r.string]],[1520131797,[r.uint256,r.address,r.uint256]],[2286109610,[r.uint256,r.address,r.uint256]],[889741179,[r.uint256,r.bool,r.address]],[1112473535,[r.uint256,r.bool,r.address]],[544310864,[r.uint256,r.bool,r.bool]],[3587091680,[r.uint256,r.bool,r.bool]],[2239189025,[r.uint256,r.bool,r.string]],[2332955902,[r.uint256,r.bool,r.string]],[537493524,[r.uint256,r.bool,r.uint256]],[1515034914,[r.uint256,r.bool,r.uint256]],[2063255897,[r.uint256,r.string,r.address]],[529592906,[r.uint256,r.string,r.address]],[1290643290,[r.uint256,r.string,r.bool]],[1185403086,[r.uint256,r.string,r.bool]],[2970968351,[r.uint256,r.string,r.string]],[1062716053,[r.uint256,r.string,r.string]],[933920076,[r.uint256,r.string,r.uint256]],[1533929535,[r.uint256,r.string,r.uint256]],[1553380145,[r.uint256,r.uint256,r.address]],[3191032091,[r.uint256,r.uint256,r.address]],[1197922930,[r.uint256,r.uint256,r.bool]],[1733758967,[r.uint256,r.uint256,r.bool]],[1909476082,[r.uint256,r.uint256,r.string]],[2104037094,[r.uint256,r.uint256,r.string]],[3522001468,[r.uint256,r.uint256,r.uint256]],[3884059252,[r.uint256,r.uint256,r.uint256]],[1717301556,[r.address,r.address,r.address,r.address]],[238520724,[r.address,r.address,r.address,r.bool]],[4161329696,[r.address,r.address,r.address,r.string]],[2485456247,[r.address,r.address,r.address,r.uint256]],[3982404743,[r.address,r.address,r.address,r.uint256]],[2669396846,[r.address,r.address,r.bool,r.address]],[752096074,[r.address,r.address,r.bool,r.bool]],[2858762440,[r.address,r.address,r.bool,r.string]],[963766156,[r.address,r.address,r.bool,r.uint256]],[2513854225,[r.address,r.address,r.bool,r.uint256]],[2406706454,[r.address,r.address,r.string,r.address]],[1863997774,[r.address,r.address,r.string,r.bool]],[566079269,[r.address,r.address,r.string,r.string]],[4011651047,[r.address,r.address,r.string,r.uint256]],[69767936,[r.address,r.address,r.string,r.uint256]],[2376523509,[r.address,r.address,r.uint256,r.address]],[3603321462,[r.address,r.address,r.uint256,r.address]],[2604815586,[r.address,r.address,r.uint256,r.bool]],[3270936812,[r.address,r.address,r.uint256,r.bool]],[4256496016,[r.address,r.address,r.uint256,r.string]],[2647731885,[r.address,r.address,r.uint256,r.string]],[3193255041,[r.address,r.address,r.uint256,r.uint256]],[1425929188,[r.address,r.address,r.uint256,r.uint256]],[1711502813,[r.address,r.bool,r.address,r.address]],[2801077007,[r.address,r.bool,r.address,r.bool]],[769095910,[r.address,r.bool,r.address,r.string]],[2807847390,[r.address,r.bool,r.address,r.uint256]],[3698398930,[r.address,r.bool,r.address,r.uint256]],[3476636805,[r.address,r.bool,r.bool,r.address]],[3401856121,[r.address,r.bool,r.bool,r.bool]],[3754205928,[r.address,r.bool,r.bool,r.string]],[2353946086,[r.address,r.bool,r.bool,r.uint256]],[3484780374,[r.address,r.bool,r.bool,r.uint256]],[436029782,[r.address,r.bool,r.string,r.address]],[1353532957,[r.address,r.bool,r.string,r.bool]],[1197235251,[r.address,r.bool,r.string,r.string]],[2162598411,[r.address,r.bool,r.string,r.uint256]],[2652011374,[r.address,r.bool,r.string,r.uint256]],[3438776481,[r.address,r.bool,r.uint256,r.address]],[227337758,[r.address,r.bool,r.uint256,r.address]],[3294903840,[r.address,r.bool,r.uint256,r.bool]],[2244855215,[r.address,r.bool,r.uint256,r.bool]],[178704301,[r.address,r.bool,r.uint256,r.string]],[2606272204,[r.address,r.bool,r.uint256,r.string]],[946861556,[r.address,r.bool,r.uint256,r.uint256]],[3255869470,[r.address,r.bool,r.uint256,r.uint256]],[221706784,[r.address,r.string,r.address,r.address]],[233909110,[r.address,r.string,r.address,r.bool]],[4158874181,[r.address,r.string,r.address,r.string]],[1166009295,[r.address,r.string,r.address,r.uint256]],[2350461865,[r.address,r.string,r.address,r.uint256]],[542667202,[r.address,r.string,r.bool,r.address]],[1595759775,[r.address,r.string,r.bool,r.bool]],[3154862590,[r.address,r.string,r.bool,r.string]],[1365129398,[r.address,r.string,r.bool,r.uint256]],[3877655068,[r.address,r.string,r.bool,r.uint256]],[2689478535,[r.address,r.string,r.string,r.address]],[900007711,[r.address,r.string,r.string,r.bool]],[1560462603,[r.address,r.string,r.string,r.string]],[362776871,[r.address,r.string,r.string,r.uint256]],[2706362425,[r.address,r.string,r.string,r.uint256]],[1662531192,[r.address,r.string,r.uint256,r.address]],[3755464715,[r.address,r.string,r.uint256,r.address]],[251125840,[r.address,r.string,r.uint256,r.bool]],[2116357467,[r.address,r.string,r.uint256,r.bool]],[1149776040,[r.address,r.string,r.uint256,r.string]],[1561552329,[r.address,r.string,r.uint256,r.string]],[499704248,[r.address,r.string,r.uint256,r.uint256]],[2764647008,[r.address,r.string,r.uint256,r.uint256]],[1200430178,[r.address,r.uint256,r.address,r.address]],[3961816175,[r.address,r.uint256,r.address,r.address]],[2713504179,[r.address,r.uint256,r.address,r.bool]],[4051804649,[r.address,r.uint256,r.address,r.bool]],[497649386,[r.address,r.uint256,r.address,r.string]],[1567749022,[r.address,r.uint256,r.address,r.string]],[269444366,[r.address,r.uint256,r.address,r.uint256]],[2782496616,[r.address,r.uint256,r.address,r.uint256]],[2736520652,[r.address,r.uint256,r.bool,r.address]],[602229106,[r.address,r.uint256,r.bool,r.address]],[1005970743,[r.address,r.uint256,r.bool,r.bool]],[4272018778,[r.address,r.uint256,r.bool,r.bool]],[3316483577,[r.address,r.uint256,r.bool,r.string]],[2391690869,[r.address,r.uint256,r.bool,r.string]],[586594713,[r.address,r.uint256,r.bool,r.uint256]],[1770996626,[r.address,r.uint256,r.bool,r.uint256]],[1547898183,[r.address,r.uint256,r.string,r.address]],[3698927108,[r.address,r.uint256,r.string,r.address]],[3474460764,[r.address,r.uint256,r.string,r.bool]],[2751614737,[r.address,r.uint256,r.string,r.bool]],[2292761606,[r.address,r.uint256,r.string,r.string]],[2119616147,[r.address,r.uint256,r.string,r.string]],[3204577425,[r.address,r.uint256,r.string,r.uint256]],[4111650715,[r.address,r.uint256,r.string,r.uint256]],[551786573,[r.address,r.uint256,r.uint256,r.address]],[519451700,[r.address,r.uint256,r.uint256,r.address]],[1727118439,[r.address,r.uint256,r.uint256,r.bool]],[3964381346,[r.address,r.uint256,r.uint256,r.bool]],[1244184599,[r.address,r.uint256,r.uint256,r.string]],[2301889963,[r.address,r.uint256,r.uint256,r.string]],[888202806,[r.address,r.uint256,r.uint256,r.uint256]],[1024368100,[r.address,r.uint256,r.uint256,r.uint256]],[487903233,[r.bool,r.address,r.address,r.address]],[1180699616,[r.bool,r.address,r.address,r.bool]],[3625099623,[r.bool,r.address,r.address,r.string]],[208064958,[r.bool,r.address,r.address,r.uint256]],[1384430956,[r.bool,r.address,r.address,r.uint256]],[474063670,[r.bool,r.address,r.bool,r.address]],[1788626827,[r.bool,r.address,r.bool,r.bool]],[1248250676,[r.bool,r.address,r.bool,r.string]],[126031106,[r.bool,r.address,r.bool,r.uint256]],[1287000017,[r.bool,r.address,r.bool,r.uint256]],[1870422078,[r.bool,r.address,r.string,r.address]],[3804222987,[r.bool,r.address,r.string,r.bool]],[2805734838,[r.bool,r.address,r.string,r.string]],[3256837319,[r.bool,r.address,r.string,r.uint256]],[194640930,[r.bool,r.address,r.string,r.uint256]],[325780957,[r.bool,r.address,r.uint256,r.address]],[1760647349,[r.bool,r.address,r.uint256,r.address]],[3590430492,[r.bool,r.address,r.uint256,r.bool]],[4002252402,[r.bool,r.address,r.uint256,r.bool]],[1374724088,[r.bool,r.address,r.uint256,r.string]],[2691192883,[r.bool,r.address,r.uint256,r.string]],[2079424929,[r.bool,r.address,r.uint256,r.uint256]],[2617143996,[r.bool,r.address,r.uint256,r.uint256]],[4102557348,[r.bool,r.bool,r.address,r.address]],[3231908568,[r.bool,r.bool,r.address,r.bool]],[2695133539,[r.bool,r.bool,r.address,r.string]],[1276263767,[r.bool,r.bool,r.address,r.uint256]],[1620281063,[r.bool,r.bool,r.address,r.uint256]],[2352126746,[r.bool,r.bool,r.bool,r.address]],[992632032,[r.bool,r.bool,r.bool,r.bool]],[719587540,[r.bool,r.bool,r.bool,r.string]],[1836074433,[r.bool,r.bool,r.bool,r.uint256]],[3259532109,[r.bool,r.bool,r.bool,r.uint256]],[4188875657,[r.bool,r.bool,r.string,r.address]],[3092715066,[r.bool,r.bool,r.string,r.bool]],[1830717265,[r.bool,r.bool,r.string,r.string]],[3819555375,[r.bool,r.bool,r.string,r.uint256]],[395003525,[r.bool,r.bool,r.string,r.uint256]],[1420274080,[r.bool,r.bool,r.uint256,r.address]],[201299213,[r.bool,r.bool,r.uint256,r.address]],[1637764366,[r.bool,r.bool,r.uint256,r.bool]],[2874982852,[r.bool,r.bool,r.uint256,r.bool]],[2111099104,[r.bool,r.bool,r.uint256,r.string]],[1348569399,[r.bool,r.bool,r.uint256,r.string]],[196087467,[r.bool,r.bool,r.uint256,r.uint256]],[1181212302,[r.bool,r.bool,r.uint256,r.uint256]],[724244700,[r.bool,r.string,r.address,r.address]],[1842623690,[r.bool,r.string,r.address,r.bool]],[316065672,[r.bool,r.string,r.address,r.string]],[2781534868,[r.bool,r.string,r.address,r.uint256]],[453743963,[r.bool,r.string,r.address,r.uint256]],[1401816747,[r.bool,r.string,r.bool,r.address]],[3697185627,[r.bool,r.string,r.bool,r.bool]],[1211958294,[r.bool,r.string,r.bool,r.string]],[369533843,[r.bool,r.string,r.bool,r.uint256]],[2372902053,[r.bool,r.string,r.bool,r.uint256]],[2547225816,[r.bool,r.string,r.string,r.address]],[508266469,[r.bool,r.string,r.string,r.bool]],[392356650,[r.bool,r.string,r.string,r.string]],[2078327787,[r.bool,r.string,r.string,r.uint256]],[1574643090,[r.bool,r.string,r.string,r.uint256]],[362193358,[r.bool,r.string,r.uint256,r.address]],[1529002296,[r.bool,r.string,r.uint256,r.address]],[1796103507,[r.bool,r.string,r.uint256,r.bool]],[549177775,[r.bool,r.string,r.uint256,r.bool]],[450457062,[r.bool,r.string,r.uint256,r.string]],[2007084013,[r.bool,r.string,r.uint256,r.string]],[679886795,[r.bool,r.string,r.uint256,r.uint256]],[2387273838,[r.bool,r.string,r.uint256,r.uint256]],[653615272,[r.bool,r.uint256,r.address,r.address]],[2318373034,[r.bool,r.uint256,r.address,r.address]],[3032683775,[r.bool,r.uint256,r.address,r.bool]],[1705899016,[r.bool,r.uint256,r.address,r.bool]],[464760986,[r.bool,r.uint256,r.address,r.string]],[403247937,[r.bool,r.uint256,r.address,r.string]],[355982471,[r.bool,r.uint256,r.address,r.uint256]],[3399820138,[r.bool,r.uint256,r.address,r.uint256]],[2597139990,[r.bool,r.uint256,r.bool,r.address]],[1114097656,[r.bool,r.uint256,r.bool,r.address]],[3468031191,[r.bool,r.uint256,r.bool,r.bool]],[2650928961,[r.bool,r.uint256,r.bool,r.bool]],[2437143473,[r.bool,r.uint256,r.bool,r.string]],[3067439572,[r.bool,r.uint256,r.bool,r.string]],[2140912802,[r.bool,r.uint256,r.bool,r.uint256]],[3554563475,[r.bool,r.uint256,r.bool,r.uint256]],[4275904511,[r.bool,r.uint256,r.string,r.address]],[2781285673,[r.bool,r.uint256,r.string,r.address]],[3857124139,[r.bool,r.uint256,r.string,r.bool]],[2446522387,[r.bool,r.uint256,r.string,r.bool]],[4122747465,[r.bool,r.uint256,r.string,r.string]],[3542771016,[r.bool,r.uint256,r.string,r.string]],[1779538402,[r.bool,r.uint256,r.string,r.uint256]],[1098907931,[r.bool,r.uint256,r.string,r.uint256]],[14518201,[r.bool,r.uint256,r.uint256,r.address]],[4049711649,[r.bool,r.uint256,r.uint256,r.address]],[3197649747,[r.bool,r.uint256,r.uint256,r.bool]],[2753397214,[r.bool,r.uint256,r.uint256,r.bool]],[2389310301,[r.bool,r.uint256,r.uint256,r.string]],[3657852616,[r.bool,r.uint256,r.uint256,r.string]],[927708338,[r.bool,r.uint256,r.uint256,r.uint256]],[853517604,[r.bool,r.uint256,r.uint256,r.uint256]],[3985582326,[r.string,r.address,r.address,r.address]],[3047013728,[r.string,r.address,r.address,r.bool]],[2148146279,[r.string,r.address,r.address,r.string]],[2398352281,[r.string,r.address,r.address,r.uint256]],[1857524797,[r.string,r.address,r.address,r.uint256]],[573965245,[r.string,r.address,r.bool,r.address]],[2038975531,[r.string,r.address,r.bool,r.bool]],[72663161,[r.string,r.address,r.bool,r.string]],[1050642026,[r.string,r.address,r.bool,r.uint256]],[3318856587,[r.string,r.address,r.bool,r.uint256]],[2864486961,[r.string,r.address,r.string,r.address]],[1595265676,[r.string,r.address,r.string,r.bool]],[609847026,[r.string,r.address,r.string,r.string]],[2446397742,[r.string,r.address,r.string,r.uint256]],[2405583849,[r.string,r.address,r.string,r.uint256]],[1677429701,[r.string,r.address,r.uint256,r.address]],[2741431424,[r.string,r.address,r.uint256,r.address]],[4232594928,[r.string,r.address,r.uint256,r.bool]],[1522647356,[r.string,r.address,r.uint256,r.bool]],[1514632754,[r.string,r.address,r.uint256,r.string]],[1280700980,[r.string,r.address,r.uint256,r.string]],[4176812830,[r.string,r.address,r.uint256,r.uint256]],[3668153533,[r.string,r.address,r.uint256,r.uint256]],[870964509,[r.string,r.bool,r.address,r.address]],[2508990662,[r.string,r.bool,r.address,r.bool]],[764294052,[r.string,r.bool,r.address,r.string]],[1560853253,[r.string,r.bool,r.address,r.uint256]],[685723286,[r.string,r.bool,r.address,r.uint256]],[1905304873,[r.string,r.bool,r.bool,r.address]],[2304440517,[r.string,r.bool,r.bool,r.bool]],[2636305885,[r.string,r.bool,r.bool,r.string]],[2386524329,[r.string,r.bool,r.bool,r.uint256]],[2155164136,[r.string,r.bool,r.bool,r.uint256]],[3764542249,[r.string,r.bool,r.string,r.address]],[1066037277,[r.string,r.bool,r.string,r.bool]],[2821114603,[r.string,r.bool,r.string,r.string]],[620303461,[r.string,r.bool,r.string,r.uint256]],[885731469,[r.string,r.bool,r.string,r.uint256]],[2472413631,[r.string,r.bool,r.uint256,r.address]],[1909687565,[r.string,r.bool,r.uint256,r.address]],[2331496330,[r.string,r.bool,r.uint256,r.bool]],[1019590099,[r.string,r.bool,r.uint256,r.bool]],[1949134567,[r.string,r.bool,r.uint256,r.string]],[1119461927,[r.string,r.bool,r.uint256,r.string]],[1689631591,[r.string,r.bool,r.uint256,r.uint256]],[1572859960,[r.string,r.bool,r.uint256,r.uint256]],[1134328815,[r.string,r.string,r.address,r.address]],[1556958775,[r.string,r.string,r.address,r.bool]],[3944480640,[r.string,r.string,r.address,r.string]],[2093204999,[r.string,r.string,r.address,r.uint256]],[1250010474,[r.string,r.string,r.address,r.uint256]],[3279013851,[r.string,r.string,r.bool,r.address]],[1081628777,[r.string,r.string,r.bool,r.bool]],[1585754346,[r.string,r.string,r.bool,r.string]],[3601791698,[r.string,r.string,r.bool,r.uint256]],[2256636538,[r.string,r.string,r.bool,r.uint256]],[1834430276,[r.string,r.string,r.string,r.address]],[739726573,[r.string,r.string,r.string,r.bool]],[3731419658,[r.string,r.string,r.string,r.string]],[2393878571,[r.string,r.string,r.string,r.uint256]],[2681211381,[r.string,r.string,r.string,r.uint256]],[270792626,[r.string,r.string,r.uint256,r.address]],[1565476480,[r.string,r.string,r.uint256,r.address]],[3282609748,[r.string,r.string,r.uint256,r.bool]],[3864418506,[r.string,r.string,r.uint256,r.bool]],[1562023706,[r.string,r.string,r.uint256,r.string]],[2366909661,[r.string,r.string,r.uint256,r.string]],[4099767596,[r.string,r.string,r.uint256,r.uint256]],[3587119056,[r.string,r.string,r.uint256,r.uint256]],[1587722158,[r.string,r.uint256,r.address,r.address]],[3939013249,[r.string,r.uint256,r.address,r.address]],[2182163010,[r.string,r.uint256,r.address,r.bool]],[285649143,[r.string,r.uint256,r.address,r.bool]],[2684039059,[r.string,r.uint256,r.address,r.string]],[844415720,[r.string,r.uint256,r.address,r.string]],[1325727174,[r.string,r.uint256,r.address,r.uint256]],[1481210622,[r.string,r.uint256,r.address,r.uint256]],[3773389720,[r.string,r.uint256,r.bool,r.address]],[3847527825,[r.string,r.uint256,r.bool,r.address]],[894187222,[r.string,r.uint256,r.bool,r.bool]],[3816813520,[r.string,r.uint256,r.bool,r.bool]],[2885106328,[r.string,r.uint256,r.bool,r.string]],[1993105508,[r.string,r.uint256,r.bool,r.string]],[3827003247,[r.string,r.uint256,r.bool,r.uint256]],[1427009269,[r.string,r.uint256,r.bool,r.uint256]],[2084975268,[r.string,r.uint256,r.string,r.address]],[3144824297,[r.string,r.uint256,r.string,r.address]],[2099530013,[r.string,r.uint256,r.string,r.bool]],[3919545039,[r.string,r.uint256,r.string,r.bool]],[1522028063,[r.string,r.uint256,r.string,r.string]],[1821956834,[r.string,r.uint256,r.string,r.string]],[3330189777,[r.string,r.uint256,r.string,r.uint256]],[2697245221,[r.string,r.uint256,r.string,r.uint256]],[3793609336,[r.string,r.uint256,r.uint256,r.address]],[3201771711,[r.string,r.uint256,r.uint256,r.address]],[1982258066,[r.string,r.uint256,r.uint256,r.bool]],[4147936829,[r.string,r.uint256,r.uint256,r.bool]],[2236298390,[r.string,r.uint256,r.uint256,r.string]],[2773406909,[r.string,r.uint256,r.uint256,r.string]],[2812835923,[r.string,r.uint256,r.uint256,r.uint256]],[149837414,[r.string,r.uint256,r.uint256,r.uint256]],[612938772,[r.uint256,r.address,r.address,r.address]],[1430734329,[r.uint256,r.address,r.address,r.address]],[153090805,[r.uint256,r.address,r.address,r.bool]],[22350596,[r.uint256,r.address,r.address,r.bool]],[52195187,[r.uint256,r.address,r.address,r.string]],[2034490470,[r.uint256,r.address,r.address,r.string]],[1936653238,[r.uint256,r.address,r.address,r.uint256]],[2587672470,[r.uint256,r.address,r.address,r.uint256]],[4017276179,[r.uint256,r.address,r.bool,r.address]],[3056677012,[r.uint256,r.address,r.bool,r.address]],[3813741583,[r.uint256,r.address,r.bool,r.bool]],[2116501773,[r.uint256,r.address,r.bool,r.bool]],[2432370346,[r.uint256,r.address,r.bool,r.string]],[1676730946,[r.uint256,r.address,r.bool,r.string]],[1522374954,[r.uint256,r.address,r.bool,r.uint256]],[2064181483,[r.uint256,r.address,r.bool,r.uint256]],[2629472255,[r.uint256,r.address,r.string,r.address]],[3420819197,[r.uint256,r.address,r.string,r.address]],[3425872647,[r.uint256,r.address,r.string,r.bool]],[581204390,[r.uint256,r.address,r.string,r.bool]],[1041403043,[r.uint256,r.address,r.string,r.string]],[2373420580,[r.uint256,r.address,r.string,r.string]],[1182952285,[r.uint256,r.address,r.string,r.uint256]],[2697204968,[r.uint256,r.address,r.string,r.uint256]],[364980149,[r.uint256,r.address,r.uint256,r.address]],[4256361684,[r.uint256,r.address,r.uint256,r.address]],[1601452668,[r.uint256,r.address,r.uint256,r.bool]],[435581801,[r.uint256,r.address,r.uint256,r.bool]],[3719324961,[r.uint256,r.address,r.uint256,r.string]],[1054063912,[r.uint256,r.address,r.uint256,r.string]],[211605953,[r.uint256,r.address,r.uint256,r.uint256]],[3399106228,[r.uint256,r.address,r.uint256,r.uint256]],[2716814523,[r.uint256,r.bool,r.address,r.address]],[2263728396,[r.uint256,r.bool,r.address,r.address]],[1162695845,[r.uint256,r.bool,r.address,r.bool]],[2449150530,[r.uint256,r.bool,r.address,r.bool]],[2917159623,[r.uint256,r.bool,r.address,r.string]],[2721084958,[r.uint256,r.bool,r.address,r.string]],[125994997,[r.uint256,r.bool,r.address,r.uint256]],[1102442299,[r.uint256,r.bool,r.address,r.uint256]],[1768164185,[r.uint256,r.bool,r.bool,r.address]],[1392910941,[r.uint256,r.bool,r.bool,r.address]],[3069540257,[r.uint256,r.bool,r.bool,r.bool]],[1315722005,[r.uint256,r.bool,r.bool,r.bool]],[3722155361,[r.uint256,r.bool,r.bool,r.string]],[831186331,[r.uint256,r.bool,r.bool,r.string]],[1952763427,[r.uint256,r.bool,r.bool,r.uint256]],[3173363033,[r.uint256,r.bool,r.bool,r.uint256]],[4015165464,[r.uint256,r.bool,r.string,r.address]],[1231956916,[r.uint256,r.bool,r.string,r.address]],[3952250239,[r.uint256,r.bool,r.string,r.bool]],[879671495,[r.uint256,r.bool,r.string,r.bool]],[1757984957,[r.uint256,r.bool,r.string,r.string]],[2754870525,[r.uint256,r.bool,r.string,r.string]],[740099910,[r.uint256,r.bool,r.string,r.uint256]],[2438978344,[r.uint256,r.bool,r.string,r.uint256]],[2295029825,[r.uint256,r.bool,r.uint256,r.address]],[1329595790,[r.uint256,r.bool,r.uint256,r.address]],[2443193898,[r.uint256,r.bool,r.uint256,r.bool]],[3534472445,[r.uint256,r.bool,r.uint256,r.bool]],[3724797812,[r.uint256,r.bool,r.uint256,r.string]],[3906845782,[r.uint256,r.bool,r.uint256,r.string]],[3333212072,[r.uint256,r.bool,r.uint256,r.uint256]],[1451396516,[r.uint256,r.bool,r.uint256,r.uint256]],[1634266465,[r.uint256,r.string,r.address,r.address]],[2141537675,[r.uint256,r.string,r.address,r.address]],[2428701270,[r.uint256,r.string,r.address,r.bool]],[4181720887,[r.uint256,r.string,r.address,r.bool]],[2621104033,[r.uint256,r.string,r.address,r.string]],[4170733439,[r.uint256,r.string,r.address,r.string]],[3906142605,[r.uint256,r.string,r.address,r.uint256]],[2565338099,[r.uint256,r.string,r.address,r.uint256]],[2922300801,[r.uint256,r.string,r.bool,r.address]],[2037328032,[r.uint256,r.string,r.bool,r.address]],[3126025628,[r.uint256,r.string,r.bool,r.bool]],[1371286465,[r.uint256,r.string,r.bool,r.bool]],[3537118157,[r.uint256,r.string,r.bool,r.string]],[2370346144,[r.uint256,r.string,r.bool,r.string]],[3472922752,[r.uint256,r.string,r.bool,r.uint256]],[2763295359,[r.uint256,r.string,r.bool,r.uint256]],[3582182914,[r.uint256,r.string,r.string,r.address]],[3432549024,[r.uint256,r.string,r.string,r.address]],[3014047421,[r.uint256,r.string,r.string,r.bool]],[310782872,[r.uint256,r.string,r.string,r.bool]],[564987523,[r.uint256,r.string,r.string,r.string]],[1474103825,[r.uint256,r.string,r.string,r.string]],[2955463101,[r.uint256,r.string,r.string,r.uint256]],[1995203422,[r.uint256,r.string,r.string,r.uint256]],[992115124,[r.uint256,r.string,r.uint256,r.address]],[2877020669,[r.uint256,r.string,r.uint256,r.address]],[1763348340,[r.uint256,r.string,r.uint256,r.bool]],[2270850606,[r.uint256,r.string,r.uint256,r.bool]],[3082360010,[r.uint256,r.string,r.uint256,r.string]],[2730232985,[r.uint256,r.string,r.uint256,r.string]],[2193775476,[r.uint256,r.string,r.uint256,r.uint256]],[3221501959,[r.uint256,r.string,r.uint256,r.uint256]],[1453707697,[r.uint256,r.uint256,r.address,r.address]],[3398671136,[r.uint256,r.uint256,r.address,r.address]],[365610102,[r.uint256,r.uint256,r.address,r.bool]],[2833785006,[r.uint256,r.uint256,r.address,r.bool]],[1826504888,[r.uint256,r.uint256,r.address,r.string]],[3600994782,[r.uint256,r.uint256,r.address,r.string]],[2297881778,[r.uint256,r.uint256,r.address,r.uint256]],[1628154048,[r.uint256,r.uint256,r.address,r.uint256]],[2592172675,[r.uint256,r.uint256,r.bool,r.address]],[3776410703,[r.uint256,r.uint256,r.bool,r.address]],[2869451494,[r.uint256,r.uint256,r.bool,r.bool]],[2495495089,[r.uint256,r.uint256,r.bool,r.bool]],[2780101785,[r.uint256,r.uint256,r.bool,r.string]],[4024028142,[r.uint256,r.uint256,r.bool,r.string]],[3950997458,[r.uint256,r.uint256,r.bool,r.uint256]],[1818524812,[r.uint256,r.uint256,r.bool,r.uint256]],[1121066423,[r.uint256,r.uint256,r.string,r.address]],[1127384482,[r.uint256,r.uint256,r.string,r.address]],[2062986021,[r.uint256,r.uint256,r.string,r.bool]],[2989403910,[r.uint256,r.uint256,r.string,r.bool]],[668512210,[r.uint256,r.uint256,r.string,r.string]],[2080582194,[r.uint256,r.uint256,r.string,r.string]],[1570936811,[r.uint256,r.uint256,r.string,r.uint256]],[949229117,[r.uint256,r.uint256,r.string,r.uint256]],[4202792367,[r.uint256,r.uint256,r.uint256,r.address]],[3766828905,[r.uint256,r.uint256,r.uint256,r.address]],[3315126661,[r.uint256,r.uint256,r.uint256,r.bool]],[1683143115,[r.uint256,r.uint256,r.uint256,r.bool]],[1506790371,[r.uint256,r.uint256,r.uint256,r.string]],[2024634892,[r.uint256,r.uint256,r.uint256,r.string]],[423606272,[r.uint256,r.uint256,r.uint256,r.uint256]],[1554033982,[r.uint256,r.uint256,r.uint256,r.uint256]]])},85:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(s(334)),a=s(50),c=s(1),l=s(0),u=s(138),d=s(75),f=s(253);function color(e){return o.default`{hex("${a.TruffleColors.porsche}") ${e}}`}n(s(253),t),n(s(815),t);const h={flavor:"ethereum",connect:(e,t)=>new f.Connector(e,t),options:{provider:u.EthereumOptionsConfig,server:d.ServerOptionsConfig,cli:d.CliOptionsConfig},ready:function ready({provider:e,options:t}){const s=e.getOptions(),r=e.getInitialAccounts(),n=Object.keys(r),i=[];i.push(""),i.push("Available Accounts"),i.push("=================="),n.length>0?(n.forEach((function(e,t){const s=r[e].balance,n=s/c.WEI,o=s%c.WEI===0n?"":"~";let a=`(${t}) ${(0,l.toChecksumAddress)(e)} (${o}${n} ETH)`;r[e].unlocked||(a+=" \u{1f512}"),i.push(a)})),i.push(""),i.push("Private Keys"),i.push("=================="),n.forEach((function(e,t){i.push(`(${t}) ${r[e].secretKey}`)})),null!=s.wallet.accountKeysPath&&(i.push(""),i.push(`Accounts and keys saved to ${s.wallet.accountKeysPath}`))):i.push("(no accounts unlocked)");null==s.wallet.accounts&&(i.push(""),i.push("HD Wallet"),i.push("=================="),i.push(`Mnemonic: ${color(s.wallet.mnemonic)}`),i.push(`Base HD Path: ${color(s.wallet.hdPath.join("/")+"/{account_index}")}`));s.miner.defaultGasPrice&&(i.push(""),i.push("Default Gas Price"),i.push("=================="),i.push(color(s.miner.defaultGasPrice.toBigInt().toString())));s.miner.blockGasLimit&&(i.push(""),i.push("BlockGas Limit"),i.push("=================="),i.push(color(s.miner.blockGasLimit.toBigInt().toString())));s.miner.callGasLimit&&(i.push(""),i.push("Call Gas Limit"),i.push("=================="),i.push(color(s.miner.callGasLimit.toBigInt().toString())));if(s.fork.network||s.fork.url){let e;i.push(""),i.push("Forked Chain"),i.push("=================="),e=s.fork.network?`Ethereum ${function capitalizeFirstLetter(e){return e[0].toUpperCase()+e.slice(1)}(s.fork.network.replace("goerli","g\xf6rli"))}, via ${o.default`{hex("${a.TruffleColors.infura}") 丕Infura}`}`:s.fork.url.toString(),i.push(`Location: ${color(e)}`),i.push(`Block: ${color(s.fork.blockNumber.toString())}`),i.push(`Network ID: ${color(s.chain.networkId.toString())}`),i.push(`Time: ${color(s.chain.time.toString())}`),0!==s.fork.requestsPerSecond&&i.push(`Requests/Second: ${color(s.fork.requestsPerSecond.toString())}`)}i.push(""),i.push("Chain"),i.push("=================="),i.push(`Hardfork: ${color(s.chain.hardfork)}`),i.push(`Id: ${color(s.chain.chainId.toString())}`),i.push(""),i.push("RPC Listening on "+t.server.host+":"+t.server.port),console.log(i.join("\n"))}};t.default=h},815:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},227:function(e,t,s){"use strict";var r,n,i,o,a,c,l=this&&this.__decorate||function(e,t,s,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(i<3?n(o):i>3?n(t,s,o):n(t,s))||o);return i>3&&o&&Object.defineProperty(t,s,o),o},u=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},d=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},f=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const h=s(3),g=s(39),p=s(23),m=s(0),b=s(284),y=s(1),w=f(s(130)),v=f(s(288)),_=s(736),k=s(373),E=s(12),B=s(11),P=s(135);async function autofillDefaultTransactionValues(e,t,s,r,n,i){if(e.gas.isNull()){const s=i.miner.defaultTransactionGasLimit;s===y.Quantity.Empty?e.gas=await t(r,h.Tag.latest):e.gas=s}if("gasPrice"in e&&e.gasPrice.isNull()&&(e.gasPrice=i.miner.defaultGasPrice),"maxFeePerGas"in e&&e.maxFeePerGas.isNull()){const t=n.blocks.latest;e.maxFeePerGas=y.Quantity.from(g.Block.calcNBlocksMaxBaseFee(3,t.header))}"maxPriorityFeePerGas"in e&&e.maxPriorityFeePerGas.isNull()&&(e.maxPriorityFeePerGas=await s())}const T="7.9.1",A=`Ganache/v${T}/EthereumJS TestRPC/v${T}/ethereum-js`,O=y.Data.from("0x3f"),S={eth:"1.0",net:"1.0",rpc:"1.0",web3:"1.0",evm:"1.0",personal:"1.0"};function assertExceptionalTransactions(e){let t,s=null;const r={};if(e.forEach((e=>{e.execException&&(s?(s=h.VM_EXCEPTIONS,t.push(`${e.hash.toString()}: ${e.execException}\n`),r[e.execException.data.hash]=e.execException.data):(s=h.VM_EXCEPTION,t=[e.execException.message],r[e.execException.data.hash]=e.execException.data))})),s){const e=new Error(s+t.join("\n"));throw e.data=r,e}}class EthereumApi{constructor(e,t,s){var l;r.set(this,(l=0,()=>y.Quantity.from(++l))),n.set(this,new Map),i.set(this,new Map),o.set(this,void 0),a.set(this,void 0),c.set(this,void 0),u(this,o,e,"f"),u(this,c,t,"f"),u(this,a,s,"f")}async db_putString(e,t,s){return!1}async db_getString(e,t){return""}async db_putHex(e,t,s){return!1}async db_getHex(e,t){return"0x00"}async bzz_hive(){return[]}async bzz_info(){return[]}async evm_mine(e){const t=d(this,a,"f"),s=d(this,o,"f").chain.vmErrorsOnRPCResponse;if(null!==e&&"object"==typeof e){let{blocks:r,timestamp:n}=e;null==r&&(r=1);for(let e=0;e<r;e++){const{transactions:e}=await t.mine(P.Capacity.FillBlock,true,n);s&&assertExceptionalTransactions(e)}}else{const r=e,{transactions:n}=await t.mine(P.Capacity.FillBlock,true,r);s&&assertExceptionalTransactions(n)}return"0x0"}async evm_setAccountNonce(e,t){const s=B.Address.from(e),r=d(this,a,"f"),n=r.vm.eei,i=await n.getAccount(s);return i.nonce=y.Quantity.toBigInt(t),await n.checkpoint(),await n.putAccount(s,i),await n.commit(),await r.mine(P.Capacity.Empty),!0}async evm_setAccountBalance(e,t){const s=B.Address.from(e),r=d(this,a,"f"),n=r.vm.eei,i=await n.getAccount(s);return i.balance=y.Quantity.toBigInt(t),await n.checkpoint(),await n.putAccount(s,i),await n.commit(),await r.mine(P.Capacity.Empty),!0}async evm_setAccountCode(e,t){const s=B.Address.from(e),r=y.Data.toBuffer(t),n=d(this,a,"f"),i=n.vm.eei;if(await i.checkpoint(),r.length>0)await i.putContractCode(s,r);else{const e=await i.getAccount(s);e.codeHash=m.KECCAK256_NULL,await i.putAccount(s,e)}return await i.commit(),await n.mine(P.Capacity.Empty),!0}async evm_setAccountStorageAt(e,t,s){const r=B.Address.from(e),n=y.Data.toBuffer(t),i=y.Data.toBuffer(s),o=d(this,a,"f"),c=o.vm.eei;return await c.checkpoint(),await c.putContractStorage(r,n,i),await c.commit(),await o.mine(P.Capacity.Empty),!0}async evm_increaseTime(e){const t=1e3*("number"==typeof e?e:y.Quantity.toNumber(e));return Math.floor(d(this,a,"f").increaseTime(t)/1e3)}async evm_setTime(e){let t;switch(typeof e){case"object":t=e.getTime();break;case"number":t=e;break;default:t=y.Quantity.toNumber(e)}const s=d(this,a,"f").setTimeDiff(t);return Math.floor(s/1e3)}async evm_revert(e){return d(this,a,"f").revert(y.Quantity.from(e))}async evm_snapshot(){return y.Quantity.from(d(this,a,"f").snapshot())}async evm_addAccount(e,t){const s=B.Address.from(e);return d(this,c,"f").addUnknownAccount(s,t)}async evm_removeAccount(e,t){const s=B.Address.from(e);return d(this,c,"f").removeKnownAccount(s,t)}async miner_start(e=1){if("eager"===d(this,o,"f").miner.instamine){const t=await d(this,a,"f").resume(e);t&&null!=t.transactions&&d(this,o,"f").chain.vmErrorsOnRPCResponse&&assertExceptionalTransactions(t.transactions)}else d(this,a,"f").resume(e);return!0}async miner_stop(){return d(this,a,"f").pause(),!0}async miner_setGasPrice(e){return d(this,o,"f").miner.defaultGasPrice=y.Quantity.from(e),!0}async miner_setEtherbase(e){return d(this,a,"f").coinbase=B.Address.from(e),!0}async miner_setExtra(e){const t=y.Data.from(e),s=t.toBuffer().length;if(s>32)throw new Error(`extra exceeds max length. ${s} > 32`);return d(this,o,"f").miner.extraData=t,!0}async web3_clientVersion(){return A}async web3_sha3(e){return y.Data.from((0,y.keccak)(y.Data.toBuffer(e)))}async net_version(){return d(this,o,"f").chain.networkId.toString()}async net_listening(){return!0}async net_peerCount(){return y.Quantity.Zero}async eth_estimateGas(e,t=h.Tag.latest){const s=d(this,a,"f"),r=s.blocks,n=(await r.get(t)).header,i=d(this,o,"f"),generateVM=async()=>await s.createVmFromStateTrie(s.trie.copy(!1),i.chain.allowUnlimitedContractSize,!1);return new Promise(((t,r)=>{const{coinbase:o}=s,a=p.TransactionFactory.fromRpc(e,s.common);null==a.from&&(a.from=o),a.gas.isNull()&&(a.gas=i.miner.callGasLimit);const c=new g.RuntimeBlock(s.common,y.Quantity.from((n.number.toBigInt()||0n)+1n),n.parentHash,new B.Address(n.miner.toBuffer()),a.gas,n.gasUsed,n.timestamp,i.miner.difficulty,n.totalDifficulty,s.getMixHash(n.parentHash.toBuffer()),0n,m.KECCAK256_RLP),l={tx:a.toVmTransaction(),block:c,skipBalance:!0,skipNonce:!0};(0,v.default)(generateVM,l,((e,s)=>{e?r(e):t(y.Quantity.from(s.gasEstimate))}))}))}async eth_protocolVersion(){return O}async eth_syncing(){return!1}async eth_coinbase(){return d(this,a,"f").coinbase}async eth_getBlockByNumber(e,t){void 0===t&&(t=!1);const s=await d(this,a,"f").blocks.get(e).catch((e=>null));return s?s.toJSON(t):null}async eth_getProof(e,t,s=h.Tag.latest){const r=d(this,a,"f");if(r.fallback)throw new Error("eth_getProof is not supported on a forked network. See https://github.com/trufflesuite/ganache/issues/3234 for details.");const n=await r.blocks.get(s),i=B.Address.from(e),o=t.map((e=>y.Data.toBuffer(e,32))),c=r.vm.stateManager.copy();await c.setStateRoot(n.header.stateRoot.toBuffer());const l=await c.getProof(i,o);return{address:i,balance:y.Quantity.from(l.balance),codeHash:y.Data.from(l.codeHash),nonce:y.Quantity.from(l.nonce),storageHash:y.Data.from(l.storageHash),accountProof:l.accountProof.map((e=>y.Data.from(e))),storageProof:l.storageProof.map((e=>({key:y.Data.from(e.key),proof:e.proof.map((e=>y.Data.from(e))),value:y.Quantity.from(e.value)})))}}async eth_getBlockByHash(e,t){void 0===t&&(t=!1);const s=await d(this,a,"f").blocks.getByHash(e).catch((e=>null));return s?s.toJSON(t):null}async eth_getBlockTransactionCountByNumber(e){const{blocks:t}=d(this,a,"f"),s=t.getEffectiveNumber(e),r=await t.getRawByBlockNumber(s);if(!r)return null;const[,n]=(0,E.decode)(r);return y.Quantity.from(n.length)}async eth_getBlockTransactionCountByHash(e){const{blocks:t}=d(this,a,"f"),s=await t.getByHash(e).catch((e=>null));if(!s)return null;const r=s.getTransactions();return y.Quantity.from(r.length)}async eth_getCompilers(){return[]}async eth_getTransactionByBlockHashAndIndex(e,t){const s=d(this,a,"f"),r=await s.blocks.getByHash(e).catch((e=>null));if(!r)return null;return r.getTransactions()[y.Quantity.toNumber(t)].toJSON(s.common)}async eth_getTransactionByBlockNumberAndIndex(e,t){const s=d(this,a,"f"),r=await s.blocks.get(e).catch((e=>null));if(!r)return null;return r.getTransactions()[y.Quantity.toNumber(t)].toJSON(s.common)}async eth_getUncleCountByBlockHash(e){return y.Quantity.Zero}async eth_getUncleCountByBlockNumber(e){return y.Quantity.Zero}async eth_getUncleByBlockHashAndIndex(e,t){return null}async eth_getUncleByBlockNumberAndIndex(e,t){return null}async eth_getWork(){return[]}async eth_submitWork(e,t,s){return!1}async eth_submitHashrate(e,t){return!1}async eth_mining(){return d(this,a,"f").isStarted()}async eth_hashrate(){return y.Quantity.Zero}async eth_gasPrice(){return d(this,o,"f").miner.defaultGasPrice}async eth_maxPriorityFeePerGas(){return y.Quantity.Gwei}async eth_accounts(){return d(this,c,"f").addresses}async eth_blockNumber(){return d(this,a,"f").blocks.latest.header.number}async eth_chainId(){return y.Quantity.from(d(this,o,"f").chain.chainId)}async eth_getBalance(e,t=h.Tag.latest){return d(this,a,"f").accounts.getBalance(B.Address.from(e),t)}async eth_getCode(e,t=h.Tag.latest){const{accounts:s}=d(this,a,"f");return s.getCode(B.Address.from(e),t)}async eth_getStorageAt(e,t,s=h.Tag.latest){const r=d(this,a,"f"),n=r.blocks.getEffectiveNumber(s),i=await r.blocks.getRawByBlockNumber(n);if(!i)throw new Error("header not found");const[[,,,o]]=(0,E.decode)(i),c=r.trie.copy(!1);c.setContext(o,null,n);const l=y.Quantity.toBuffer(t),u=l.length;let f;u<32?(f=Buffer.allocUnsafe(32).fill(0),l.copy(f,32-u)):f=32===u?l:l.slice(-32);const g=B.Address.from(e).toBuffer(),p=await c.get(g),m=(0,E.decode)(p)[2];c.setContext(m,g,n);const b=await c.get(f);return y.Data.from((0,E.decode)(b),32)}async eth_getTransactionByHash(e){const{transactions:t}=d(this,a,"f"),s=y.Data.toBuffer(e),r=await t.get(s);if(null===r){const e=t.transactionPool.find(s);return e?e.toJSON(d(this,a,"f").common):null}return r.toJSON(d(this,a,"f").common)}async eth_getTransactionReceipt(e){const{transactions:t,transactionReceipts:s,blocks:r,common:n}=d(this,a,"f"),i=y.Data.from(e),c=i.toBuffer(),l=t.get(c),u=s.get(c),[f,h]=await Promise.all([l,u]);if(f)return h.toJSON(f,n);const g=d(this,o,"f");if(g.miner.blockTime<=0&&"strict"===g.miner.instamine&&d(this,a,"f").isStarted()){null!=d(this,a,"f").transactions.transactionPool.find(c)&&g.logging.logger.log(` > Ganache \`eth_getTransactionReceipt\` notice: the transaction with hash\n > \`${i.toString()}\` has not\n > yet been mined. See https://trfl.io/v7-instamine for additional information.`)}return null}async eth_sendTransaction(e){const t=d(this,a,"f"),s=p.TransactionFactory.fromRpc(e,t.common);if(null==s.from)throw new Error("from not found; is required");const r=s.from.toString(),n=d(this,c,"f"),i=n.knownAccounts.has(r),l=n.unlockedAccounts.get(r);if(void 0===l){throw new Error(i?"authentication needed: passphrase or unlock":"sender account not recognized")}return await autofillDefaultTransactionValues(s,this.eth_estimateGas.bind(this),this.eth_maxPriorityFeePerGas,e,t,d(this,o,"f")),t.queueTransaction(s,l)}async eth_signTransaction(e){const t=d(this,a,"f"),s=p.TransactionFactory.fromRpc(e,t.common);if(null==s.from)throw new Error("from not found; is required");const r=s.from.toString(),n=d(this,c,"f"),i=n.knownAccounts.has(r),o=n.unlockedAccounts.get(r);if(void 0===o){throw new Error(i?"authentication needed: passphrase or unlock":"sender account not recognized")}return s.signAndHash(o.toBuffer()),y.Data.from(s.serialized)}async eth_sendRawTransaction(e){const t=d(this,a,"f"),s=p.TransactionFactory.fromString(e,t.common);return t.queueTransaction(s)}async eth_sign(e,t){const s=B.Address.from(e).toString().toLowerCase(),r=d(this,c,"f").unlockedAccounts.get(s);if(null==r)throw new Error("cannot sign data; no private key");const n=(0,m.hashPersonalMessage)(y.Data.toBuffer(t)),{v:i,r:o,s:a}=(0,y.ecsign)(n,r.toBuffer());return(0,m.toRpcSig)(i,o,a)}async eth_signTypedData(e,t){return this.eth_signTypedData_v4(e,t)}async eth_signTypedData_v4(e,t){const s=B.Address.from(e).toString().toLowerCase(),r=d(this,c,"f").unlockedAccounts.get(s);if(null==r)throw new Error("cannot sign data; no private key");if("string"==typeof t)throw new Error("cannot sign data; string sent, expected object");if(!t.types)throw new Error("cannot sign data; types missing");if(!t.types.EIP712Domain)throw new Error("cannot sign data; EIP712Domain definition missing");if(!t.domain)throw new Error("cannot sign data; domain missing");if(!t.primaryType)throw new Error("cannot sign data; primaryType missing");if(!t.message)throw new Error("cannot sign data; message missing");return(0,b.signTypedData_v4)(r.toBuffer(),{data:t})}eth_subscribe(e,t){const s=d(this,i,"f");switch(e){case"newHeads":{const e=d(this,r,"f").call(this),t=y.PromiEvent.resolve(e),n=d(this,a,"f").on("block",(s=>{const r=s.header,n={logsBloom:r.logsBloom,miner:r.miner,difficulty:r.difficulty,totalDifficulty:r.totalDifficulty,extraData:r.extraData,gasLimit:r.gasLimit,gasUsed:r.gasUsed,hash:s.hash(),mixHash:s.header.mixHash,nonce:r.nonce,number:r.number,parentHash:r.parentHash,receiptsRoot:r.receiptsRoot,stateRoot:r.stateRoot,timestamp:r.timestamp,transactionsRoot:r.transactionsRoot,sha3Uncles:r.sha3Uncles};void 0!==r.baseFeePerGas&&(n.baseFeePerGas=r.baseFeePerGas),void 0!==r.withdrawalsRoot&&(n.withdrawalsRoot=r.withdrawalsRoot),t.emit("message",{type:"eth_subscription",data:{result:n,subscription:e.toString()}})}));return s.set(e.toString(),n),t}case"logs":{const e=d(this,r,"f").call(this),n=y.PromiEvent.resolve(e),{addresses:i,topics:o}=t?(0,k.parseFilterDetails)(t):{addresses:[],topics:[]},c=d(this,a,"f").on("blockLogs",(t=>{for(const s of t.filter(i,o))n.emit("message",{type:"eth_subscription",data:{result:s,subscription:e.toString()}})}));return s.set(e.toString(),c),n}case"newPendingTransactions":{const e=d(this,r,"f").call(this),t=y.PromiEvent.resolve(e),n=d(this,a,"f").on("pendingTransaction",(s=>{const r=s.hash.toString();t.emit("message",{type:"eth_subscription",data:{result:r,subscription:e.toString()}})}));return s.set(e.toString(),n),t}case"syncing":{const e=d(this,r,"f").call(this),t=y.PromiEvent.resolve(e);return d(this,i,"f").set(e.toString(),(()=>{})),t}default:throw new h.CodedError(`no "${e}" subscription in eth namespace`,y.JsonRpcErrorCode.METHOD_NOT_FOUND)}}async eth_unsubscribe(e){const t=d(this,i,"f"),s=t.get(e);return!!s&&(t.delete(e),s(),!0)}async eth_newBlockFilter(){const e={updates:[],unsubscribe:d(this,a,"f").on("block",(t=>{e.updates.push(t.hash())})),filter:null,type:h.FilterTypes.block},t=d(this,r,"f").call(this);return d(this,n,"f").set(t.toString(),e),t}async eth_newPendingTransactionFilter(){const e={updates:[],unsubscribe:d(this,a,"f").on("pendingTransaction",(t=>{e.updates.push(t.hash)})),filter:null,type:h.FilterTypes.pendingTransaction},t=d(this,r,"f").call(this);return d(this,n,"f").set(t.toString(),e),t}async eth_newFilter(e){const t=d(this,a,"f");null==e&&(e={});const{addresses:s,topics:i}=(0,k.parseFilterDetails)(e||{}),o={updates:[],unsubscribe:t.on("blockLogs",(r=>{const n=r.blockNumber,{fromBlock:a,toBlock:c}=(0,k.parseFilterRange)(e,t);a<=n&&c>=n&&o.updates.push(...r.filter(s,i))})),filter:e,type:h.FilterTypes.log},c=d(this,r,"f").call(this);return d(this,n,"f").set(c.toString(),o),c}async eth_getFilterChanges(e){const t=d(this,n,"f").get(y.Quantity.toString(e));if(t){const e=t.updates;return t.updates=[],e}throw new Error("filter not found")}async eth_uninstallFilter(e){const t=y.Quantity.toString(e),s=d(this,n,"f").get(t);return!!s&&(s.unsubscribe(),d(this,n,"f").delete(t))}async eth_getFilterLogs(e){const t=d(this,n,"f").get(y.Quantity.toString(e));if(t&&t.type===h.FilterTypes.log)return this.eth_getLogs(t.filter);throw new Error("filter not found")}async eth_getLogs(e){return d(this,a,"f").blockLogs.getLogs(e)}async eth_getTransactionCount(e,t=h.Tag.latest){return d(this,a,"f").accounts.getNonce(B.Address.from(e),t)}async eth_call(e,t=h.Tag.latest,s={}){const r=d(this,a,"f"),n=r.common,i=r.blocks,c=await i.get(t),l=c.header,u=d(this,o,"f");let f,p;f=void 0===e.gasLimit?void 0!==e.gas?y.Quantity.from(e.gas):u.miner.callGasLimit:y.Quantity.from(e.gasLimit),void 0===e.data?void 0!==e.input&&(p=y.Data.from(e.input)):p=y.Data.from(e.data);const b=c.header.baseFeePerGas?c.header.baseFeePerGas.toBigInt():void 0;let w;const v=void 0!==e.gasPrice;if(n.isActivatedEIP(1559)&&void 0!==b){const t=void 0!==e.maxFeePerGas,s=void 0!==e.maxPriorityFeePerGas;if(v&&(t||s))throw new Error("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified");let r=0n,n=0n;if(t&&(r=BigInt(e.maxFeePerGas)),s&&(n=BigInt(e.maxPriorityFeePerGas)),n>0||r>0){const e=r-b,t=e<n?e:n;w=y.Quantity.from(b+t)}else w=y.Quantity.from(0)}else w=y.Quantity.from(v?0:e.gasPrice);const _=new g.RuntimeBlock(r.common,l.number,l.parentHash,r.coinbase,f,l.gasUsed,l.timestamp,u.miner.difficulty,l.totalDifficulty,r.getMixHash(l.parentHash.toBuffer()),b,m.KECCAK256_RLP),k={gas:f,from:null==e.from?r.coinbase:B.Address.from(e.from),to:null==e.to?null:B.Address.from(e.to),gasPrice:w,value:null==e.value?null:y.Quantity.from(e.value),data:p,block:_};return r.simulateTransaction(k,c,s)}async eth_feeHistory(e,t,s){const r=d(this,a,"f"),n=BigInt(1e16),i=r.blocks.getEffectiveNumber(t).toBigInt(),o=Number((0,y.min)((0,y.max)(y.Quantity.toBigInt(e),1),i+1n,1024)),c=new Array(o),l=new Array(o);let u;if(s.length>0){const e="invalid reward percentile: percentiles must be unique and in ascending order";if(s[0]<0)throw new Error(`${e} ${s[0]}`);if(s[s.length-1]>100)throw new Error(`${e} ${s[s.length-1]}`);for(let t=1;t<s.length;t++)if(s[t]<=s[t-1])throw new Error(`${e} ${s[t]} ${s[t-1]}`);u=new Array(o)}const f=i-BigInt(o-1);let h,p=0;for(;p<o;){h=await r.blocks.get(y.Quantity.toBuffer(f+BigInt(p))),c[p]=h.header.baseFeePerGas;const e=h.header.gasUsed.toBigInt(),t=h.header.gasLimit.toBigInt();if(l[p]=e===t?1:Number(`0.${(e*n/t).toString().padStart(16,"0")}`),void 0!==u){const t=h.getTransactions();if(0===t.length)u[p]=s.map((()=>y.Quantity.Zero));else{const i=c[p].toBigInt(),o=await Promise.all(t.map((e=>r.transactionReceipts.get(e.hash.toBuffer())))),a=t.map(((e,t)=>{let s;if("maxPriorityFeePerGas"in e){const t=e.maxPriorityFeePerGas.toBigInt();s=BigInt((0,y.min)(e.maxFeePerGas.toBigInt()-i,t))}else s=e.gasPrice.toBigInt()-i;return{effectiveGasReward:s,gasUsed:y.Quantity.toBigInt(o[t].gasUsed)}})).sort(((e,t)=>e.effectiveGasReward>t.effectiveGasReward?1:e.effectiveGasReward<t.effectiveGasReward?-1:0));u[p]=s.map((t=>{let s=0n;const r=e*BigInt(1e14*t)/n;for(const e of a)if(s+=e.gasUsed,r<=s)return y.Quantity.from(e.effectiveGasReward)}))}}p++}return c[o]=y.Quantity.from(g.Block.calcNextBaseFee(h)),{oldestBlock:y.Quantity.from(f),baseFeePerGas:c,gasUsedRatio:l,reward:u}}async debug_traceTransaction(e,t={}){return d(this,a,"f").traceTransaction(e,t)}async debug_storageRangeAt(e,t,s,r,n){const i=d(this,a,"f");if(i.fallback)throw new Error("debug_storageRangeAt is not supported on a forked network. See https://github.com/trufflesuite/ganache/issues/3488 for details.");return i.storageRangeAt(e,y.Quantity.toNumber(t),s,r,y.Quantity.toNumber(n))}async personal_listAccounts(){return d(this,c,"f").addresses}async personal_newAccount(e){if("string"!=typeof e)throw new Error("missing value for required argument `passphrase`");const t=d(this,c,"f"),s=t.createRandomAccount(),r=s.address,n=r.toString();return await t.addToKeyFile(r,s.privateKey,e,!0),t.addresses.push(n),t.knownAccounts.add(n),s.address}async personal_importRawKey(e,t){if("string"!=typeof t)throw new Error("missing value for required argument `passphrase`");const s=d(this,c,"f"),r=w.default.createAccountFromPrivateKey(y.Data.from(e)),n=r.address,i=n.toString();return await s.addToKeyFile(n,r.privateKey,t,!0),s.addresses.push(i),s.knownAccounts.add(i),r.address}async personal_lockAccount(e){return d(this,c,"f").lockAccount(e.toLowerCase())}async personal_unlockAccount(e,t,s=300){const r=B.Address.from(e);return d(this,c,"f").unlockAccount(r,t,s)}async personal_sendTransaction(e,t){const s=d(this,a,"f"),r=p.TransactionFactory.fromRpc(e,s.common);if(null==r.from)throw new Error("from not found; is required");const n=d(this,c,"f"),i=await n.getFromKeyFile(r.from,t);return await autofillDefaultTransactionValues(r,this.eth_estimateGas.bind(this),this.eth_maxPriorityFeePerGas,e,s,d(this,o,"f")),s.queueTransaction(r,y.Data.from(i))}async personal_signTransaction(e,t){const s=d(this,a,"f"),r=p.TransactionFactory.fromRpc(e,s.common);if(null==r.from)throw new Error("from not found; is required");const n=d(this,c,"f"),i=await n.getFromKeyFile(r.from,t);return r.signAndHash(i),y.Data.from(r.serialized)}async rpc_modules(){return S}async shh_newIdentity(){return"0x00"}async shh_hasIdentity(e){return!1}async shh_newGroup(){return"0x00"}async shh_addToGroup(e){return!1}async shh_newFilter(e,t){return!1}async shh_uninstallFilter(e){return!1}async shh_getFilterChanges(e){return[]}async shh_getMessages(e){return!1}async shh_post(e){return!1}async shh_version(){return"2"}async txpool_content(){const{transactions:e,common:t}=d(this,a,"f"),{transactionPool:{executables:s,origins:r}}=e,processMap=e=>{let s={};for(let[r,{array:n,length:i}]of e)for(let e=0;e<i;++e){const r=n[e],i=r.from.toString();void 0===s[i]&&(s[i]={});const o=r.nonce.toBigInt().toString();s[i][o]=r.toJSON(t)}return s};return{pending:processMap(s.pending),queued:processMap(r)}}}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,t.default=EthereumApi,l([(0,_.assertArgLength)(3)],EthereumApi.prototype,"db_putString",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"db_getString",null),l([(0,_.assertArgLength)(3)],EthereumApi.prototype,"db_putHex",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"db_getHex",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"bzz_hive",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"bzz_info",null),l([(0,_.assertArgLength)(0,1)],EthereumApi.prototype,"evm_mine",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"evm_setAccountNonce",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"evm_setAccountBalance",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"evm_setAccountCode",null),l([(0,_.assertArgLength)(3)],EthereumApi.prototype,"evm_setAccountStorageAt",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"evm_increaseTime",null),l([(0,_.assertArgLength)(0,1)],EthereumApi.prototype,"evm_setTime",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"evm_revert",null),l([(0,_.assertArgLength)(0,1)],EthereumApi.prototype,"miner_start",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"miner_stop",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"miner_setGasPrice",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"miner_setEtherbase",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"miner_setExtra",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"web3_clientVersion",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"web3_sha3",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"net_version",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"net_listening",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"net_peerCount",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"eth_estimateGas",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_protocolVersion",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_syncing",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_coinbase",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"eth_getBlockByNumber",null),l([(0,_.assertArgLength)(2,3)],EthereumApi.prototype,"eth_getProof",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"eth_getBlockByHash",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getBlockTransactionCountByNumber",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getBlockTransactionCountByHash",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_getCompilers",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_getTransactionByBlockHashAndIndex",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_getTransactionByBlockNumberAndIndex",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getUncleCountByBlockHash",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getUncleCountByBlockNumber",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_getUncleByBlockHashAndIndex",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_getUncleByBlockNumberAndIndex",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_getWork",null),l([(0,_.assertArgLength)(3)],EthereumApi.prototype,"eth_submitWork",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_submitHashrate",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_mining",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_hashrate",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_gasPrice",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_maxPriorityFeePerGas",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_accounts",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_blockNumber",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_chainId",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"eth_getBalance",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"eth_getCode",null),l([(0,_.assertArgLength)(2,3)],EthereumApi.prototype,"eth_getStorageAt",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getTransactionByHash",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getTransactionReceipt",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_sendTransaction",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_signTransaction",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_sendRawTransaction",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_sign",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_signTypedData",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"eth_signTypedData_v4",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"eth_subscribe",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_unsubscribe",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_newBlockFilter",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"eth_newPendingTransactionFilter",null),l([(0,_.assertArgLength)(0,1)],EthereumApi.prototype,"eth_newFilter",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getFilterChanges",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_uninstallFilter",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getFilterLogs",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"eth_getLogs",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"eth_getTransactionCount",null),l([(0,_.assertArgLength)(1,3)],EthereumApi.prototype,"eth_call",null),l([(0,_.assertArgLength)(3)],EthereumApi.prototype,"eth_feeHistory",null),l([(0,_.assertArgLength)(1,2)],EthereumApi.prototype,"debug_traceTransaction",null),l([(0,_.assertArgLength)(5)],EthereumApi.prototype,"debug_storageRangeAt",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"personal_listAccounts",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"personal_newAccount",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"personal_importRawKey",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"personal_lockAccount",null),l([(0,_.assertArgLength)(2,3)],EthereumApi.prototype,"personal_unlockAccount",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"personal_sendTransaction",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"personal_signTransaction",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"rpc_modules",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"shh_newIdentity",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"shh_hasIdentity",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"shh_newGroup",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"shh_addToGroup",null),l([(0,_.assertArgLength)(2)],EthereumApi.prototype,"shh_newFilter",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"shh_uninstallFilter",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"shh_getFilterChanges",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"shh_getMessages",null),l([(0,_.assertArgLength)(1)],EthereumApi.prototype,"shh_post",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"shh_version",null),l([(0,_.assertArgLength)(0)],EthereumApi.prototype,"txpool_content",null)},224:function(e,t,s){"use strict";var r,n,i,o,a,c,l,u,d,f,h,g,p,m,b,y,w,v,_,k,E,B,P,T=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),O=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&T(t,e,s);return A(t,e),t},S=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},I=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},R=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Status=void 0;const D=s(18),C=O(s(135)),F=R(s(238)),x=R(s(29)),N=s(3),M=s(12),L=s(0),j=s(7),G=s(239),z=s(428),Q=s(1),U=R(s(260)),H=R(s(137)),W=R(s(240)),K=R(s(241)),q=s(11),V=s(23),$=s(39),J=s(805),Z=s(806),Y=s(433),X=s(244),ee=s(808),te=R(s(245)),se=s(390),re=R(s(434)),ne=s(391),ie=s(809),oe=s(432),ae=s(437),ce=re.default.init(re.default.BLS12_381).then((()=>{re.default.setMapToMode(re.default.IRTF),re.default.verifyOrderG1(!0),re.default.verifyOrderG2(!0)}));var le;function makeTrie(e,t,s){return e.fallback?new X.ForkTrie(t,s?s.toBuffer():null,e):new Y.GanacheTrie(t,s?s.toBuffer():null,e)}!function(e){e[e.started=1]="started",e[e.starting=2]="starting",e[e.stopped=4]="stopped",e[e.stopping=8]="stopping",e[e.paused=16]="paused"}(le||(t.Status=le={}));class Blockchain extends x.default{constructor(e,t,s){super(),r.set(this,le.starting),n.set(this,void 0),i.set(this,void 0),o.set(this,null),a.set(this,!1),c.set(this,void 0),l.set(this,void 0),u.set(this,void 0),d.set(this,(({block:e,serialized:t,storageKeys:s,transactions:r})=>{const{blocks:n}=this;return n.latest=e,I(this,c,"f").batch((()=>{const i=e.hash(),o=e.header,a=o.number,c=a.toBuffer(),u=N.BlockLogs.create(i),d=o.timestamp,f=new Date(1e3*d.toNumber()).toString(),g=[];return r.forEach(((e,t)=>{const s=e.hash.toBuffer(),r=Q.Quantity.from(t),n=(0,V.serializeForDb)(e,i,a,r);this.transactions.set(s,n);const c=e.getReceipt(),l=c.serialize(!0);this.transactionReceipts.set(s,l),e.getLogs().forEach(u.append.bind(u,r,e.hash)),g.push(I(this,h,"f").call(this,s,c,o.number,f,e.execException))})),s.forEach((e=>{this.storageKeys.put(e.hashedKey,e.key)})),u.blockNumber=o.number,this.blockLogs.set(c,u.serialize()),n.putBlock(c,i,t),n.updateLatestIndex(c),g.length>0&&I(this,l,"f").logging.logger.log(g.join(D.EOL)),{block:e,blockLogs:u,transactions:r}}))})),f.set(this,(async e=>{const t=I(this,l,"f"),{block:s,blockLogs:r,transactions:n}=e;return n.forEach((e=>{e.finalize("confirmed",e.execException)})),"eager"===t.miner.instamine?await new Promise((e=>{setImmediate((async()=>{await Promise.all([this.emit("blockLogs",r),this.emit("block",s)]),e(void 0)}))})):await Promise.all([this.emit("blockLogs",r),this.emit("block",s)]),e})),h.set(this,((e,t,s,r,n)=>{let i=`${D.EOL} Transaction: ${Q.Data.from(e)}${D.EOL}`;const o=t.contractAddress;return null!=o&&(i+=` Contract created: ${q.Address.from(o)}${D.EOL}`),i+=` Gas usage: ${Q.Quantity.toNumber(t.raw[1])}\n Block number: ${s.toNumber()}\n Block time: ${r}${D.EOL}`,n&&(i+=` Runtime error: ${n.data.message}${D.EOL}`,n.data.reason&&(i+=` Revert reason: ${n.data.reason}${D.EOL}`)),i})),g.set(this,(async e=>{S(this,i,I(this,i,"f").then((()=>{const t=I(this,d,"f").call(this,e);return t.then(I(this,f,"f")),t})),"f"),await I(this,i,"f")})),p.set(this,((e,t)=>{const s=e.header,r=s.number.toBigInt()||0n,n=I(this,l,"f").miner;return null==t&&(t=I(this,v,"f").call(this,s.timestamp)),new $.RuntimeBlock(this.common,Q.Quantity.from(r+1n),e.hash(),this.coinbase,n.blockGasLimit,Q.Quantity.Zero,Q.Quantity.from(t),this.isPostMerge?Q.Quantity.Zero:n.difficulty,s.totalDifficulty,this.getMixHash(e.hash().toBuffer()),$.Block.calcNextBaseFee(e),L.KECCAK256_RLP)})),this.isStarted=()=>I(this,r,"f")===le.started,this.mine=async(e,t=!1,s)=>{const r=I(this,p,"f").call(this,this.blocks.latest,s),o=await I(this,n,"f").mine(r,e,t);return await I(this,i,"f"),"clock"!==I(this,l,"f").miner.timestampIncrement?S(this,w,0,"f"):void 0!==s&&this.setTimeDiff(1e3*s),{transactions:o,blockNumber:r.header.number}},m.set(this,(()=>0!=(I(this,r,"f")&le.paused))),this.createVmFromStateTrie=async(e,t,s,r)=>{const n=this.blocks,i={getBlock:async e=>{const t=await n.get(Q.Quantity.toBuffer(e)).catch((e=>null));return t?{hash:()=>t.hash().toBuffer()}:null},copy:()=>i};r=r||this.common;const o=this.fallback?new Z.ForkStateManager({trie:e,prefixCodeHashes:!1}):new oe.GanacheStateManager({trie:e,prefixCodeHashes:!1}),a=new G.EEI(o,r,i),c=new z.EVM({common:r,allowUnlimitedContractSize:t,eei:a}),l=await G.VM.create({activatePrecompiles:!1,common:r,blockchain:i,stateManager:o,evm:c});return s&&(await(0,ee.activatePrecompiles)(l.eei),r.isActivatedEIP(2537)&&await ce),l},b.set(this,(e=>Promise.all(e.map((e=>this.trie.put(e.address.toBuffer(),e.serialize())))))),y.set(this,(async(e,t,s)=>{if(null!=this.fallback){const{block:r}=this.fallback,{miner:n}=I(this,l,"f"),i=this.vm.stateManager;let o;await i.checkpoint(),s.forEach((e=>{this.vm.eei.putAccount(e.address,e)})),await i.commit(),this.common.isActivatedEIP(1559)&&(o=void 0===r.header.baseFeePerGas?$.Block.INITIAL_BASE_FEE_PER_GAS:r.header.baseFeePerGas.toBigInt());const a=new $.RuntimeBlock(this.common,Q.Quantity.from(r.header.number.toBigInt()+1n),r.hash(),this.coinbase,t,Q.Quantity.Zero,Q.Quantity.from(e),this.isPostMerge?Q.Quantity.Zero:n.difficulty,r.header.totalDifficulty,this.getMixHash(r.hash().toBuffer()),o,L.KECCAK256_RLP),{block:c,serialized:u}=a.finalize(L.KECCAK256_RLP,L.KECCAK256_RLP,Q.BUFFER_256_ZERO,this.trie.root(),0n,n.extraData,[],new Map),d=c.hash();return this.blocks.putBlock(c.header.number.toBuffer(),d,u).then((e=>({block:c,blockLogs:N.BlockLogs.create(d)})))}await I(this,b,"f").call(this,s);const r=Q.Quantity.Empty,n=this.common.isActivatedEIP(1559)?$.Block.INITIAL_BASE_FEE_PER_GAS:void 0,i=new $.RuntimeBlock(this.common,r,Q.Data.from(Q.BUFFER_32_ZERO),this.coinbase,t,Q.Quantity.Zero,Q.Quantity.from(e),this.isPostMerge?Q.Quantity.Zero:I(this,l,"f").miner.difficulty,Q.Quantity.Zero,this.isPostMerge?(0,Q.keccak)(this.trie.root()):Q.BUFFER_32_ZERO,n,L.KECCAK256_RLP),{block:o,serialized:a}=i.finalize(L.KECCAK256_RLP,L.KECCAK256_RLP,Q.BUFFER_256_ZERO,this.trie.root(),0n,I(this,l,"f").miner.extraData,[],new Map);o.header.number=Q.Quantity.Zero;const c=o.hash();return this.blocks.putBlock(o.header.number.toBuffer(),c,a).then((e=>({block:o,blockLogs:N.BlockLogs.create(c)})))})),w.set(this,0),v.set(this,(e=>{const t=I(this,w,"f"),s=I(this,l,"f").miner.timestampIncrement;return"clock"===s?Math.floor((Date.now()+t)/1e3):e.toNumber()+Math.floor(t/1e3)+s.toNumber()})),_.set(this,(async(e,t)=>{"revertMetaData"in this.trie&&await this.trie.revertMetaData(e[e.length-1].header.number,e[0].header.number),await I(this,c,"f").batch((()=>{const{blocks:s,transactions:r,transactionReceipts:n,blockLogs:i}=this;s.updateLatestIndex(t),e.forEach((e=>{e.getTransactions().forEach((e=>{const t=e.hash.toBuffer();r.del(t),n.del(t)}));const t=e.header.number.toBuffer();s.del(t),s.del(e.hash().toBuffer()),i.del(t)}))}))})),k.set(this,{snaps:[],blocks:null,unsubscribeFromBlocks:null}),E.set(this,(async(e,t,s)=>{const r=this.blocks,n={getBlock:async e=>{const t=await r.get(Q.Quantity.toBuffer(e)).catch((e=>null));return t?{hash:()=>t.hash().toBuffer()}:null}},i=this.fallback?this.fallback.getCommonForBlock(this.common,s.header):this.common,o=this.fallback?new Z.ForkStateManager({trie:t,prefixCodeHashes:!1}):new oe.GanacheStateManager({trie:t,prefixCodeHashes:!1}),a=new G.EEI(o,i,n),c=new z.EVM({common:i,allowUnlimitedContractSize:I(this,l,"f").chain.allowUnlimitedContractSize,eei:a}),u=await G.VM.create({activatePrecompiles:!1,common:i,blockchain:n,stateManager:o,evm:c});u.stateManager._cache.flush=async()=>{},await u.stateManager.checkpoint();for(let t=0;t<e;t++){const e=s.transactions[t],r={};this.emit("ganache:vm:tx:before",{context:r}),await u.runTx({skipHardForkValidation:!0,skipNonce:!0,skipBalance:!0,skipBlockGasLimitValidation:!0,tx:e,block:s}),this.emit("ganache:vm:tx:after",{context:r})}return u})),B.set(this,(async(e,t,s,r)=>{const n=await I(this,E,"f").call(this,e,t,s);let i=-1;const o=[];let c=0n;const l=[],u=(0,N.TraceDataFactory)(),d=s.transactions[e],f={},stepListener=async(e,t)=>{I(this,a,"f")&&this.emit("ganache:vm:tx:step",(0,se.makeStepEvent)(f,e));const s=e.gasLeft,h=d.gasLimit-s-c;let g;if(c+=h,!0===r.disableMemory)g=[];else{const t=Number(e.memoryWordCount);g=Array(t);let s=0;for(;s<t;){const t=32*s,r=e.memory.subarray(t,t+32);g[s++]=u.from(r)}}const p=[];if(!0!==r.disableStack)for(const t of e.stack)p.push(u.from(Q.Quantity.toBuffer(t)));const m={depth:e.depth+1,error:"",gas:Q.Quantity.from(s),gasCost:0,memory:g,op:e.opcode.name,pc:e.pc,stack:p,storage:null};if(l.length&&(l[l.length-1].gasCost=Number(h)),!0===r.disableStorage)l.push(m),t();else{const{depth:s}=e;switch(i>s?o.pop():i<s&&o.push(new N.TraceStorageMap),i=s,e.opcode.name){case"SSTORE":{const e=p[p.length-1],r=p[p.length-2];m.storage=new N.TraceStorageMap(o[s]),l.push(m),t(),o[s].set(e,r);break}case"SLOAD":{const r=p[p.length-1],i=await n.stateManager.getContractStorage(e.address,r.toBuffer()),a=u.from(i);o[s].set(r,a),m.storage=new N.TraceStorageMap(o[s]),l.push(m),t();break}default:m.storage=new N.TraceStorageMap(o[s]),l.push(m),t()}}};return n.evm.events.on("step",stepListener),this.emit("ganache:vm:tx:before",{context:f}),await n.runTx({skipHardForkValidation:!0,skipNonce:!0,skipBalance:!0,skipBlockGasLimitValidation:!0,tx:d,block:s}),this.emit("ganache:vm:tx:after",{context:f}),n.evm.events.removeListener("step",stepListener),{gas:Q.Quantity.from(c),structLogs:l,returnValue:"",storage:{}}})),P.set(this,((e,t,s)=>{e.header.parentHash;const r=new $.RuntimeBlock(this.common,Q.Quantity.from((t.header.number.toBigInt()||0n)+1n),t.hash(),q.Address.from(t.header.miner.toString()),t.header.gasLimit,Q.Quantity.Zero,e.header.timestamp,this.isPostMerge?Q.Quantity.Zero:I(this,l,"f").miner.difficulty,t.header.totalDifficulty,this.getMixHash(t.hash().toBuffer()),$.Block.calcNextBaseFee(t),L.KECCAK256_RLP);r.transactions=[],r.uncleHeaders=[];const n=e.getTransactions();for(let e=0;e<=s;e++){const t=n[e];r.transactions.push(t.toVmTransaction())}return r})),S(this,l,e,"f"),this.fallback=s,this.coinbase=t,S(this,u,!e.miner.blockTime||e.miner.blockTime<=0,"f"),S(this,c,new F.default(e,this),"f")}async initialize(e){const t=I(this,c,"f"),s=I(this,l,"f"),d=I(this,u,"f");try{let r;this.fallback?(await this.fallback.initialize(),await t.initialize(),r=this.common=this.fallback.common,s.fork.blockNumber=this.fallback.blockNumber.toNumber(),s.chain.networkId=Number(r.networkId()),s.chain.chainId=Number(r.chainId())):(await t.initialize(),r=this.common=function createCommon(e,t,s){const r=j.Common.custom({name:"ganache",networkId:t,chainId:e,comment:"Local test network",defaultHardfork:s},{baseChain:Q.KNOWN_CHAINIDS.has(e)?e:1});return r.on=()=>{},r}(s.chain.chainId,s.chain.networkId,s.chain.hardfork),s.chain.allowUnlimitedInitCodeSize&&(0,ae.removeEIP3860InitCodeSizeLimitCheck)(r)),this.isPostMerge=this.common.gteHardfork("merge");const c=this.blocks=await H.default.initialize(this,r,t.blockIndexes,t.blocks);this.blockLogs=new W.default(t.blockLogs,this),this.transactions=new K.default(s,r,this,t.transactions),this.transactionReceipts=new te.default(t.transactionReceipts,this),this.accounts=new U.default(this),this.storageKeys=t.storageKeys;const{latest:l}=c;{let e;l?(S(this,i,Promise.resolve({block:l,blockLogs:null}),"f"),({stateRoot:e}=l.header)):e=null,this.trie=makeTrie(this,t.trie,e)}this.vm=await this.createVmFromStateTrie(this.trie,s.chain.allowUnlimitedContractSize,!0);{const t=new Date;null==s.chain.time&&(s.chain.time=t);const r=s.chain.time.getTime(),n=Math.floor(r/1e3);"clock"===s.miner.timestampIncrement&&S(this,w,r-+t,"f"),l||(e.length>0&&await I(this,b,"f").call(this,e),S(this,i,I(this,y,"f").call(this,n,s.miner.blockGasLimit,e),"f"),c.latest=await I(this,i,"f").then((({block:e})=>e)),c.earliest||(c.earliest=c.latest))}{const e=this.transactions.transactionPool,t=s.miner,r=S(this,n,new C.default(t,e.executables,this.vm,I(this,p,"f")),"f");r.on("ganache:vm:tx:before",(e=>{this.emit("ganache:vm:tx:before",e)})),r.on("ganache:vm:tx:step",(e=>{I(this,a,"f")&&this.emit("ganache:vm:tx:step",e)})),r.on("ganache:vm:tx:after",(e=>{this.emit("ganache:vm:tx:after",e)})),r.on("ganache:vm:tx:console.log",(e=>{s.logging.logger.log(...e.logs),this.emit("ganache:vm:tx:console.log",e)}));const i=Promise.resolve(null),mineAll=(e,t)=>I(this,m,"f").call(this)?i:this.mine(e,t);if(d)e.on("drain",mineAll.bind(null,C.Capacity.Single));else{const wait=()=>S(this,o,setTimeout(next,1e3*t.blockTime),"f"),next=()=>{mineAll(C.Capacity.FillBlock,!0).then(wait)};wait()}r.on("block",I(this,g,"f")),this.once("stop").then((()=>r.clearListeners()))}}catch(e){throw S(this,r,le.stopping,"f"),await this.stop().catch((e=>{})),e}S(this,r,le.started,"f"),this.emit("ready")}getMixHash(e){return this.isPostMerge?(0,Q.keccak)(e):Q.BUFFER_32_ZERO}pause(){S(this,r,I(this,r,"f")|le.paused,"f")}resume(e=1){if(I(this,m,"f").call(this))return S(this,r,I(this,r,"f")^le.paused,"f"),I(this,u,"f")?this.mine(C.Capacity.FillBlock):void 0;I(this,l,"f").logging.logger.log("Warning: startMining called when miner was already started")}increaseTime(e){return e<0&&(e=0),S(this,w,I(this,w,"f")+e,"f")}setTimeDiff(e){const t="clock"===I(this,l,"f").miner.timestampIncrement?Date.now():1e3*this.blocks.latest.header.timestamp.toNumber();return S(this,w,e-t,"f")}snapshot(){const e=I(this,k,"f"),t=e.snaps.push({block:this.blocks.latest,timeAdjustment:I(this,w,"f")});return 1===t&&(e.unsubscribeFromBlocks=this.on("block",(t=>{e.blocks={current:t.hash().toBuffer(),next:e.blocks}}))),I(this,l,"f").logging.logger.log("Saved snapshot #"+t),t}async revert(e){if(e.isNull())throw new Error("invalid snapshotId");const t=e.toBigInt();I(this,l,"f").logging.logger.log("Reverting to snapshot #"+e);const s=I(this,k,"f"),r=s.snaps,o=Number(t-1n),a=r[o];if(!a)return!1;await this.transactions.pause(),await I(this,n,"f").pause(),await I(this,i,"f"),this.transactions.clear();const c=this.blocks,u=c.latest.hash().toBuffer(),d=a.block,f=d.header,h=d.hash().toBuffer();if(r.splice(o),0===r.length&&s.unsubscribeFromBlocks(),!u.equals(h)){const e=[];let t=s.blocks;for(;null!==t&&!t.current.equals(h);)e.push(c.getByHash(t.current)),t=t.next;s.blocks=t;const r=await Promise.all(e);await I(this,_,"f").call(this,r,f.number.toBuffer()),function setStateRootSync(e,t){e._trie.root(t),e._cache.clear(),e._storageTries={}}(this.vm.stateManager,f.stateRoot.toBuffer()),c.latest=d}return S(this,w,a.timeAdjustment,"f"),I(this,n,"f").resume(),this.transactions.resume(),!0}async queueTransaction(e,t){const s=!0===await this.transactions.add(e,t);s&&process.nextTick(this.emit.bind(this),"pendingTransaction",e);const{hash:r}=e,n=I(this,u,"f");if(!n||I(this,m,"f").call(this))return r;{const t=I(this,l,"f");if(n&&"eager"===t.miner.instamine){s||t.logging.logger.log(`Transaction "${r}" has a too-high nonce; this transaction has been added to the pool, and will be processed when its nonce is reached. See https://github.com/trufflesuite/ganache/issues/4165 for more information.`);const{status:n,error:i}=await e.once("finalized");if(i&&("rejected"===n||t.chain.vmErrorsOnRPCResponse))throw i}return r}}async simulateTransaction(e,t,s){let r;const n=e.data;let i=e.gas.toBigInt();const o=null!=e.to,c=o?new q.Address(e.to.toBuffer()):null,u=this.fallback?this.fallback.getCommonForBlock(this.common,e.block.header):this.common,d=i-(0,V.calculateIntrinsicGas)(n,o,u),f={};if(this.emit("ganache:vm:tx:before",{context:f}),d>=0n){const n=this.trie.copy(!1);n.setContext(t.header.stateRoot.toBuffer(),null,t.header.number);const o=I(this,l,"f"),h=await this.createVmFromStateTrie(n,o.chain.allowUnlimitedContractSize,!1,u);await h.eei.checkpoint(),h.evm.events.on("step",(e=>{const t=(0,ne.maybeGetLogs)(e);if(t&&(o.logging.logger.log(...t),this.emit("ganache:vm:tx:console.log",{context:f,logs:t})),!I(this,a,"f"))return;const s=(0,se.makeStepEvent)(f,e);this.emit("ganache:vm:tx:step",s)}));const g=e.from.toBuffer(),p=new q.Address(g);if(u.isActivatedEIP(2929)){const t=h.eei;(0,ee.warmPrecompiles)(t),t.addWarmedAddress(g),c&&t.addWarmedAddress(c.buf),u.isActivatedEIP(3651)&&t.addWarmedAddress(e.block.header.coinbase.buf)}await(0,J.applySimulationOverrides)(n,h,s);const m=await h.eei.getAccount(p);m.nonce+=1n;const b=i*e.gasPrice.toBigInt(),y=m.balance;m.balance=b>y?0n:y-b,await h.eei.putAccount(p,m),r=await h.evm.runCall({caller:p,data:e.data&&e.data.toBuffer(),gasPrice:e.gasPrice.toBigInt(),gasLimit:d,to:c,value:null==e.value?0n:e.value.toBigInt(),block:e.block})}else r={execResult:{runState:{programCounter:0},exceptionError:new z.EvmError(z.EvmErrorMessage.OUT_OF_GAS),returnValue:Q.BUFFER_EMPTY}};if(this.emit("ganache:vm:tx:after",{context:f}),r.execResult.exceptionError)throw new N.CallError(r);return Q.Data.from(r.execResult.returnValue||"0x")}async traceTransaction(e,t){const s=Q.Data.toBuffer(e),r=await this.transactions.get(s);if(!r)throw new Error("Unknown transaction "+e);const n=await this.blocks.getByHash(r.blockHash.toBuffer()),i=await this.blocks.getByHash(n.header.parentHash.toBuffer()),o=r.index.toNumber(),a=I(this,P,"f").call(this,n,i,o),c=this.trie.copy();c.setContext(i.header.stateRoot.toBuffer(),null,i.header.number);const{gas:l,structLogs:u,returnValue:d,storage:f}=await I(this,B,"f").call(this,o,c,a,t);return{gas:l,structLogs:u,returnValue:d,storage:f}}async storageRangeAt(e,t,s,r,n){const i=await this.blocks.getByHash(e);if(!i.getTransactions()[t])throw new Error(`transaction index ${t} is out of range for block ${e}`);const o=await this.blocks.getByHash(i.header.parentHash.toBuffer()),{trie:a,storageKeys:l}=I(this,c,"f"),u=makeTrie(this,a,o.header.stateRoot),d=q.Address.toBuffer(s),f=await u.get(d);if(!f)throw new Error(`account ${s} doesn't exist`);let h;if(0===t){const[,,e]=(0,M.decode)(f);u.setContext(e,d,o.header.number),h=u}else{const e=I(this,P,"f").call(this,i,o,t),s=await I(this,E,"f").call(this,t,u,e);h=await s.stateManager.getStorageTrie(d)}return await(0,ie.dumpTrieStorageDetails)(Q.Data.toBuffer(r),n,h,l)}toggleStepEvent(e){S(this,a,e,"f"),I(this,n,"f").toggleStepEvent(e)}async stop(){I(this,r,"f")===le.starting&&await this.once("ready"),S(this,r,le.stopping,"f"),clearTimeout(I(this,o,"f")),this.vm&&(this.vm.events.removeAllListeners(),this.vm.evm&&this.vm.evm.events.removeAllListeners()),this.transactions&&await this.transactions.pause(),I(this,n,"f")&&await I(this,n,"f").pause(),await I(this,i,"f"),this.fallback&&await this.fallback.close(),await this.emit("stop"),I(this,c,"f")&&await I(this,c,"f").close(),S(this,r,le.stopped,"f")}}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,h=new WeakMap,g=new WeakMap,p=new WeakMap,m=new WeakMap,b=new WeakMap,y=new WeakMap,w=new WeakMap,v=new WeakMap,_=new WeakMap,k=new WeakMap,E=new WeakMap,B=new WeakMap,P=new WeakMap,t.default=Blockchain},253:function(e,t,s){"use strict";var r,n,i=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},o=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.Connector=void 0;const a=s(1),c=s(237),l=s(3),u=s(814);class Connector{get provider(){return i(this,r,"f")}constructor(e=null,t){r.set(this,void 0),this.BUFFERIFY_THRESHOLD=Connector.BUFFERIFY_THRESHOLD,n.set(this,((e,t)=>{const s=e.method;if("eth_subscribe"===s&&function isHttp(e){return"uWS.HttpRequest"===e.constructor.name||"HttpRequest"===e.constructor.name}(t))return Promise.reject(new l.CodedError("notifications not supported",a.JsonRpcErrorCode.METHOD_NOT_SUPPORTED));const n=e.params;return i(this,r,"f")._requestRaw({method:s,params:n})})),o(this,r,new c.EthereumProvider(e,t),"f")}async connect(){await i(this,r,"f").initialize()}parse(e){try{return JSON.parse(e)}catch(e){throw new l.CodedError(e.message,a.JsonRpcErrorCode.PARSE_ERROR)}}handle(e,t){if(Array.isArray(e)){const s=e.map((e=>i(this,n,"f").call(this,e,t).then((({value:e})=>e)).catch((e=>e))));return Promise.resolve({value:Promise.all(s)})}return i(this,n,"f").call(this,e,t)}format(e,t){if(Array.isArray(t))return JSON.stringify(t.map(((t,s)=>{const r=e[s];return r instanceof Error?(0,a.makeError)(t.id,r):(0,a.makeResponse)(t.id,r)})));{const s=(0,a.makeResponse)(t.id,e);return"debug_traceTransaction"===t.method&&"object"==typeof e&&Array.isArray(e.structLogs)&&e.structLogs.length>this.BUFFERIFY_THRESHOLD?(0,u.bufferify)(s,""):JSON.stringify(s)}}formatError(e,t){const s=(0,a.makeError)(t&&t.id?t.id:null,e);return JSON.stringify(s)}close(){return i(this,r,"f").disconnect()}}t.Connector=Connector,r=new WeakMap,n=new WeakMap,Connector.BUFFERIFY_THRESHOLD=1e5},260:function(e,t,s){"use strict";var r,n=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},i=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0});const o=s(3),a=s(0),c=s(1),l=s(12);r=new WeakMap,t.default=class AccountManager{constructor(e){r.set(this,void 0),n(this,r,e,"f")}async get(e,t=o.Tag.latest){const s=await this.getRaw(e,t);return null==s?null:o.Account.fromBuffer(s)}async getRaw(e,t=o.Tag.latest){const{trie:s,blocks:n}=i(this,r,"f"),{stateRoot:a,number:c}=(await n.get(t)).header,l=s.copy(!1);return l.setContext(a.toBuffer(),null,c),await l.get(e.toBuffer())}async getNonce(e,t=o.Tag.latest){const s=await this.getRaw(e,t);if(null==s)return c.Quantity.Zero;const[r]=(0,l.decode)(s);return 0===r.length?c.Quantity.Zero:c.Quantity.from(r)}async getBalance(e,t=o.Tag.latest){const s=await this.getRaw(e,t);if(null==s)return c.Quantity.Zero;const[,r]=(0,l.decode)(s);return 0===r.length?c.Quantity.Zero:c.Quantity.from(r)}async getNonceAndBalance(e,t=o.Tag.latest){const s=await this.getRaw(e,t);if(null==s)return{nonce:c.Quantity.Zero,balance:c.Quantity.Zero};const[r,n]=(0,l.decode)(s);return{nonce:0===r.length?c.Quantity.Zero:c.Quantity.from(r),balance:0===n.length?c.Quantity.Zero:c.Quantity.from(n)}}async getCode(e,t=o.Tag.latest){const s=await this.getRaw(e,t);if(null==s)return c.Data.Empty;const[,,,n]=(0,l.decode)(s);return n.equals(a.KECCAK256_NULL)?c.Data.Empty:i(this,r,"f").trie.database().get(n).then(c.Data.from)}}},137:function(e,t,s){"use strict";var r,n,i,o=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},a=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=c(s(62)),u=s(3),d=s(1),f=s(39),h=s(11),g=s(23),p=s(12),m=d.BUFFER_ZERO,b=Buffer.from([]);class BlockManager extends l.default{static async initialize(e,t,s,r){const n=new BlockManager(e,t,s,r);return await n.updateTaggedBlocks(),n}constructor(e,t,s,c){super(c,f.Block,t),r.set(this,void 0),n.set(this,void 0),i.set(this,void 0),this.fromFallback=async e=>{const t=a(this,r,"f").fallback;let s;if("string"==typeof e)s=e;else{if(!t.isValidForkBlockNumber(e))return null;s=e.toString()}const i=await t.request("eth_getBlockByNumber",[s,!0]);if(null==i)return null;{const e=t.getCommonForBlock(a(this,n,"f"),{number:BigInt(i.number),timestamp:BigInt(i.timestamp)});return BlockManager.rawFromJSON(i,e)}},o(this,r,e,"f"),o(this,n,t,"f"),o(this,i,s,"f")}static rawFromJSON(e,t){const s=d.Quantity.toBuffer(e.number),r=null!=e.withdrawalsRoot,n=[d.Data.toBuffer(e.parentHash),d.Data.toBuffer(e.sha3Uncles),h.Address.from(e.miner).toBuffer(),d.Data.toBuffer(e.stateRoot),d.Data.toBuffer(e.transactionsRoot),d.Data.toBuffer(e.receiptsRoot),d.Data.toBuffer(e.logsBloom),d.Quantity.toBuffer(e.difficulty),s,d.Quantity.toBuffer(e.gasLimit),d.Quantity.toBuffer(e.gasUsed),d.Quantity.toBuffer(e.timestamp),d.Data.toBuffer(e.extraData),d.Data.toBuffer(e.mixHash),d.Data.toBuffer(e.nonce)];e.baseFeePerGas&&(n[15]=d.Quantity.toBuffer(e.baseFeePerGas),r&&(n[16]=d.Data.toBuffer(e.withdrawalsRoot)));const i=d.Quantity.toBuffer(e.totalDifficulty),o=Array(e.transactions.length),a=Array(e.transactions.length),c=d.Data.toBuffer(e.hash);for(let r=0;r<e.transactions.length;r++){const n=e.transactions[r],i=[h.Address.toBuffer(n.from),d.Quantity.toBuffer(n.hash)],l=[...i,c,s,d.Quantity.toBuffer(r)],u=g.TransactionFactory.fromRpc(n,t,l);o[r]=9===u.raw.length?u.raw:u.serialized??(0,g.encodeWithPrefix)(u.type.toNumber(),u.raw),a[r]=i}let l;if(r){const t=Array(e.withdrawals.length);for(let s=0;s<e.withdrawals.length;s++){const r=e.withdrawals[s];t[s]=[d.Quantity.toBuffer(r.index),d.Quantity.toBuffer(r.validatorIndex),h.Address.toBuffer(r.address),d.Quantity.toBuffer(r.amount)]}l=[n,o,[],t]}else l=[n,o,[]];return(0,f.serialize)(l,[i,a]).serialized}getBlockByTag(e){switch(e){case"latest":case"finalized":case"safe":case"pending":return this.latest;case"earliest":return this.earliest}}getEffectiveNumber(e=typeof u.Tag.latest){if("string"==typeof e){const t=this.getBlockByTag(e);if(t)return t.header.number}return d.Quantity.from(e)}async getNumberFromHash(e){return a(this,i,"f").get(d.Data.toBuffer(e)).catch((e=>{if(404===e.status)return null;throw e}))}async getByHash(e){const t=await this.getNumberFromHash(e);if(null===t){const t=a(this,r,"f").fallback;if(t){const s=await t.request("eth_getBlockByHash",[d.Data.from(e),!0]);if(s){const e=BigInt(s.number);if(e<=t.blockNumber.toBigInt()){const r=t.getCommonForBlock(a(this,n,"f"),{number:e,timestamp:BigInt(s.timestamp)});return new f.Block(BlockManager.rawFromJSON(s,r),r)}}}return null}return this.get(t)}async getRawByBlockNumber(e){const t=a(this,r,"f").fallback,s=e.toBuffer();return this.getRaw(s).then((s=>null==s&&t?this.fromFallback(e):s))}async get(e){if("string"==typeof e){const t=this.getBlockByTag(e);if(t)return t}const t=d.Quantity.from(e),s=await this.getRaw(t.toBuffer()),i=a(this,n,"f");if(s)return new f.Block(s,i);{const e=a(this,r,"f").fallback;if(e){const s=await this.fromFallback(t);if(s){const r=(0,p.decode)(s)[0];return new f.Block(s,e.getCommonForBlock(i,{number:t.toBigInt(),timestamp:d.Quantity.toBigInt(r[11])}))}}}throw new Error("header not found")}async putBlock(e,t,s){let r=e;b.equals(r)&&(r=Buffer.from([0]));const n=t.toBuffer();await Promise.all([a(this,i,"f").put(n,r),super.set(r,s)])}async updateLatestIndex(e){await a(this,i,"f").put(m,e)}async getEarliest(){const e=a(this,r,"f").fallback;if(e){const t=await e.request("eth_getBlockByNumber",[u.Tag.earliest,!0],{disableCache:!0});if(t){const s=e.getCommonForBlock(a(this,n,"f"),{number:BigInt(t.number),timestamp:BigInt(t.timestamp)});return new f.Block(BlockManager.rawFromJSON(t,s),s)}}else for await(const e of this.base.createValueStream({limit:1}))return new f.Block(e,a(this,n,"f"))}async updateTaggedBlocks(){const[e,t]=await Promise.all([this.getEarliest(),a(this,i,"f").get(m).catch((e=>null))]);e&&(this.earliest=e),t?this.latest=await this.get(t):(this.latest=await(async()=>{let e;for await(const t of this.base.createValueStream()){const s=new f.Block(t,a(this,n,"f"));(!e||s.header.number.toBigInt()>e.header.number.toBigInt())&&(e=s)}return e})(),this.latest&&await a(this,i,"f").put(m,this.latest.header.number.toBuffer()).catch((e=>null)))}}r=new WeakMap,n=new WeakMap,i=new WeakMap,t.default=BlockManager},240:function(e,t,s){"use strict";var r,n=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},i=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=s(3),c=o(s(62)),l=s(1),u=s(373);class BlockLogManager extends c.default{constructor(e,t){super(e,a.BlockLogs),r.set(this,void 0),n(this,r,t,"f")}async get(e){const t=await super.get(e);if(t)t.blockNumber=l.Quantity.from(e);else if(i(this,r,"f").fallback){const t=l.Quantity.from(e),s=await i(this,r,"f").fallback.request("eth_getLogs",[{fromBlock:t,toBlock:t}]);return a.BlockLogs.fromJSON(s)}return t}async getLogs(e){const t=i(this,r,"f");if("blockHash"in e){const{addresses:s,topics:r}=(0,u.parseFilterDetails)(e),n=await t.blocks.getNumberFromHash(e.blockHash);if(!n)return[];const i=await this.get(n);return i?[...i.filter(s,r)]:[]}{const{addresses:s,topics:r,fromBlock:n,toBlockNumber:i}=(0,u.parseFilter)(e,t),o=[this.get(n.toBuffer())],a=n.toNumber();if(a!==i)for(let e=a+1,t=i+1;e<t;e++)o.push(this.get(l.Quantity.toBuffer(e)));return Promise.all(o).then((e=>{const t=[];return e.forEach((e=>{e&&t.push(...e.filter(s,r))})),t}))}}}r=new WeakMap,t.default=BlockLogManager},62:function(e,t,s){"use strict";var r,n,i=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},o=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0});const a=s(1);r=new WeakMap,n=new WeakMap,t.default=class Manager{constructor(e,t,s){r.set(this,void 0),n.set(this,void 0),i(this,r,t,"f"),i(this,n,s,"f"),this.base=e}getRaw(e){return"string"==typeof e&&(e=a.Data.toBuffer(e)),0===e.length&&(e=a.BUFFER_ZERO),this.base.get(e).catch((e=>{if(404===e.status)return null;throw e}))}async get(e){const t=await this.getRaw(e);return t?new(o(this,r,"f"))(t,o(this,n,"f")):null}set(e,t){return this.base.put(e,t)}del(e){return this.base.del(e)}}},241:function(e,t,s){"use strict";var r,n,i,o,a,c=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const d=u(s(62)),f=u(s(242)),h=u(s(243)),g=s(1),p=s(23);class TransactionManager extends d.default{constructor(e,t,s,u){super(u,p.TransactionFactory,t),r.set(this,new h.default),n.set(this,!1),i.set(this,void 0),o.set(this,void 0),a.set(this,void 0),this.fromFallback=async e=>{const{fallback:t}=l(this,a,"f"),s=await t.request("eth_getTransactionByHash",[g.Data.toString(e)]);if(null==s)return null;const r=g.Data.from(s.blockHash,32),n=g.Quantity.from(s.blockNumber),i=g.Quantity.from(s.transactionIndex);return t.isValidForkBlockNumber(n)?(0,p.serializeRpcForDb)(s,r,n,i):null},this.resume=()=>{l(this,n,"f")&&(c(this,n,!1,"f"),l(this,o,"f").call(this))},c(this,a,s,"f"),this.transactionPool=new f.default(e,s)}async getRaw(e){return super.getRaw(e).then((t=>null==t&&l(this,a,"f").fallback?this.fromFallback(e):t))}async get(e){const t=await super.get(e);return t?t.tx:null}async add(e,t){l(this,n,"f")&&await l(this,i,"f");const s=this.transactionPool.prepareTransaction(e,t),o=await l(this,r,"f").add(s);return o&&this.transactionPool.drain(),o}clear(){l(this,r,"f").clear(!1),this.transactionPool.clear()}async pause(){l(this,n,"f")||(c(this,n,!0,"f"),c(this,i,new Promise((e=>{c(this,o,e,"f")})),"f")),l(this,r,"f").isBusy()&&await l(this,r,"f").emit("idle")}}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,t.default=TransactionManager},245:function(e,t,s){"use strict";var r,n=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},i=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=o(s(62)),c=s(1),l=s(23),u=s(11);class TransactionReceiptManager extends a.default{constructor(e,t){super(e,l.InternalTransactionReceipt),r.set(this,void 0),n(this,r,t,"f")}async get(e){const t=await super.get(e);if(t)return t;if(i(this,r,"f").fallback){const t=await i(this,r,"f").fallback.request("eth_getTransactionReceipt",["string"==typeof e?e:c.Data.from(e)]);if(!t)return null;const s="0x1"===t.status?c.Quantity.One.toBuffer():c.BUFFER_ZERO,n=c.Quantity.toBuffer(t.cumulativeGasUsed),o=c.Data.toBuffer(t.logsBloom,256),a=t.logs.map((e=>[u.Address.from(e.address).toBuffer(),e.topics.map((e=>c.Data.toBuffer(e))),Array.isArray(e.data)?e.data.map((e=>c.Data.toBuffer(e))):c.Data.toBuffer(e.data)])),d=c.Quantity.toBuffer(t.gasUsed),f=null==t.contractAddress?c.BUFFER_EMPTY:u.Address.from(t.contractAddress).toBuffer();return l.InternalTransactionReceipt.fromValues(s,n,o,a,d,f)}}}r=new WeakMap,t.default=TransactionReceiptManager},238:function(e,t,s){"use strict";var r,n,i,o,a,c=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const d=u(s(29)),f=s(289),h=u(s(94)),g=u(s(119)),p=u(s(190)),m=s(147),b=s(1),y=s(39),w=s(117);(0,f.setGracefulCleanup)();const v={prefix:"ganache_",unsafeCleanup:!0},noop=()=>Promise.resolve();class Database extends d.default{constructor(e,t){super(),r.set(this,void 0),n.set(this,noop),i.set(this,!1),this.directory=null,this.db=null,o.set(this,void 0),this.initialize=async()=>{const e={keyEncoding:"binary",valueEncoding:"binary"},t=l(this,r,"f").database,s=t.db;let u,d=!1;if(s)c(this,o,(0,g.default)(s,e),"f"),u=w(l(this,o,"f"),{}),d=!0;else{let s=t.dbPath;if(s)d=!0;else{const e=await(0,f.dir)(v);if(s=e.path,c(this,n,e.cleanup,"f"),l(this,i,"f"))return l(this,a,"f").call(this)}this.directory=s;const r={prefix:""},h=(0,g.default)((0,p.default)(s,r),e);c(this,o,h,"f"),u=w(h)}if(l(this,i,"f"))return l(this,a,"f").call(this);const b=u.open(),y=(0,h.default)(u,"T",e);return this.trie=new m.TrieDB(y),this.db=u,await b,l(this,i,"f")?l(this,a,"f").call(this):(this.blocks=(0,h.default)(u,"b",e),this.blockIndexes=(0,h.default)(u,"i",e),this.blockLogs=(0,h.default)(u,"l",e),this.transactions=(0,h.default)(u,"t",e),this.transactionReceipts=(0,h.default)(u,"r",e),this.storageKeys=(0,h.default)(u,"s",e),d&&await this.runMigrations(),this.emit("ready"))},a.set(this,(async()=>{const e=this.db;return e&&(await new Promise(((t,s)=>e.close((e=>{e?s(e):t(void 0)})))),await Promise.all([this.blocks.close(),this.blockIndexes.close(),this.blockIndexes.close(),this.transactionReceipts.close(),this.transactions.close(),this.storageKeys.close(),this.trie.close()])),l(this,n,"f").call(this)})),c(this,r,e,"f"),this.blockchain=t}async runMigrations(){let e;try{e=await this.db.get(b.VERSION_KEY)}catch{}if(e)return;const t=l(this,r,"f").logging.logger;t.log("Migrating database from version `null` to `0`\u2026");const s=[{type:"put",key:b.VERSION_KEY,value:b.BUFFER_ZERO}],n=this.blocks.createReadStream(),i=Buffer.from(this.blocks.db.db.prefix);for await(const e of n){const{key:t,value:r}=e;s.push({type:"put",key:Buffer.concat([i,t]),value:y.Block.migrate(r)})}await this.db.batch(s),t.log("Migration complete")}batch(e){const t=l(this,o,"f").db,s=this.db.batch(),r=t.put,n=t.del;let i;t.put=s.put.bind(s),t.del=s.del.bind(s);try{const o=e();i=s.write().then((()=>o))}finally{t.put=r,t.del=n}return i}async close(){const e=l(this,i,"f");c(this,i,!0,"f"),await l(this,a,"f").call(this),e||this.emit("close")}}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,t.default=Database},807:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForkCache=void 0;const r=s(0),n=s(195);class ForkCache extends n.Cache{constructor(e){super({getCb:async t=>{const s=await e.get(t.buf);return s?r.Account.fromRlpSerializedAccount(s):new r.Account},putCb:e.put.bind(e),deleteCb:e.del.bind(e)})}}t.ForkCache=ForkCache},441:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function Deferred(){const e={};return e.promise=new Promise(((t,s)=>{e.resolve=t,e.reject=s})),e}},246:function(e,t,s){"use strict";var r,n,i,o,a,c,l,u,d=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},f=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},h=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Fork=void 0;const g=s(1),p=s(7),m=s(228),b=s(295),y=s(3),w=s(39),v=h(s(137)),_=s(811),k=s(229),E=s(109),B=s(437);async function fetchNetworkId(e){const t=await e.request("net_version",[]);return parseInt(t,10)}function fetchBlock(e,t){return e.request("eth_getBlockByNumber",[t,!0])}t.Fork=class Fork{constructor(e,t){r.set(this,new AbortController),n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),a.set(this,void 0),c.set(this,(async e=>{const[t,s]=await Promise.all([e,fetchNetworkId(this)]);this.chainId=t,this.common=p.Common.custom({name:"ganache-fork",defaultHardfork:f(this,a,"f"),networkId:s,chainId:f(this,i,"f").chain.chainId,comment:"Local test network fork"},{baseChain:g.KNOWN_CHAINIDS.has(t)?t:1}),f(this,i,"f").chain.allowUnlimitedInitCodeSize&&(0,B.removeEIP3860InitCodeSizeLimitCheck)(this.common),this.common.on=()=>{}})),l.set(this,(async e=>{const{fork:t}=f(this,i,"f"),s=t.blockNumber;if(s===y.Tag.latest){const[s,r]=await Promise.all([fetchBlock(this,y.Tag.latest),e]);let n=parseInt(s.number,16);const i=g.KNOWN_CHAINIDS.has(r)?Math.max(n-t.preLatestConfirmations,0):n;let o;return o=i!==n?await fetchBlock(this,g.Quantity.from(i)):s,t.blockNumber=i,this.blockNumber=g.Quantity.from(i),this.stateRoot=g.Data.from(o.stateRoot),await f(this,u,"f").call(this,this.blockNumber),o}if(s>=0){const e=g.Quantity.from(s),[n]=await Promise.all([fetchBlock(this,e).then((async t=>(this.stateRoot=t.stateRoot,await f(this,u,"f").call(this,e),t))),(r=this,r.request("eth_blockNumber",[],{disableCache:!0})).then((r=>{const n=parseInt(r,16);if(s>n)throw new Error(`\`fork.blockNumber\` (${t.blockNumber}) must not be greater than the current block number (${n})`);this.blockNumber=e}))]);return n}throw new Error(`Invalid value for \`fork.blockNumber\` option: "${t.blockNumber}". Must be a positive integer or the string "latest".`);var r})),u.set(this,(e=>Promise.all(f(this,o,"f").map((async t=>{const s=await async function fetchNonce(e,t,s){const r=await e.request("eth_getTransactionCount",[t,s]);return g.Quantity.from(r)}(this,t.address,e);t.nonce=s}))))),d(this,i,e,"f");const s=e.fork;d(this,a,e.chain.hardfork,"f"),d(this,o,t,"f");const{url:h,network:w}=s;if(h){const{protocol:t}=h;switch(t){case"ws:":case"wss:":d(this,n,new b.WsHandler(e,f(this,r,"f").signal),"f");break;case"http:":case"https:":d(this,n,new m.HttpHandler(e,f(this,r,"f").signal),"f");break;default:throw new Error(`Unsupported protocol: ${t}`)}}else if(s.provider)d(this,n,new _.ProviderHandler(e,f(this,r,"f").signal),"f");else if(w){let t;"g\xf6rli"===w?s.network=t="goerli":t=w;const i="db244d7eaedb430ebea06787b77a7d5a";if(!i)throw new Error("The INFURA_KEY environment variable was not given and is required when using Ganache's integrated archive network feature.");s.url=new E.URL(`wss://${t}.infura.io/ws/v3/${i}`),d(this,n,new b.WsHandler(e,f(this,r,"f").signal),"f")}}async initialize(){let e;const{fork:t,chain:s,miner:r}=f(this,i,"f");t.deleteCache&&await k.PersistentCache.deleteDb(),e=!1===t.disableCache?k.PersistentCache.create().catch((e=>null)):null;const n=async function fetchChainId(e){const t=await e.request("eth_chainId",[]);return parseInt(t,16)}(this),[o,a]=await Promise.all([f(this,l,"f").call(this,n),e,f(this,c,"f").call(this,n)]),u=this.getCommonForBlock(this.common,{timestamp:BigInt(o.timestamp),number:BigInt(o.number)});this.block=new w.Block(v.default.rawFromJSON(o,u),u),s.time||"clock"===r.timestampIncrement||(s.time=new Date(1e3*(this.block.header.timestamp.toNumber()+r.timestampIncrement.toNumber()))),a&&await this.initCache(a)}async initCache(e){await e.initialize(this.block.header.number,this.block.hash(),this.request.bind(this)),f(this,n,"f").setCache(e)}request(e,t,s={disableCache:!1}){return f(this,n,"f").request(e,t,s)}abort(){return f(this,r,"f").abort()}close(){return f(this,n,"f").close()}isValidForkBlockNumber(e){return e.toBigInt()<=this.blockNumber.toBigInt()}selectValidForkBlockNumber(e){return this.isValidForkBlockNumber(e)?e:this.blockNumber}getCommonForBlock(e,t){if(t.number<=this.blockNumber.toBigInt()){let s;if(g.KNOWN_CHAINIDS.has(this.chainId)){let r;for(const s of e.hardforks())if(s.timestamp){const e=BigInt(s.timestamp);if(!(t.timestamp>=e))break;r=s.name}else if(s.block){if(!(t.number>=BigInt(s.block)))break;r=s.name}s=new p.Common({chain:this.chainId,hardfork:r})}else s=p.Common.custom({chainId:this.chainId,defaultHardfork:e.hardfork()},{baseChain:1});return f(this,i,"f").chain.allowUnlimitedInitCodeSize&&(0,B.removeEIP3860InitCodeSizeLimitCheck)(s),s}return e}},r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap},95:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseHandler=void 0;const n=s(1),i=r(s(293)),o=r(s(438)),a=s(3);class BaseHandler{constructor(e,t){this.id=1,this.requestCache=new Map,this.fireForget=new Set;const s=e.fork,{requestsPerSecond:r,url:n,userAgent:a,origin:c}=s;if(this.abortSignal=t,this.limiter=new i.default(30*r,3e4,t),this.valueCache=new o.default({max:1073741824,length:(e,t)=>e.length+t.length}),n){const e={"user-agent":a};c&&(e.origin=c),n.password=n.username="";const t=n.host.endsWith(".infura.io");BaseHandler.setAuthHeaders(s,e),BaseHandler.setUserHeaders(s,e,!t),this.headers=e}}setCache(e){this.persistentCache=e}static setAuthHeaders(e,t){if(null!=e.username||null!=e.password){if(null!=e.jwt)throw new Error("Authentication via both username/password (Basic) and JWT (Bearer) is not possible");t.authorization=`Basic ${Buffer.from(`${e.username||""}:${e.password||""}`).toString("base64")}`}else e.jwt&&(t.authorization=`Bearer ${e.jwt}`)}static setUserHeaders(e,t,s){const r=e.headers;if(r)for(let e=0,n=r.length;e<n;e++){let{name:n,value:i}=r[e];const o=n.toLowerCase();if("authorization"===o&&"authorization"in t){if(!s)throw new Error("Authentication with multiple auth-params is not allowed.");const e=t.authorization.split(" ",1)[0],[r,n]=i.split(/\.(?:.+)/);if(r.toLowerCase()!==e.toLowerCase())throw new Error(`Authentication via both ${e} and ${r} is not allowed.`);t.authorization+=","+n}else t[o]=i}}getFromMemCache(e){const t=this.requestCache.get(e);if(void 0!==t)return t;const s=this.valueCache.get(e);return void 0!==s?JSON.parse(s).result:void 0}async getFromSlowCache(e,t,s){if(!this.persistentCache)return;const r=await this.persistentCache.get(e,t,s).catch((e=>{if(e.notFound)return null;throw e}));return null!=r?{result:JSON.parse(r).result,raw:r}:void 0}async queueRequest(e,t,s,r,i={disableCache:!1}){if(!i.disableCache){const r=this.getFromMemCache(s);if(void 0!==r)return r;const n=await this.getFromSlowCache(e,t,s);if(void 0!==n)return this.valueCache.set(s,Buffer.from(n.raw)),n.result}const o=this.limiter.handle(r).then((async({response:r,raw:o})=>{if(this.abortSignal.aborted)return Promise.reject(new a.AbortError);if((0,n.hasOwn)(r,"result")){if(!i.disableCache&&(this.valueCache.set(s,o),this.persistentCache)){const r=this.persistentCache.put(e,t,s,"string"==typeof o?Buffer.from(o):o).catch((e=>{}));this.fireForget.add(r),r.finally((()=>{this.fireForget.delete(r)}))}return r.result}if((0,n.hasOwn)(r,"error")&&null!=r.error){const{error:e}=r;throw new a.CodedError(e.message,e.code)}throw new Error(`Invalid response from fork provider: \`${JSON.stringify(r)}\``)}));return this.requestCache.set(s,o),await o}async close(){await Promise.all(this.fireForget.keys()),this.persistentCache&&await this.persistentCache.close()}}t.BaseHandler=BaseHandler,BaseHandler.JSONRPC_PREFIX='{"jsonrpc":"2.0","id":'},228:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HttpHandler=void 0;const a=s(3),c=i(s(123)),l=i(s(124)),u=s(95),d=o(s(441));process.versions&&process.versions.node&&process.versions.node.match(/20\.[0-2]\.0/)&&s(80).setDefaultAutoSelectFamily(!1);const{JSONRPC_PREFIX:f}=u.BaseHandler;class HttpHandler extends u.BaseHandler{constructor(e,t){super(e,t),this.url=e.fork.url,this.headers.accept=this.headers["content-type"]="application/json","http:"===this.url.protocol?(this._request=c.default.request,this.agent=new c.Agent({keepAlive:!0,scheduling:"fifo"})):(this._request=l.default.request,this.agent=new l.Agent({keepAlive:!0,scheduling:"fifo"}))}async handleLengthedResponse(e,t){return await new Promise(((s,r)=>{const n=Buffer.allocUnsafe(t);let i=0;e.on("data",(function data(e){const t=e.length;e.copy(n,i,0,t),i+=t})),e.on("end",(function end(){i!==t?r(new Error("content-length mismatch")):s(n)})),e.on("error",r)}))}async handleChunkedResponse(e){const t=[];let s=0;for await(let r of e)t.push(r),s+=r.length;return 1===t.length?t[0]:Buffer.concat(t,s)}async request(e,t,s={disableCache:!1}){const r=JSON.stringify({method:e,params:t}),{protocol:n,hostname:i,port:o,pathname:c,search:l}=this.url,u={protocol:n,host:i,port:o,path:c+l,headers:this.headers,method:"POST",agent:this.agent,signal:this.abortSignal};return await this.queueRequest(e,t,r,(()=>{if(this.abortSignal.aborted)return Promise.reject(new a.AbortError);const e=(0,d.default)(),t=`${f}${this.id++},${r.slice(1)}`;this.headers["content-length"]=t.length;const s=this._request(u);return s.on("response",(t=>{const{headers:s}=t;let r;if("transfer-encoding"in s)r=this.handleChunkedResponse(t);else{const e=s["content-length"]/1;r=isNaN(e)||e<=0?this.handleChunkedResponse(t):this.handleLengthedResponse(t,e)}r.then((t=>{try{e.resolve({response:JSON.parse(t),raw:t})}catch{const s=t.toString();let r;r=s.length>340?s.slice(0,320)+"\u2026":s;let n=`Invalid JSON response from fork provider:\n\n ${r}`;(s.startsWith("invalid project id")||s.startsWith("project id required in the url"))&&this.url.host.endsWith("infura.io")&&(n+=`\n\nThe provided fork url, ${this.url}, may be an invalid or incorrect Infura endpoint.`,n+="\nVisit https://infura.io/docs/ethereum for Infura documentation."),e.reject(new Error(n))}}))})),s.setTimeout(5e3,s.abort.bind(s)),s.on("error",e.reject),s.write(t),s.end(),e.promise.finally((()=>this.requestCache.delete(r)))}),s)}}t.HttpHandler=HttpHandler},811:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProviderHandler=void 0;const r=s(95);class ProviderHandler extends r.BaseHandler{constructor(e,t){super(e,t);const s=e.fork.provider;if("function"==typeof s.request)this._request=async(e,t)=>{try{const r={result:await s.request({method:e,params:t})};return{response:r,raw:JSON.stringify(r)}}catch(e){if("number"!=typeof e.code)throw e;return{response:{error:e},raw:null}}};else{if("function"!=typeof s.send)throw new Error("Forking `provider` must be EIP-1193 compatible");this._request=async(e,t)=>await new Promise(((r,n)=>{const i={id:this.id++,jsonrpc:"2.0",method:e,params:t};s.send(i,((e,t)=>{e?n(e):r({response:t,raw:JSON.stringify(t)})}))}))}}async request(e,t,s={disableCache:!1}){const r=JSON.stringify(t);return await this.queueRequest(e,t,`${e}:${r}`,(()=>this._request(e,JSON.parse(r))),s)}}t.ProviderHandler=ProviderHandler},295:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WsHandler=void 0;const n=s(3),i=r(s(442)),o=s(95),a=r(s(441)),{JSONRPC_PREFIX:c}=o.BaseHandler;class WsHandler extends o.BaseHandler{constructor(e,t){super(e,t),this.inFlightRequests=new Map;const{fork:{url:s,origin:r},logging:n}=e;this.connection=new i.default(s.toString(),{origin:r,headers:this.headers}),this.connection.binaryType="nodebuffer",this.open=this.connect(this.connection,n),this.connection.onclose=()=>{this.open=this.connect(this.connection,n)},this.abortSignal.addEventListener("abort",(()=>{this.connection.onclose=null,this.connection.close(1e3)})),this.connection.onmessage=this.onMessage.bind(this)}async request(e,t,s={disableCache:!1}){if(await this.open,this.abortSignal.aborted)return Promise.reject(new n.AbortError);const r=JSON.stringify({method:e,params:t});return await this.queueRequest(e,t,r,(()=>{if(this.abortSignal.aborted)return Promise.reject(new n.AbortError);const e=this.id++,t=(0,a.default)();return this.inFlightRequests.set(e,t),this.connection.send(`${c}${e},${r.slice(1)}`),t.promise.finally((()=>this.requestCache.delete(r)))}),s)}onMessage(e){if("message"!==e.type)return;const t=e.data,s=JSON.parse(t),r=s.id,n=this.inFlightRequests.get(r);n&&(this.inFlightRequests.delete(r),n.resolve({response:s,raw:t}))}connect(e,t){let s=new Promise(((t,s)=>{e.onopen=t,e.onerror=s}));return s.then((()=>{e.onopen=null,e.onerror=null}),(e=>{t.logger.log(e)})),s}async close(){await super.close(),this.connection.close()}}t.WsHandler=WsHandler},196:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=void 0;const r=s(1);t.encode=function encode(e){const t=e.length;let s=0;const n=[];for(let i=0;i<t;i++){const t=e[i];if(null===t)s+=2,n.push([r.BUFFER_ZERO,r.BUFFER_EMPTY]);else{const e=t.length,i=r.Quantity.toBuffer(e);s+=1+i.length+e,n.push([i,t])}}const i=Buffer.allocUnsafe(s);let o=0;for(let e=0;e<t;e++){const[t,s]=n[e],r=t.length;i[o++]=r,t.copy(i,o,0,r),s.copy(i,o+=r,0,s.length),o+=s.length}return i},t.decode=function decode(e){const t=[];for(let s=0,n=e.length;s<n;){const n=e[s++],i=r.Quantity.from(e.slice(s,s+=n)).toNumber();t.push(e.slice(s,s+=i))}return t}},812:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Ancestry=void 0;const r=s(1),n=s(90);t.Ancestry=class Ancestry{constructor(e,t){this.cacheLock=new Map,this.db=e,null==t?(this.next=null,this.knownAncestors=new Set):(this.next=t.closestKnownAncestor.equals(r.BUFFER_EMPTY)?null:t.closestKnownAncestor,this.knownAncestors=new Set([t.hash.toString("hex")]))}async loadNextAncestor(e){const t=e.toString("hex");if(this.cacheLock.has(t))throw new Error("couldn't load next ancestor as it is locked");let s;this.cacheLock.set(t,new Promise((e=>{s=e})));const i=await this.db.get(e),o=n.Tree.deserialize(e,i);this.next=o.closestKnownAncestor.equals(r.BUFFER_EMPTY)?null:o.closestKnownAncestor,this.knownAncestors.add(o.hash.toString("hex")),this.cacheLock.delete(t),s()}async has(e){const t=e.toString("hex");if(this.knownAncestors.has(t))return!0;if(this.next){const t=this.cacheLock.get(this.next.toString("hex"));return t?(await t,this.has(e)):(await this.loadNextAncestor(this.next),this.has(e))}return!1}}},813:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBlockByNumber=t.findClosestDescendants=t.findClosestAncestor=t.findRelated=t.resolveTargetAndClosestAncestor=t.setDbVersion=t.getBlockNumberFromParams=void 0;const r=s(3),n=s(1),i=s(90);async function*findRelated(e,t,s){const r=e.createReadStream({keys:!0,values:!0,...s});for await(const e of r){const{key:s,value:r}=e,o=i.Tree.deserialize(s,r),{height:a}=o.decodeKey(),c=await getBlockByNumber(t,a);null!=c&&c.hash===n.Data.toString(o.hash)&&(yield o)}}async function findClosestAncestor(e,t,s,r){const o=findRelated(e,t,{gte:r,lt:i.Tree.encodeKey(s,n.Data.Empty),reverse:!0}),a=await o.next();return await o.return(),a.value}async function getBlockByNumber(e,t){return await e("eth_getBlockByNumber",[t.toString(),!1])}t.getBlockNumberFromParams=function getBlockNumberFromParams(e,t){switch(e){case"eth_getBlockByNumber":return t[0];case"eth_getTransactionCount":case"eth_getCode":case"eth_getBalance":return t[1];case"eth_getStorageAt":return t[2];default:return null}},t.setDbVersion=async function setDbVersion(e,t){try{const s=await e.get(n.VERSION_KEY);if(!t.equals(s))throw new Error(`Persistent cache version "${t.toString()}"" is not understood.`)}catch(s){if(!s.notFound)throw s;await e.put(n.VERSION_KEY,t)}},t.resolveTargetAndClosestAncestor=async function resolveTargetAndClosestAncestor(e,t,s,o){let a,c,l;try{const r=i.Tree.encodeKey(s,o);a=i.Tree.deserialize(r,await e.get(r)),a.closestKnownAncestor.equals(n.BUFFER_EMPTY)?(c=null,l=null):(l=i.Tree.deserialize(a.closestKnownAncestor,await e.get(a.closestKnownAncestor)),c=await findClosestAncestor(e,t,s,l.key)||l)}catch(u){if(!u.notFound)throw u;if(l=null,0n===s.toBigInt())c=null,a=new i.Tree(s,o);else{const l=await getBlockByNumber(t,r.Tag.earliest);if(!l)throw new Error('Could not find "earliest" block.');const{hash:u,number:d}=l,f=n.Data.from(u,32),h=new i.Tree(n.Quantity.from(d),f);c=await findClosestAncestor(e,t,s,h.key)||h,a=new i.Tree(s,o,c.key)}}return{targetBlock:a,closestAncestor:c,previousClosestAncestor:l}},t.findRelated=findRelated,t.findClosestAncestor=findClosestAncestor,t.findClosestDescendants=async function*findClosestDescendants(e,t,s){const r=findRelated(e,t,{gte:i.Tree.encodeKey(n.Quantity.from(s.toBigInt()+1n),n.Data.Empty),reverse:!1});for await(const e of r)yield e},t.getBlockByNumber=getBlockByNumber},229:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return n(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PersistentCache=void 0;const a=s(90),c=s(9),l=o(s(201)),u=o(s(190)),d=o(s(94)),f=o(s(119)),h=i(s(196)),g=s(1),p=s(812),m=s(813),b=s(117),y={keyEncoding:"binary",valueEncoding:"binary"},w={prefix:""},v=Buffer.from([255]);class PersistentCache{constructor(){this.version=g.BUFFER_ZERO,this._reBalancePromise=null,this.status="open"}static async deleteDb(e){return new Promise(((t,s)=>{const r=PersistentCache.getDbDirectory(e);u.default.destroy(r,(e=>{e?s(e):t(void 0)}))}))}static async serializeDb(e){const t=await PersistentCache.create(e);return await new Promise((async e=>{const s=t.ancestorDb.createReadStream({gte:g.BUFFER_ZERO,keys:!0,values:!0}),r={},n={};for await(const e of s){const{key:t,value:s}=e,i=a.Tree.deserialize(t,s);i.height=i.decodeKey().height.toNumber();const o=t.toString("hex"),c=i.closestKnownAncestor.toString("hex");if(n[o]=i,0===i.closestKnownAncestor.length)r[o]=i;else{const e=n[c].descendants||{};e[o]=i,n[c].descendants=e}i.hash=g.Data.toString(i.hash),i.parent=i.closestKnownAncestor.length>0?g.Data.toString(n[c].hash):null,delete i.key,delete i.closestKnownDescendants,delete i.closestKnownAncestor}await t.close(),e(JSON.parse(JSON.stringify(r)))}))}static getDbDirectory(e=""){const{data:t}=(0,l.default)("Ganache/db",{suffix:e});return t}static async create(e){const t=new PersistentCache,s=PersistentCache.getDbDirectory(e);await c.promises.mkdir(s,{recursive:!0});const r=(0,f.default)((0,u.default)(s,w),y),n=await new Promise(((e,t)=>{const s=b(r,(r=>{r?t(r):e(s)}))}));return t.db=n,t.cacheDb=(0,d.default)(n,"c",y),t.ancestorDb=(0,d.default)(n,"a",y),await t.cacheDb.open(),await t.ancestorDb.open(),await(0,m.setDbVersion)(t.db,t.version),t}async initialize(e,t,s){this.hashBuffer=t.toBuffer(),this.request=s;const{targetBlock:r,closestAncestor:n,previousClosestAncestor:i}=await(0,m.resolveTargetAndClosestAncestor)(this.ancestorDb,this.request,e,t);this.ancestry=new p.Ancestry(this.ancestorDb,n);const o=this.ancestorDb.batch();if(i&&!i.key.equals(n.key)){r.closestKnownAncestor=n.key;const e=i.closestKnownDescendants.findIndex((e=>e.equals(r.key)));i.closestKnownDescendants.splice(e,1),o.put(i.key,i.serialize())}let c=[...r.closestKnownDescendants];if(null==n)o.put(r.key,r.serialize());else{const t=[r.key];await Promise.all(n.closestKnownDescendants.map((async s=>{if(s.equals(r.key))return;const{height:n}=a.Tree.decodeKey(s);if(n.toBigInt()<=e.toBigInt())return void t.push(s);const i=await this.ancestorDb.get(s),l=a.Tree.deserialize(s,i),u=await this.getBlock(n);null==u||u.hash!==g.Data.toString(l.hash,32)?t.push(s):(r.closestKnownDescendants.push(l.key),c.push(...l.closestKnownDescendants),l.closestKnownAncestor=r.key,o.put(l.key,l.serialize()))}))),n.closestKnownDescendants=t,o.put(n.key,n.serialize())}o.put(r.key,r.serialize()),await o.write(),this._reBalancePromise=this.reBalanceDescendantTree(e,r,c).catch((e=>{})).finally((()=>{this._reBalancePromise=null}))}async getBlock(e){return await(0,m.getBlockByNumber)(this.request,e)}async reBalanceDescendantTree(e,t,s){const r=this.ancestorDb.batch(),n=t.closestKnownDescendants,i=n.length;for await(const i of(0,m.findClosestDescendants)(this.ancestorDb,this.request,e)){const e=i.key;if(t.key.equals(e))continue;if(s.push(...i.closestKnownDescendants),n.some((t=>t.equals(e))))continue;if(s.some((t=>t.equals(e))))continue;const o=a.Tree.deserialize(i.closestKnownAncestor,await this.ancestorDb.get(i.closestKnownAncestor));if(o.closestKnownDescendants.splice(o.closestKnownDescendants.findIndex((t=>t.equals(e))),1),i.closestKnownAncestor=t.key,n.push(i.key),r.put(o.key,o.serialize()),r.put(i.key,i.serialize()),"closed"===this.status)break}i!==n.length&&(r.put(t.key,t.serialize()),r.length>0&&this.ancestorDb.isOpen()&&await r.write())}async get(e,t,s){const r=(0,m.getBlockNumberFromParams)(e,t);if(null==r)return;const n=g.Quantity.from(r),i=Buffer.from(s),o=h.encode([n.toBuffer(),i]),a=Buffer.concat([o,v]),c=this.cacheDb.createReadStream({gt:o,lt:a,keys:!0,values:!0});for await(const e of c){const{key:t,value:s}=e,[r,n,o]=h.decode(t);if(!n.equals(i))return;if(this.hashBuffer.equals(o)||await this.ancestry.has(o))return s}}async put(e,t,s,r){const n=(0,m.getBlockNumberFromParams)(e,t);if(null==n)return!1;const i=g.Quantity.from(n),o=h.encode([i.toBuffer(),Buffer.from(s),this.hashBuffer]);return await this.cacheDb.put(o,r),!0}async close(){"closed"!==this.status&&(this.status="closed",this.cacheDb&&await this.cacheDb.close(),this.ancestorDb&&(await this._reBalancePromise,await this.ancestorDb.close()),this.db&&await this.db.close())}}t.PersistentCache=PersistentCache},90:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Tree=void 0;const o=i(s(196)),a=s(1),c=i(s(12));class Tree{constructor(e,t,s=a.BUFFER_EMPTY){this.closestKnownDescendants=[],this.key=Tree.encodeKey(e,t),this.hash=t.toBuffer(),this.closestKnownAncestor=s}serialize(){return c.encode([this.hash,this.closestKnownAncestor,this.closestKnownDescendants])}decodeKey(){return Tree.decodeKey(this.key)}static decodeKey(e){const[t,s]=o.decode(e);return{height:a.Quantity.from(t),hash:a.Data.from(s)}}static deserialize(e,t){const[s,r,n]=c.decode(t),i=Object.create(Tree.prototype);return i.key=e,i.hash=s,i.closestKnownAncestor=r,i.closestKnownDescendants=n,i}static encodeKey(e,t){return o.encode([e.toBuffer(),t.toBuffer()])}}t.Tree=Tree},810:(e,t)=>{"use strict";function timeSince(e){return Date.now()-e}Object.defineProperty(t,"__esModule",{value:!0}),t.LimitCounter=void 0;t.LimitCounter=class LimitCounter{constructor(e){this.counters=new Map,this.windowLength=e}evict(){const e=3*this.windowLength;if(timeSince(this.lastEvict)<e)return;this.lastEvict=Date.now();const t=this.counters;t.forEach(((s,r)=>{timeSince(s.updatedAt)>=e&&t.delete(r)}))}increment(e){this.evict();let t=this.counters.get(e);null==t?this.counters.set(e,{value:1,updatedAt:Date.now()}):(t.value+=1,t.updatedAt=Date.now())}get(e,t){let s=this.counters.get(e);null==s&&(s={value:0,updatedAt:Date.now()});let r=this.counters.get(t);return null==r&&(r={value:0,updatedAt:Date.now()}),[s.value,r.value]}}},293:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=s(3),i=s(1),o=r(s(294)),a=s(810),sleep=(e,t)=>t.aborted?Promise.reject(new n.AbortError):new Promise(((s,r)=>{function abort(){clearTimeout(i),t.removeEventListener("abort",abort),r(new n.AbortError)}const i=setTimeout((()=>{t.removeEventListener("abort",abort),s()}),e);t.addEventListener("abort",abort)}));t.default=class RateLimiter{constructor(e,t,s){this.sem=(0,o.default)(1),this.take=()=>new Promise((e=>this.sem.take(e))),this.mustBackoff=null,this.counter=0,this.requestLimit=e,this.windowSizeMs=t/2,this.limitCounter=new a.LimitCounter(this.windowSizeMs),this.abortSignal=s}status(e,t){const s=this.requestLimit,r=this.windowSizeMs,n=t,i=n-r,[o,a]=this.limitCounter.get(n,i);let c;if(c=0===a?o:a*((r-(e-n))/r)+o,s>0&&c+1>s){const e=s+1;return{rate:c,next:0===a?n+r+r/e:r*(a+(o+1)-e)/a+n}}return{rate:c,next:e}}async handle(e){await this.take();try{return await this.schedule(e)}finally{this.sem.leave()}}async schedule(e){const t=this.abortSignal;for(;;){if(t.aborted)return Promise.reject(new n.AbortError);this.mustBackoff&&await this.mustBackoff;const a=Date.now(),c=(r=a,o=this.windowSizeMs,r-r%o),{rate:l,next:u}=this.status(a,c);if(!(l+1>this.requestLimit&&u>a)){this.limitCounter.increment(c);const r=await e();if(s=r.response,(0,i.hasOwn)(s,"error")&&null!=s.error&&s.error.code===i.JsonRpcErrorCode.LIMIT_EXCEEDED&&(0,i.hasOwn)(r.response.error.data,"rate")){const e=r.response.error.data.rate.backoff_seconds;this.requestLimit=r.response.error.data.rate.allowed_rps*(this.windowSizeMs/1e3);const s=this.mustBackoff=sleep(1e3*e,t);await this.mustBackoff,this.mustBackoff===s&&(this.mustBackoff=null);continue}return r}await sleep(Date.now()-u,t)}var s,r,o}}},806:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForkStateManager=void 0;const r=s(12),n=s(807),i=s(432);class ForkStateManager extends i.GanacheStateManager{constructor(e){super(e),this._cache=new n.ForkCache(e.trie),this.prefixCodeHashes=e.prefixCodeHashes||!1}copy(){return new ForkStateManager({trie:this._trie.copy(!1),prefixCodeHashes:this.prefixCodeHashes})}async _lookupStorageTrie(e){const t=await this.getAccount(e),s=this._trie.copy(!0);return s.setContext(t.storageRoot,e.buf,s.blockNumber),s.database().checkpoints=[],s}async getContractStorage(e,t){const s=await this._getStorageTrie(e),n=await s.get(t);return(0,r.decode)(n)}}t.ForkStateManager=ForkStateManager},244:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ForkTrie=void 0;const o=s(11),a=s(1),c=s(433),l=s(24),u=i(s(196)),d=s(12),f=s(3),h=s(0),g=s(147),p=Buffer.allocUnsafe(1).fill(1),m=new WeakMap,b={keyEncoding:"binary",valueEncoding:"binary"};function isEqualKey(e,t,s){const r=u.decode(e),[n,i,o]=r;return i.equals(t)&&o.equals(s)}class ForkTrie extends c.GanacheTrie{constructor(e,t,s){super(e,t,s),this.address=null,this.isPreForkBlock=!1,this.accountFromFallback=async(e,t)=>{const{fallback:s}=this.blockchain,r=this.blockchain.fallback.selectValidForkBlockNumber(t),n=s.request("eth_getCode",[e,r]),i=[s.request("eth_getTransactionCount",[e,r]),s.request("eth_getBalance",[e,r]),null],o=new f.Account(e);try{const e=await n;if("0x"!==e){const t=a.Data.toBuffer(e);o.codeHash=(0,a.keccak)(t),o.codeHash.equals(h.KECCAK256_NULL)||(i[2]=this.db.put(o.codeHash,t))}}catch(e){throw Promise.all(i).catch((e=>{})),e}const[c,l]=await Promise.all(i);return o.nonce="0x0"===c?a.Quantity.Empty:a.Quantity.from(c,!0),o.balance="0x0"===l?a.Quantity.Empty:a.Quantity.from(l),o.serialize()},this.storageFromFallback=async(e,t,s)=>{const r=await this.blockchain.fallback.request("eth_getStorageAt",[`0x${e.toString("hex")}`,`0x${t.toString("hex")}`,this.blockchain.fallback.selectValidForkBlockNumber(s)]);if(!r)return null;const n=r.replace(/^0x(00)*/,""),i=Buffer.from(n,"hex");return(0,d.encode)(i)},this.accounts=s.accounts,this.blockNumber=this.blockchain.fallback.blockNumber,this.forkBlockNumber=this.blockNumber.toBigInt();let r=m.get(e);r||(r=e.sublevel("f",b),m.set(e,r)),this.metadataDB=r,this.checkpointedMetadata=new l.CheckpointDB(new g.TrieDB(this.metadataDB))}checkpoint(){super.checkpoint(),this.checkpointedMetadata.checkpoint(this.root())}async commit(){await Promise.all([super.commit(),this.checkpointedMetadata.commit()])}async revert(){await Promise.all([super.revert(),this.checkpointedMetadata.revert()])}setContext(e,t,s){this._root=e,this.address=t,this.blockNumber=s,this.isPreForkBlock=s.toBigInt()<this.forkBlockNumber}async put(e,t){return super.put(e,t)}async revertMetaData(e,t){const s=this.metadataDB,r=s.createKeyStream({gte:u.encode([e.toBuffer()]),lt:u.encode([a.Quantity.from(t.toBigInt()+1n).toBuffer()])}),n=s.batch();for await(const e of r)n.del(e);await n.write()}createDelKey(e){const t=this.blockNumber.toBuffer();return u.encode([t,this.address,e])}async keyWasDeleted(e){const t=null===this.address?a.BUFFER_EMPTY:this.address,{checkpoints:s}=this.checkpointedMetadata;for(let r=s.length-1;r>=0;r--)for(let[n,i]of s[r].keyValueMap.entries()){if(!i||!i.equals(p))continue;if(isEqualKey(Buffer.from(n,"binary"),t,e))return!0}const r=this.metadataDB.createReadStream({lte:this.createDelKey(e),reverse:!0});for await(const s of r){const{key:r,value:n}=s;if(n&&n.equals(p)&&isEqualKey(r,t,e))return!0}return!1}async del(e){if(await this._lock.acquire(),this.isPreForkBlock){const t=(0,a.keccak)(e),{node:s,stack:r}=await this.findPath(t);s&&(await this._deleteNode(t,r),await this.persistRoot())}else{const t=this.createDelKey(e),s=this.checkpointedMetadata.put(t,p),r=(0,a.keccak)(e),{node:n,stack:i}=await this.findPath(r);n&&(await this._deleteNode(r,i),await this.persistRoot()),await s}this._lock.release()}async get(e){const t=await super.get(e);return null!=t?t:!this.isPreForkBlock&&await this.keyWasDeleted(e)?null:null===this.address?this.accountFromFallback(o.Address.from(e),this.blockNumber):this.storageFromFallback(this.address,e,this.blockNumber)}copy(e=!0){const t=new ForkTrie(this.db.copy(),this.root(),this.blockchain);return t.accounts=this.accounts,t.address=this.address,t.blockNumber=this.blockNumber,e&&this.hasCheckpoints()&&(t._db.checkpoints=[...this._db.checkpoints],t.checkpointedMetadata.checkpoints=this.checkpointedMetadata.checkpoints),t}}t.ForkTrie=ForkTrie},287:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deriveFromIndex=t.deriveFromPath=t.createAccountFromSeed=t.createAccountGeneratorFromSeedAndPath=void 0;const n=s(10),i=r(s(71)),o=s(1),a=2147483648,c=Buffer.from("Bitcoin seed","utf8");function createAccountFromSeed(e){const t=(0,n.createHmac)("sha512",c).update(e).digest(),s=t.slice(0,32);return{privateKey:s,chainCode:t.slice(32),publicKey:makePublicKey(s)}}function deriveFromPath(e,t){return e.forEach((function(e,s){if(0===s){if(!/^[mM]{1}/.test(e))throw new Error('Path must start with "m" or "M"');return}const r=e.length>1&&"'"===e[e.length-1];let n=parseInt(e,10);if(n>=a)throw new Error("Invalid index");r&&(n+=a),t=deriveChild(n,r,t.privateKey,t.publicKey,t.chainCode)})),t}function deriveFromIndex(e,t){if(e>=a)throw new Error("Invalid index");return deriveChild(e,!1,t.privateKey,t.publicKey,t.chainCode)}function makePublicKey(e){const t=Buffer.allocUnsafe(33);switch(i.default.publicKeyCreate(t,e)){case 0:return t;case 1:throw new Error("Private Key is invalid");case 2:throw new Error("Public Key serialization error")}}t.createAccountGeneratorFromSeedAndPath=function createAccountGeneratorFromSeedAndPath(e,t){const s=deriveFromPath(t,createAccountFromSeed(e));return e=>deriveFromIndex(e,s)},t.createAccountFromSeed=createAccountFromSeed,t.deriveFromPath=deriveFromPath,t.deriveFromIndex=deriveFromIndex;const l=Buffer.allocUnsafe(4);function deriveChild(e,t,s,r,a){const c=l;let u;c.writeUInt32BE(e,0);const d=s.length;if(t){const e=d+1+4;u=Buffer.concat([o.BUFFER_ZERO,s,c],e)}else u=Buffer.concat([r,c],r.length+4);const f=(0,n.createHmac)("sha512",a).update(u).digest(),h=f.slice(0,32);try{const e=Buffer.allocUnsafe(d);switch(s.copy(e,0,0,d),i.default.privateKeyTweakAdd(e,h)){case 0:return{privateKey:e,publicKey:makePublicKey(e),chainCode:f.slice(32)};case 1:throw new Error("The tweak was out of range or the resulted private key is invalid")}}catch{return deriveChild(e+1,t,s,r,a)}}},736:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertArgLength=void 0,t.assertArgLength=function assertArgLength(e,t=e){return function(s,r,n){const i=n.value;return n.value=function(){const s=arguments.length;if(s<e||s>t)throw new Error(`Incorrect number of arguments. '${String(r)}' requires ${e===t?`exactly ${e} ${1===e?"argument":"arguments"}.`:`between ${e} and ${t} arguments.`}`);return Reflect.apply(i,this,arguments)},n}}},814:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bufferify=void 0;const s=Buffer.from('[]{},"":null'),r=s.slice(0,2),n=r.slice(0,1),i=r.slice(1,2),o=s.slice(2,4),a=o.slice(0,1),c=o.slice(1,2),l=s.slice(4,6).slice(0,1),u=s.slice(5,7),d=s.slice(6,8).slice(1,2),f=s.slice(8,12),h=s.slice(0,0),g=Object.prototype.toString;function stringToQuotedBuffer(e){const{length:t}=e;if(t>0){const s=Buffer.allocUnsafe(t+2);return s[0]=34,s[t+1]=34,s.utf8Write(e,1,t),s}return u}function*bufferify(e,t){const s=typeof e;if("number"===s||"boolean"===s)yield function numberToBuffer(e){const t=e.toString(),{length:s}=t;if(s>0){const e=Buffer.allocUnsafe(s);return e.utf8Write(t,0,s),e}return h}(e);else if("string"===s)yield stringToQuotedBuffer(e);else if(Buffer.isBuffer(e))yield function bufferToQuotedBuffer(e){const{length:t}=e,s=Buffer.allocUnsafe(t+2);return s[0]=34,e.copy(s,1,0,t),s[t+1]=34,s}(e);else if(Array.isArray(e))yield*function*arrayToBuffer(e){const{length:t}=e;if(0!==t){yield n;for(const t of bufferify(e[0],"0"))yield 0===t.length?f:t;for(let s=1;s<t;s++){yield l;for(const t of bufferify(e[s],s.toString()))yield 0===t.length?f:t}yield i}else yield r}(e);else if(u=e,"[object Object]"===g.call(u))yield*function*objectToBuffer(e,t){if("toJSON"in e)return void(yield*bufferify(e.toJSON(t),t));let s=!1;for(const t in e){const r=e[t];let n=!0;for(const e of bufferify(r,t))if(0!==e.length)if(n){n=!1;const r=stringToQuotedBuffer(t);s?yield Buffer.concat([l,r,d,e]):(yield Buffer.concat([a,r,d,e]),s=!0)}else yield e}return s?void(yield c):void(yield o)}(e,t);else if(null===e)yield f;else if("undefined"===s)yield h;else{if(!("toJSON"in e)||"function"!=typeof e.toJSON)throw new Error("unsupported value in bufferify");yield*bufferify(e.toJSON(),t)}var u}t.bufferify=bufferify},437:(e,t)=>{"use strict";function changeCommonParamValue(e,t,s,r,n){const i=e.paramByEIP.bind(e);e.paramByEIP=function(o,a,c){return o===s&&a===r&&c===t?n:i.call(e,o,a,c)}}Object.defineProperty(t,"__esModule",{value:!0}),t.changeCommonParamValue=t.removeEIP3860InitCodeSizeLimitCheck=void 0,t.removeEIP3860InitCodeSizeLimitCheck=function removeEIP3860InitCodeSizeLimitCheck(e){return changeCommonParamValue(e,3860,"vm","maxInitCodeSize",BigInt(Number.MAX_SAFE_INTEGER))},t.changeCommonParamValue=changeCommonParamValue},373:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseFilter=t.parseFilterRange=t.parseFilterDetails=void 0;const r=s(3),n=s(11);function parseFilterDetails(e){return{addresses:e.address?(Array.isArray(e.address)?e.address:[e.address]).map((e=>n.Address.from(e.toLowerCase()).toBuffer())):[],topics:e.topics?e.topics:[]}}function parseFilterRange(e,t){const s=t.blocks.latest.header.number,n=t.blocks.getEffectiveNumber(e.fromBlock||r.Tag.latest),i=s.toNumber(),o=t.blocks.getEffectiveNumber(e.toBlock||r.Tag.latest);let a;return a=o>s?i:o.toNumber(),{fromBlock:n,toBlock:o,toBlockNumber:a}}t.parseFilterDetails=parseFilterDetails,t.parseFilterRange=parseFilterRange,t.parseFilter=function parseFilter(e={address:[],topics:[]},t){const{addresses:s,topics:r}=parseFilterDetails(e),{fromBlock:n,toBlock:i,toBlockNumber:o}=parseFilterRange(e,t);return{addresses:s,fromBlock:n,toBlock:i,toBlockNumber:o,topics:r}}},288:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(s(4)),i=s(3),o=s(1),bn=(e=0)=>new n.default(e),a=bn(2300),bigIntToBN=e=>new n.default(e.toString()),check=e=>t=>e.has(t),c=check(new Set(["CALL","DELEGATECALL","STATICCALL","CALLCODE"])),l=check(new Set(["CALL","CALLCODE"])),u=check(new Set(["CREATE","CREATE2"])),d=check(new Set(["STOP","RETURN","REVERT","INVALID","SELFDESTRUCT"])),binSearch=async(e,t,s,r)=>{const n=bigIntToBN(t.block.header.gasLimit),i=s.execResult.gasRefund,a=bigIntToBN(i?s.gasEstimate+i:s.gasEstimate),c={lo:a,hi:a},isEnoughGas=async s=>{const r=await e();t.tx.gasLimit=o.Quantity.toBigInt(s.toArrayLike(Buffer)),await r.stateManager.checkpoint();const n=await r.runTx(t).catch((e=>({vmerr:e})));return await r.stateManager.revert(),!("vmerr"in n)&&!n.execResult.exceptionError};if(!await isEnoughGas(c.hi)){do{c.hi=c.hi.muln(1.0158730158730158)}while(!await isEnoughGas(c.hi));for(;c.lo.addn(1).lt(c.hi);){const e=c.lo.add(c.hi).divn(2);await isEnoughGas(e)?c.hi=e:c.lo=e}if(c.hi.gte(n)&&!await isEnoughGas(c.hi))return r(new Error("gas required exceeds allowance or always failing transaction"))}s.gasEstimate=o.Quantity.toBigInt(c.hi.toArrayLike(Buffer)),r(null,s)},exactimate=async(e,t,s)=>{const r=(()=>{const e=[],t=[],s=new Set;let r=!1,n=0;return{collect:i=>{r&&(i.depth===n&&s.add(t.length-1),r=!1),c(i.opcode.name)?(i.stack=[...i.stack],r=!0,n=i.depth,e.push({index:t.length,depth:i.depth,name:i.opcode.name})):(u(i.opcode.name)||d(i.opcode.name))&&e.push({index:t.length,depth:i.depth,name:i.opcode.name}),t.push(i)},isPrecompile:e=>s.has(e),done:()=>!t.length||e.length<2||!d(t[t.length-1].opcode.name),ops:t,systemOps:e}})();e.evm.events.on("step",r.collect);const Context=(e,t)=>{const s=0===e;let n=e,i=0;const o=bn();let c=bn();const u=r.ops[e],d=r.ops[e+1],f=bigIntToBN(u.gasLeft-d.gasLeft),h=t||bn();let g=!1;function addGas(e){c.gtn(0)&&(e.gte(c)?c=bn():c.isub(e)),o.iadd(e)}return{start:()=>n,stop:()=>i,setStart:e=>{n=e,g=!0},setStop:e=>{i=e},getCost:()=>({cost:o,sixtyFloorths:c}),transfer:e=>{const t=e.getCost();addGas(t.cost),c.iadd(t.sixtyFloorths)},addSixtyFloorth:e=>{c.iadd(e)},addRange:(e=bn())=>{const t=r.ops[s||g?n:n+1].gasLeft-r.ops[i].gasLeft;addGas(bigIntToBN(t).add(e))},finalizeRange:()=>{let e;if(g&&i!==r.ops.length-1){e=bigIntToBN(r.ops[n].gasLeft-r.ops[i-1].gasLeft),addGas(e);e=bigIntToBN(r.ops[i-1].gasLeft-r.ops[i].gasLeft).add(f)}else e=bigIntToBN(r.ops[n].gasLeft-r.ops[i].gasLeft);if(e.isub(h),addGas(e),l(u.opcode.name)&&0n!==u.stack[u.stack.length-3]){o.iadd(c);const e=bigIntToBN(d.gasLeft-r.ops[i-1].gasLeft);e.gt(a)?c=o.divn(63):e.lte(a)&&(c=a.sub(e))}else i!==r.ops.length-1&&(o.iadd(c),c=o.divn(63))}}};await e.stateManager.checkpoint();const n=await e.runTx(t).catch((e=>({vmerr:e})));if(await e.stateManager.revert(),"vmerr"in n){return s(n.vmerr)}if(n.execResult.exceptionError){return s(new i.RuntimeError(o.Quantity.Empty,n,i.RETURN_TYPES.RETURN_VALUE),n)}{const e=n;if(r.done()){const t=n.totalGasSpent;e.gasEstimate=t}else{const t=r.ops[0].gasLeft,s=r.ops[r.ops.length-1].gasLeft,i=bigIntToBN(t-s),l=(()=>{const e=r.systemOps,t=r.ops,opIndex=t=>e[t].index,s=[];let n=0,i=Context(0);for(;n<e.length;){const e=opIndex(n),o=t[e],l=o.opcode.name;if(c(l)||u(l))if(r.isPrecompile(e))i.setStop(e+1),i.addRange(),i.setStart(e+1),i.addSixtyFloorth(a);else{i.setStop(e);const t=bn(o.opcode.fee);i.addRange(t),s.push(i),i=Context(e,t)}else{if(!d(l))throw new Error("INVALID OPCODE");{i.setStop(e+1<r.ops.length?e+1:e),i.finalizeRange();const t=s.pop();if(!t)break;t.transfer(i),i=t,i.setStart(e+1)}}n++}const o=i.getCost();return o.cost.add(o.sixtyFloorths)})().sub(i);e.gasEstimate=n.totalGasSpent+o.Quantity.toBigInt(l.toArrayLike(Buffer))}s(null,e)}};t.default=async(e,t,s)=>{const r=await e();exactimate(r,t,((r,n)=>{if(r)return s(r);binSearch(e,t,n,((e,t)=>{if(e)return s(e);s(null,t)}))}))}},808:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.warmPrecompiles=t.activatePrecompiles=void 0;const s=Uint8Array.from([248,68,128,1,160,86,232,31,23,27,204,85,166,255,131,69,230,146,192,248,110,91,72,224,27,153,108,173,192,1,98,47,181,227,99,180,33,160,197,210,70,1,134,247,35,60,146,126,125,178,220,199,3,192,229,0,182,83,202,130,39,59,123,250,216,4,93,133,164,112]),r={serialize:()=>s},n=[],makeAccount=e=>{if(n[e])return n[e];const t=Buffer.allocUnsafe(20).fill(0,0,19);return t[19]=e,n[e]={buf:t}};t.activatePrecompiles=async e=>{await e.checkpoint();for(let t=1;t<=18;t++){const s=makeAccount(t);e.putAccount(s,r)}await e.commit()};t.warmPrecompiles=async e=>{for(let t=1;t<=18;t++){const s=makeAccount(t);e.addWarmedAddress(s.buf)}}},805:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applySimulationOverrides=t.runCall=void 0;const r=s(1),n=s(11),i=s(0);t.runCall=function runCall(e,t,s){const r=t.from,n=t.to??null,i=null==t.value?0n:t.value.toBigInt();e.evm.runCall({origin:r,block:t.block,gasPrice:t.gasPrice.toBigInt(),caller:r,gasLimit:s,to:n,value:i,data:t.data&&t.data.toBuffer()})};const validateStorageOverride=(e,t,s)=>{if("string"==typeof e&&""!==e&&0===e.indexOf("0x")&&66!=e.length)throw new Error(`${s} override slot must be a 64 character hex string. Received ${e.length-2} character string.`);if(null==t)throw new Error(`${s} override data not valid. Received: ${t}`);if("string"==typeof t&&""!==t&&0===t.indexOf("0x")&&66!=t.length)throw new Error(`${s} override data must be a 64 character hex string. Received ${t.length-2} character string.`)};t.applySimulationOverrides=async function applySimulationOverrides(e,t,s){const o=t.eei;for(const t in s){if(!(0,r.hasOwn)(s,t))continue;const{balance:a,nonce:c,code:l,state:u,stateDiff:d}=s[t],f=n.Address.from(t);if(null!=c||null!=a||null!=l){const t=await o.getAccount(f);if(null!=c&&(t.nonce=""===c?0n:r.Quantity.toBigInt(c)),null!=a&&(t.balance=""===a?0n:r.Quantity.toBigInt(a)),null!=l){const s=r.Data.toBuffer(""===l?"0x":l),n=s.length>0?(0,r.keccak)(s):i.KECCAK256_NULL;t.codeHash=n,await e.database().put(n,s)}await o.putAccount(f,t)}if(u||d)if(u){if(d)throw new Error("both state and stateDiff overrides specified");let e=!1;for(const t in u){if(!(0,r.hasOwn)(u,t))continue;const s=u[t];validateStorageOverride(t,s,"State"),e||(await o.clearContractStorage(f),e=!0);const n=r.Data.toBuffer(t,32),i=r.Data.toBuffer(s);await o.putContractStorage(f,n,i)}}else for(const e in d){if(!(0,r.hasOwn)(d,e))continue;const t=d[e];validateStorageOverride(e,t,"StateDiff");const s=r.Data.toBuffer(e,32),n=r.Data.toBuffer(t);await o.putContractStorage(f,s,n)}}}},809:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpTrieStorageDetails=t.getStorage=void 0;const r=s(1),n=s(12),compare=(e,t)=>e.compare(t)<0;async function getStorage(e,t,s,i){const o={},a=[];for(let c=0;c<s;c++){const s=e[c];a.push(i.get(s).then((e=>{o[r.Data.toString(s,32)]={key:r.Data.from(e,32),value:r.Data.from((0,n.decode)(t[c]),32)}})))}return await Promise.all(a),o}t.getStorage=getStorage,t.dumpTrieStorageDetails=async function dumpTrieStorageDetails(e,t,s,n){const{keys:i,length:o,nextKey:a,values:c}=await async function getHashedKeysWithValues(e,t,s){return await new Promise(((n,i)=>{const o=[],a=[];e.createReadStream().on("data",(function onData({key:e,value:n}){if(t.compare(e)>0)return;const i=(0,r.findInsertPosition)(o,e,compare);i>s||(o.splice(i,0,e),a.splice(i,0,n))})).on("end",(function onEnd(){const e=o.length;if(e>s){const e=r.Data.from(o[s]);n({keys:o,length:s,nextKey:e,values:a})}else n({keys:o,length:e,nextKey:null,values:a})})).on("error",i)}))}(s,e,t);return{storage:await getStorage(i,c,o,n),nextKey:a}}},433:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GanacheTrie=void 0;const r=s(1),n=s(24),keyHashingFunction=e=>(0,r.keccak)(Buffer.from(e.buffer,e.byteOffset,e.length));class GanacheTrie extends n.Trie{constructor(e,t,s){super({db:e,root:t,useRootPersistence:!0,useKeyHashing:!0,useKeyHashingFunction:keyHashingFunction}),this.blockchain=s,this.db=e}setContext(e,t,s){this.root(e)}copy(e=!0){const t=new GanacheTrie(this.db.copy(),this.root(),this.blockchain);return e&&this.hasCheckpoints()&&(t._db.checkpoints=[...this._db.checkpoints]),t}}t.GanacheTrie=GanacheTrie},135:function(e,t,s){"use strict";var r,n,i,o,a,c,l,u,d,f,h,g,p,m,b,y,w,v,_,k,E,B=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},P=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},T=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Capacity=void 0;const A=s(3),O=s(1),S=s(12),I=s(24),R=T(s(29)),D=T(s(742)),C=s(23),F=s(390),x=s(391);var N;!function(e){e[e.FillBlock=-1]="FillBlock",e[e.Empty=0]="Empty",e[e.Single=1]="Single"}(N||(t.Capacity=N={}));const updateBloom=(e,t)=>{let s=256;for(;--s;)e[s]|=t[s]},sortByPrice=(e,t,s)=>e[t].effectiveGasPrice>e[s].effectiveGasPrice,refresher=(e,t)=>e.updateEffectiveGasPrice(t);class Miner extends R.default{async pause(){B(this,a,"f")||(P(this,a,!0,"f"),P(this,c,new Promise((e=>{P(this,u,e,"f")})),"f")),B(this,o,"f")&&await this.once("idle")}resume(){B(this,a,"f")&&(P(this,a,!1,"f"),B(this,u,"f").call(this))}constructor(e,t,s,T){super(),r.set(this,0n),n.set(this,new Set),i.set(this,void 0),o.set(this,!1),a.set(this,!1),c.set(this,void 0),l.set(this,void 0),u.set(this,void 0),d.set(this,!1),f.set(this,void 0),h.set(this,void 0),g.set(this,void 0),p.set(this,void 0),m.set(this,new O.Heap(sortByPrice,refresher)),b.set(this,(async(e,t=N.FillBlock,s=!1)=>{const{block:r,transactions:n}=await B(this,y,"f").call(this,e,t,s);if(B(this,i,"f")&&(B(this,k,"f").call(this),P(this,i,!1,"f"),!s&&B(this,m,"f").length>0)){const e=B(this,p,"f").call(this,r);await B(this,b,"f").call(this,e,t)}return n})),y.set(this,(async(e,t,s)=>{let n;const i=B(this,g,"f"),{pending:a,inProgress:c}=B(this,f,"f"),u=B(this,h,"f");let d=!0;const b=B(this,m,"f"),y=new Map;let k;do{d=!1,P(this,o,!0,"f"),k=[];const f=new I.Trie,h=new I.Trie;if(t===N.Empty){await i.stateManager.checkpoint(),await i.stateManager.commit();const t=e.finalize(f.root(),h.root(),O.BUFFER_256_ZERO,i.stateManager._trie.root(),0n,u.extraData,[],y);return this.emit("block",t),B(this,_,"f").call(this),{block:t.block,transactions:[]}}let g=0,m=u.blockGasLimit.toBigInt(),T=0n;const R=Buffer.allocUnsafe(256).fill(0),F=[];await i.stateManager.checkpoint();const x=(0,A.TraceDataFactory)(),stepListener=e=>{if("SSTORE"===e.opcode.name){const t=x.from(O.Quantity.toBuffer(e.stack[e.stack.length-1])).toBuffer(),s=(0,O.keccak)(t);y.set(s.toString(),{key:t,hashedKey:s})}};let M;for(i.evm.events.on("step",stepListener);M=b.peek();){const s=M.from.toString();if(M.calculateIntrinsicGas()>m){M.locked=!1,B(this,v,"f").call(this,s);continue}P(this,r,M.effectiveGasPrice.toBigInt(),"f"),await i.stateManager.checkpoint(),i.stateManager._trie.blockNumber=O.Quantity.from(e.header.number);const n=await B(this,w,"f").call(this,M,e,s,a);if(null!==n){const e=n.totalGasSpent;if(m>=e){await i.stateManager.commit(),k[g]=M,m-=e,T+=e;const r=(0,S.encode)(0===g?O.BUFFER_EMPTY:(0,O.uintToBuffer)(g));F.push(f.put(r,M.serialized));const o=M.fillFromResult(n,T);F.push(h.put(r,o)),updateBloom(R,n.bloom.bitvector),g++;const l=a.get(s);c.add(M),M.once("finalized").then((()=>{c.delete(M)}));if(d=l.removeBest()?(0,D.default)(b,l):B(this,v,"f").call(this,s),m<=C.Params.TRANSACTION_GAS||g===t)break}else await i.stateManager.revert(),M.locked=!1,d=b.removeBest()}else await i.stateManager.revert()}await Promise.all(F),await i.stateManager.commit(),i.evm.events.removeListener("step",stepListener);const L=e.finalize(f.root(),h.root(),R,i.stateManager._trie.root(),T,u.extraData,k,y);if(n=L.block,this.emit("block",L),s){P(this,r,0n,"f"),B(this,_,"f").call(this);break}P(this,r,0n,"f"),B(this,E,"f").call(this),0!==b.length?(e=B(this,p,"f").call(this,n),void 0!==B(this,l,"f")&&b.refresh(B(this,l,"f"))):B(this,_,"f").call(this)}while(d);return{block:n,transactions:k}})),w.set(this,(async(e,t,s,r)=>{const n={},i=B(this,g,"f");this.emit("ganache:vm:tx:before",{context:n});const stepListener=e=>{const t=(0,x.maybeGetLogs)(e);t&&this.emit("ganache:vm:tx:console.log",{context:n,logs:t}),B(this,d,"f")&&this.emit("ganache:vm:tx:step",(0,F.makeStepEvent)(n,e))};i.evm.events.on("step",stepListener);try{return await i.runTx({skipHardForkValidation:!0,tx:e.toVmTransaction(),block:t})}catch(t){const n=t.message,i=r.get(s);i.removeBest()?(0,D.default)(B(this,m,"f"),i):B(this,v,"f").call(this,s);const o={execResult:{runState:{programCounter:0},exceptionError:{error:n},returnValue:O.BUFFER_EMPTY}},a=new A.RuntimeError(e.hash,o,A.RETURN_TYPES.TRANSACTION_HASH);return e.finalize("rejected",a),null}finally{i.evm.events.removeListener("step",stepListener),this.emit("ganache:vm:tx:after",{context:n})}})),v.set(this,(e=>(B(this,n,"f").delete(e),B(this,m,"f").removeBest()))),_.set(this,(()=>{B(this,n,"f").clear();const e=B(this,m,"f"),t=e.length,s=e.array;for(let e=0;e<t;e++){s[e].locked=!1}e.clear(),P(this,o,!1,"f")})),k.set(this,(()=>{const{pending:e}=B(this,f,"f"),t=B(this,n,"f"),s=B(this,m,"f");for(let r of e){const e=r[1].peek();if(e&&!e.locked){const r=e.from.toString();t.add(r),e.updateEffectiveGasPrice(B(this,l,"f")),s.push(e),e.locked=!0}}})),E.set(this,(()=>{const{pending:e}=B(this,f,"f"),t=B(this,n,"f"),s=B(this,m,"f");for(let n of e){const e=n[1].peek();if(e&&!e.locked){const n=e.effectiveGasPrice.toBigInt();if(B(this,r,"f")>n)continue;const i=e.from.toString();if(t.has(i))continue;t.add(i),e.updateEffectiveGasPrice(B(this,l,"f")),s.push(e),e.locked=!0}}})),P(this,g,s,"f"),P(this,h,e,"f"),P(this,f,t,"f"),P(this,p,(e=>{const t=T(e);return P(this,l,t.header.baseFeePerGas,"f"),t}),"f"),B(this,m,"f").init([])}async mine(e,t=N.FillBlock,s=!1){if(B(this,a,"f")&&await B(this,c,"f"),B(this,o,"f"))return P(this,i,!0,"f"),void B(this,E,"f").call(this);{P(this,l,e.header.baseFeePerGas,"f"),B(this,k,"f").call(this);const r=await B(this,b,"f").call(this,e,t,s);return this.emit("idle"),r}}toggleStepEvent(e){P(this,d,e,"f")}}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,h=new WeakMap,g=new WeakMap,p=new WeakMap,m=new WeakMap,b=new WeakMap,y=new WeakMap,w=new WeakMap,v=new WeakMap,_=new WeakMap,k=new WeakMap,E=new WeakMap,t.default=Miner},742:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function replaceFromHeap(e,t){const s=t.peek();return s?(e.replaceBest(s),s.locked=!0,!0):e.removeBest()}},390:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeStepEvent=void 0;const r=s(1);function normalizeEvent(e){const{account:t,memory:s,opcode:n}=e,i=s.length,o=Buffer.allocUnsafe(104+i);t.storageRoot.copy(o,0,0,32),t.codeHash.copy(o,32,0,32),e.address.buf.copy(o,64,0,20),e.codeAddress.buf.copy(o,84,0,20);const a=o.slice(0,32),c=o.slice(32,64),l=o.slice(64,84),u=o.slice(84,104);let d;return 0!==i?(s.copy(o,104,0,i),d=o.slice(104,104+i)):d=r.BUFFER_ZERO,{account:{nonce:t.nonce,balance:t.balance,stateRoot:a,codeHash:c},address:l,codeAddress:u,depth:BigInt(e.depth),gasLeft:e.gasLeft,gasRefund:e.gasRefund,memory:d,memoryWordCount:e.memoryWordCount,opcode:{name:n.name,fee:n.fee},pc:BigInt(e.pc),returnStack:e.returnStack.map((e=>e)),stack:e.stack.map((e=>e))}}t.makeStepEvent=function makeStepEvent(e,t){return{context:e,data:normalizeEvent(t)}}},237:function(e,t,s){"use strict";var r,n,i,o,a,c,l,u,d,f=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},h=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},g=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EthereumProvider=void 0;const p=g(s(29)),m=g(s(227)),b=s(1),y=s(138),w=g(s(232)),v=g(s(130)),_=g(s(224)),k=s(246),E=s(11);class EthereumProvider extends p.default{constructor(e={},t){super(),r.set(this,void 0),n.set(this,void 0),i.set(this,void 0),o.set(this,void 0),a.set(this,void 0),this.removeListener=this.off,c.set(this,((e,t)=>{let s,r,n;if("string"==typeof e)s=e,r=t,n=this.request({method:s,params:r});else{if("function"!=typeof t)throw new Error("No callback provided to provider's send function. As of web3 1.0, provider.send is no longer synchronous and must be passed a callback as its final argument.");if(Array.isArray(e)){const s=t;h(this,u,"f").call(this,e).then((({error:e,result:t})=>{s(e,t)}))}else{const s=t;h(this,d,"f").call(this,e).then((({error:e,result:t})=>{s(e,t)}))}}return n})),l.set(this,((e,t)=>{const s=h(this,r,"f");s.logging.verbose?s.logging.logger.log(` > ${e}: ${null==t?t:JSON.stringify(t,null,2).split("\n").join("\n > ")}`):s.logging.logger.log(e)})),this.disconnect=async()=>{h(this,o,"f").stop(),await h(this,a,"f").stop(),await h(this,r,"f").logging.logger.close(),h(this,o,"f").end(),this.emit("disconnect")},u.set(this,(e=>Promise.all(e.map(h(this,d,"f"))).then((e=>{let t=null;const s=[];return e.forEach((({error:e,result:r},n)=>{s.push(r),e&&(null==t&&(t=new Error("Batch error:")),t.errors[n]=e)})),{error:t,result:s}})))),d.set(this,(async e=>{const t=e.method,s=e.params;try{const r=await this.request({method:t,params:s});return{error:null,result:(0,b.makeResponse)(e.id,JSON.parse(JSON.stringify(r)))}}catch(t){let s;return(0,b.hasOwn)(t,"result")&&(s=t.result,delete t.result),{error:t,result:(0,b.makeError)(e.id,t,s)}}})),f(this,o,t,"f");const s=f(this,r,y.EthereumOptionsConfig.normalize(e),"f"),g=f(this,i,new v.default(s.wallet,s.logging),"f"),w=g.initialAccounts,B=s.fork.url||s.fork.provider||s.fork.network?new k.Fork(s,w):null,P=function parseCoinbase(e,t){switch(typeof e){case"object":return e;case"number":const s=t[e];if(s)return s.address;throw new Error(`invalid coinbase address index: ${e}`);case"string":return E.Address.from(e);default:throw new Error(`coinbase address must be string or number, received: ${e}`)}}(s.miner.coinbase,w),T=new _.default(s,P,B);f(this,a,T,"f"),T.on("ganache:vm:tx:before",(e=>{this.emit("ganache:vm:tx:before",e)})),T.on("ganache:vm:tx:step",(e=>{this.emit("ganache:vm:tx:step",e)})),T.on("ganache:vm:tx:after",(e=>{this.emit("ganache:vm:tx:after",e)})),T.on("ganache:vm:tx:console.log",(e=>{this.emit("ganache:vm:tx:console.log",e)})),function hookEventSystem(e,t){let s=0;e.on(p.default.listenerAdded,(({eventName:e})=>{"ganache:vm:tx:step"!==e&&void 0!==e||(0===s&&t(!0),s++)})),e.on(p.default.listenerRemoved,(({eventName:e})=>{"ganache:vm:tx:step"!==e&&void 0!==e||(s--,0===s&&t(!1))}))}(this,(e=>{T.toggleStepEvent(e)})),f(this,n,new m.default(s,g,T),"f")}async initialize(){await h(this,a,"f").initialize(h(this,i,"f").initialAccounts),this.emit("connect")}getOptions(){return(0,w.default)(h(this,r,"f"))}getInitialAccounts(){const e={},t=h(this,i,"f"),s=h(this,i,"f").unlockedAccounts;return t.initialAccounts.forEach((t=>{const r=t.address.toString();e[r]={secretKey:t.privateKey.toString(),balance:t.balance.toBigInt(),unlocked:s.has(r)}})),e}send(e,t){return h(this,c,"f").call(this,e,t)}sendAsync(e,t){h(this,c,"f").call(this,e,t)}async request(e){const t=await this._requestRaw(e),s=await t.value;return JSON.parse(JSON.stringify(s))}async _requestRaw({method:e,params:t}){h(this,l,"f").call(this,e,t);const s=(await h(this,o,"f").execute(h(this,n,"f"),e,t)).value;s instanceof b.PromiEvent&&s.on("message",(e=>{const t=JSON.parse(JSON.stringify(e));this.emit("message",t),this.emit("data",{jsonrpc:"2.0",method:"eth_subscription",params:t.data})}));return{value:s.catch((e=>{throw h(this,r,"f").chain.vmErrorsOnRPCResponse&&(0,b.hasOwn)(e,"result")&&(e.result=JSON.parse(JSON.stringify(e.result))),e}))}}}t.EthereumProvider=EthereumProvider,r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap},432:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GanacheStateManager=void 0;const r=s(194);class GanacheStateManager extends r.DefaultStateManager{async getStorageTrie(e){return await this._getStorageTrie({buf:e})}}t.GanacheStateManager=GanacheStateManager},242:function(e,t,s){"use strict";var r,n,i,o,a,c=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},l=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TriageOption=void 0;const d=u(s(29)),f=s(1),h=s(1),g=s(3),p=s(39);function shouldReplace(e,t,s,r){if(e.nonce.toBigInt()!==t)return!1;if(e.locked)throw new g.CodedError(g.TRANSACTION_LOCKED,h.JsonRpcErrorCode.TRANSACTION_REJECTED);const n="maxPriorityFeePerGas"in s?s.maxPriorityFeePerGas.toBigInt():s.effectiveGasPrice.toBigInt(),i="maxFeePerGas"in s?s.maxFeePerGas.toBigInt():s.effectiveGasPrice.toBigInt(),o="maxPriorityFeePerGas"in e?e.maxPriorityFeePerGas.toBigInt():e.effectiveGasPrice.toBigInt(),a="maxFeePerGas"in e?e.maxFeePerGas.toBigInt():e.effectiveGasPrice.toBigInt();if(n<o+o*r/100n||i<a+a*r/100n)throw new g.CodedError(g.UNDERPRICED,h.JsonRpcErrorCode.TRANSACTION_REJECTED);return!0}function byNonce(e,t,s){return(e[s].nonce.toBigInt()||0n)>(e[t].nonce.toBigInt()||0n)}var m;!function(e){e[e.FutureQueue=0]="FutureQueue",e[e.Executable=1]="Executable",e[e.ReplacesPendingExecutable=2]="ReplacesPendingExecutable",e[e.ReplacesFutureTransaction=3]="ReplacesFutureTransaction"}(m||(t.TriageOption=m={}));class TransactionPool extends d.default{constructor(e,t,s=new Map){super(),r.set(this,void 0),n.set(this,void 0),i.set(this,void 0),this.executables={inProgress:new Set,pending:new Map},o.set(this,new Map),this.drain=()=>{this.emit("drain")},a.set(this,(e=>{if(e.gas>l(this,r,"f").miner.blockGasLimit)return new g.CodedError(g.GAS_LIMIT,h.JsonRpcErrorCode.INVALID_INPUT);const t=e.calculateIntrinsicGas();return-1n===t||e.gas.toBigInt()<t?new g.CodedError(g.INTRINSIC_GAS_TOO_LOW,h.JsonRpcErrorCode.INVALID_INPUT):null==e.to&&e.data&&!1===l(this,r,"f").chain.allowUnlimitedInitCodeSize&&l(this,i,"f").common.isActivatedEIP(3860)&&e.data.valueOf().length>49152?new g.CodedError(g.INITCODE_TOO_LARGE,h.JsonRpcErrorCode.INVALID_INPUT):null})),c(this,i,t,"f"),c(this,r,e,"f"),this.origins=s,c(this,n,e.miner.priceBump,"f")}async prepareTransaction(e,t){let s;if(s=l(this,a,"f").call(this,e),null!=s)throw s;const r=e.from;let c;e.nonce.isNull()||(c=e.nonce.toBigInt());const u=r.toString();let d=l(this,o,"f").get(u);if(d&&await d,!e.effectiveGasPrice&&l(this,i,"f").common.isActivatedEIP(1559)){const t=p.Block.calcNextBaseFee(l(this,i,"f").blocks.latest);e.updateEffectiveGasPrice(t)}let b=0n;d||(d=l(this,i,"f").accounts.getNonceAndBalance(r),l(this,o,"f").set(u,d),d.then((()=>{l(this,o,"f").delete(u)})));const y=await d,w=e.gas.toBigInt()*e.maxGasPrice().toBigInt()+e.value.toBigInt();if(y.balance.toBigInt()<w)throw new g.CodedError(g.INSUFFICIENT_FUNDS,h.JsonRpcErrorCode.TRANSACTION_REJECTED);const v=this.origins,_=v.get(u);let k=m.FutureQueue;const E=this.executables.pending;let B=E.get(u);const P=l(this,n,"f");let T;if(B&&(T=B.length)){const t=B.array;for(let s=0;s<T;s++){const r=t[s];if(shouldReplace(r,c,e,P)){t[s]=e,k=m.ReplacesPendingExecutable,r.finalize("rejected",new g.CodedError(g.REPLACED,h.JsonRpcErrorCode.TRANSACTION_REJECTED));break}const n=r.nonce.toBigInt();n>b&&(b=n)}void 0===c?(c=b+1n,e.nonce=h.Quantity.from(c),k=m.Executable):c===b+1n&&(k=m.Executable)}else{const t=y.nonce.toBigInt();if(void 0===c)c=t||0n,e.nonce=h.Quantity.from(c),k=m.Executable;else{if(c<t)throw new g.CodedError(`the tx doesn't have the correct nonce. account has nonce of: ${t} tx has nonce of: ${c}`,h.JsonRpcErrorCode.INVALID_INPUT);c===t&&(k=m.Executable)}}if(_&&k!==m.Executable&&k!==m.ReplacesPendingExecutable&&(T=_.length)){const t=_.array;for(let s=0;s<T;s++){const r=t[s];if(shouldReplace(r,c,e,P)){t[s]=e,k=m.ReplacesFutureTransaction,r.finalize("rejected",new g.CodedError(g.REPLACED,h.JsonRpcErrorCode.TRANSACTION_REJECTED));break}}}switch(t&&e.signAndHash(t.toBuffer()),k){case m.Executable:if(B?B.push(e):(B=f.Heap.from(e,byNonce),E.set(u,B)),_){let e=c+1n;for(;;){const t=_.peek();if((t.nonce.toBigInt()||0n)!==e)break;if(B.push(t),!_.removeBest()){v.delete(u);break}e+=1n}}return!0;case m.FutureQueue:return _?_.push(e):v.set(u,f.Heap.from(e,byNonce)),!1;case m.ReplacesPendingExecutable:return!0;case m.ReplacesFutureTransaction:return!1}}clear(){this.origins.clear(),l(this,o,"f").clear(),this.executables.pending.clear()}find(e){const{pending:t,inProgress:s}=this.executables;for(let[t,s]of this.origins){if(void 0===s)continue;const t=s.array;for(let r=0;r<s.length;r++){const s=t[r];if(s.hash.toBuffer().equals(e))return s}}for(let[s,r]of t){const t=r.array;for(let s=0;s<r.length;s++){const r=t[s];if(r.hash.toBuffer().equals(e))return r}}for(let t of s)if(t.hash.toBuffer().equals(e))return t;return null}}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,t.default=TransactionPool},147:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TrieDB=void 0;const n=r(s(94)),i={keyEncoding:"binary",valueEncoding:"binary"};class TrieDB{constructor(e){this._db=e}async get(e){let t=null;try{t=await this._db.get(e,i)}catch(e){if(!e.notFound)throw e}return t}async put(e,t){await this._db.put(e,t,i)}async del(e){await this._db.del(e,i)}async batch(e){await this._db.batch(e,i)}copy(){return new TrieDB(this._db)}async close(){await this._db.close()}sublevel(e,t){return(0,n.default)(this._db,e,t)}createReadStream(e){return this._db.createReadStream(e)}}t.TrieDB=TrieDB},130:function(e,t,s){"use strict";var r,n,i,o,a,c,l,u=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),d=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&u(t,e,s);return d(t,e),t},h=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},g=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},p=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const m=s(3),b=s(287),y=s(1),w=s(0),v=f(s(71)),_=s(352),k=s(96),E=p(s(10)),B=s(9),P=s(11),T=Buffer.allocUnsafe(12).fill(255),A={dklen:32,n:1024,p:8,r:1},O="aes-128-ctr",S=1e5,scrypt=(...e)=>new Promise(((t,s)=>{E.default.scrypt.call(E.default,...e,((e,r)=>{if(!e)return t(r);s(e)}))})),I=Buffer.allocUnsafe(65),uncompressedPublicKeyToAddress=e=>{switch(v.default.publicKeyConvert(I,e)){case 0:return P.Address.from((0,y.keccak)(I.slice(1)).slice(-20));case 1:throw new Error("Public Key could not be parsed");case 2:throw new Error("Public Key serialization error")}},asUUID=e=>`${e.toString("hex",0,4)}-${e.toString("hex",4,6)}-${e.toString("hex",6,8)}-${e.toString("hex",8,10)}-${e.toString("hex",10)}`;class Wallet{constructor(e,t){this.knownAccounts=new Set,this.keyFiles=new Map,this.unlockedAccounts=new Map,this.lockTimers=new Map,r.set(this,void 0),n.set(this,(e=>{const t=Buffer.allocUnsafe(e),s=g(this,r,"f");for(let r=0;r<e;r++)t[r]=256*s()|0;return t})),i.set(this,(e=>{const t=(0,b.createAccountGeneratorFromSeedAndPath)((0,_.mnemonicToSeedSync)(e.mnemonic,null),e.hdPath),s=e.defaultBalance.toString().split(".",2),r=BigInt(s[0]),n=s[1]||"0",i=BigInt(n),c=10n**BigInt(n.length),l=y.WEI*r+i*(y.WEI/c),u=y.Quantity.from(l),d=new Map,f=e.accounts;let h;if(f&&0!==(h=f.length))for(let s=0;s<h;s++){const r=f[s],n=r.secretKey;let i;if(n){const t=y.Quantity.from(r.balance);i=g(this,o,"f").call(this,t,n,e)}else{const r=t(s);i=g(this,a,"f").call(this,u,r,e)}d.set(i.address.toString(),i)}else{const s=e.totalAccounts;if(null!=s)for(let r=0;r<s;r++){const s=t(r),n=g(this,a,"f").call(this,u,s,e);d.set(n.address.toString(),n)}}return d})),o.set(this,((e,t,s)=>{const r=y.Data.from(t),n=Wallet.createAccountFromPrivateKey(r);n.balance=e;const i=n.address;return g(this,c,"f").call(this,i,r,s),n})),a.set(this,((e,t,s)=>{const r=uncompressedPublicKeyToAddress(t.publicKey),n=y.Data.from(t.privateKey),i=Wallet.createAccount(e,n,r);return g(this,c,"f").call(this,r,n,s),i})),c.set(this,((e,t,s)=>{const{passphrase:r,lock:n}=s,i=this.knownAccounts;this.addToKeyFileSync(e,t,r,n);const o=e.toString();i.add(o),n||this.unlockedAccounts.set(o,t)})),l.set(this,(e=>(this.lockTimers.delete(e),this.unlockedAccounts.delete(e),!0))),e.totalAccounts>S&&t.logger.log("wallet.totalAccounts exceeds MAX_ACCOUNTS (100000) and may affect performance."),h(this,r,(0,k.alea)("ganache "+e.mnemonic),"f");const s=g(this,i,"f").call(this,e);this.initialAccounts=Array.from(s.values()),this.addresses=Array.from(s.keys());const u=this.initialAccounts.length,d=this.unlockedAccounts,f=e.unlockedAccounts;if(f){const e=f.length;for(let t=0;t<e;t++){let e,r,n=f[t];switch(typeof n){case"string":const t=n.toLowerCase();if(0===t.indexOf("0x")){e=t;const n=s.get(e);n?r=n.privateKey:(r=this.createFakePrivateKey(e),this.addresses.push(e));break}{const e=n-0;if(!Number.isSafeInteger(e))throw new Error(`Invalid value in wallet.unlockedAccounts: ${n}`);n=e}case"number":const i=this.initialAccounts[n];if(null==i)throw new Error(`Account at index ${n} not found. Max index available is ${u-1}.`);e=i.address.toString().toLowerCase(),r=i.privateKey;break;default:throw new Error("Invalid value specified in unlocked_accounts")}d.has(e)||d.set(e,r)}}if(null!=e.accountKeysPath){const t={addresses:{},private_keys:{}};d.forEach(((e,s)=>{t.addresses[s]=s,t.private_keys[s]=e})),(0,B.writeFileSync)(e.accountKeysPath,JSON.stringify(t))}}async encrypt(e,t){const s=g(this,n,"f").call(this,64),r=s.slice(0,32),i=s.slice(32,48),o=s.slice(48),a=await scrypt(t,r,A.dklen,{...A,N:A.n});return this.finishEncryption(a,e,r,i,o)}encryptSync(e,t){const s=g(this,n,"f").call(this,64),r=s.slice(0,32),i=s.slice(32,48),o=s.slice(48),a=((...e)=>E.default.scryptSync.call(E.default,...e))(t,r,A.dklen,{...A,N:A.n});return this.finishEncryption(a,e,r,i,o)}finishEncryption(e,t,s,r,n){const i=E.default.createCipheriv(O,e.slice(0,16),r),o=Buffer.concat([i.update(t.toBuffer()),i.final()]),a=(0,y.keccak)(Buffer.concat([e.slice(16,32),o]));return{crypto:{cipher:O,ciphertext:y.Data.from(o),cipherparams:{iv:y.Data.from(r)},kdf:"scrypt",kdfParams:{...A,salt:y.Data.from(s)},mac:y.Data.from(a)},id:asUUID(n),version:3}}async decrypt(e,t){const s=e.crypto;if(s.cipher!==O)throw new Error(`keyfile cypher must be "${O}"`);if("scrypt"!==s.kdf)throw new Error('keyfile kdf must be "script"');const r=s.kdfParams,n=r.salt,i=s.mac,o=s.ciphertext.toBuffer();let a,c;if(null!=t)try{a=await scrypt(t,n.toBuffer(),r.dklen,{...r,N:r.n}),c=(0,y.keccak)(Buffer.concat([a.slice(16,32),o]))}catch{c=null}if(!c||!i.toBuffer().equals(c))throw new Error("could not decrypt key with given passphrase");return E.default.createDecipheriv(s.cipher,a.slice(0,16),s.cipherparams.iv.toBuffer()).update(o)}async addToKeyFile(e,t,s,r){s||r?this.keyFiles.set(e.toString(),{encrypted:!0,key:await this.encrypt(t,s)}):this.keyFiles.set(e.toString(),{encrypted:!1,key:t.toBuffer()})}addToKeyFileSync(e,t,s,r){s||r?this.keyFiles.set(e.toString(),{encrypted:!0,key:this.encryptSync(t,s)}):this.keyFiles.set(e.toString(),{encrypted:!1,key:t.toBuffer()})}async getFromKeyFile(e,t){const s=this.keyFiles.get(e.toString());if(null==s)throw new Error("no key for given address or file");if(!0===s.encrypted)return this.decrypt(s.key,t);if(t)throw new Error('could not decrypt key with given passphrase (default passphrase for accounts created at startup is "")');return s.key}static createAccount(e,t,s){const r=new m.Account(s);return r.privateKey=t,r.balance=e,r}static createAccountFromPrivateKey(e){const t=P.Address.from((0,w.privateToAddress)(e.toBuffer())),s=new m.Account(t);return s.privateKey=e,s}createRandomAccount(){const e=g(this,n,"f").call(this,128),t=(0,b.createAccountFromSeed)(e),s=uncompressedPublicKeyToAddress(t.publicKey),r=y.Data.from(t.privateKey);return Wallet.createAccount(y.Quantity.Zero,r,s)}async unlockAccount(e,t,s){const r=e.toString(),n=await this.getFromKeyFile(e,t),i=this.lockTimers.get(r);i&&clearTimeout(i);const o=1e3*s|0;if(o>0){const e=setTimeout(g(this,l,"f"),o,r);(0,y.unref)(e),this.lockTimers.set(r,e)}return this.unlockedAccounts.set(r,y.Data.from(n)),!0}async addUnknownAccount(e,t){const s=e.toString();if(this.knownAccounts.has(s))return!1;const r=this.createFakePrivateKey(s);return await this.addToKeyFile(e,r,t,!0),this.knownAccounts.add(s),this.addresses.push(s),!0}async removeKnownAccount(e,t){const s=e.toString();if(!this.knownAccounts.has(s))return!1;if(null!=await this.getFromKeyFile(e,t))return this.keyFiles.delete(s),this.knownAccounts.delete(s),this.addresses.splice(this.addresses.indexOf(s),1),this.lockTimers.delete(s),this.unlockedAccounts.delete(s),!0;throw new Error("could not find private key for address/passphrase combination")}createFakePrivateKey(e){let t;const s=P.Address.from(e).toBuffer();if(s.equals(y.ACCOUNT_ZERO))t=Buffer.allocUnsafe(32).fill(0,0,31),t[31]=1;else{const e=s.slice(0,12);if(t=Buffer.concat([s,e]),0===e.compare(T))for(;BigInt(`0x${t.toString("hex")}`)>=v.SECP256K1_N;)t=(0,y.keccak)(t)}return y.Data.from(t)}lockAccount(e){return!!this.unlockedAccounts.has(e)&&(clearTimeout(this.lockTimers.get(e)),g(this,l,"f").call(this,e))}}r=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakMap,a=new WeakMap,c=new WeakMap,l=new WeakMap,t.default=Wallet},138:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(223),t)},560:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChainOptions=void 0;const r=s(45);t.ChainOptions={allowUnlimitedContractSize:{normalize:r.normalize,cliDescription:"Allows unlimited contract sizes. Setting this to `true` will cause ganache to behave differently than production environments.",default:()=>!1,legacyName:"allowUnlimitedContractSize",cliType:"boolean"},allowUnlimitedInitCodeSize:{normalize:r.normalize,cliDescription:"Allows unlimited initcode (`transaction.data`) sizes. Setting this to `true` will cause ganache to behave differently than production environments.",default:()=>!1,cliType:"boolean"},asyncRequestProcessing:{normalize:r.normalize,cliDescription:"When set to `false` only one request will be processed at a time.",default:()=>!0,legacyName:"asyncRequestProcessing",cliType:"boolean"},chainId:{normalize:r.normalize,cliDescription:"The currently configured chain id.",default:()=>1337,legacyName:"chainId",cliType:"number"},networkId:{normalize:r.normalize,cliDescription:"The id of the network returned by the RPC method `net_version`.",default:()=>Date.now(),defaultDescription:"System time at process start or Network ID of forked blockchain if configured.",legacyName:"network_id",cliAliases:["i","networkId"],cliType:"number"},time:{normalize:e=>void 0!==e?new Date(e):null,cliDescription:"Date that the first block should start.",legacyName:"time",cliAliases:["t","time"],cliType:"string",cliCoerce:e=>{const t=e/1;return isNaN(t)?e:t}},hardfork:{normalize:r.normalize,cliDescription:"Set the hardfork rules for the EVM.",default:()=>"shanghai",legacyName:"hardfork",cliAliases:["k","hardfork"],cliType:"string",cliChoices:["constantinople","byzantium","petersburg","istanbul","muirGlacier","berlin","london","arrowGlacier","grayGlacier","merge","shanghai"]},vmErrorsOnRPCResponse:{normalize:r.normalize,cliDescription:"Whether to report runtime errors from EVM code as RPC errors.",default:()=>!1,legacyName:"vmErrorsOnRPCResponse",cliType:"boolean"}}},561:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DatabaseOptions=void 0;const r=s(45);t.DatabaseOptions={db:{normalize:r.normalize,cliDescription:"Specify an alternative database instance, like MemDOWN",disableInCLI:!0,legacyName:"db",conflicts:["dbPath"]},dbPath:{normalize:r.normalize,cliDescription:"Specify a path to a directory to save the chain database.",legacyName:"db_path",cliAliases:["db","db_path"],cliType:"string",conflicts:["db"]}}},252:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ForkOptions=t.KNOWN_NETWORKS=void 0;const r=s(45),n=s(3),i=s(109),o=Math.floor(Number.MAX_SAFE_INTEGER/2);t.KNOWN_NETWORKS=["mainnet","goerli","g\xf6rli","sepolia"];const a=/:\s?(?:.+)/;function coerceHeaders(e,t){const[s,r]=t.split(a);return e.push({name:s,value:r}),e}const c=["ws:","wss:","http:","https:"];t.ForkOptions={url:{normalize:e=>{if("string"!=typeof e||t.KNOWN_NETWORKS.includes(e))return;let s=new i.URL(e);const r=s.pathname+s.search,a=r.lastIndexOf("@");if(-1!==a){s=new i.URL(r.substr(0,a),s);const e=r.substr(a+1);if(e&&e!==n.Tag.latest){const t=e-0;isNaN(t)||t<0||(0|t)!==t||t>o?console.warn(`Ignoring invalid block number in fork url: "${e}". Block number must be an integer from [0 - ${o}].`):s._blockNumber=t}if(!c.includes(s.protocol))throw new Error(`Invalid protocol for fork url: ${s.protocol}. Supported protocols are: ${((e,t="and")=>{const s=e.pop();switch(e.length){case 0:return"";case 1:return s;case 2:return e[0]+` ${t} `+s;default:return e.join(", ")+`, ${t} `+s}})(c)}.`)}return s},cliDescription:'Fork from another currently running Ethereum client at a given block. Input should be the URL of the node, e.g. `"http://localhost:1337"`. You can optionally specify the block to fork from using an @ sign: `"http://localhost:1337@8675309"`.\n\nYou can specify Basic Authentication credentials in the URL as well. e.g., `"wss://user:password@example.com/"`. If you need to use an Infura Project Secret, you would use it like this: `"wss://:{YOUR-PROJECT-SECRET}@mainnet.infura.com/..."`\n\nAlternatively, you can use the `fork.username` and `fork.password` options.',legacyName:"fork",cliAliases:["f","fork"],conflicts:["provider","network"]},provider:{normalize:e=>"string"==typeof e||"object"==typeof e&&("string"==typeof e.url||"boolean"==typeof e.url||"string"==typeof e.network||"boolean"==typeof e.network)?void 0:e,cliDescription:"Specify an EIP-1193 provider to use instead of a url.",disableInCLI:!0,legacyName:"fork",conflicts:["url","network"]},network:{normalize:e=>{if("string"==typeof e&&t.KNOWN_NETWORKS.includes(e))return e;if("object"==typeof e&&"url"in e){const{url:s}=e;if(!0===s)return"mainnet";if(t.KNOWN_NETWORKS.includes(s))return e.url}},cliDescription:"A network name to fork from; uses Infura's archive nodes.\n\nUse the shorthand command `ganache --fork` to automatically fork from Mainnet at the latest block.\n",cliChoices:t.KNOWN_NETWORKS,legacyName:"fork",conflicts:["url","provider"]},blockNumber:{normalize:r.normalize,cliDescription:"Block number the provider should fork from.",legacyName:"fork_block_number",default:({url:e,provider:t,network:s})=>e?e._blockNumber?e._blockNumber:n.Tag.latest:t||s?n.Tag.latest:void 0,defaultDescription:"Latest block number"},preLatestConfirmations:{normalize:r.normalize,cliDescription:'When the `fork.blockNumber` is set to "latest" (default), the number of blocks before the remote node\'s "latest" block to fork from.',default:()=>5,defaultDescription:"5",cliType:"number"},username:{normalize:r.normalize,cliDescription:'Username to use for Basic Authentication. Does not require setting `fork.password`.\n\nWhen combined with `fork.password`, is shorthand for `fork: { headers: { "Authorization": "Basic {ENCODED-BASIC-HEADER}" } }`\n\nIf the `fork.headers` option specifies an "Authorization" header, it will be be inserted _after_ this Basic token.',default:({url:e})=>{if(e&&e.username)return e.username},defaultDescription:""},password:{normalize:r.normalize,cliDescription:'Password to use for Basic Authentication. Does not require setting `fork.username`.\n\nWhen combined with `fork.username`, is shorthand for `fork: { headers: { "Authorization": "Basic {ENCODED-BASIC-HEADER}" } }`\n\nIf the `fork.headers` option specifies an "Authorization" header, it will be be inserted _after_ this Basic token.',default:({url:e})=>{if(e&&e.password)return e.password},defaultDescription:""},jwt:{normalize:r.normalize,cliDescription:'_Encoded_ JSON Web Token (JWT) used for authenticating to some servers.\n\nShorthand for `fork: { headers: { "Authorization": "Bearer {YOUR-ENCODED-JWT}" } }`\n\n If the `fork.headers` option specifies an "Authorization" header, it will be be inserted _after_ the JWT Bearer token.'},userAgent:{normalize:r.normalize,cliDescription:'The User-Agent header sent to the fork on each request.\n\nSent as Api-User-Agent when used in the browser.\n\nWill be overridden by a `"User-Agent"` defined in the `fork.headers` option, if provided.',default:()=>"Ganache/7.9.1 (https://www.trufflesuite.com/ganache; ganache<at>trufflesuite.com)"},origin:{normalize:r.normalize,cliDescription:'The Origin header sent to the fork on each request.\n\nIgnored in the browser.\n\nWill be overridden by an `"Origin"` value defined in the `fork.headers` option, if provided.'},headers:{normalize:r.normalize,cliDescription:'Headers to supply on each request to the forked provider.\n\nHeaders set here override headers set by other options, unless otherwise specified.\n\nDefaults to: `["User-Agent: Ganache/VERSION (https://www.trufflesuite.com/ganache; ganache<at>trufflesuite.com)"]`',cliType:"array:string",implies:["url"],cliCoerce:e=>e.reduce(coerceHeaders,[])},requestsPerSecond:{normalize(e){if(e<0)throw new Error(`fork.requestsPerSecond is invalid: "${e}"; must be a positive number`);return e},default:()=>0,cliDescription:"Restrict the number of requests per second sent to the fork provider. `0` means no limit is applied.",cliType:"number"},disableCache:{normalize:r.normalize,default:()=>!1,cliDescription:"Disables caching of all forking requests.",cliType:"boolean"},deleteCache:{normalize:r.normalize,default:()=>!1,cliDescription:"Deletes the persistent cache before starting.",cliType:"boolean"}}},45:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.normalize=void 0;t.normalize=e=>e},223:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),t.EthereumOptionsConfig=t.EthereumDefaults=void 0;const i=s(560),o=s(561),a=s(562),c=s(563),l=s(263),u=s(252),d=s(59);t.EthereumDefaults={chain:i.ChainOptions,database:o.DatabaseOptions,logging:a.LoggingOptions,miner:c.MinerOptions,wallet:l.WalletOptions,fork:u.ForkOptions},t.EthereumOptionsConfig=new d.OptionsConfig(t.EthereumDefaults),n(s(560),t),n(s(561),t),n(s(45),t),n(s(562),t),n(s(563),t),n(s(263),t),n(s(252),t)},562:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoggingOptions=void 0;const r=s(45),n=s(9),i=s(1),o=s(18);t.LoggingOptions={debug:{normalize:r.normalize,cliDescription:"Set to `true` to log EVM opcodes.",default:()=>!1,legacyName:"debug",cliType:"boolean"},quiet:{normalize:r.normalize,cliDescription:"Set to `true` to disable writing logs to `logger.log` (`stdout` by default).",default:()=>!1,cliAliases:["q","quiet"],cliType:"boolean"},verbose:{normalize:r.normalize,cliDescription:"Set to `true` to log detailed RPC requests.",default:()=>!1,legacyName:"verbose",cliAliases:["v","verbose"],cliType:"boolean"},file:{normalize:e=>{let t;try{t=(0,n.openSync)(e,"a")}catch(t){const s=t.message;throw new Error(`Failed to open log file ${e}. Please check if the file path is valid and if the process has write permissions to the directory.${o.EOL}${s}`)}return t},cliDescription:"The file to append logs to.",cliType:"string"},logger:{normalize:(e,t)=>(0,i.createLogger)({file:t.file,baseLogger:e}),cliDescription:"An object, like `console`, that implements a `log` function.",disableInCLI:!0,default:e=>{const t=e.quiet?{log:()=>{}}:console;return(0,i.createLogger)({file:e.file,baseLogger:t})},legacyName:"logger"}}},563:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MinerOptions=void 0;const r=s(45),n=s(1),i=s(11),toBigIntOrString=e=>e.startsWith("0x")?e:BigInt(e),normalizeQuantity=e=>n.Quantity.from(e);t.MinerOptions={blockTime:{normalize:e=>{if(e<0)throw new Error("miner.blockTime must be 0 or a positive number.");return e},cliDescription:'Sets the `blockTime` in seconds for automatic mining. A blockTime of `0` enables "instamine mode", where new executable transactions will be mined instantly.',default:()=>0,legacyName:"blockTime",cliAliases:["b","blockTime"],cliType:"number"},timestampIncrement:{normalize:e=>"clock"===e?"clock":n.Quantity.from(BigInt(e)),cliDescription:'The amount of time, in seconds, to add to the `timestamp` of each new block header. By default the value is `"clock"`, which uses your system clock time as the timestamp for each block.',default:()=>"clock",cliType:"string"},defaultGasPrice:{normalize:normalizeQuantity,cliDescription:"Sets the default gas price in WEI for transactions if not otherwise specified.",default:()=>n.Quantity.from(2e9),legacyName:"gasPrice",cliAliases:["g","gasPrice"],cliType:"string",cliCoerce:toBigIntOrString},blockGasLimit:{normalize:normalizeQuantity,cliDescription:"Sets the block gas limit in WEI.",default:()=>n.Quantity.from(3e7),legacyName:"gasLimit",cliAliases:["l","gasLimit"],cliType:"string",cliCoerce:toBigIntOrString},defaultTransactionGasLimit:{normalize:e=>"estimate"===e?n.Quantity.Empty:n.Quantity.from(e),cliDescription:'Sets the default transaction gas limit in WEI. Set to "estimate" to use an estimate (slows down transaction execution by 40%+).',default:()=>n.Quantity.from(9e4),cliType:"string",cliCoerce:e=>"estimate"===e?e:toBigIntOrString(e)},difficulty:{normalize:normalizeQuantity,cliDescription:"Sets the block difficulty. Value is always 0 after the merge hardfork.",default:()=>n.Quantity.One,cliType:"string",cliCoerce:toBigIntOrString},callGasLimit:{normalize:normalizeQuantity,cliDescription:"Sets the transaction gas limit in WEI for `eth_call` and `eth_estimateGas` calls.",default:()=>n.Quantity.from(5e7),legacyName:"callGasLimit",cliType:"string",cliCoerce:toBigIntOrString},instamine:{normalize:r.normalize,cliDescription:'Set the instamine mode to either "eager" (default) or "strict".\n * In "eager" mode a transaction will be included in a block before its hash is returned to the caller.\n * In "strict" mode a transaction\'s hash is returned to the caller before the transaction is included in a block.\n`instamine` has no effect if `blockTime` is *not* `0` (the default).',default:()=>"eager",legacyName:"instamine",cliAliases:["instamine"],cliType:"string",cliChoices:["eager","strict"]},coinbase:{normalize:e=>"number"==typeof e?e:i.Address.from(e),cliDescription:"Sets the address where mining rewards will go.",cliType:"string",cliCoerce:e=>e.startsWith("0x")?e:parseInt(e),default:()=>i.Address.from(n.ACCOUNT_ZERO)},extraData:{normalize:e=>{const t=n.Data.from(e);if(t.toBuffer().length>32)throw new Error(`extra exceeds max length. ${t.toBuffer().length} > 32`);return t},cliDescription:"Set the extraData block header field a miner can include.",default:()=>n.Data.Empty,cliType:"string"},priceBump:{normalize:BigInt,cliDescription:"Minimum price bump percentage needed to replace a transaction that already exists in the transaction pool.",default:()=>10n,cliType:"string"}}},263:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WalletOptions=void 0;const n=s(45),i=r(s(96)),o=s(352),a=(0,i.default)();const c=(()=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e.length;return(s,r)=>{let n="";for(let i=0;i<s;i++)n+=e[r()*t|0];return n}})();t.WalletOptions={accounts:{normalize:n.normalize,cliDescription:"Account data in the form `<private_key>,<initial_balance>`, can be specified multiple times. Note that private keys are 64 characters long and must be entered as an 0x-prefixed hex string. Balance can either be input as an integer, or as a 0x-prefixed hex string with either form specifying the initial balance in wei.",legacyName:"accounts",cliAliases:["account"],cliType:"array:string",cliCoerce:e=>e.map((e=>{const[t,s]=e.split(/,(.+)/);return{secretKey:t,balance:BigInt(s)}})),conflicts:["totalAccounts"]},totalAccounts:{normalize:n.normalize,cliDescription:"Number of accounts to generate at startup.",default:e=>null==e.accounts?10:0,legacyName:"total_accounts",cliAliases:["a","accounts"],cliType:"number",conflicts:["accounts"]},deterministic:{normalize:n.normalize,cliDescription:"Use pre-defined, deterministic seed.",default:()=>!1,cliAliases:["d","deterministic"],cliType:"boolean",conflicts:["mnemonic","seed"]},seed:{normalize:n.normalize,cliDescription:"Seed to use to generate a mnemonic.",default:e=>!0===e.deterministic?"TestRPC is awesome!":c(10,a),defaultDescription:"Random value, unless wallet.deterministic is specified",legacyName:"seed",cliAliases:["s","seed"],cliType:"string",conflicts:["mnemonic","deterministic"]},mnemonic:{normalize:n.normalize,cliDescription:"Use a specific HD wallet mnemonic to generate initial addresses.",default:e=>(0,o.entropyToMnemonic)(function notVeryRandomBytes(e,t){const s=Buffer.allocUnsafe(e);for(let r=0;r<e;r++)s[r]=255*t()|0;return s}(16,(0,i.default)(e.seed))),defaultDescription:"Generated from wallet.seed",legacyName:"mnemonic",cliAliases:["m","mnemonic"],cliType:"string",conflicts:["seed","deterministic"]},unlockedAccounts:{normalize:n.normalize,cliDescription:"Array of addresses or address indexes specifying which accounts should be unlocked.",legacyName:"unlocked_accounts",cliAliases:["u","unlock"],cliType:"array:string"},lock:{normalize:n.normalize,cliDescription:"Lock available accounts by default (good for third party transaction signing).",default:()=>!1,legacyName:"secure",cliAliases:["n","secure","lock"],cliType:"boolean"},passphrase:{normalize:n.normalize,cliDescription:"Passphrase to use when locking accounts.",default:()=>"",cliAliases:["passphrase"],cliType:"string"},accountKeysPath:{normalize:n.normalize,cliDescription:"Specifies a file to save accounts and private keys to, for testing.",legacyName:"account_keys_path",cliAliases:["account_keys_path","acctKeys"],cliType:"string"},defaultBalance:{normalize:n.normalize,cliDescription:"The default account balance, specified in ether.",default:()=>1e3,legacyName:"default_balance_ether",cliAliases:["e","defaultBalanceEther"],cliType:"number"},hdPath:{normalize:e=>e.split("/"),cliDescription:"The hierarchical deterministic path to use when generating accounts.",default:()=>["m","44'","60'","0'","0"],legacyName:"hd_path",cliType:"string"}}},23:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(358),t),n(s(367),t),n(s(175),t),n(s(722),t),n(s(368),t),n(s(176),t),n(s(723),t),n(s(58),t),n(s(179),t),n(s(61),t),n(s(145),t),n(s(724),t),n(s(725),t),n(s(726),t),n(s(727),t)},177:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccessLists=t.isAccessList=void 0;const r=s(40);var n=s(40);Object.defineProperty(t,"isAccessList",{enumerable:!0,get:function(){return n.isAccessList}});const i=s(1),o=s(11),a=s(176);t.AccessLists=class AccessLists{static getAccessListData(e){let t,s,n=0;const c=a.Params.ACCESS_LIST_STORAGE_KEY_GAS,l=a.Params.ACCESS_LIST_ADDRESS_GAS;if(e&&(0,r.isAccessList)(e)){t=e;const r=[];for(let t=0;t<e.length;t++){const s=e[t],a=o.Address.toBuffer(s.address),c=[],l=s.storageKeys.length;n+=l;for(let e=0;e<l;e++)c.push(i.Data.toBuffer(s.storageKeys[e],32));r.push([a,c])}s=r}else{s=e||[];const r=[];for(let e=0;e<s.length;e++){const t=s[e],a=o.Address.toString(t[0]),c=[],l=t[1].length;n+=l;for(let e=0;e<l;e++)c.push(i.Data.toString(t[1][e],32));const u={address:a,storageKeys:c};r.push(u)}t=r}return{AccessListJSON:t,accessList:s,dataFeeEIP2930:BigInt(s.length*l+n*c)}}}},175:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTransaction=t.calculateIntrinsicGas=void 0;const r=s(1),n=s(11),i=s(176),o=1n<<64n-1n;t.calculateIntrinsicGas=(e,t,s)=>{const r=s.hardfork();let n;if(n=t?i.Params.TRANSACTION_GAS:i.Params.TRANSACTION_CREATION_GAS,e){const a=e.toBuffer(),c=a.byteLength;if(c>0){const e=i.Params.TRANSACTION_DATA_NON_ZERO_GAS.get(r),l=i.Params.TRANSACTION_DATA_ZERO_GAS;let u=0n;for(const e of a)0!==e&&u++;if((o-n)/e<u)return-1n;n+=u*e;const d=BigInt(c),f=d-u;if((o-n)/l<f)return-1n;if(n+=f*l,!t&&s.isActivatedEIP(3860)){n+=(d+31n)/32n*i.Params.INITCODE_WORD_GAS}}}return n};t.BaseTransaction=class BaseTransaction{constructor(e,t){this.common=e,t&&this.setExtra(t)}setExtra(e){const[t,s,i,o,a,c]=e;this.from=n.Address.from(t),this.hash=r.Data.from(s,32),this.blockHash=r.Data.from(i,32),this.blockNumber=r.Quantity.from(o),this.index=r.Quantity.from(a),this.effectiveGasPrice=r.Quantity.from(c)}calculateIntrinsicGas(){const e=null!=this.to&&!this.to.toBuffer().equals(r.BUFFER_EMPTY);return(0,t.calculateIntrinsicGas)(this.data,e,this.common)}}},367:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EIP1559FeeMarketTransaction=void 0;const r=s(1),n=s(11),i=s(12),o=s(61),a=s(177),c=s(58),l=s(3),u=[2718,2930,1559];class EIP1559FeeMarketTransaction extends o.RuntimeTransaction{constructor(e,t,s){if(super(e,t,s),this.type=r.Quantity.from("0x2"),this.yParity=r.Quantity.from("0x0"),Array.isArray(e)){this.chainId=r.Quantity.from(e[0]),this.nonce=r.Quantity.from(e[1]),this.maxPriorityFeePerGas=r.Quantity.from(e[2]),this.maxFeePerGas=r.Quantity.from(e[3]),this.gas=r.Quantity.from(e[4]),this.to=0==e[5].length?null:n.Address.from(e[5]),this.value=r.Quantity.from(e[6]),this.data=r.Data.from(e[7]);const i=a.AccessLists.getAccessListData(e[8]);if(this.accessList=i.accessList,this.accessListJSON=i.AccessListJSON,this.accessListDataFee=i.dataFeeEIP2930,this.yParity=this.v=r.Quantity.from(e[9]),this.r=r.Quantity.from(e[10]),this.s=r.Quantity.from(e[11]),this.raw=e,!s){if(t.chainId()!==this.chainId.toBigInt())throw new l.CodedError(`Invalid chain id (${this.chainId.toNumber()}) for chain with id ${t.chainId()}.`,r.JsonRpcErrorCode.INVALID_INPUT);const{from:e,serialized:s,hash:n}=this.computeIntrinsics(this.v,this.raw);this.from=e,this.serialized=s,this.hash=n}}else{e.chainId?this.chainId=r.Quantity.from(e.chainId):this.chainId=r.Quantity.from(t.chainId()),this.maxPriorityFeePerGas=r.Quantity.from(e.maxPriorityFeePerGas),this.maxFeePerGas=r.Quantity.from(e.maxFeePerGas);const s=a.AccessLists.getAccessListData(e.accessList);this.accessList=s.accessList,this.accessListJSON=s.AccessListJSON,this.accessListDataFee=s.dataFeeEIP2930,this.validateAndSetSignature(e),this.yParity=this.v}}maxGasPrice(){return this.maxFeePerGas}toJSON(e){return{type:this.type,hash:this.hash,chainId:this.chainId,nonce:this.nonce,blockHash:this.blockHash?this.blockHash:null,blockNumber:this.blockNumber?this.blockNumber:null,transactionIndex:this.index?this.index:null,from:this.from,to:this.to,value:this.value,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasPrice:this.effectiveGasPrice,gas:this.gas,input:this.data,accessList:this.accessListJSON,v:this.v,r:this.r,s:this.s,yParity:this.yParity}}static fromTxData(e,t,s){return new EIP1559FeeMarketTransaction(e,t,s)}toVmTransaction(){const e=this.data.toBuffer();return{hash:()=>r.BUFFER_32_ZERO,nonce:this.nonce.toBigInt(),common:this.common,maxPriorityFeePerGas:this.maxPriorityFeePerGas.toBigInt(),maxFeePerGas:this.maxFeePerGas.toBigInt(),gasLimit:this.gas.toBigInt(),to:this.to,value:this.value.toBigInt(),data:e,AccessListJSON:this.accessListJSON,getSenderAddress:()=>this.from,getBaseFee:()=>this.calculateIntrinsicGas(),getUpfrontCost:(e=0n)=>{const{gas:t,maxPriorityFeePerGas:s,maxFeePerGas:r,value:n}=this,i=s.toBigInt(),o=r.toBigInt(),a=t.toBigInt(),c=n.toBigInt();return a*(((...e)=>e.reduce(((e,t)=>t<e?t:e)))(i,o-e)+e)+c},supports:e=>u.includes(e)}}calculateIntrinsicGas(){return super.calculateIntrinsicGas()+this.accessListDataFee}signAndHash(e){if(null!=this.v)throw new Error("Internal Error: RuntimeTransaction `sign` called but transaction has already been signed");const t=this.toEthRawTransaction(r.BUFFER_ZERO,r.BUFFER_ZERO,r.BUFFER_ZERO),s=(0,i.encodeRange)(t,0,9),n=s.length,o=(0,r.keccak)((0,c.digestWithPrefix)(2,[s.output],n)),a=(0,r.ecsign)(o,e);this.yParity=this.v=r.Quantity.from(a.v),this.r=r.Quantity.from(a.r),this.s=r.Quantity.from(a.s),t[9]=this.v.toBuffer(),t[10]=this.r.toBuffer(),t[11]=this.s.toBuffer(),this.raw=t;const l=(0,i.encodeRange)(t,9,3),u=[s.output,l.output],d=n+l.length;this.serialized=(0,c.digestWithPrefix)(2,u,d),this.hash=r.Data.from((0,r.keccak)(this.serialized))}toEthRawTransaction(e,t,s){return[this.chainId.toBuffer(),this.nonce.toBuffer(),this.maxPriorityFeePerGas.toBuffer(),this.maxFeePerGas.toBuffer(),this.gas.toBuffer(),this.to?this.to.toBuffer():r.BUFFER_EMPTY,this.value.toBuffer(),this.data.toBuffer(),this.accessList,e,t,s]}computeIntrinsics(e,t){return(0,c.computeIntrinsicsFeeMarketTx)(e,t)}updateEffectiveGasPrice(e){const t=this.maxFeePerGas.toBigInt(),s=this.maxPriorityFeePerGas.toBigInt(),n=t-e,i=n<s?n:s;this.effectiveGasPrice=r.Quantity.from(e+i)}}t.EIP1559FeeMarketTransaction=EIP1559FeeMarketTransaction},358:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EIP2930AccessListTransaction=void 0;const r=s(1),n=s(11),i=s(12),o=s(61),a=s(177),c=s(58),l=s(3),u=[2718,2930];class EIP2930AccessListTransaction extends o.RuntimeTransaction{constructor(e,t,s){if(super(e,t,s),this.type=r.Quantity.from("0x1"),this.yParity=r.Quantity.from("0x0"),Array.isArray(e)){this.chainId=r.Quantity.from(e[0]),this.nonce=r.Quantity.from(e[1]),this.gasPrice=this.effectiveGasPrice=r.Quantity.from(e[2]),this.gas=r.Quantity.from(e[3]),this.to=0==e[4].length?null:n.Address.from(e[4]),this.value=r.Quantity.from(e[5]),this.data=r.Data.from(e[6]);const i=a.AccessLists.getAccessListData(e[7]);if(this.accessList=i.accessList,this.accessListJSON=i.AccessListJSON,this.accessListDataFee=i.dataFeeEIP2930,this.yParity=this.v=r.Quantity.from(e[8]),this.r=r.Quantity.from(e[9]),this.s=r.Quantity.from(e[10]),this.raw=e,!s){if(t.chainId()!==this.chainId.toBigInt())throw new l.CodedError(`Invalid chain id (${this.chainId.toBigInt()}) for chain with id ${t.chainId()}.`,r.JsonRpcErrorCode.INVALID_INPUT);const{from:e,serialized:s,hash:n}=this.computeIntrinsics(this.v,this.raw);this.from=e,this.serialized=s,this.hash=n}}else{if(e.chainId){if(this.chainId=r.Quantity.from(e.chainId),this.common.chainId()!==this.chainId.toBigInt())throw new l.CodedError(`Invalid chain id (${this.chainId.toNumber()}) for chain with id ${t.chainId()}.`,r.JsonRpcErrorCode.INVALID_INPUT)}else this.chainId=r.Quantity.from(t.chainId());this.gasPrice=this.effectiveGasPrice=r.Quantity.from(e.gasPrice);const s=a.AccessLists.getAccessListData(e.accessList);this.accessList=s.accessList,this.accessListJSON=s.AccessListJSON,this.accessListDataFee=s.dataFeeEIP2930,this.validateAndSetSignature(e),this.yParity=this.v}}maxGasPrice(){return this.gasPrice}toJSON(e){return{hash:this.hash,type:this.type,chainId:this.chainId,nonce:this.nonce,blockHash:this.blockHash?this.blockHash:null,blockNumber:this.blockNumber?this.blockNumber:null,transactionIndex:this.index?this.index:null,from:this.from,to:this.to,value:this.value,gas:this.gas,gasPrice:this.gasPrice,input:this.data,accessList:this.accessListJSON,v:this.v,r:this.r,s:this.s,yParity:this.v}}static fromTxData(e,t,s){return new EIP2930AccessListTransaction(e,t,s)}toVmTransaction(){const e=this.data.toBuffer();return{hash:()=>r.BUFFER_32_ZERO,nonce:this.nonce.toBigInt(),common:this.common,gasPrice:this.gasPrice.toBigInt(),gasLimit:this.gas.toBigInt(),to:this.to,value:this.value.toBigInt(),data:e,AccessListJSON:this.accessListJSON,getSenderAddress:()=>this.from,getBaseFee:()=>this.calculateIntrinsicGas(),getUpfrontCost:()=>{const{gas:e,gasPrice:t,value:s}=this;return e.toBigInt()*t.toBigInt()+s.toBigInt()},supports:e=>u.includes(e)}}calculateIntrinsicGas(){return super.calculateIntrinsicGas()+this.accessListDataFee}signAndHash(e){if(null!=this.v)throw new Error("Internal Error: RuntimeTransaction `sign` called but transaction has already been signed");const t=this.toEthRawTransaction(r.BUFFER_ZERO,r.BUFFER_ZERO,r.BUFFER_ZERO),s=(0,i.encodeRange)(t,0,8),n=s.length,o=(0,r.keccak)((0,c.digestWithPrefix)(1,[s.output],n)),a=(0,r.ecsign)(o,e);this.yParity=this.v=r.Quantity.from(a.v),this.r=r.Quantity.from(a.r),this.s=r.Quantity.from(a.s),t[8]=this.v.toBuffer(),t[9]=this.r.toBuffer(),t[10]=this.s.toBuffer(),this.raw=t;const l=(0,i.encodeRange)(t,8,3),u=[s.output,l.output],d=n+l.length;this.serialized=(0,c.digestWithPrefix)(1,u,d),this.hash=r.Data.from((0,r.keccak)(this.serialized))}toEthRawTransaction(e,t,s){return[this.chainId.toBuffer(),this.nonce.toBuffer(),this.gasPrice.toBuffer(),this.gas.toBuffer(),this.to?this.to.toBuffer():r.BUFFER_EMPTY,this.value.toBuffer(),this.data.toBuffer(),this.accessList,e,t,s]}computeIntrinsics(e,t){return(0,c.computeIntrinsicsAccessListTx)(e,t)}updateEffectiveGasPrice(){}}t.EIP2930AccessListTransaction=EIP2930AccessListTransaction},722:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},368:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyTransaction=void 0;const r=s(1),n=s(11),i=s(12),o=s(61),a=s(58);class LegacyTransaction extends o.RuntimeTransaction{constructor(e,t,s){if(super(e,t,s),this.type=r.Quantity.from("0x0"),Array.isArray(e)){if(this.nonce=r.Quantity.from(e[0]),this.gasPrice=this.effectiveGasPrice=r.Quantity.from(e[1]),this.gas=r.Quantity.from(e[2]),this.to=0==e[3].length?null:n.Address.from(e[3]),this.value=r.Quantity.from(e[4]),this.data=r.Data.from(e[5]),this.v=r.Quantity.from(e[6]),this.r=r.Quantity.from(e[7]),this.s=r.Quantity.from(e[8]),this.raw=e,!s){const{from:e,serialized:t,hash:s}=this.computeIntrinsics(this.v,this.raw,this.common.chainId());this.from=e,this.serialized=t,this.hash=s}}else this.gasPrice=this.effectiveGasPrice=r.Quantity.from(e.gasPrice),this.validateAndSetSignature(e)}maxGasPrice(){return this.gasPrice}toJSON(e){const t={hash:this.hash,type:this.type,nonce:this.nonce,blockHash:this.blockHash?this.blockHash:null,blockNumber:this.blockNumber?this.blockNumber:null,transactionIndex:this.index?this.index:null,from:this.from,to:this.to,value:this.value,gas:this.gas,gasPrice:this.gasPrice,input:this.data,v:this.v,r:this.r,s:this.s};return(this.common||e).isActivatedEIP(2718)&&(t.type=this.type),t}static fromTxData(e,t,s){return new LegacyTransaction(e,t,s)}static fromEIP2930AccessListTransaction(e,t){return Array.isArray(e)?new LegacyTransaction(e.slice(1,7).concat(e.slice(8)),t):new LegacyTransaction(e,t)}toVmTransaction(){const e=this.data.toBuffer();return{hash:()=>r.BUFFER_32_ZERO,common:this.common,nonce:this.nonce.toBigInt(),gasPrice:this.gasPrice.toBigInt(),gasLimit:this.gas.toBigInt(),to:this.to,value:this.value.toBigInt(),data:e,getSenderAddress:()=>this.from,getBaseFee:()=>this.calculateIntrinsicGas(),getUpfrontCost:()=>{const{gas:e,gasPrice:t,value:s}=this;return e.toBigInt()*t.toBigInt()+s.toBigInt()},supports:e=>!1}}signAndHash(e){if(null!=this.v)throw new Error("Internal Error: RuntimeTransaction `sign` called but transaction has already been signed");let t,s,n,o,a;if(this.common.gteHardfork("spuriousDragon")){t=r.Quantity.toBuffer(this.common.chainId()),s=this.toEthRawTransaction(t,r.BUFFER_EMPTY,r.BUFFER_EMPTY),n=(0,i.encodeRange)(s,0,6),o=n.length;const c=(0,i.encodeRange)(s,6,3),l=(0,r.keccak)((0,i.digest)([n.output,c.output],o+c.length));a=(0,r.ecsignLegacy)(l,e,this.common.chainId())}else{s=this.toEthRawTransaction(r.BUFFER_EMPTY,r.BUFFER_EMPTY,r.BUFFER_EMPTY),n=(0,i.encodeRange)(s,0,6),o=n.length;const t=(0,r.keccak)((0,i.digest)([n.output],o));a=(0,r.ecsignLegacy)(t,e)}this.v=r.Quantity.from(a.v),this.r=r.Quantity.from(a.r),this.s=r.Quantity.from(a.s),s[6]=this.v.toBuffer(),s[7]=this.r.toBuffer(),s[8]=this.s.toBuffer(),this.raw=s;const c=(0,i.encodeRange)(s,6,3),l=[n.output,c.output],u=o+c.length;this.serialized=(0,i.digest)(l,u),this.hash=r.Data.from((0,r.keccak)(this.serialized))}toEthRawTransaction(e,t,s){return[this.nonce.toBuffer(),this.gasPrice.toBuffer(),this.gas.toBuffer(),this.to?this.to.toBuffer():r.BUFFER_EMPTY,this.value.toBuffer(),this.data.toBuffer(),e,t,s]}computeIntrinsics(e,t,s){return(0,a.computeIntrinsicsLegacyTx)(e,t,s)}updateEffectiveGasPrice(){}}t.LegacyTransaction=LegacyTransaction},176:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0,t.Params={TRANSACTION_GAS:21000n,TRANSACTION_DATA_NON_ZERO_GAS:new Map([["chainstart",68n],["homestead",68n],["dao",68n],["tangerineWhistle",68n],["spuriousDragon",68n],["byzantium",68n],["constantinople",68n],["petersburg",68n],["istanbul",16n],["muirGlacier",16n],["berlin",16n],["london",16n],["arrowGlacier",16n],["grayGlacier",16n],["merge",16n],["mergeForkIdTransition",16n],["shanghai",16n]]),TRANSACTION_DATA_ZERO_GAS:4n,TRANSACTION_CREATION_GAS:53000n,INITCODE_WORD_GAS:2n,ACCESS_LIST_ADDRESS_GAS:2400,ACCESS_LIST_STORAGE_KEY_GAS:1900}},723:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},179:(e,t)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionType=void 0,function(e){e[e.Legacy=0]="Legacy",e[e.EIP2930AccessList=1]="EIP2930AccessList",e[e.EIP1559AccessList=2]="EIP1559AccessList"}(s||(t.TransactionType=s={}))},61:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RuntimeTransaction=t.hasPartialSignature=t.toValidLengthAddress=void 0;const r=s(3),n=s(1),i=s(175),o=s(145),a=s(11);t.toValidLengthAddress=(e,t)=>{const s=n.Data.toBuffer(e);if(s.byteLength!==a.Address.ByteLength)throw new Error(`The field ${t} must have byte length of ${a.Address.ByteLength}`);return a.Address.from(s)};t.hasPartialSignature=e=>null!=e.v||null!=e.r||null!=e.s;const c=n.Quantity.One.toBuffer();class RuntimeTransaction extends i.BaseTransaction{constructor(e,s,r){let i;if(super(s,r),this.locked=!1,this.validateAndSetSignature=e=>{if((0,t.hasPartialSignature)(e)){if(null==e.v||null==e.r||null==e.s)throw new Error("Transaction signature is incomplete; v, r, and s are required.");if(null==e.nonce)throw new Error("Signed transaction is incomplete; nonce is required.");this.v=n.Quantity.from(e.v,!0),this.r=n.Quantity.from(e.r,!0),this.s=n.Quantity.from(e.s,!0);const s=this.toEthRawTransaction(this.v.toBuffer(),this.r.toBuffer(),this.s.toBuffer());if(this.raw=s,!this.from){const{from:r,serialized:n,hash:i}=this.computeIntrinsics(this.v,s,this.common.chainId());if(null!==e.from){const s=(0,t.toValidLengthAddress)(e.from,"from");if(!r.toBuffer().equals(s.toBuffer()))throw new Error("Transaction is signed and contains a `from` field, but the signature doesn't match.")}this.from=r,this.serialized=n,this.hash=i}}else null!=e.from&&(this.from=(0,t.toValidLengthAddress)(e.from,"from"))},this.finalized=new Promise((e=>{i=(...t)=>process.nextTick(e,...t)})),this.finalizer=i,!Array.isArray(e)){this.nonce=n.Quantity.from(e.nonce,!0),this.gas=n.Quantity.from(null==e.gas?e.gasLimit:e.gas),this.to=null==e.to?null:(0,t.toValidLengthAddress)(e.to,"to"),this.value=n.Quantity.from(e.value||0);const s=null==e.data?null==e.input?"0x":e.input:e.data;this.data=n.Data.from(s)}}fillFromResult(e,t){const s=e.execResult;let i;s.exceptionError?(i=n.BUFFER_ZERO,this.execException=new r.RuntimeError(this.hash,e,r.RETURN_TYPES.TRANSACTION_HASH)):i=c;return(this.receipt=o.InternalTransactionReceipt.fromValues(i,n.Quantity.toBuffer(t),e.bloom.bitvector,this.logs=s.logs||[],n.Quantity.toBuffer(e.totalGasSpent),e.createdAddress?e.createdAddress.buf:null,this.type)).serialize(!1)}getReceipt(){return this.receipt}getLogs(){return this.logs}once(e){return this.finalized}finalize(e,t=null){this.finalizer({status:e,error:t})}}t.RuntimeTransaction=RuntimeTransaction},58:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.computeIntrinsicsFeeMarketTx=t.computeIntrinsicsAccessListTx=t.digestWithPrefix=t.encodeWithPrefix=t.computeIntrinsicsLegacyTx=t.computeFromAddress=t.publicKeyConvert=t.ecdsaRecover=t.isValidSigRecovery=void 0;const n=s(1),i=s(12),o=s(11),a=r(s(71));function copyOrFill(e,t,s,r){if(e.byteLength>r)throw new Error("Invalid signature");const n=r-e.byteLength,i=s+n;let o=s;for(;o<i;o++)t[o]=0;let a=s+r;const c=s+n;for(;o<a;o++)t[o]=e[o-c]}t.isValidSigRecovery=e=>1===e||0===e;function _ecdsaRecover(e,s,r,i,o){if(!(0,t.isValidSigRecovery)(o))throw new Error("Invalid signature v value");const c=(0,n.keccak)(e),l=s.slice(0,64);copyOrFill(r,l,0,32),copyOrFill(i,l,32,32);const u=s.slice(0,33);if(0!==a.default.ecdsaRecover(u,l,o,c))throw new Error("Invalid Signature");return u}t.ecdsaRecover=(e,t,s,r,o,a)=>{let c,l;const u=2n*r+35n;if(s===u||s===u+1n){const t=[(0,n.bigIntToBuffer)(r),n.BUFFER_EMPTY,n.BUFFER_EMPTY],o=(0,i.encodeRange)(t,0,3);c=(0,i.digest)([e.output,o.output],e.length+o.length),l=Number(s-u)}else c=(0,i.digest)([e.output],e.length),l=Number(s)-27;return _ecdsaRecover(c,t,o,a,l)};t.publicKeyConvert=(e,t)=>{const s=e.slice(0,65);if(0!==a.default.publicKeyConvert(s,t))throw new Error("Invalid Signature");return s};const c=Buffer.allocUnsafe(65);t.computeFromAddress=(e,s,r,i,a)=>{const l=(0,t.ecdsaRecover)(e,c,s,a,r,i),u=(0,t.publicKeyConvert)(c,l);return o.Address.from((0,n.keccak)(u.slice(1)).slice(-20))};t.computeIntrinsicsLegacyTx=(e,s,r)=>{const o=(0,i.encodeRange)(s,0,6),a=(0,i.encodeRange)(s,6,3),c=[o.output,a.output],l=o.length+a.length,u=(0,i.digest)(c,l);return{from:(0,t.computeFromAddress)(o,e.toBigInt(),s[7],s[8],r),hash:n.Data.from((0,n.keccak)(u),32),serialized:u}};const allocUnsafePrefix=e=>Buffer.allocUnsafe(e+1);t.encodeWithPrefix=(e,s)=>{const r=(0,i.encodeRange)(s,0,s.length),n=[r.output],o=r.length;return(0,t.digestWithPrefix)(e,n,o)};t.digestWithPrefix=(e,t,s)=>{const r=(0,i.digest)(t,s,1,allocUnsafePrefix);return r[0]=e,r};t.computeIntrinsicsAccessListTx=(e,s)=>{const r=(0,i.encodeRange)(s,0,8),a=(0,i.encodeRange)(s,8,3),l=[r.output,a.output],u=r.length+a.length,d=(0,t.digestWithPrefix)(1,l,u),f=_ecdsaRecover((0,t.digestWithPrefix)(1,[r.output],r.length),c,s[9],s[10],e.toNumber()),h=(0,t.publicKeyConvert)(c,f);return{from:o.Address.from((0,n.keccak)(h.subarray(1)).subarray(-20)),hash:n.Data.from((0,n.keccak)(d),32),serialized:d}};t.computeIntrinsicsFeeMarketTx=(e,s)=>{const r=(0,i.encodeRange)(s,0,9),a=(0,i.encodeRange)(s,9,3),l=[r.output,a.output],u=r.length+a.length,d=(0,t.digestWithPrefix)(2,l,u),f=_ecdsaRecover((0,t.digestWithPrefix)(2,[r.output],r.length),c,s[10],s[11],e.toNumber()),h=(0,t.publicKeyConvert)(c,f);return{from:o.Address.from((0,n.keccak)(h.slice(1)).slice(-20)),hash:n.Data.from((0,n.keccak)(d),32),serialized:d}}},724:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionFactory=void 0;const r=s(1),n=s(368),i=s(358),o=s(179),a=s(12),c=s(3),l=s(367),u=s(71);function assertValidTransactionSValue(e,t){if(t.s&&t.s.toBigInt()>=u.SECP256K1_MAX_PRIVATE_KEY_DIV_2&&e.gteHardfork("homestead"))throw new Error("Invalid Signature: s-values greater than secp256k1n/2 are considered invalid")}class TransactionFactory{constructor(e,t){const[s,r]=(0,a.decode)(e);this.tx=TransactionFactory.fromDatabaseTx(s,t,r)}static _fromUnsafeUserData(e,t,s,a){if(!s.isActivatedEIP(2718))return n.LegacyTransaction.fromTxData(e,s,a);if(s.isActivatedEIP(1559))if(Array.isArray(e)){if(t===o.TransactionType.Legacy)return n.LegacyTransaction.fromTxData(e,s,a);if(t===o.TransactionType.EIP2930AccessList)return i.EIP2930AccessListTransaction.fromTxData(e,s,a);if(t===o.TransactionType.EIP1559AccessList)return l.EIP1559FeeMarketTransaction.fromTxData(e,s,a)}else{const c=(t===o.TransactionType.Legacy||t===o.TransactionType.EIP2930AccessList)&&void 0===e.gasPrice;if(t===o.TransactionType.EIP1559AccessList||c){const t=l.EIP1559FeeMarketTransaction.fromTxData(e,s,a);return c&&(e.maxFeePerGas||(t.maxFeePerGas=r.Quantity.from(null)),e.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=r.Quantity.Gwei)),t}if(t===o.TransactionType.Legacy)return n.LegacyTransaction.fromTxData(e,s,a);if(t===o.TransactionType.EIP2930AccessList)return void 0===e.accessList?n.LegacyTransaction.fromTxData(e,s,a):i.EIP2930AccessListTransaction.fromTxData(e,s,a)}else{if(t===o.TransactionType.Legacy)return n.LegacyTransaction.fromTxData(e,s,a);if(t===o.TransactionType.EIP2930AccessList){if(s.isActivatedEIP(2930))return i.EIP2930AccessListTransaction.fromTxData(e,s,a);throw new c.CodedError("EIP 2930 is not activated.",r.JsonRpcErrorCode.INVALID_PARAMS)}if(t===o.TransactionType.EIP1559AccessList)throw new c.CodedError("EIP 1559 is not activated.",r.JsonRpcErrorCode.INVALID_PARAMS)}throw new c.CodedError("Tx instantiation with supplied type not supported",r.JsonRpcErrorCode.METHOD_NOT_FOUND)}static fromRpc(e,t,s){const r=this.typeOfRPC(e),n=this._fromUnsafeUserData(e,r,t,s);return assertValidTransactionSValue(t,n),n}static fromDatabaseTx(e,t,s){const a=this.typeOfRaw(e);switch(a){case o.TransactionType.EIP1559AccessList:return l.EIP1559FeeMarketTransaction.fromTxData(e.slice(1),t,s);case o.TransactionType.Legacy:return n.LegacyTransaction.fromTxData(e,t,s);case o.TransactionType.EIP2930AccessList:return i.EIP2930AccessListTransaction.fromTxData(e.slice(1),t,s);default:throw new c.CodedError(`Transactions with supplied type ${a} not supported`,r.JsonRpcErrorCode.METHOD_NOT_FOUND)}}static fromSafeTypeAndTxData(e,t,s,a){switch(e){case o.TransactionType.EIP1559AccessList:return l.EIP1559FeeMarketTransaction.fromTxData(t,s,a);case o.TransactionType.Legacy:return n.LegacyTransaction.fromTxData(t,s,a);case o.TransactionType.EIP2930AccessList:return i.EIP2930AccessListTransaction.fromTxData(t,s,a);default:throw new c.CodedError(`Transactions with supplied type ${e} not supported`,r.JsonRpcErrorCode.METHOD_NOT_FOUND)}}static fromString(e,t){let s=r.Data.toBuffer(e);const n=s[0],i=this.typeOf(n);let c;if(t.isActivatedEIP(2718)){let e;try{e=(0,a.decode)(i===o.TransactionType.Legacy?s:s.slice(1))}catch(e){throw new Error("Could not decode transaction: "+e.message)}c=this._fromUnsafeUserData(e,i,t)}else{let e;try{e=(0,a.decode)(s)}catch(e){throw new Error("Could not decode transaction: "+e.message)}c=this._fromUnsafeUserData(e,o.TransactionType.Legacy,t)}return assertValidTransactionSValue(t,c),c}static typeOf(e){return e===o.TransactionType.EIP1559AccessList||e===o.TransactionType.EIP2930AccessList?e:o.TransactionType.Legacy}static typeOfRaw(e){return 9===e.length?o.TransactionType.Legacy:e[0][0]}static typeOfRPC(e){if("type"in e&&void 0!==e.type){const t=parseInt(e.type,16);return this.typeOf(t)}return o.TransactionType.Legacy}}t.TransactionFactory=TransactionFactory},145:function(e,t,s){"use strict";var r,n=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.InternalTransactionReceipt=void 0;const i=s(3),o=s(12),a=s(1),c=[a.Quantity.Zero,a.Quantity.One];class InternalTransactionReceipt{constructor(e){if(r.set(this,((e,t,s,r,n,i=null,o=null)=>{this.raw=[e,t,s,r],this.contractAddress=i,this.gasUsed=n,this.txType=o})),e){const t=(0,o.decode)(e);n(this,r,"f").call(this,t[0],t[1],t[2],t[3],t[4],t[5])}}static fromValues(e,t,s,i,o,a,c=null){const l=new InternalTransactionReceipt;return n(l,r,"f").call(l,e,t,s,i,o,a,c),l}serialize(e){if(null==this.encoded&&(this.encoded=(0,o.encodeRange)(this.raw,0,4)),e){const e=[this.gasUsed,this.contractAddress],t=(0,o.encodeRange)(e,0,2);return(0,o.digest)([this.encoded.output,t.output],this.encoded.length+t.length)}{const e=(0,o.digest)([this.encoded.output],this.encoded.length);return this.txType?Buffer.concat([this.txType.toBuffer(),e]):e}}toJSON(e,t){const s=this.raw,r=0===this.contractAddress.length?null:a.Data.from(this.contractAddress),{blockHash:n,blockNumber:o}=e,l=i.BlockLogs.create(n),u=e.hash,d=e.index;l.blockNumber=o,s[3].forEach((e=>l.append(d,u,e)));const f=[...l.toJSON()],h={transactionHash:u,transactionIndex:d,blockNumber:o,blockHash:n,from:e.from,to:r?null:e.to,cumulativeGasUsed:a.Quantity.from(s[1]),gasUsed:a.Quantity.from(this.gasUsed),contractAddress:r,logs:f,logsBloom:a.Data.from(s[2],256),status:c[s[0][0]],effectiveGasPrice:e.effectiveGasPrice};return e.type&&t.isActivatedEIP(2718)&&(h.type=e.type),h}}t.InternalTransactionReceipt=InternalTransactionReceipt,r=new WeakMap},727:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rawFromRpc=t.serializeForDb=t.serializeRpcForDb=void 0;const r=s(1),n=s(11),i=s(12),o=s(179),a=s(177),c=s(3);function serializeForDb(e,t,s,r){const n=[9===e.raw.length?e.raw:[e.type.toBuffer(),...e.raw],[e.from.buf,e.hash.toBuffer(),t.toBuffer(),s.toBuffer(),r.toBuffer(),e.effectiveGasPrice.toBuffer()]];return(0,i.encode)(n)}function rawFromRpc(e,t){const s=r.Quantity.toBuffer(e.chainId),n=r.Quantity.toBuffer(e.nonce),i=r.Quantity.toBuffer(e.gasPrice),l=r.Quantity.toBuffer(e.gas||e.gasLimit),u=r.Data.toBuffer(e.to,20),d=r.Quantity.toBuffer(e.value),f=r.Data.toBuffer(e.data||e.input),h=r.Data.toBuffer(e.v),g=r.Data.toBuffer(e.r),p=r.Data.toBuffer(e.s);switch(t===o.TransactionType.EIP2930AccessList&&void 0===e.accessList?o.TransactionType.Legacy:t){case o.TransactionType.Legacy:return[n,i,l,u,d,f,h,g,p];case o.TransactionType.EIP2930AccessList:return[s,n,i,l,u,d,f,e.accessList?a.AccessLists.getAccessListData(e.accessList).accessList:[],h,g,p];case o.TransactionType.EIP1559AccessList:return[s,n,r.Quantity.toBuffer(e.maxPriorityFeePerGas),r.Quantity.toBuffer(e.maxFeePerGas),l,u,d,f,e.accessList?a.AccessLists.getAccessListData(e.accessList).accessList:[],h,g,p];default:throw new c.CodedError("Tx instantiation with supplied type not supported",r.JsonRpcErrorCode.METHOD_NOT_FOUND)}}t.serializeRpcForDb=function serializeRpcForDb(e,t,s,i){let a;return a="type"in e&&void 0!==e.type?parseInt(e.type,16):o.TransactionType.Legacy,serializeForDb({raw:rawFromRpc(e,a),from:n.Address.from(e.from),hash:r.Data.from(e.hash,32),effectiveGasPrice:r.Quantity.from(e.gasPrice),type:r.Quantity.from(a)},t,s,i)},t.serializeForDb=serializeForDb,t.rawFromRpc=rawFromRpc},725:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},726:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(220),t)},651:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbortError=void 0;class AbortError extends Error{constructor(){super("The user aborted a request.")}}t.AbortError=AbortError},650:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallError=void 0;const r=s(174),n=s(170),i=s(1),o=s(1);class CallError extends n.CodedError{constructor(e){const t=e.execResult,s=t.exceptionError.error;let a=r.VM_EXCEPTION+s;super(a,i.JsonRpcErrorCode.INVALID_INPUT),n.CodedError.captureStackTraceExtended.bind(this,a),this.name=this.constructor.name;const{returnValue:c}=t,l=n.CodedError.createRevertReason(c);this.message=l?a+" "+l:a,this.data=o.Data.toString(c)}}t.CallError=CallError},170:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodedError=void 0;const r=s(642),n=Buffer.from("08c379a0","hex");class CodedError extends Error{constructor(e,t){super(e),CodedError.captureStackTraceExtended.bind(this,e),this.code=t}static from(e,t){const s=new CodedError(e.message,t);return s.stack=e.stack,s}static nonEnumerableProperty(e){return{value:e,writable:!0,configurable:!0}}static captureStackTraceExtended(e){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):(Object.defineProperty(this,"stack",CodedError.nonEnumerableProperty(Error(e).stack)),Object.defineProperty(this,"message",CodedError.nonEnumerableProperty(void 0!==e?""+e:"")))}static createRevertReason(e){let t;if(e.length>4&&0===n.compare(e,0,4))try{t=(0,r.rawDecode)(["bytes"],e.slice(4))[0].toString()}catch{t=null}else t=null;return t}}t.CodedError=CodedError},174:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.INSUFFICIENT_FUNDS=t.TRANSACTION_LOCKED=t.VM_EXCEPTIONS=t.VM_EXCEPTION=t.GAS_LIMIT=t.INITCODE_TOO_LARGE=t.INTRINSIC_GAS_TOO_LOW=t.REPLACED=t.UNDERPRICED=t.NONCE_TOO_LOW=t.INVALID_SENDER=void 0,t.INVALID_SENDER="invalid sender",t.NONCE_TOO_LOW="nonce too low",t.UNDERPRICED="transaction underpriced",t.REPLACED="transaction replaced by better transaction",t.INTRINSIC_GAS_TOO_LOW="intrinsic gas too low",t.INITCODE_TOO_LARGE="Transaction's `data`/`input` field is greater than 49152 bytes, which isn't allowed as of EIP-3860. To bypass this restriction set the `--chain.allowUnlimitedInitCodeSize` flag to `true`.",t.GAS_LIMIT="exceeds block gas limit",t.VM_EXCEPTION="VM Exception while processing transaction: ",t.VM_EXCEPTIONS="Multiple VM Exceptions while processing transactions: : \n\n",t.TRANSACTION_LOCKED="transaction can't be replaced, mining has already started. (please open an issue with reproduction steps: https://github.com/trufflesuite/ganache/issues/new)",t.INSUFFICIENT_FUNDS="insufficient funds for gas * price + value"},649:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RuntimeError=t.RETURN_TYPES=void 0;const r=s(174),n=s(1),i=s(170),o=s(1);var a;!function(e){e[e.TRANSACTION_HASH=0]="TRANSACTION_HASH",e[e.RETURN_VALUE=1]="RETURN_VALUE"}(a||(t.RETURN_TYPES=a={}));class RuntimeError extends i.CodedError{constructor(e,t,s){const c=t.execResult,l=c.exceptionError.error;let u=r.VM_EXCEPTION+l;super(u,o.JsonRpcErrorCode.INVALID_INPUT),i.CodedError.captureStackTraceExtended.bind(this,u),this.name=this.constructor.name;const d=e.toString(),{returnValue:f}=c,h=i.CodedError.createRevertReason(f);this.message=h?u+" "+h:u,this.data={hash:d,programCounter:c.runState?.programCounter,result:s===a.TRANSACTION_HASH?d:n.Data.toString(f||"0x"),reason:h,message:l}}}t.RuntimeError=RuntimeError},220:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(170),t),n(s(174),t),n(s(649),t),n(s(650),t),n(s(651),t),n(s(652),t),n(s(653),t),n(s(654),t),n(s(655),t),n(s(656),t),n(s(657),t),n(s(658),t),n(s(659),t),n(s(660),t),n(s(661),t),n(s(662),t),n(s(663),t),n(s(664),t),n(s(665),t),n(s(666),t)},652:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Account=void 0;const r=s(1),n=s(0),i=s(12);class Account{constructor(e){this.storageRoot=n.KECCAK256_RLP,this.codeHash=n.KECCAK256_NULL,this.address=e,this.balance=r.Quantity.Empty,this.nonce=r.Quantity.Empty}static fromBuffer(e){const t=Object.create(Account.prototype),s=(0,i.decode)(e);return t.nonce=r.Quantity.from(s[0]),t.balance=r.Quantity.from(s[1]),t.storageRoot=s[2],t.codeHash=s[3],t}serialize(){return(0,i.encode)([this.nonce.toBuffer(),this.balance.toBuffer(),this.storageRoot,this.codeHash])}}t.Account=Account},653:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockLogs=void 0;const r=s(1),n=s(1),i=s(12),o=s(11),a=Symbol("raw"),c=Symbol("logs"),filterByTopic=(e,t)=>!(e.length>t.length)&&e.every(((e,s)=>{if(null===e)return!0;let n;if(!Array.isArray(e))return t[s].equals(r.Data.toBuffer(e));if(0===e.length)return!0;n=e;const i=t[s];return n.some((e=>i.equals(r.Data.toBuffer(e))))}));class BlockLogs{constructor(e){if(e){const t=(0,i.decode)(e);this[a]=t}}static create(e){const t=Object.create(BlockLogs.prototype);return t[a]=[e.toBuffer(),[]],t}serialize(){return(0,i.encode)(this[a])}append(e,t,s){this[a][1].push([n.BUFFER_ZERO,e.toBuffer(),t.toBuffer(),s[0],s[1],s[2]])}get length(){return this[a][1].length}static fromJSON(e){if(!e||0===e.length)return null;const t=e[0].blockHash,s=e[0].blockNumber,i=BlockLogs.create(r.Data.from(t,32));return i.blockNumber=r.Quantity.from(s),e.forEach((e=>{const t=o.Address.from(e.address),s=(e.blockNumber,Array.isArray(e.data)?e.data.map((e=>r.Data.toBuffer(e))):r.Data.toBuffer(e.data)),a=(e.logIndex,!1===e.removed?n.BUFFER_ZERO:r.Quantity.One.toBuffer(),Array.isArray(e.topics)?e.topics.map((e=>r.Data.toBuffer(e,32))):r.Data.toBuffer(e.topics,32)),c=r.Data.from(e.transactionHash,32),l=r.Quantity.from(e.transactionIndex);i.append(l,c,[t.toBuffer(),a,s])})),i}toJSON(){return this[c]().toJSON()}[c](){const e=this.blockNumber,t=this[a],s=t[1],n=this.length,i=r.Data.from(t[0]);return{toJSON:()=>({*[Symbol.iterator](){for(let t=0;t<n;t++)yield BlockLogs.logToJSON(s[t],r.Quantity.from(t),i,e)}}),*[Symbol.iterator](){for(let t=0;t<n;t++){const n=s[t],o=n[3],a=n[4];yield{address:o,topics:a,toJSON:()=>BlockLogs.logToJSON(n,r.Quantity.from(t),i,e)}}}}}static logToJSON(e,t,s,i){const a=e[4],c=e[5];return{address:o.Address.from(e[3]),blockHash:s,blockNumber:i,data:Array.isArray(c)?c.map((e=>r.Data.from(e,e.length))):r.Data.from(c,c.length),logIndex:t,removed:!e[0].equals(n.BUFFER_ZERO),topics:Array.isArray(a)?a.map((e=>r.Data.from(e,32))):r.Data.from(a,32),transactionHash:r.Data.from(e[2],32),transactionIndex:r.Quantity.from(e[1])}}*filter(e,t){const s=this[c]();if(0!==e.length)if(0===t.length)for(const t of s)e.some((e=>e.equals(t.address)))&&(yield t.toJSON());else for(const r of s)e.some((e=>e.equals(r.address)))&&filterByTopic(t,r.topics)&&(yield r.toJSON());else if(0!==t.length)for(const e of s)filterByTopic(t,e.topics)&&(yield e.toJSON());else yield*s.toJSON()}}t.BlockLogs=BlockLogs},654:(e,t)=>{"use strict";var s,r;Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=t.InternalTag=void 0,function(e){e.earliest="earliest",e.finalized="finalized",e.latest="latest",e.safe="safe",e.pending="pending"}(s||(t.InternalTag=s={})),function(e){e.earliest="earliest",e.finalized="finalized",e.latest="latest",e.safe="safe",e.pending="pending"}(r||(t.Tag=r={}))},655:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TraceDataFactory=void 0;const r=s(1),n=["","00","0000","000000","00000000","0000000000","000000000000","00000000000000","0000000000000000","000000000000000000","00000000000000000000","0000000000000000000000","000000000000000000000000","00000000000000000000000000","0000000000000000000000000000","000000000000000000000000000000","00000000000000000000000000000000","0000000000000000000000000000000000","000000000000000000000000000000000000","00000000000000000000000000000000000000","0000000000000000000000000000000000000000","000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000","000000000000000000000000000000000000000000000000000000000000","00000000000000000000000000000000000000000000000000000000000000","0000000000000000000000000000000000000000000000000000000000000000"];t.TraceDataFactory=()=>{const e=new Map;return{from:t=>{const s=(0,r.bufferToMinHexKey)(t),i=e.get(s);if(i)return i;let o,a;const c={toBuffer:()=>{if(o)return o;const e=t.byteLength;if(32===e)o=t;else{const s=32-e;o=Buffer.allocUnsafe(32).fill(0,0,s),t.copy(o,s,0,e)}return o},toJSON:()=>a||(a=`${n[32-s.length/2]}${s}`)};return e.set(s,c),c}}}},656:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TraceStorageMap=void 0;class TraceStorageMap extends Map{toJSON(){const e={};for(const[t,s]of this)e[t.toJSON()]=s;return e}}t.TraceStorageMap=TraceStorageMap},665:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},657:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},658:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},666:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},659:(e,t)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),t.FilterTypes=void 0,function(e){e[e.log=0]="log",e[e.block=1]="block",e[e.pendingTransaction=2]="pendingTransaction"}(s||(t.FilterTypes=s={}))},660:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},662:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},663:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},664:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},75:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.load=t.OptionsConfig=t.cliDefaults=t.CliOptions=t.CliOptionsConfig=t.serverDefaults=t.ServerOptions=t.ServerOptionsConfig=void 0;var r=s(585);Object.defineProperty(t,"ServerOptionsConfig",{enumerable:!0,get:function(){return r.ServerOptionsConfig}});var n=s(325);Object.defineProperty(t,"ServerOptions",{enumerable:!0,get:function(){return n.ServerOptions}});var i=s(324);Object.defineProperty(t,"serverDefaults",{enumerable:!0,get:function(){return i.serverDefaults}});var o=s(590);Object.defineProperty(t,"CliOptionsConfig",{enumerable:!0,get:function(){return o.CliOptionsConfig}});var a=s(327);Object.defineProperty(t,"CliOptions",{enumerable:!0,get:function(){return a.CliOptions}});var c=s(326);Object.defineProperty(t,"cliDefaults",{enumerable:!0,get:function(){return c.cliDefaults}});var l=s(59);Object.defineProperty(t,"OptionsConfig",{enumerable:!0,get:function(){return l.OptionsConfig}});var u=s(282);Object.defineProperty(t,"load",{enumerable:!0,get:function(){return u.load}})},282:function(__unused_webpack_module,exports,__webpack_require__){"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.load=void 0;const chalk_1=__importDefault(__webpack_require__(43)),colors_1=__webpack_require__(50),utils_1=__webpack_require__(1);function load(flavor){"filecoin"===flavor&&(flavor="@ganache/filecoin");try{const flavorImport=eval("require")(flavor);return"@ganache/filecoin"!==flavor||flavorImport.default||(console.error("Your version of @ganache/filecoin is outdated. Please install the latest version by running `npm install @ganache/filecoin --global`."),process.exit(1)),flavorImport.default}catch(e){if(!(0,utils_1.hasOwn)(e,"message")||"string"!=typeof e.message||!e.message.includes(`Cannot find module '${flavor}'`))throw e;{const e="Need help? Reach out to the Truffle community at",t="https://trfl.io/support";console.warn(chalk_1.default`\n\n{red.bold ERROR:} Could not find Ganache flavor "{bold ${flavor}}"; `+"it probably\nneeds to be installed.\n \u25b8 if you're using Ganache as a library run: \n"+chalk_1.default` {blue.bold $ npm install ${flavor}}\n`+" \u25b8 if you're using Ganache as a CLI run: \n"+chalk_1.default` {blue.bold $ npm install --global ${flavor}}\n\n`+chalk_1.default`{hex("${colors_1.TruffleColors.porsche}").bold ${e}}\n`+chalk_1.default`{hex("${colors_1.TruffleColors.turquoise}") ${t}}\n\n`),process.exit(1)}}}exports.load=load},326:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cliDefaults=void 0;const r=s(327);t.cliDefaults={server:r.CliOptions}},590:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CliOptionsConfig=void 0;const r=s(59),n=s(326);t.CliOptionsConfig=new r.OptionsConfig(n.cliDefaults)},327:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CliOptions=void 0;const s="DOCKER"in process.env&&"true"===process.env.DOCKER.toLowerCase();t.CliOptions={port:{normalize:e=>{if(e<1||e>65535)throw new Error(`Invalid port number '${e}'`);return e},cliDescription:"The port to listen on.",default:()=>8545,legacyName:"port",cliType:"number",cliAliases:["p","port"]},host:{normalize:e=>{if(""===(e=e.trim()))throw new Error("Cannot leave host blank; please provide a host");return e},cliDescription:"Hostname to listen on.",default:()=>s?"0.0.0.0":"127.0.0.1",legacyName:"host",cliType:"string",cliAliases:["h","host"]}}},324:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serverDefaults=void 0;const r=s(325);t.serverDefaults={server:r.ServerOptions}},585:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerOptionsConfig=void 0;const r=s(59),n=s(324);t.ServerOptionsConfig=new r.OptionsConfig(n.serverDefaults)},325:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerOptions=void 0;const r=s(21),normalize=e=>e;t.ServerOptions={ws:{normalize,cliDescription:"Enable a websocket server.",default:()=>!0,legacyName:"ws",cliType:"boolean"},wsBinary:{normalize,cliDescription:"Whether or not websockets should response with binary data (ArrayBuffers) or strings.",default:()=>"auto",cliChoices:["true","false","auto"]},rpcEndpoint:{normalize,cliDescription:"Defines the endpoint route the HTTP and WebSocket servers will listen on.",default:()=>"/"},chunkSize:{normalize:e=>{if(e<0||e>r.kMaxLength)throw new Error(`--server.chunkSize must be >= 0 and <= ${r.kMaxLength}`);return e},cliDescription:"For memory and performance reasons ganache may respond with chunked transfer-encoding over HTTP and fragmented send over WebSockets. This option allows you to control the approximate size of each chunk.",default:()=>1048576,cliType:"number"}}},36:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debug=void 0;t.debug=()=>()=>{}},59:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(586),t),n(s(587),t),n(s(588),t),n(s(589),t)},586:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},589:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsConfig=void 0;const r=s(1),checkForConflicts=(e,t,s,r)=>{if(r)for(const n of r)if(s.has(n))throw new Error(`Values for both "${t}.${e}" and "${t}.${n}" cannot be specified; they are mutually exclusive.`)};t.OptionsConfig=class OptionsConfig{constructor(e){this.defaults=e}normalize(e){const t={};return Object.entries(this.defaults).forEach((([s,n])=>{!function fill(e,t,s,n){const i=t[n]=t[n]||{},o=new Set,a=Object.entries(s);if((0,r.hasOwn)(e,n)){const t=e[n];for(const[s,c]of a){let a=t[s];if(void 0!==a){const e=c.normalize(a,i);void 0!==e&&(checkForConflicts(s,n,o,c.conflicts),i[s]=e,o.add(s))}else if(a=e[c.legacyName||s],void 0!==a){const e=c.normalize(a,i);void 0!==e&&(checkForConflicts(s,n,o,c.conflicts),i[s]=e,o.add(s))}else(0,r.hasOwn)(c,"default")&&(i[s]=c.default(i))}}else for(const[t,s]of a){const a=e[s.legacyName||t];if(void 0!==a){const e=s.normalize(a,i);void 0!==e&&(checkForConflicts(t,n,o,s.conflicts),i[t]=e,o.add(t))}else(0,r.hasOwn)(s,"default")&&(i[t]=s.default(i))}}(e,t,n,s)})),t}}},588:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},587:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},243:function(e,t,s){"use strict";var r,n,i,o=this&&this.__decorate||function(e,t,s,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(i<3?n(o):i>3?n(t,s,o):n(t,s))||o);return i>3&&o&&Object.defineProperty(t,s,o),o},a=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=c(s(29)),u=c(s(804));let d=class PromiseQueue{constructor(){r.set(this,[]),n.set(this,((e,t)=>{t===e[0]?(e.shift(),t.resolve(t.value),a(this,i,"f").call(this,e)):t.resolved=!0})),i.set(this,(e=>{let t=e[0];for(;t&&t.resolved;)e.shift(),t.resolve(t.value),t=e[0];0===e.length&&this.emit("idle")}))}isBusy(){return 0!==a(this,r,"f").length}add(e){const t=a(this,r,"f"),s=new u.default(e,t,a(this,n,"f"));return t.push(s),s.promise}clear(e){const t=a(this,r,"f").splice(0);t.forEach((s=>{s.queue=t,s.value=e}))}};r=new WeakMap,n=new WeakMap,i=new WeakMap,d=o([l.default.mixin(Symbol.for("emittery"),["emit","once"])],d),t.default=d},804:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class Entry{constructor(e,t,s){this.resolved=!1,this.value=e,this.queue=t,this.onSetteled=s;const _onSetteled=()=>this.onSetteled(this.queue,this);e.then(_onSetteled,_onSetteled),this.promise=new Promise((e=>{this.resolve=e}))}}},12:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encodeLength=t.encode=t.digest=t.encodeRange=void 0;const r=s(1);function encode(e){if(Array.isArray(e)){let t=0;const s=[];for(let r=0,n=e.length;r<n;r++){const n=encode(e[r]);t+=n.length,s.push(n)}const r=Buffer.concat(s,t),n=encodeLength(t,192);return Buffer.concat([n,r],n.length+t)}if(null==e){const e=Buffer.allocUnsafe(1);return e[0]=128,e}{const t=e.length;if(1===t&&e[0]<128)return e;{const s=encodeLength(t,128);return Buffer.concat([s,e],s.length+t)}}}function encodeLength(e,t){if(e<56){const s=Buffer.allocUnsafe(1);return s[0]=e+t,s}{const s=(0,r.uintToBuffer)(e),n=s.length,i=(0,r.uintToBuffer)(t+55+n);return Buffer.concat([i,s],i.length+n)}}function safeSlice(e,t,s){if(s>e.length)throw new Error("invalid RLP (safeSlice): end slice of Buffer out-of-bounds");return e.slice(t,s)}function decodeLength(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return function parseHexByte(e){const t=Number.parseInt(e,16);if(Number.isNaN(t))throw new Error("Invalid byte sequence");return t}(function bytesToHex(e){let t="";for(let s=0;s<e.length;s++)t+=n[e[s]];return t}(e))}function _decode(e){let t,s,r,n,i;const o=[],a=e[0];if(a<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(a<=183){if(t=a-127,r=128===a?Buffer.from([]):safeSlice(e,1,t),2===t&&r[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:r,remainder:e.slice(t)}}if(a<=191){if(s=a-182,e.length-1<s)throw new Error("invalid RLP: not enough bytes for string length");if(t=decodeLength(safeSlice(e,1,s)),t<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return r=safeSlice(e,s,t+s),{data:r,remainder:e.slice(t+s)}}if(a<=247){for(t=a-191,n=safeSlice(e,1,t);n.length;)i=_decode(n),o.push(i.data),n=i.remainder;return{data:o,remainder:e.slice(t)}}{if(s=a-246,t=decodeLength(safeSlice(e,1,s)),t<56)throw new Error("invalid RLP: encoded list too short");const r=s+t;if(r>e.length)throw new Error("invalid RLP: total length is larger than the data");for(n=safeSlice(e,s,r);n.length;)i=_decode(n),o.push(i.data),n=i.remainder;return{data:o,remainder:e.slice(r)}}}t.encodeRange=function encodeRange(e,t,s){let r=0;const n=t+s,i=[];for(var o=t;o<n;o++){const t=encode(e[o]);r+=t.length,i.push(t)}return{length:r,output:i}},t.digest=function digest(e,t,s=0,r=Buffer.allocUnsafe){const n=encodeLength(t,192),i=n.length,o=r(i+t);n.copy(o,s,0,i),s+=i;for(let t=0,r=e.length;t<r;t++){const r=e[t];for(let e=0,t=r.length;e<t;e++){const t=r[e],n=t.length;t.copy(o,s,0,n),s+=n}}return o},t.encode=encode,t.encodeLength=encodeLength,t.decode=function decode(e){if(!e||0===e.length)return r.BUFFER_EMPTY;const t=_decode(e);if(0!==t.remainder.length)throw new Error("invalid RLP: remainder must be zero");return t.data};const n=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")))},71:(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SECP256K1_MAX_PRIVATE_KEY_DIV_2=exports.SECP256K1_N=void 0;const path_1=__webpack_require__(14);let secp256k1;exports.SECP256K1_N=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,exports.SECP256K1_MAX_PRIVATE_KEY_DIV_2=0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0n;try{const nodeRequire=eval("require"),path=nodeRequire.resolve("secp256k1/package.json"),dir=(0,path_1.dirname)(path),nodeGypBuild=__webpack_require__(305),{Secp256k1}=nodeGypBuild(dir);secp256k1=new Secp256k1}catch{secp256k1=__webpack_require__(306)}exports.default=secp256k1},1:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PromiEvent=t.JsonRpcErrorCode=t.makeResponse=t.makeRequest=t.makeError=t.JsonRpcType=void 0,n(s(250),t),n(s(221),t);var o=s(578);Object.defineProperty(t,"JsonRpcType",{enumerable:!0,get:function(){return o.JsonRpcType}}),n(s(580),t),n(s(581),t),n(s(582),t);var a=s(583);Object.defineProperty(t,"makeError",{enumerable:!0,get:function(){return a.makeError}}),Object.defineProperty(t,"makeRequest",{enumerable:!0,get:function(){return a.makeRequest}}),Object.defineProperty(t,"makeResponse",{enumerable:!0,get:function(){return a.makeResponse}}),Object.defineProperty(t,"JsonRpcErrorCode",{enumerable:!0,get:function(){return a.JsonRpcErrorCode}});var c=s(259);Object.defineProperty(t,"PromiEvent",{enumerable:!0,get:function(){return i(c).default}}),n(s(584),t)},569:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toBigIntBE=t.toBufferBE=void 0;var r=s(148);Object.defineProperty(t,"toBufferBE",{enumerable:!0,get:function(){return r.toBufferBE}}),Object.defineProperty(t,"toBigIntBE",{enumerable:!0,get:function(){return r.toBigIntBE}})},578:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonRpcType=void 0;var r=s(156);Object.defineProperty(t,"JsonRpcType",{enumerable:!0,get:function(){return r.BaseJsonRpcType}})},579:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseAndValidateStringInput=t.parseAndValidateBigIntInput=t.parseAndValidateNumberInput=void 0;const r=s(302),n=s(149),i=Buffer.allocUnsafe(0);t.parseAndValidateNumberInput=function parseAndValidateNumberInput(e){if(0===e)return i;if(e<0)throw new Error("Cannot wrap a negative value as a json-rpc type");if(e%1)throw new Error("Cannot wrap a decimal as a json-rpc type");if(!isFinite(e))throw new Error(`Cannot wrap a ${e} as a json-rpc type`);return(0,n.uintToBuffer)(e)},t.parseAndValidateBigIntInput=function parseAndValidateBigIntInput(e){if(e<0n)throw new Error("Cannot wrap a negative value as a json-rpc type");return(0,r.bigIntToBuffer)(e)},t.parseAndValidateStringInput=function parseAndValidateStringInput(e){if("0x"!==e.slice(0,2).toLowerCase())throw new Error(`Cannot wrap string value "${e}" as a json-rpc type; strings must be prefixed with "0x".`);let t=e.slice(2);1&t.length&&(t=`0${t}`);const s=Math.ceil(e.length/2-1),r=Buffer.from(t,"hex");if(r.length!==s)throw new Error(`Cannot wrap string value "${e}" as a json-rpc type; the input value contains an invalid hex character.`);return r}},156:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseJsonRpcType=void 0;const r=s(579),n=Symbol.for("nodejs.util.inspect.custom");t.BaseJsonRpcType=class BaseJsonRpcType{[n](e,t){return`[${this.constructor.name}] ${this.toString()}`}constructor(e){if(null==e)this.bufferValue=null;else if(Buffer.isBuffer(e))this.bufferValue=0===e.length?null:e;else switch(typeof e){case"string":this.bufferValue=(0,r.parseAndValidateStringInput)(e);break;case"number":this.bufferValue=(0,r.parseAndValidateNumberInput)(e);break;case"bigint":this.bufferValue=(0,r.parseAndValidateBigIntInput)(e);break;default:throw new Error(`Cannot wrap a "${typeof e}" as a json-rpc type`)}}toString(){return null==this.bufferValue?null:`0x${this.bufferValue.toString("hex")}`}toBuffer(){return this.bufferValue}valueOf(){return this.bufferValue}toJSON(){return this.toString()}isNull(){return null==this.bufferValue}}},582:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Data=void 0;const r=s(156),n=s(60);class Data extends r.BaseJsonRpcType{constructor(e,t){if(super(e),this._byteLength=t,"bigint"==typeof e)throw new Error(`Cannot create a ${typeof e} as a Data`)}toString(e){const t=e||this._byteLength;if(null==this.bufferValue)return"0x";if(void 0===t)return super.toString();const s=this.bufferValue.toString("hex");return`0x${Data.stringToFixedByteLength(s,t)}`}toBuffer(e){if(null==this.bufferValue)return n.BUFFER_EMPTY;const t=e||this._byteLength;return null==t||t===this.bufferValue.length?this.bufferValue:Data.bufferToFixedByteLength(this.bufferValue,t)}static from(e,t){return new Data(e,t)}static stringToFixedByteLength(e,t){const s=2*t;if(s===e.length)return e;const r=s-e.length;let n;return n=r>0?"0".repeat(r)+e:e.slice(0,s),n}static bufferToFixedByteLength(e,t){if(t===e.length)return e;const s=Buffer.allocUnsafe(t),r=e.length>t?0:t-e.length;return r>0&&s.fill(0,0,r),e.copy(s,r,0,t),s}static toBuffer(e,t){return Data.from(e,t).toBuffer()}static toString(e,t){return Data.from(e,t).toString()}}t.Data=Data,Data.Empty=Data.from(n.BUFFER_EMPTY)},581:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Quantity=void 0;const r=s(303),n=s(156),i=s(60);class Quantity extends n.BaseJsonRpcType{static from(e,t=!1){return e instanceof Quantity?e:new Quantity(e,t)}constructor(e,t){if(super(e),this._nullable=!1,"0x"===e)throw new Error('Cannot wrap "0x" as a json-rpc Quantity type; strings must contain at least one hexadecimal character.');this._nullable=t}toString(){if(null==this.bufferValue)return this._nullable?null:Quantity.ZERO_VALUE_STRING;const e=this.findFirstNonZeroByteIndex();if(e===this.bufferValue.length)return Quantity.ZERO_VALUE_STRING;let t=this.bufferValue.toString("hex",e);return"0"===t[0]&&(t=t.slice(1)),`0x${t}`}toBuffer(){if(null==this.bufferValue)return i.BUFFER_EMPTY;const e=this.findFirstNonZeroByteIndex();return e>0?this.bufferValue.subarray(e):this.bufferValue}toBigInt(){return null==this.bufferValue?this._nullable?null:0n:0===this.bufferValue.length?0n:(0,r.bufferToBigInt)(this.bufferValue)}toNumber(){if(null==this.bufferValue)return this._nullable?null:0;const e=this.findFirstNonZeroByteIndex(),t=this.bufferValue.length-e;if(0===t)return 0;let s;if(t>6){const t=0===e?this.bufferValue:this.bufferValue.subarray(e);s=Number((0,r.bufferToBigInt)(t)),Number.isSafeInteger(s)||console.warn(`0x${this.bufferValue.toString("hex")} is too large - the maximum safe integer value is 0${Number.MAX_SAFE_INTEGER.toString(16)}`)}else s=this.bufferValue.readUIntBE(e,t);return s}valueOf(){return null==this.bufferValue?null:this.toBigInt()}findFirstNonZeroByteIndex(){let e=0;for(e=0;e<this.bufferValue.length&&0===this.bufferValue[e];e++);return e}static toBuffer(e,t){return Quantity.from(e,t).toBuffer()}static toString(e,t){return Quantity.from(e,t).toString()}static toNumber(e,t){return Quantity.from(e,t).toNumber()}static toBigInt(e,t){return Quantity.from(e,t).toBigInt()}}t.Quantity=Quantity,Quantity.Empty=Quantity.from(i.BUFFER_EMPTY,!0),Quantity.Zero=Quantity.from(i.BUFFER_ZERO),Quantity.One=Quantity.from(1),Quantity.Gwei=Quantity.from(1e9),Quantity.ZERO_VALUE_STRING="0x0",t.default=Quantity},583:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonRpcErrorCode=t.makeError=t.makeResponse=t.makeRequest=void 0;const s="2.0";t.makeRequest=e=>({id:e.id,jsonrpc:s,method:e.method,params:e.params});t.makeResponse=(e,t)=>({id:e,jsonrpc:s,result:t});var r;t.makeError=(e,t,r)=>{const n={message:t.message};return Object.getOwnPropertyNames(t).forEach((e=>{"string"==typeof e&&(n[e]=t[e])})),"number"!=typeof n.code&&(n.code=-32700),void 0!==r?{id:e,jsonrpc:s,error:n,result:r}:{id:e,jsonrpc:s,error:n}},function(e){e[e.PARSE_ERROR=-32700]="PARSE_ERROR",e[e.INVALID_REQUEST=-32600]="INVALID_REQUEST",e[e.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",e[e.INVALID_PARAMS=-32602]="INVALID_PARAMS",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e[e.INVALID_INPUT=-32e3]="INVALID_INPUT",e[e.TRANSACTION_REJECTED=-32003]="TRANSACTION_REJECTED",e[e.METHOD_NOT_SUPPORTED=-32004]="METHOD_NOT_SUPPORTED",e[e.LIMIT_EXCEEDED=-32005]="LIMIT_EXCEEDED",e[e.JSON_RPC_VERSION_NOT_SUPPORTED=-32006]="JSON_RPC_VERSION_NOT_SUPPORTED"}(r||(t.JsonRpcErrorCode=r={}))},584:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createLogger=void 0;const r=s(9),n=s(6),i=s(18),o=/^|(?<=\r?\n)/g;t.createLogger=function createLogger(e){const baseLog=(...t)=>e.baseLogger.log(...t);if("file"in e&&void 0!==e.file){const t=e.file,diskLogFormatter=e=>{const t=`${(new Date).toISOString()} `;return e.replace(o,t)},s=(0,r.createWriteStream)(null,{fd:t}),onError=e=>console.error(`Error writing to log file: ${e.message}`);s.on("error",onError);return{log:(e,...t)=>{baseLog(e,...t);const r=(0,n.format)(e,...t);s.write(diskLogFormatter(r)+i.EOL)},close:()=>new Promise(((e,t)=>{s.close((s=>{s?t(s):e()}))}))}}return{log:baseLog,close:async()=>{}}}},259:function(e,t,s){"use strict";var r,n=this&&this.__decorate||function(e,t,s,r){var n,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(i<3?n(o):i>3?n(t,s,o):n(t,s))||o);return i>3&&o&&Object.defineProperty(t,s,o),o},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(s(29)),a=["clearListeners","once","on","emit","onAny"],c=o.default.mixin.bind(o.default);let l=r=class PromiEvent extends Promise{constructor(e){super(e),this.dispose=()=>{if(!this.clearListeners)throw new Error("PromiEvent already disposed");this.clearListeners();const fn=()=>{throw new Error("PromiEvent bound after dispose")};a.filter((e=>"emit"!==e)).forEach((e=>{Object.defineProperty(this,e,{enumerable:!1,value:fn})}))}}catch(e){const t=new r(((s,r)=>{this.onAny(((e,s)=>t.emit(e,s)));super.catch(e).then(s,r)}));return t}static resolve(e){return new r((t=>{t(e)}))}};l=r=n([c(Symbol.for("emittery"),a)],l),t.default=l},580:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},568:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},250:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(568),t)},302:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bigIntToBuffer=void 0;const r=s(569),n=s(60),i=s(149),o=Buffer.allocUnsafe;let a;function bigIntByteLength(e){let t=1;for(;e>>=8n;)t++;return t}const c=BigInt(Number.MAX_SAFE_INTEGER);try{if(!r.toBufferBE)throw new Error("Missing function `toBufferBE`!");a=e=>{if(0n===e)return n.BUFFER_EMPTY;if(e<=c)return(0,i.uintToBuffer)(Number(e));{const t=bigIntByteLength(e);return(0,r.toBufferBE)(e,t)}}}catch{a=e=>{if(0n===e)return n.BUFFER_EMPTY;if(e<=c)return(0,i.uintToBuffer)(Number(e));{let t=bigIntByteLength(e);const s=o(t);do{s[--t]=Number(0xffffffffn&e),e>>=8n}while(t);return s}}}t.bigIntToBuffer=a},303:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bufferToBigInt=void 0;const r=s(148);t.bufferToBigInt=function bufferToBigInt(e){const t=e.byteLength;if(0===t)return null;if(t<=6)return BigInt(e.readUIntBE(0,t));let s;if(7===t){const t=new Uint8Array(8);t.set(e,1),s=new DataView(t.buffer)}else{if(8!==t)return(0,r.toBigIntBE)(e);s=new DataView(e.buffer,e.byteOffset,t)}return s.getBigUint64(0)}},572:(e,t)=>{"use strict";let s;Object.defineProperty(t,"__esModule",{value:!0}),t.bufferToMinHexKey=void 0,s="function"==typeof Buffer.prototype.latin1Slice?(e,t,s)=>e.hexSlice(t,s):(e,t,s)=>e.slice(t,s).toString("hex"),t.bufferToMinHexKey=function bufferToMinHexKey(e){for(let t=0,n=e.byteLength;t<n;t++){const i=e[t];if(0!==i)return t+1===n?r[i]:s(e,t,n)}return""};const r=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]},60:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION_KEY=t.KNOWN_CHAINIDS=t.WEI=t.BUFFER_8_ZERO=t.BUFFER_32_ZERO=t.BUFFER_ZERO=t.BUFFER_EMPTY=t.ACCOUNT_ZERO=t.BUFFER_256_ZERO=void 0,t.BUFFER_256_ZERO=Buffer.allocUnsafe(256).fill(0),t.ACCOUNT_ZERO=t.BUFFER_256_ZERO.slice(0,20),t.BUFFER_EMPTY=Buffer.allocUnsafe(0),t.BUFFER_ZERO=t.BUFFER_256_ZERO.slice(0,1),t.BUFFER_32_ZERO=t.BUFFER_256_ZERO.slice(0,32),t.BUFFER_8_ZERO=t.BUFFER_256_ZERO.slice(0,8),t.WEI=1000000000000000000n,t.KNOWN_CHAINIDS=new Set([1,3,4,5,42,11155111]),t.VERSION_KEY=Buffer.from([118,101,114,115,105,111,110])},257:function(e,t,s){"use strict";var r,n=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s},i=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)};Object.defineProperty(t,"__esModule",{value:!0}),t.Executor=void 0;const o=s(304);t.Executor=class Executor{constructor(e){r.set(this,void 0),n(this,r,e,"f")}stop(){i(this,r,"f").stop()}end(){i(this,r,"f").end()}execute(e,t,s){if("string"==typeof t&&((0,o.hasOwn)(e.__proto__,t)&&"constructor"!==t||(0,o.hasOwn)(e,t))){const n=e[t];if("function"==typeof n)return i(this,r,"f").queue(n,e,s)}throw new Error(`The method ${String(t)} does not exist/is not available`)}},r=new WeakMap},573:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findInsertPosition=void 0,t.findInsertPosition=function findInsertPosition(e,t,s){let r=e.length,n=0,i=0;for(;r>0;){const o=r/2|0;i+=o,s(t,e[i])?(r=o,i=n):(n=++i,r-=o+1)}return n}},304:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasOwn=void 0;const s={}.hasOwnProperty.call.bind({}.hasOwnProperty);t.hasOwn=(e,t)=>null!=e&&s(e,t)},570:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Heap=void 0;class Heap{constructor(e,t){this.length=0,this.array=[],this.less=e,this.refresher=t}init(e){this.array=e;const t=this.length=e.length;for(let e=(t/2|0)-1;e>=0;)this.down(e--,t)}refresh(e){const t=this.length,s=t/2|0;for(let r=s;r<t;r++)this.refresher(this.array[r],e);for(let r=s-1;r>=0;)this.refresher(this.array[r],e),this.down(r--,t)}push(e){const t=this.length++;this.array[t]=e,this.up(t)}size(){return this.length}peek(){return this.array[0]}clear(){this.length=this.array.length=0}shift(){const e=this.length;if(e<=1){if(0===e)return;const t=this.array[0];return this.clear(),t}const t=this.array,s=t[0],r=this.length=e-1;return t[0]=t[r],this.down(0,r),s}replaceBest(e){this.array[0]=e,this.down(0,this.length)}replace(e,t){this.array[e]=t,this.fix(e)}remove(e){const t=--this.length;t!==e&&(this.swap(e,t),this.down(e,t)||this.up(e))}removeBest(){const e=this.array;if(1===this.length)return this.length=e.length=0,!1;const t=--this.length;return e[0]=e[t],this.down(0,t),!0}fix(e){this.down(e,this.length)||this.up(e)}up(e){const t=this.less.bind(null,this.array);for(let s;s=(e-1)/2|0,s!==e&&t(e,s);e=s)this.swap(s,e)}down(e,t){const s=this.less.bind(null,this.array);let r,n=e;for(;(r=2*n+1)<t;){let e=r,i=r+1;if(i<t&&s(i,r)&&(e=i),!s(e,n))break;this.swap(n,e),n=e}return n>e}swap(e,t){const s=this.array,r=s[e];s[e]=s[t],s[t]=r}static from(e,t,s){const r=new Heap(t,s);return r.array=[e],r.length=1,r}}t.Heap=Heap},221:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var n=Object.getOwnPropertyDescriptor(t,s);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,n)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),n=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(s(302),t),n(s(303),t),n(s(257),t),n(s(570),t),n(s(258),t),n(s(571),t),n(s(304),t),n(s(149),t),n(s(60),t),n(s(572),t),n(s(272),t),n(s(573),t),n(s(273),t),n(s(574),t),n(s(280),t)},272:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.keccak=void 0;const n=r(s(150)),i=(0,n.default)("keccak256");t.keccak=function keccak(e){i._state.absorb(e);const t=i._state.squeeze(32);return i._state.initialize(1088,512),i._finalized=!1,t}},574:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.min=t.max=void 0;t.max=(...e)=>e.reduce(((e,t)=>t>e?t:e));t.min=(...e)=>e.reduce(((e,t)=>t<e?t:e))},273:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RandomNumberGenerator=void 0;const n=r(s(96));t.RandomNumberGenerator=class RandomNumberGenerator{constructor(e,t){if("string"==typeof e&&void 0===t)this.rng=n.default.alea(e,{state:!0});else if("object"==typeof t)this.rng=n.default.alea("",{state:t});else{const e=Math.random()*Date.now();this.rng=n.default.alea(`${e}`,{state:!0})}}getNumber(e=1){return 1!==e?this.rng()*e:this.rng()}getNumbers(e,t=1){const s=[];for(let r=0;r<e;r++)s.push(this.getNumber(t));return s}getBuffer(e){return Buffer.from(this.getNumbers(e,256))}state(){return this.rng.state()}}},258:function(e,t){"use strict";var s,r,n=this&&this.__classPrivateFieldGet||function(e,t,s,r){if("a"===s&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?r:"a"===s?r.call(e):r?r.value:t.get(e)},i=this&&this.__classPrivateFieldSet||function(e,t,s,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,s):n?n.value=s:t.set(e,s),s};Object.defineProperty(t,"__esModule",{value:!0}),t.RequestCoordinator=void 0;const noop=()=>{};t.RequestCoordinator=class RequestCoordinator{get paused(){return n(this,s,"f")}constructor(e){this.pending=[],this.runningTasks=0,s.set(this,!0),this.pause=()=>{i(this,s,!0,"f")},this.resume=()=>{i(this,s,!1,"f"),n(this,r,"f").call(this)},r.set(this,(()=>{for(;!this.paused&&this.pending.length>0&&(!this.limit||this.runningTasks<this.limit);){const e=this.pending.shift();this.runningTasks++,e.execute().catch(noop).finally((()=>{this.runningTasks--,n(this,r,"f").call(this)}))}})),this.queue=(e,t,s)=>new Promise(((i,o)=>{this.pending.push({execute:async()=>{try{const r=Reflect.apply(e,t,s||[]);return i({value:r}),r}catch(e){o(e)}},reject:o}),n(this,r,"f").call(this)})),this.limit=e}stop(){this.pause(),this.resume=()=>{throw new Error("Cannot resume processing requests, Ganache is disconnected.")},this.queue=async()=>{throw new Error("Cannot process request, Ganache is disconnected.")}}end(){for(;this.pending.length>0;)this.pending.shift().reject(new Error("Cannot process request, Ganache is disconnected."))}},s=new WeakMap,r=new WeakMap},280:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ecsignLegacy=t.ecsign=void 0;const n=r(s(71));function ecsign(e,t){const s={signature:new Uint8Array(64),recid:null};if(0!==n.default.ecdsaSign(s,e,t))throw new Error("The nonce generation function failed, or the private key was invalid");const{signature:r,recid:i}=s,o=r.buffer;return{r:Buffer.from(o,0,32),s:Buffer.from(o,32,32),v:BigInt(i)}}t.ecsign=ecsign,t.ecsignLegacy=function ecsignLegacy(e,t,s){const{v:r,r:n,s:i}=ecsign(e,t);return{r:n,s:i,v:void 0===s?r+27n:r+35n+2n*BigInt(s)}}},149:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uintToBuffer=void 0;const s=4294967295,r=Buffer.allocUnsafe;t.uintToBuffer=function uintToBuffer(e){return e>s?function uintWideToBuf(e){let t,n=Number(BigInt(e)>>32n);const i=n;let o=0;if(n>>>=8){const e=n;if(n>>>=8){const s=n;(n>>>=8)?(t=r(8),t[0]=n,t[1]=s,t[2]=e,t[3]=i,o=7):(t=r(7),t[0]=s,t[1]=e,t[2]=i,o=6)}else t=r(6),t[0]=e,t[1]=i,o=5}else t=r(5),t[0]=i,o=4;let a=e&s;const c=a;if(a>>>=8){const e=a;if(a>>>=8){const s=a;t[o-3]=a>>>=8,t[o-2]=s,t[o-1]=e,t[o]=c}else t[o-3]=0,t[o-2]=0,t[o-1]=e,t[o]=c}else t[o-3]=0,t[o-2]=0,t[o-1]=0,t[o]=c;return t}(e):function uint32ToBuf(e){let t;const s=e;if(e>>>=8){const n=e;if(e>>>=8){const i=e;(e>>>=8)?(t=r(4),t[0]=e,t[1]=i,t[2]=n,t[3]=s):(t=r(3),t[0]=i,t[1]=n,t[2]=s)}else t=r(2),t[0]=n,t[1]=s}else t=r(1),t[0]=s;return t}(e)}},571:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unref=void 0,t.unref=function unref(e){return"object"==typeof e&&"function"==typeof e.unref&&(e.unref(),!0)}},799:()=>{},720:()=>{}};
|
|
//# sourceMappingURL=1.js.map
|