-
Notifications
You must be signed in to change notification settings - Fork 1
/
3.4154932b5451eb99da8e.js
1 lines (1 loc) · 34.5 KB
/
3.4154932b5451eb99da8e.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{"/u+i":function(e,t,r){r("QXrW"),r("4CaD");const n=r("y2lW"),o=(e,t)=>e+t,s=["sync","latest"];function i(e){return Number.parseInt(e,16)}e.exports=class extends n{constructor(e={}){super(),this._blockResetDuration=e.blockResetDuration||2e4,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(e=>this.once("latest",e))}removeAllListeners(e){e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener()}_start(){}_end(){}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e,t){s.includes(e)&&this._maybeStart()}_onRemoveListener(e,t){this._getBlockTrackerEventCount()>0||this._maybeEnd()}_maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),this._start())}_maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),this._end())}_getBlockTrackerEventCount(){return s.map(e=>this.listenerCount(e)).reduce(o)}_newPotentialLatest(e){const t=this._currentBlock;t&&i(e)<=i(t)||this._setCurrentBlock(e)}_setCurrentBlock(e){const t=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:t,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}},"0Q/7":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const n=r("1MZ5"),o=r("M6k5"),s=n.errorCodes.rpc.internal,i={code:s,message:a(s)};function a(e,r="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){const r=e.toString();if(d(n.errorValues,r))return n.errorValues[r].message;if(u(e))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function c(e){if(!Number.isInteger(e))return!1;const t=e.toString();return!!n.errorValues[t]||!!u(e)}function u(e){return e>=-32099&&e<=-32e3}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",t.getMessageFromCode=a,t.isValidCode=c,t.serializeError=function(e,{fallbackError:t=i,shouldIncludeStack:r=!1}={}){var n,s;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof o.EthereumRpcError)return e.serialize();const u={};if(e&&"object"==typeof e&&!Array.isArray(e)&&d(e,"code")&&c(e.code)){const t=e;u.code=t.code,t.message&&"string"==typeof t.message?(u.message=t.message,d(t,"data")&&(u.data=t.data)):(u.message=a(u.code),u.data={originalError:l(e)})}else{u.code=t.code;const r=null===(n=e)||void 0===n?void 0:n.message;u.message=r&&"string"==typeof r?r:t.message,u.data={originalError:l(e)}}const p=null===(s=e)||void 0===s?void 0:s.stack;return r&&e&&p&&"string"==typeof p&&(u.stack=p),u}},"0QlC":function(e,t){function r(e){return null==e?e:Number.parseInt(e,16)}function n(e){return null==e?e:"0x"+e.toString(16)}e.exports=async function({provider:e,fromBlock:t,toBlock:o}){t||(t=o);const s=r(t),i=r(o),a=Array(i-s+1).fill().map((e,t)=>s+t).map(n);return await Promise.all(a.map(t=>function(e,t,r){return new Promise((t,n)=>{e.sendAsync({id:1,jsonrpc:"2.0",method:"eth_getBlockByNumber",params:r},(e,r)=>{if(e)return n(e);t(r.result)})})}(e,0,[t,!1])))}},"1MZ5":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorValues=t.errorCodes=void 0,t.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},t.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}}},"1Ti9":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMiddleware=void 0;const n=r("X+co");t.mergeMiddleware=function(e){const t=new n.JsonRpcEngine;return e.forEach(e=>t.push(e)),t.asMiddleware()}},"1VPL":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const n=r("M6k5");Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return n.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return n.EthereumProviderError}});const o=r("0Q/7");Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return o.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return o.getMessageFromCode}});const s=r("UuhT");Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return s.ethErrors}});const i=r("1MZ5");Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})},"2J3U":function(e,t){e.exports=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}}},"2nhq":function(e,t,r){const n=r("q6/2").Mutex,{createAsyncMiddleware:o}=r("llSS"),s=r("VJGR"),i=r("FqFB"),a=r("rW7p"),c=r("hyCD"),{intToHex:u,hexToInt:l}=r("UJ2e");function d(e){return p(async(...t)=>{const r=await e(...t);return u(r.id)})}function p(e){return o(async(t,r)=>{const n=await e.apply(null,t.params);r.result=n})}function h(e,t){const r=[];for(let n in e)r.push(e[n]);return r}e.exports=function({blockTracker:e,provider:t}){let r=0,o={};const f=new n,m=function({mutex:e}){return t=>async(r,n,o,s)=>{(await e.acquire())(),t(r,n,o,s)}}({mutex:f}),y=s({eth_newFilter:m(d(v)),eth_newBlockFilter:m(d(_)),eth_newPendingTransactionFilter:m(d(w)),eth_uninstallFilter:m(p(R)),eth_getFilterChanges:m(p(b)),eth_getFilterLogs:m(p(k))}),g=async({oldBlock:e,newBlock:t})=>{if(0===o.length)return;const r=await f.acquire();try{await Promise.all(h(o).map(async r=>{try{await r.update({oldBlock:e,newBlock:t})}catch(n){console.error(n)}}))}catch(n){console.error(n)}r()};return y.newLogFilter=v,y.newBlockFilter=_,y.newPendingTransactionFilter=w,y.uninstallFilter=R,y.getFilterChanges=b,y.getFilterLogs=k,y.destroy=()=>{!async function(){const e=h(o).length;o={},B({prevFilterCount:e,newFilterCount:0})}()},y;async function v(e){const r=new i({provider:t,params:e});return await E(r),r}async function _(){const e=new a({provider:t});return await E(e),e}async function w(){const e=new c({provider:t});return await E(e),e}async function b(e){const t=l(e),r=o[t];if(!r)throw new Error(`No filter for index "${t}"`);return r.getChangesAndClear()}async function k(e){const t=l(e),r=o[t];if(!r)throw new Error(`No filter for index "${t}"`);return results="log"===r.type?r.getAllResults():[],results}async function R(e){const t=l(e),r=Boolean(o[t]);return r&&await async function(e){const t=h(o).length;delete o[e],B({prevFilterCount:t,newFilterCount:h(o).length})}(t),r}async function E(t){const n=h(o).length,s=await e.getLatestBlock();return await t.initialize({currentBlock:s}),r++,o[r]=t,t.id=r,t.idHex=u(r),B({prevFilterCount:n,newFilterCount:h(o).length}),r}function B({prevFilterCount:t,newFilterCount:r}){0===t&&r>0?e.on("sync",g):t>0&&0===r&&e.removeListener("sync",g)}}},"4CaD":function(e,t,r){"use strict";const n=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let e=0;e<arguments.length;e++)n[e]=arguments[e];return new r((r,o)=>{n.push(t.errorFirst?function(e,n){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e<arguments.length;e++)t[e-1]=arguments[e];e?(t.unshift(e),o(t)):r(t)}else e?o(e):r(n)}:function(e){if(t.multiArgs){const e=new Array(arguments.length-1);for(let t=0;t<arguments.length;t++)e[t]=arguments[t];r(e)}else r(e)}),e.apply(this,n)})};e.exports=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=e=>{const r=t=>"string"==typeof t?e===t:t.test(e);return t.include?t.include.some(r):!t.exclude.some(r)};let o;o="function"==typeof e?function(){return t.excludeMain?e.apply(this,arguments):n(e,t).apply(this,arguments)}:Object.create(Object.getPrototypeOf(e));for(const s in e){const i=e[s];o[s]="function"==typeof i&&r(s)?n(i,t):i}return o}},"8Pg7":function(e,t,r){const n=r("zvTS");e.exports=class extends n{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}},Fj00:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r("+qE3");function o(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}t.default=class extends n.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const s=n[e];if(void 0===s)return!1;if("function"==typeof s)o(s,this,t);else{const e=s.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}(s);for(let n=0;n<e;n+=1)o(r[n],this,t)}return!0}}},FqFB:function(e,t,r){const n=r("QXrW"),o=r("h9tj"),s=r("8Pg7"),{hexToInt:i,incrementHexInt:a,minBlockRef:c,blockRefIsNumber:u}=r("UJ2e");e.exports=class extends s{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new n(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(e=>e.toLowerCase()))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const r=c(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:r}),o=await this._fetchLogs(n);this.addInitialResults(o)}async update({oldBlock:e,newBlock:t}){const r=t;let n;n=e?a(e):t;const o=Object.assign({},this.params,{fromBlock:n,toBlock:r}),s=(await this._fetchLogs(o)).filter(e=>this.matchLog(e));this.addResults(s)}async _fetchLogs(e){return await o(t=>this.ethQuery.getLogs(e,t))()}matchLog(e){if(i(this.params.fromBlock)>=i(e.blockNumber))return!1;if(u(this.params.toBlock)&&i(this.params.toBlock)<=i(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();return!(this.params.address&&t&&!this.params.address.includes(t))&&this.params.topics.every((t,r)=>{let n=e.topics[r];if(!n)return!1;n=n.toLowerCase();let o=Array.isArray(t)?t:[t];return!!o.includes(null)||(o=o.map(e=>e.toLowerCase()),o.includes(n))})}}},LPKZ:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createAsyncMiddleware=void 0,t.createAsyncMiddleware=function(e){return async(t,r,n,o)=>{let s;const i=new Promise(e=>{s=e});let a=null,c=!1;const u=async()=>{c=!0,n(e=>{a=e,s()}),await i};try{await e(t,r,u),c?(await i,a(null)):o(null)}catch(l){a?a(l):o(l)}}}},M6k5:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EthereumProviderError=t.EthereumRpcError=void 0;const n=r("N1pS");class o extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return n.default(this.serialize(),s,2)}}function s(e,t){if("[Circular]"!==t)return t}t.EthereumRpcError=o,t.EthereumProviderError=class extends o{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}},N1pS:function(e,t){e.exports=o,o.default=o,o.stable=a,o.stableStringify=a;var r=[],n=[];function o(e,t,o){var i;for(s(e,"",[],void 0),i=0===n.length?JSON.stringify(e,t,o):JSON.stringify(e,u(t),o);0!==r.length;){var a=r.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}return i}function s(e,t,o,i){var a;if("object"==typeof e&&null!==e){for(a=0;a<o.length;a++)if(o[a]===e){var c=Object.getOwnPropertyDescriptor(i,t);return void(void 0!==c.get?c.configurable?(Object.defineProperty(i,t,{value:"[Circular]"}),r.push([i,t,e,c])):n.push([e,t]):(i[t]="[Circular]",r.push([i,t,e])))}if(o.push(e),Array.isArray(e))for(a=0;a<e.length;a++)s(e[a],a,o,e);else{var u=Object.keys(e);for(a=0;a<u.length;a++){var l=u[a];s(e[l],l,o,e)}}o.pop()}}function i(e,t){return e<t?-1:e>t?1:0}function a(e,t,o){var s,i=c(e,"",[],void 0)||e;for(s=0===n.length?JSON.stringify(i,t,o):JSON.stringify(i,u(t),o);0!==r.length;){var a=r.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}return s}function c(e,t,o,s){var a;if("object"==typeof e&&null!==e){for(a=0;a<o.length;a++)if(o[a]===e){var u=Object.getOwnPropertyDescriptor(s,t);return void(void 0!==u.get?u.configurable?(Object.defineProperty(s,t,{value:"[Circular]"}),r.push([s,t,e,u])):n.push([e,t]):(s[t]="[Circular]",r.push([s,t,e])))}if("function"==typeof e.toJSON)return;if(o.push(e),Array.isArray(e))for(a=0;a<e.length;a++)c(e[a],a,o,e);else{var l={},d=Object.keys(e).sort(i);for(a=0;a<d.length;a++){var p=d[a];c(e[p],p,o,e),l[p]=e[p]}if(void 0===s)return l;r.push([s,t,e]),s[t]=l}o.pop()}}function u(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var o=0;o<n.length;o++){var s=n[o];if(s[1]===t&&s[0]===r){r="[Circular]",n.splice(o,1);break}}return e.call(this,t,r)}}},QXrW:function(e,t,r){const n=r("U6jy"),o=r("2J3U")();function s(e){this.currentProvider=e}function i(e){return function(){const t=this;var r=[].slice.call(arguments),n=r.pop();t.sendAsync({method:e,params:r},n)}}function a(e,t){return function(){const r=this;var n=[].slice.call(arguments),o=n.pop();n.length<e&&n.push("latest"),r.sendAsync({method:t,params:n},o)}}e.exports=s,s.prototype.getBalance=a(2,"eth_getBalance"),s.prototype.getCode=a(2,"eth_getCode"),s.prototype.getTransactionCount=a(2,"eth_getTransactionCount"),s.prototype.getStorageAt=a(3,"eth_getStorageAt"),s.prototype.call=a(2,"eth_call"),s.prototype.protocolVersion=i("eth_protocolVersion"),s.prototype.syncing=i("eth_syncing"),s.prototype.coinbase=i("eth_coinbase"),s.prototype.mining=i("eth_mining"),s.prototype.hashrate=i("eth_hashrate"),s.prototype.gasPrice=i("eth_gasPrice"),s.prototype.accounts=i("eth_accounts"),s.prototype.blockNumber=i("eth_blockNumber"),s.prototype.getBlockTransactionCountByHash=i("eth_getBlockTransactionCountByHash"),s.prototype.getBlockTransactionCountByNumber=i("eth_getBlockTransactionCountByNumber"),s.prototype.getUncleCountByBlockHash=i("eth_getUncleCountByBlockHash"),s.prototype.getUncleCountByBlockNumber=i("eth_getUncleCountByBlockNumber"),s.prototype.sign=i("eth_sign"),s.prototype.sendTransaction=i("eth_sendTransaction"),s.prototype.sendRawTransaction=i("eth_sendRawTransaction"),s.prototype.estimateGas=i("eth_estimateGas"),s.prototype.getBlockByHash=i("eth_getBlockByHash"),s.prototype.getBlockByNumber=i("eth_getBlockByNumber"),s.prototype.getTransactionByHash=i("eth_getTransactionByHash"),s.prototype.getTransactionByBlockHashAndIndex=i("eth_getTransactionByBlockHashAndIndex"),s.prototype.getTransactionByBlockNumberAndIndex=i("eth_getTransactionByBlockNumberAndIndex"),s.prototype.getTransactionReceipt=i("eth_getTransactionReceipt"),s.prototype.getUncleByBlockHashAndIndex=i("eth_getUncleByBlockHashAndIndex"),s.prototype.getUncleByBlockNumberAndIndex=i("eth_getUncleByBlockNumberAndIndex"),s.prototype.getCompilers=i("eth_getCompilers"),s.prototype.compileLLL=i("eth_compileLLL"),s.prototype.compileSolidity=i("eth_compileSolidity"),s.prototype.compileSerpent=i("eth_compileSerpent"),s.prototype.newFilter=i("eth_newFilter"),s.prototype.newBlockFilter=i("eth_newBlockFilter"),s.prototype.newPendingTransactionFilter=i("eth_newPendingTransactionFilter"),s.prototype.uninstallFilter=i("eth_uninstallFilter"),s.prototype.getFilterChanges=i("eth_getFilterChanges"),s.prototype.getFilterLogs=i("eth_getFilterLogs"),s.prototype.getLogs=i("eth_getLogs"),s.prototype.getWork=i("eth_getWork"),s.prototype.submitWork=i("eth_submitWork"),s.prototype.submitHashrate=i("eth_submitHashrate"),s.prototype.sendAsync=function(e,t){var r;this.currentProvider.sendAsync((r=e,n({id:o(),jsonrpc:"2.0",params:[]},r)),function(e,r){if(!e&&r.error&&(e=new Error("EthQuery - RPC Error - "+r.error.message)),e)return t(e);t(null,r.result)})}},RhWC:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getUniqueId=void 0;const n=4294967295;let o=Math.floor(Math.random()*n);t.getUniqueId=function(){return o=(o+1)%n,o}},UJ2e:function(e,t){function r(e){return e.sort((e,t)=>"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:n(e)-n(t))}function n(e){return null==e?e:Number.parseInt(e,16)}function o(e){if(null==e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function s(){return Math.floor(16*Math.random()).toString(16)}e.exports={minBlockRef:function(...e){return r(e)[0]},maxBlockRef:function(...e){const t=r(e);return t[t.length-1]},sortBlockRefs:r,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:n,incrementHexInt:function(e){return null==e?e:o(n(e)+1)},intToHex:o,unsafeRandomBytes:function(e){let t="0x";for(let r=0;r<e;r++)t+=s(),t+=s();return t}}},UuhT:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ethErrors=void 0;const n=r("M6k5"),o=r("0Q/7"),s=r("1MZ5");function i(e,t){const[r,s]=c(t);return new n.EthereumRpcError(e,r||o.getMessageFromCode(e),s)}function a(e,t){const[r,s]=c(t);return new n.EthereumProviderError(e,r||o.getMessageFromCode(e),s)}function c(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}t.ethErrors={rpc:{parse:e=>i(s.errorCodes.rpc.parse,e),invalidRequest:e=>i(s.errorCodes.rpc.invalidRequest,e),invalidParams:e=>i(s.errorCodes.rpc.invalidParams,e),methodNotFound:e=>i(s.errorCodes.rpc.methodNotFound,e),internal:e=>i(s.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return i(t,e)},invalidInput:e=>i(s.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>i(s.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>i(s.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>i(s.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>i(s.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>i(s.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>a(s.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>a(s.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>a(s.errorCodes.provider.unsupportedMethod,e),disconnected:e=>a(s.errorCodes.provider.disconnected,e),chainDisconnected:e=>a(s.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:o}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new n.EthereumProviderError(t,r,o)}}}},V5x4:function(e,t,r){const n=r("4CaD"),o=r("/u+i");function s(e,t){return new Promise(r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()})}e.exports=class extends o{constructor(e={}){if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");const t=e.pollingInterval||2e4,r=e.retryTimeout||t/10,n=void 0===e.keepEventLoopActive||e.keepEventLoopActive,o=e.setSkipCacheFlag||!1;super(Object.assign({blockResetDuration:t},e)),this._provider=e.provider,this._pollingInterval=t,this._retryTimeout=r,this._keepEventLoopActive=n,this._setSkipCacheFlag=o}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}_start(){this._performSync().catch(e=>this.emit("error",e))}async _performSync(){for(;this._isRunning;)try{await this._updateLatestBlock(),await s(this._pollingInterval,!this._keepEventLoopActive)}catch(e){const r=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${e.stack}`);try{this.emit("error",r)}catch(t){console.error(r)}await s(this._retryTimeout,!this._keepEventLoopActive)}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:1,method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0);const t=await n(t=>this._provider.sendAsync(e,t))();if(t.error)throw new Error(`PollingBlockTracker - encountered error fetching block:\n${t.error}`);return t.result}}},VJGR:function(e,t,r){e.exports=r("X+YH")},"X+YH":function(e,t){e.exports=function(e){return(t,r,n,o)=>{const s=e[t.method];return void 0===s?n():"function"==typeof s?s(t,r,n,o):(r.result=s,o())}}},"X+co":function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.JsonRpcEngine=void 0;const o=n(r("Fj00")),s=r("1VPL");class i extends o.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,r,n)=>{try{const[o,s,a]=await i._runAllMiddleware(e,t,this._middleware);return s?(await i._runReturnHandlers(a),n(o)):r(async e=>{try{await i._runReturnHandlers(a)}catch(t){return e(t)}return e()})}catch(o){return n(o)}}}async _handleBatch(e,t){try{const r=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,r):r}catch(r){if(t)return t(r);throw r}}_promiseHandle(e){return new Promise(t=>{this._handle(e,(e,r)=>{t(r)})})}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const r=new s.EthereumRpcError(s.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(r,{id:void 0,jsonrpc:"2.0",error:r})}if("string"!=typeof e.method){const r=new s.EthereumRpcError(s.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return t(r,{id:e.id,jsonrpc:"2.0",error:r})}const r=Object.assign({},e),n={id:r.id,jsonrpc:r.jsonrpc};let o=null;try{await this._processRequest(r,n)}catch(i){o=i}return o&&(delete n.result,n.error||(n.error=s.serializeError(o))),t(o,n)}async _processRequest(e,t){const[r,n,o]=await i._runAllMiddleware(e,t,this._middleware);if(i._checkForCompletion(e,t,n),await i._runReturnHandlers(o),r)throw r}static async _runAllMiddleware(e,t,r){const n=[];let o=null,s=!1;for(const a of r)if([o,s]=await i._runMiddleware(e,t,a,n),s)break;return[o,s,n.reverse()]}static _runMiddleware(e,t,r,n){return new Promise(o=>{const i=e=>{const r=e||t.error;r&&(t.error=s.serializeError(r)),o([r,!0])},c=r=>{t.error?i(t.error):(r&&("function"!=typeof r&&i(new s.EthereumRpcError(s.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof r}" for request:\n${a(e)}`,{request:e})),n.push(r)),o([null,!1]))};try{r(e,t,c,i)}catch(u){i(u)}})}static async _runReturnHandlers(e){for(const t of e)await new Promise((e,r)=>{t(t=>t?r(t):e())})}static _checkForCompletion(e,t,r){if(!("result"in t)&&!("error"in t))throw new s.EthereumRpcError(s.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:\n${a(e)}`,{request:e});if(!r)throw new s.EthereumRpcError(s.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:\n${a(e)}`,{request:e})}}function a(e){return JSON.stringify(e,null,2)}t.JsonRpcEngine=i},XW5J:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createIdRemapMiddleware=void 0;const n=r("RhWC");t.createIdRemapMiddleware=function(){return(e,t,r,o)=>{const s=e.id,i=n.getUniqueId();e.id=i,t.id=i,r(r=>{e.id=s,t.id=s,r()})}}},h9tj:function(e,t,r){"use strict";const n=(e,t,r,n)=>function(...o){return new(0,t.promiseModule)((s,i)=>{o.push(t.multiArgs?(...e)=>{t.errorFirst?e[0]?i(e):(e.shift(),s(e)):s(e)}:t.errorFirst?(e,t)=>{e?i(e):s(t)}:s),Reflect.apply(e,this===r?n:this,o)})},o=new WeakMap;e.exports=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(null===e||"object"!==r&&"function"!==r)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===e?"null":r}\``);const s=new WeakMap,i=new Proxy(e,{apply(e,r,o){const a=s.get(e);if(a)return Reflect.apply(a,r,o);const c=t.excludeMain?e:n(e,t,i,e);return s.set(e,c),Reflect.apply(c,r,o)},get(e,r){const a=e[r];if(!((e,r)=>{let n=o.get(e);if(n||(n={},o.set(e,n)),r in n)return n[r];const s=e=>"string"==typeof e||"symbol"==typeof r?r===e:e.test(r),i=Reflect.getOwnPropertyDescriptor(e,r),a=void 0===i||i.writable||i.configurable,c=(t.include?t.include.some(s):!t.exclude.some(s))&&a;return n[r]=c,c})(e,r)||a===Function.prototype[r])return a;const c=s.get(a);if(c)return c;if("function"==typeof a){const r=n(a,t,i,e);return s.set(a,r),r}return a}});return i}},hyCD:function(e,t,r){const n=r("zvTS"),o=r("0QlC"),{incrementHexInt:s}=r("UJ2e");e.exports=class extends n{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,r=s(e),n=await o({provider:this.provider,fromBlock:r,toBlock:t}),i=[];for(const o of n)i.push(...o.transactions);this.addResults(i)}}},llSS:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r("XW5J"),t),o(r("LPKZ"),t),o(r("vhlx"),t),o(r("RhWC"),t),o(r("X+co"),t),o(r("1Ti9"),t)},"q6/2":function(e,t,r){"use strict";r.r(t),r.d(t,"Mutex",function(){return s}),r.d(t,"Semaphore",function(){return o}),r.d(t,"withTimeout",function(){return i});var n=r("mrSG"),o=function(){function e(e){if(this._maxConcurrency=e,this._queue=[],e<=0)throw new Error("semaphore must be initialized to a positive value");this._value=e}return e.prototype.acquire=function(){var e=this,t=this.isLocked(),r=new Promise(function(t){return e._queue.push(t)});return t||this._dispatch(),r},e.prototype.runExclusive=function(e){return Object(n.a)(this,void 0,void 0,function(){var t,r,o;return Object(n.b)(this,function(n){switch(n.label){case 0:return[4,this.acquire()];case 1:t=n.sent(),r=t[0],o=t[1],n.label=2;case 2:return n.trys.push([2,,4,5]),[4,e(r)];case 3:return[2,n.sent()];case 4:return o(),[7];case 5:return[2]}})})},e.prototype.isLocked=function(){return this._value<=0},e.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=void 0,e()}},e.prototype._dispatch=function(){var e=this,t=this._queue.shift();if(t){var r=!1;this._currentReleaser=function(){r||(r=!0,e._value++,e._dispatch())},t([this._value--,this._currentReleaser])}},e}(),s=function(){function e(){this._semaphore=new o(1)}return e.prototype.acquire=function(){return Object(n.a)(this,void 0,void 0,function(){return Object(n.b)(this,function(e){switch(e.label){case 0:return[4,this._semaphore.acquire()];case 1:return[2,e.sent()[1]]}})})},e.prototype.runExclusive=function(e){return this._semaphore.runExclusive(function(){return e()})},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();function i(e,t,r){var o=this;return void 0===r&&(r=new Error("timeout")),{acquire:function(){return new Promise(function(s,i){return Object(n.a)(o,void 0,void 0,function(){var o,a;return Object(n.b)(this,function(n){switch(n.label){case 0:return o=!1,setTimeout(function(){o=!0,i(r)},t),[4,e.acquire()];case 1:return a=n.sent(),o?(Array.isArray(a)?a[1]:a)():s(a),[2]}})})})},runExclusive:function(e){return Object(n.a)(this,void 0,void 0,function(){var t,r;return Object(n.b)(this,function(n){switch(n.label){case 0:t=function(){},n.label=1;case 1:return n.trys.push([1,,7,8]),[4,this.acquire()];case 2:return r=n.sent(),Array.isArray(r)?(t=r[1],[4,e(r[0])]):[3,4];case 3:return[2,n.sent()];case 4:return t=r,[4,e()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:return t(),[7];case 8:return[2]}})})},release:function(){e.release()},isLocked:function(){return e.isLocked()}}}},rW7p:function(e,t,r){const n=r("zvTS"),o=r("0QlC"),{incrementHexInt:s}=r("UJ2e");e.exports=class extends n{constructor({provider:e}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const r=t,n=s(e),i=(await o({provider:this.provider,fromBlock:n,toBlock:r})).map(e=>e.hash);this.addResults(i)}}},t7TP:function(e,t,r){const n=r("Fj00").default,o=r("VJGR"),{createAsyncMiddleware:s}=r("llSS"),i=r("2nhq"),{unsafeRandomBytes:a,incrementHexInt:c}=r("UJ2e"),u=r("0QlC");function l(e){return{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}e.exports=function({blockTracker:e,provider:t}){const r={},d=i({blockTracker:e,provider:t});let p=!1;const h=new n,f=o({eth_subscribe:s(async function(n,o){if(p)throw new Error("SubscriptionManager - attempting to use after destroying");const s=n.params[0],i=a(16);let h;switch(s){case"newHeads":h=function({subId:r}){const n={type:s,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const o=n,s=c(e);(await u({provider:t,fromBlock:s,toBlock:o})).map(l).forEach(e=>{m(r,e)})}};return e.on("sync",n.update),n}({subId:i});break;case"logs":const r=n.params[1];h=function({subId:e,filter:t}){return t.on("update",t=>m(e,t)),{type:s,destroy:async()=>await d.uninstallFilter(t.idHex)}}({subId:i,filter:await d.newLogFilter(r)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${s}"`)}return r[i]=h,void(o.result=i)}),eth_unsubscribe:s(async function(e,t){if(p)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],o=r[n];o?(delete r[n],await o.destroy(),t.result=!0):t.result=!1})});return f.destroy=function(){h.removeAllListeners();for(const e in r)r[e].destroy(),delete r[e];p=!0},{events:h,middleware:f};function m(e,t){h.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}}},vhlx:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createScaffoldMiddleware=void 0,t.createScaffoldMiddleware=function(e){return(t,r,n,o)=>{const s=e[t.method];return void 0===s?n():"function"==typeof s?s(t,r,n,o):(r.result=s,o())}}},y2lW:function(e,t,r){const n=r("MCLT"),o=r("+qE3");var s="object"==typeof Reflect?Reflect:null,i=s&&"function"==typeof s.apply?s.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function a(){o.call(this)}function c(e,t,r){try{i(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function u(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}e.exports=a,n.inherits(a,o),a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var a=o[e];if(void 0===a)return!1;if("function"==typeof a)c(a,this,t);else{var l=a.length,d=u(a,l);for(r=0;r<l;++r)c(d[r],this,t)}return!0}},zvTS:function(e,t,r){const n=r("Fj00").default;e.exports=class extends n{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach(e=>this.emit("update",e))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}}}}]);