Skip to content

Instantly share code, notes, and snippets.

@michaelsbradleyjr
Created April 24, 2020 20:18
Show Gist options
  • Save michaelsbradleyjr/2035e530a94a92f860bf62f61e197a08 to your computer and use it in GitHub Desktop.
Save michaelsbradleyjr/2035e530a94a92f860bf62f61e197a08 to your computer and use it in GitHub Desktop.
$ lerna run --concurrency=1 --scope embark-dapp-* --stream test
lerna notice cli v3.20.2
lerna notice filter including "embark-dapp-*"
lerna info filter [ 'embark-dapp-*' ]
lerna info Executing command in 6 packages: "npm run test"
embark-dapp-template-boilerplate: > [email protected] test /Users/michael/repos/embark/dapps/templates/boilerplate
embark-dapp-template-boilerplate: > npx embark test
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
embark-dapp-template-boilerplate: (Use `node --trace-warnings ...` to show where the warning was created)
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
embark-dapp-template-boilerplate: (node:54646) Warning: Accessing non-existent property 'print' of module exports inside circular dependency
embark-dapp-template-boilerplate: /Users/michael/repos/embark/node_modules/ganache-cli/build/ganache-core.node.cli.js:17
embark-dapp-template-boilerplate: */!function(){var r,a={};function i(){}function o(e){return e}function c(e){return!!e}function s(e){return!e}var f="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this;function d(e){return function(){if(null===e)throw new Error("Callback was already called.");e.apply(this,arguments),e=null}}function u(e){return function(){null!==e&&(e.apply(this,arguments),e=null)}}null!=f&&(r=f.async),a.noConflict=function(){return f.async=r,a};var l=Object.prototype.toString,b=Array.isArray||function(e){return"[object Array]"===l.call(e)};function p(e){return b(e)||"number"==typeof e.length&&e.length>=0&&e.length%1==0}function h(e,t){for(var r=-1,n=e.length;++r<n;)t(e[r],r,e)}function m(e,t){for(var r=-1,n=e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}function x(e){return m(Array(e),(function(e,t){return t}))}function v(e,t,r){return h(e,(function(e,n,a){r=t(r,e,n,a)})),r}function g(e,t){h(A(e),(function(r){t(e[r],r)}))}function y(e,t){for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1}var A=Object.keys||function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(r);return t};function w(e){var t,r,n=-1;return p(e)?(t=e.length,function(){return++n<t?n:null}):(r=A(e),t=r.length,function(){return++n<t?r[n]:null})}function _(e,t){return t=null==t?e.length-1:+t,function(){for(var r=Math.max(arguments.length-t,0),n=Array(r),a=0;a<r;a++)n[a]=arguments[a+t];switch(t){case 0:return e.call(this,n);case 1:return e.call(this,arguments[0],n)}}}function k(e){return function(t,r,n){return e(t,n)}}var E="function"==typeof setImmediate&&setImmediate,S=E?function(e){E(e)}:function(e){setTimeout(e,0)};function T(e){return function(t,r,n){n=u(n||i);var a=w(t=t||[]);if(e<=0)return n(null);var o=!1,c=0,s=!1;!function i(){if(o&&c<=0)return n(null);for(;c<e&&!s;){var f=a();if(null===f)return o=!0,void(c<=0&&n(null));c+=1,r(t[f],f,d((function(e){c-=1,e?(n(e),s=!0):i()})))}}()}}function O(e){return function(t,r,n){return e(a.eachOf,t,r,n)}}function R(e){return function(t,r,n,a){return e(T(r),t,n,a)}}function C(e){return function(t,r,n){return e(a.eachOfSeries,t,r,n)}}function B(e,t,r,n){n=u(n||i);var a=p(t=t||[])?[]:{};e(t,(function(e,t,n){r(e,(function(e,r){a[t]=r,n(e)}))}),(function(e){n(e,a)}))}function I(e,t,r,n){var a=[];e(t,(function(e,t,n){r(e,(function(r){r&&a.push({index:t,value:e}),n()}))}),(function(){n(m(a.sort((function(e,t){return e.index-t.index})),(function(e){return e.value})))}))}function N(e,t,r,n){I(e,t,(function(e,t){r(e,(function(e){t(!e)}))}),n)}function P(e,t,r){return function(n,a,i,o){function c(){o&&o(r(!1,void 0))}function s(e,n,a){if(!o)return a();i(e,(function(n){o&&t(n)&&(o(r(!0,e)),o=i=!1),a()}))}arguments.length>3?e(n,a,s,c):(o=i,i=a,e(n,s,c))}}function L(e,t){return t}function M(e,t,r){r=r||i;var n=p(t)?[]:{};e(t,(function(e,t,r){e(_((function(e,a){a.length<=1&&(a=a[0]),n[t]=a,r(e)})))}),(function(e){r(e,n)}))}function j(e,t,r,n){var a=[];e(t,(function(e,t,n){r(e,(function(e,t){a=a.concat(t||[]),n(e)}))}),(function(e){n(e,a)}))}function F(e,t,r){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");function n(e,t,r,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(e.started=!0,b(t)||(t=[t]),0===t.length&&e.idle())return a.setImmediate((function(){e.drain()}));h(t,(function(t){var a={data:t,callback:n||i};r?e.tasks.unshift(a):e.tasks.push(a),e.tasks.length===e.concurrency&&e.saturated()})),a.setImmediate(e.process)}function o(e,t){return function(){c-=1;var r=!1,n=arguments;h(t,(function(e){h(s,(function(t,n){t!==e||r||(s.splice(n,1),r=!0)})),e.callback.apply(e,n)})),e.tasks.length+c===0&&e.drain(),e.process()}}var c=0,s=[],f={tasks:[],concurrency:t,payload:r,saturated:i,empty:i,drain:i,started:!1,paused:!1,push:function(e,t){n(f,e,!1,t)},kill:function(){f.drain=i,f.tasks=[]},unshift:function(e,t){n(f,e,!0,t)},process:function(){for(;!f.paused&&c<f.concurrency&&f.tasks.length;){var t=f.payload?f.tasks.splice(0,f.payload):f.tasks.splice(0,f.tasks.length),r=m(t,(function(e){return e.data}));0===f.tasks.length&&f.empty(),c+=1,s.push(t[0]);var n=d(o(f,t));e(r,n)}},length:function(){return f.tasks.length},running:function(){return c},workersList:function(){return s},idle:function(){return f.tasks.length+c===0},pause:function(){f.paused=!0},resume:function(){if(!1!==f.paused){f.paused=!1;for(var e=Math.min(f.concurrency,f.tasks.length),t=1;t<=e;t++)a.setImmediate(f.process)}}};return f}function D(e){return _((function(t,r){t.apply(null,r.concat([_((function(t,r){"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&h(r,(function(t){console[e](t)})))}))]))}))}function U(e){return function(t,r,n){e(x(t),r,n)}}function z(e){return _((function(t,r){var n=_((function(r){var n=this,a=r.pop();return e(t,(function(e,t,a){e.apply(n,r.concat([a]))}),a)}));return r.length?n.apply(this,r):n}))}function H(e){return _((function(t){var r=t.pop();t.push((function(){var e=arguments;n?a.setImmediate((function(){r.apply(null,e)})):r.apply(null,e)}));var n=!0;e.apply(this,t),n=!1}))}"object"==typeof process&&"function"==typeof process.nextTick?a.nextTick=process.nextTick:a.nextTick=S,a.setImmediate=E?S:a.nextTick,a.forEach=a.each=function(e,t,r){return a.eachOf(e,k(t),r)},a.forEachSeries=a.eachSeries=function(e,t,r){return a.eachOfSeries(e,k(t),r)},a.forEachLimit=a.eachLimit=function(e,t,r,n){return T(t)(e,k(r),n)},a.forEachOf=a.eachOf=function(e,t,r){r=u(r||i);for(var n,a=w(e=e||[]),o=0;null!=(n=a());)o+=1,t(e[n],n,d(c));function c(e){o--,e?r(e):null===n&&o<=0&&r(null)}0===o&&r(null)},a.forEachOfSeries=a.eachOfSeries=function(e,t,r){r=u(r||i);var n=w(e=e||[]),o=n();!function i(){var c=!0;if(null===o)return r(null);t(e[o],o,d((function(e){if(e)r(e);else{if(null===(o=n()))return r(null);c?a.setImmediate(i):i()}}))),c=!1}()},a.forEachOfLimit=a.eachOfLimit=function(e,t,r,n){T(t)(e,r,n)},a.map=O(B),a.mapSeries=C(B),a.mapLimit=R(B),a.inject=a.foldl=a.reduce=function(e,t,r,n){a.eachOfSeries(e,(function(e,n,a){r(t,e,(function(e,r){t=r,a(e)}))}),(function(e){n(e,t)}))},a.foldr=a.reduceRight=function(e,t,r,n){var i=m(e,o).reverse();a.reduce(i,t,r,n)},a.transform=function(e,t,r,n){3===arguments.length&&(n=r,r=t,t=b(e)?[]:{}),a.eachOf(e,(function(e,n,a){r(t,e,n,a)}),(function(e){n(e,t)}))},a.select=a.filter=O(I),a.selectLimit=a.filterLimit=R(I),a.selectSeries=a.filterSeries=C(I),a.reject=O(N),a.rejectLimit=R(N),a.rejectSeries=C(N),a.any=a.some=P(a.eachOf,c,o),a.someLimit=P(a.eachOfLimit,c,o),a.all=a.every=P(a.eachOf,s,s),a.everyLimit=P(a.eachOfLimit,s,s),a.detect=P(a.eachOf,o,L),a.detectSeries=P(a.eachOfSeries,o,L),a.detectLimit=P(a.eachOfLimit,o,L),a.sortBy=function(e,t,r){function n(e,t){var r=e.criteria,n=t.criteria;return r<n?-1:r>n?1:0}a.map(e,(function(e,r){t(e,(function(t,n){t?r(t):r(null,{value:e,criteria:n})}))}),(function(e,t){if(e)return r(e);r(null,m(t.sort(n),(function(e){return e.value})))}))},a.auto=function(e,t,r){"function"==typeof arguments[1]&&(r=t,t=null),r=u(r||i);var n=A(e),o=n.length;if(!o)return r(null);t||(t=o);var c={},s=0,f=!1,d=[];function l(e){d.unshift(e)}function p(e){var t=y(d,e);t>=0&&d.splice(t,1)}function m(){o--,h(d.slice(0),(function(e){e()}))}l((function(){o||r(null,c)})),h(n,(function(n){if(!f){for(var i,o=b(e[n])?e[n]:[e[n]],d=_((function(e,t){if(s--,t.length<=1&&(t=t[0]),e){var i={};g(c,(function(e,t){i[t]=e})),i[n]=t,f=!0,r(e,i)}else c[n]=t,a.setImmediate(m)})),u=o.slice(0,o.length-1),h=u.length;h--;){if(!(i=e[u[h]]))throw new Error("Has nonexistent dependency in "+u.join(", "));if(b(i)&&y(i,n)>=0)throw new Error("Has cyclic dependencies")}x()?(s++,o[o.length-1](d,c)):l((function e(){x()&&(s++,p(e),o[o.length-1](d,c))}))}function x(){return s<t&&v(u,(function(e,t){return e&&c.hasOwnProperty(t)}),!0)&&!c.hasOwnProperty(n)}}))},a.retry=function(e,t,r){var n=5,i=0,o=[],c={times:n,interval:i};function s(e,t){if("number"==typeof t)e.times=parseInt(t,10)||n;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);e.times=parseInt(t.times,10)||n,e.interval=parseInt(t.interval,10)||i}}var f=arguments.length;if(f<1||f>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");function d(e,t){function r(e,r){return function(n){e((function(e,t){n(!e||r,{err:e,result:t})}),t)}}function n(e){return function(t){setTimeout((function(){t(null)}),e)}}for(;c.times;){var i=!(c.times-=1);o.push(r(c.task,i)),!i&&c.interval>0&&o.push(n(c.interval))}a.series(o,(function(t,r){r=r[r.length-1],(e||c.callback)(r.err,r.result)}))}return f<=2&&"function"==typeof e&&(r=t,t=e),"function"!=typeof e&&s(c,e),c.callback=r,c.task=t,c.callback?d():d},a.waterfall=function(e,t){if(t=u(t||i),!b(e)){var r=new Error("First argument to waterfall must be an array of functions");return t(r)}if(!e.length)return t();!function e(r){return _((function(n,a){if(n)t.apply(null,[n].concat(a));else{var i=r.next();i?a.push(e(i)):a.push(t),H(r).apply(null,a)}}))}(a.iterator(e))()},a.parallel=function(e,t){M(a.eachOf,e,t)},a.parallelLimit=function(e,t,r){M(T(t),e,r)},a.series=function(e,t){M(a.eachOfSeries,e,t)},a.iterator=function(e){return function t(r){function n(){return e.length&&e[r].apply(null,arguments),n.next()}return n.next=function(){return r<e.length-1?t(r+1):null},n}(0)},a.apply=_((function(e,t){return _((function(r){return e.apply(null,t.concat(r))}))})),a.concat=O(j),a.concatSeries=C(j),a.whilst=function(e,t,r){if(r=r||i,e()){var n=_((function(a,i){a?r(a):e.apply(this,i)?t(n):r.apply(null,[null].concat(i))}));t(n)}else r(null)},a.doWhilst=function(e,t,r){var n=0;return a.whilst((function(){return++n<=1||t.apply(this,arguments)}),e,r)},a.until=function(e,t,r){return a.whilst((function(){return!e.apply(this,arguments)}),t,r)},a.doUntil=function(e,t,r){return a.doWhilst(e,(function(){return!t.apply(this,arguments)}),r)},a.during=function(e,t,r){r=r||i;var n=_((function(t,n){t?r(t):(n.push(a),e.apply(this,n))})),a=function(e,a){e?r(e):a?t(n):r(null)};e(a)},a.doDuring=function(e,t,r){var n=0;a.during((function(e){n++<1?e(null,!0):t.apply(this,arguments)}),e,r)},a.queue=function(e,t){return F((function(t,r){e(t[0],r)}),t,1)},a.priorityQueue=function(e,t){function r(e,t){return e.priority-t.priority}var n=a.queue(e,t);return n.push=function(e,t,o){!function(e,t,n,o){if(null!=o&&"function"!=typeof o)throw new Error("task callback must be a function");if(e.started=!0,b(t)||(t=[t]),0===t.length)return a.setImmediate((function(){e.drain()}));h(t,(function(t){var c={data:t,priority:n,callback:"function"==typeof o?o:i};e.tasks.splice(function(e,t,r){for(var n=-1,a=e.length-1;n<a;){var i=n+(a-n+1>>>1);r(t,e[i])>=0?n=i:a=i-1}return n}(e.tasks,c,r)+1,0,c),e.tasks.length===e.concurrency&&e.saturated(),a.setImmediate(e.process)}))}(n,e,t,o)},delete n.unshift,n},a.cargo=function(e,t){return F(e,1,t)},a.log=D("log"),a.dir=D("dir"),a.memoize=function(e,t){var r={},n={},i=Object.prototype.hasOwnProperty;t=t||o;var c=_((function(o){var c=o.pop(),s=t.apply(null,o);i.call(r,s)?a.setImmediate((function(){c.apply(null,r[s])})):i.call(n,s)?n[s].push(c):(n[s]=[c],e.apply(null,o.concat([_((function(e){r[s]=e;var t=n[s];delete n[s];for(var a=0,i=t.length;a<i;a++)t[a].apply(null,e)}))])))}));return c.memo=r,c.unmemoized=e,c},a.unmemoize=function(e){return function(){return(e.unmemoized||e).apply(null,arguments)}},a.times=U(a.map),a.timesSeries=U(a.mapSeries),a.timesLimit=function(e,t,r,n){return a.mapLimit(x(e),t,r,n)},a.seq=function(){var e=arguments;return _((function(t){var r=this,n=t[t.length-1];"function"==typeof n?t.pop():n=i,a.reduce(e,t,(function(e,t,n){t.apply(r,e.concat([_((function(e,t){n(e,t)}))]))}),(function(e,t){n.apply(r,[e].concat(t))}))}))},a.compose=function(){return a.seq.apply(null,Array.prototype.reverse.call(arguments))},a.applyEach=z(a.eachOf),a.applyEachSeries=z(a.eachOfSeries),a.forever=function(e,t){var r=d(t||i),n=H(e);!function e(t){if(t)return r(t);n(e)}()},a.ensureAsync=H,a.constant=_((function(e){var t=[null].concat(e);return function(e){return e.apply(this,t)}})),a.wrapSync=a.asyncify=function(e){return _((function(t){var r,n,a,i=t.pop();try{r=e.apply(this,t)}catch(e){return i(e)}("function"===(a=typeof(n=r))||"object"===a&&n)&&"function"==typeof r.then?r.then((function(e){i(null,e)})).catch((function(e){i(e.message?e:new Error(e))})):i(null,r)}))},e.exports?e.exports=a:void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},function(e,t,r){const n=r(19),a=r(86);function i(e,t,r){if(Array.isArray(e))this.parseNode(e);else if(this.type=e,"branch"===e){var n=t;this.raw=Array.apply(null,Array(17)),n&&n.forEach((function(e){this.set.apply(this,e)}))}else this.raw=Array(2),this.setValue(r),this.setKey(t)}function o(e,t){return e.length%2?e.unshift(1):(e.unshift(0),e.unshift(0)),t&&(e[0]+=2),e}function c(e){return e=e[0]%2?e.slice(1):e.slice(2)}function s(e){return e[0]>1}function f(e){for(var t=new Buffer(e),r=[],n=0;n<t.length;n++){var a=2*n;r[a]=t[n]>>4,r[++a]=t[n]%16}return r}function d(e){for(var t=new Buffer(e.length/2),r=0;r<t.length;r++){var n=2*r;t[r]=(e[n]<<4)+e[++n]}return t}function u(e){return 17===e.length?"branch":2===e.length?s(f(e[0]))?"leaf":"extention":void 0}e.exports=i,i.isRawNode=function(e){return Array.isArray(e)&&!Buffer.isBuffer(e)},i.addHexPrefix=o,i.removeHexPrefix=c,i.isTerminator=s,i.stringToNibbles=f,i.nibblesToBuffer=d,i.getNodeType=u,Object.defineProperty(i.prototype,"value",{get:function(){return this.getValue()},set:function(e){this.setValue(e)}}),Object.defineProperty(i.prototype,"key",{get:function(){return this.getKey()},set:function(e){this.setKey(e)}}),i.prototype.parseNode=function(e){this.raw=e,this.type=u(e)},i.prototype.setValue=function(e,t){"branch"!==this.type?this.raw[1]=e:(1===arguments.length&&(t=e,e=16),this.raw[e]=t)},i.prototype.getValue=function(e){if("branch"!==this.type)return this.raw[1];0===arguments.length&&(e=16);var t=this.raw[e];return null!=t&&0!==t.length?t:void 0},i.prototype.setKey=function(e){"branch"!==this.type&&(e=o(e=Buffer.isBuffer(e)?f(e):e.slice(0),"leaf"===this.type),this.raw[0]=d(e))},i.prototype.getKey=function(){if("branch"!==this.type){var e=this.raw[0];return e=c(f(e))}},i.prototype.serialize=function(){return n.encode(this.raw)},i.prototype.hash=function(){return a.sha3(this.serialize())},i.prototype.toString=function(){var e=this.type;return e+=": [",this.raw.forEach((function(t){Buffer.isBuffer(t)?e+=t.toString("hex")+", ":e+=t?"object, ":"empty, "})),e=e.slice(0,-2),e+="]"},i.prototype.getChildren=function(){var e=[];switch(this.type){case"leaf":break;case"extention":e.push([this.key,this.getValue()]);break;case"branch":for(var t=0;t<16;t++){var r=this.getValue(t);r&&e.push([[t],r])}}return e}},function(e,t,r){e.exports=c;var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},a=r(18);a.inherits=r(4);var i=r(233),o=r(234);function c(e){if(!(this instanceof c))return new c(e);i.call(this,e),o.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",s)}function s(){this.allowHalfOpen||this._writableState.ended||process.nextTick(this.end.bind(this))}a.inherits(c,i),function(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}(n(o.prototype),(function(e){c.prototype[e]||(c.prototype[e]=o.prototype[e])}))},function(e,t,r){var n=r(20);function a(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}a.prototype.toJSON=function(){return{logIndex:n.rpcQuantityHexString(this.logIndex),transactionIndex:n.rpcQuantityHexString(this.transactionIndex),transactionHash:n.rpcDataHexString(this.transactionHash),blockHash:n.rpcDataHexString(this.block.hash()),blockNumber:n.rpcQuantityHexString(this.block.header.number),address:n.rpcDataHexString(this.address),data:n.rpcDataHexString(this.data),topics:this.topics,type:"mined"}},e.exports=a},function(e,t,r){var n=r(20);function a(e,t,r,n,a,i,o,c){this.tx=e,this.block=t,this.logs=r,this.gasUsed=n,this.cumulativeGasUsed=a,this.contractAddress=i,this.status=o,this.logsBloom=c,this.transactionIndex=0,this.txHash=e.hash();for(var s=0;s<t.transactions.length;s++){if(t.transactions[s].hash().equals(this.txHash)){this.transactionIndex=s;break}}}a.prototype.toJSON=function(){return{transactionHash:n.rpcDataHexString(this.txHash),transactionIndex:n.rpcQuantityHexString(this.transactionIndex),blockHash:n.rpcDataHexString(this.block.hash()),blockNumber:n.rpcQuantityHexString(this.block.header.number),from:n.rpcDataHexString(this.tx.from),to:n.nullableRpcDataHexString(this.tx.to),gasUsed:n.rpcQuantityHexString(this.gasUsed),cumulativeGasUsed:n.rpcQuantityHexString(this.cumulativeGasUsed),contractAddress:null!=this.contractAddress?n.rpcDataHexString(this.contractAddress):null,logs:this.logs.map((function(e){return e.toJSON()})),status:n.rpcQuantityHexString(this.status),logsBloom:n.rpcDataHexString(this.logsBloom),v:n.rpcQuantityHexString(this.tx.v),r:n.rpcQuantityHexString(this.tx.r),s:n.rpcQuantityHexString(this.tx.s)}},e.exports=a},function(e,t,r){t.AbstractLevelDOWN=r(566),t.AbstractIterator=r(244),t.AbstractChainedBatch=r(245)},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports={}},function(e,t){var r=0,n=Math.random();e.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++r+n).toString(36)}},function(e,t,r){var n=r(134),a=r(592);(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.4.7",mode:n?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports=!0},function(e,t,r){var n=r(136),a=Math.min;e.exports=function(e){return e>0?a(n(e),9007199254740991):0}},function(e,t){var r=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:r)(e)}},function(e,t,r){var n={};n[r(33)("toStringTag")]="z",e.exports="[object z]"===String(n)},function(e,t,r){var n=r(137),a=r(48).f,i=r(36),o=r(35),c=r(597),s=r(33)("toStringTag");e.exports=function(e,t,r,f){if(e){var d=r?e:e.prototype;o(d,s)||a(d,s,{configurable:!0,value:t}),f&&!n&&i(d,"toString",c)}}},function(e,t,r){var n=r(133),a=r(132),i=n("keys");e.exports=function(e){return i[e]||(i[e]=a(e))}},function(e,t,r){"use strict";var n=r(252),a=r(611),i=r(268),o=r(613),c=r(138),s=r(36),f=r(266),d=r(33),u=r(134),l=r(62),b=r(267),p=b.IteratorPrototype,h=b.BUGGY_SAFARI_ITERATORS,m=d("iterator"),x=function(){return this};e.exports=function(e,t,r,d,b,v,g){a(r,t,d);var y,A,w,_=function(e){if(e===b&&O)return O;if(!h&&e in S)return S[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},k=t+" Iterator",E=!1,S=e.prototype,T=S[m]||S["@@iterator"]||b&&S[b],O=!h&&T||_(b),R="Array"==t&&S.entries||T;if(R&&(y=i(R.call(new e)),p!==Object.prototype&&y.next&&(u||i(y)===p||(o?o(y,p):"function"!=typeof y[m]&&s(y,m,x)),c(y,k,!0,!0),u&&(l[k]=x))),"values"==b&&T&&"values"!==T.name&&(E=!0,O=function(){return T.call(this)}),u&&!g||S[m]===O||s(S,m,O),l[t]=O,b)if(A={values:_("values"),keys:v?O:_("keys"),entries:_("entries")},g)for(w in A)!h&&!E&&w in S||f(S,w,A[w]);else n({target:t,proto:!0,forced:h||E},A);return A}},function(e,t,r){"use strict";var n=r(633),a="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,o=Array.prototype.concat,c=Object.defineProperty,s=c&&function(){var e={};try{for(var t in c(e,"x",{enumerable:!1,value:e}),e)return!1;return e.x===e}catch(e){return!1}}(),f=function(e,t,r,n){var a;t in e&&("function"!=typeof(a=n)||"[object Function]"!==i.call(a)||!n())||(s?c(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},d=function(e,t){var r=arguments.length>2?arguments[2]:{},i=n(t);a&&(i=o.call(i,Object.getOwnPropertySymbols(t)));for(var c=0;c<i.length;c+=1)f(e,i[c],t[i[c]],r[i[c]])};d.supportsDescriptors=!!s,e.exports=d},function(e,t,r){"use strict";var n=r(639);e.exports=Function.prototype.bind||n},function(e,t,r){"use strict";var n=Function.prototype.toString,a=/^\s*class\b/,i=function(e){try{var t=n.call(e);return a.test(t)}catch(e){return!1}},o=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if("function"==typeof e&&!e.prototype)return!0;if(c)return function(e){try{return!i(e)&&(n.call(e),!0)}catch(e){return!1}}(e);if(i(e))return!1;var t=o.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},function(e,t,r){"use strict";var n=Object.getOwnPropertyDescriptor?function(){return Object.getOwnPropertyDescriptor(arguments,"callee").get}():function(){throw new TypeError},a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator,i=Object.getPrototypeOf||function(e){return e.__proto__},o=void 0,c="undefined"==typeof Uint8Array?void 0:i(Uint8Array),s={"$ %Array%":Array,"$ %ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"$ %ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer.prototype,"$ %ArrayIteratorPrototype%":a?i([][Symbol.iterator]()):void 0,"$ %ArrayPrototype%":Array.prototype,"$ %ArrayProto_entries%":Array.prototype.entries,"$ %ArrayProto_forEach%":Array.prototype.forEach,"$ %ArrayProto_keys%":Array.prototype.keys,"$ %ArrayProto_values%":Array.prototype.values,"$ %AsyncFromSyncIteratorPrototype%":void 0,"$ %AsyncFunction%":void 0,"$ %AsyncFunctionPrototype%":void 0,"$ %AsyncGenerator%":void 0,"$ %AsyncGeneratorFunction%":void 0,"$ %AsyncGeneratorPrototype%":void 0,"$ %AsyncIteratorPrototype%":o&&a&&Symbol.asyncIterator?o[Symbol.asyncIterator]():void 0,"$ %Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"$ %Boolean%":Boolean,"$ %BooleanPrototype%":Boolean.prototype,"$ %DataView%":"undefined"==typeof DataView?void 0:DataView,"$ %DataViewPrototype%":"undefined"==typeof DataView?void 0:DataView.prototype,"$ %Date%":Date,"$ %DatePrototype%":Date.prototype,"$ %decodeURI%":decodeURI,"$ %decodeURIComponent%":decodeURIComponent,"$ %encodeURI%":encodeURI,"$ %encodeURIComponent%":encodeURIComponent,"$ %Error%":Error,"$ %ErrorPrototype%":Error.prototype,"$ %eval%":eval,"$ %EvalError%":EvalError,"$ %EvalErrorPrototype%":EvalError.prototype,"$ %Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"$ %Float32ArrayPrototype%":"undefined"==typeof Float32Array?void 0:Float32Array.prototype,"$ %Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"$ %Float64ArrayPrototype%":"undefined"==typeof Float64Array?void 0:Float64Array.prototype,"$ %Function%":Function,"$ %FunctionPrototype%":Function.prototype,"$ %Generator%":void 0,"$ %GeneratorFunction%":void 0,"$ %GeneratorPrototype%":void 0,"$ %Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"$ %Int8ArrayPrototype%":"undefined"==typeof Int8Array?void 0:Int8Array.prototype,"$ %Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"$ %Int16ArrayPrototype%":"undefined"==typeof Int16Array?void 0:Int8Array.prototype,"$ %Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"$ %Int32ArrayPrototype%":"undefined"==typeof Int32Array?void 0:Int32Array.prototype,"$ %isFinite%":isFinite,"$ %isNaN%":isNaN,"$ %IteratorPrototype%":a?i(i([][Symbol.iterator]())):void 0,"$ %JSON%":JSON,"$ %JSONParse%":JSON.parse,"$ %Map%":"undefined"==typeof Map?void 0:Map,"$ %MapIteratorPrototype%":"undefined"!=typeof Map&&a?i((new Map)[Symbol.iterator]()):void 0,"$ %MapPrototype%":"undefined"==typeof Map?void 0:Map.prototype,"$ %Math%":Math,"$ %Number%":Number,"$ %NumberPrototype%":Number.prototype,"$ %Object%":Object,"$ %ObjectPrototype%":Object.prototype,"$ %ObjProto_toString%":Object.prototype.toString,"$ %ObjProto_valueOf%":Object.prototype.valueOf,"$ %parseFloat%":parseFloat,"$ %parseInt%":parseInt,"$ %Promise%":"undefined"==typeof Promise?void 0:Promise,"$ %PromisePrototype%":"undefined"==typeof Promise?void 0:Promise.prototype,"$ %PromiseProto_then%":"undefined"==typeof Promise?void 0:Promise.prototype.then,"$ %Promise_all%":"undefined"==typeof Promise?void 0:Promise.all,"$ %Promise_reject%":"undefined"==typeof Promise?void 0:Promise.reject,"$ %Promise_resolve%":"undefined"==typeof Promise?void 0:Promise.resolve,"$ %Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"$ %RangeError%":RangeError,"$ %RangeErrorPrototype%":RangeError.prototype,"$ %ReferenceError%":ReferenceError,"$ %ReferenceErrorPrototype%":ReferenceError.prototype,"$ %Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"$ %RegExp%":RegExp,"$ %RegExpPrototype%":RegExp.prototype,"$ %Set%":"undefined"==typeof Set?void 0:Set,"$ %SetIteratorPrototype%":"undefined"!=typeof Set&&a?i((new Set)[Symbol.iterator]()):void 0,"$ %SetPrototype%":"undefined"==typeof Set?void 0:Set.prototype,"$ %SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"$ %SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer.prototype,"$ %String%":String,"$ %StringIteratorPrototype%":a?i(""[Symbol.iterator]()):void 0,"$ %StringPrototype%":String.prototype,"$ %Symbol%":a?Symbol:void 0,"$ %SymbolPrototype%":a?Symbol.prototype:void 0,"$ %SyntaxError%":SyntaxError,"$ %SyntaxErrorPrototype%":SyntaxError.prototype,"$ %ThrowTypeError%":n,"$ %TypedArray%":c,"$ %TypedArrayPrototype%":c?c.prototype:void 0,"$ %TypeError%":TypeError,"$ %TypeErrorPrototype%":TypeError.prototype,"$ %Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"$ %Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?void 0:Uint8Array.prototype,"$ %Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"$ %Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray.prototype,"$ %Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"$ %Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?void 0:Uint16Array.prototype,"$ %Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"$ %Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?void 0:Uint32Array.prototype,"$ %URIError%":URIError,"$ %URIErrorPrototype%":URIError.prototype,"$ %WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"$ %WeakMapPrototype%":"undefined"==typeof WeakMap?void 0:WeakMap.prototype,"$ %WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet,"$ %WeakSetPrototype%":"undefined"==typeof WeakSet?void 0:WeakSet.prototype};e.exports=function(e,t){if(arguments.length>1&&"boolean"!=typeof t)throw new TypeError('"allowMissing" argument must be a boolean');var r="$ "+e;if(!(r in s))throw new SyntaxError("intrinsic "+e+" does not exist!");if(void 0===s[r]&&!t)throw new TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return s[r]}},function(e,t,r){const n=r(663),a=n.cwrap("ec_add","string",["string"]),i=n.cwrap("ec_mul","string",["string"]),o=n.cwrap("ec_pairing","string",["string"]);e.exports={add:function(e){return Buffer.from(a(e.toString("hex")),"hex")},mul:function(e){return Buffer.from(i(e.toString("hex")),"hex")},pairing:function(e){return Buffer.from(o(e.toString("hex")),"hex")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){this.gasPrice=e,this.origin=t};t.default=n},function(e,t,r){"use strict";var n=r(680),a=r(682),i=r(684),o=r(246),c=r(15),s=r(685);e.exports=function(e,t){return"function"==typeof e.sublevel&&"function"==typeof e.clone?e.clone(t):function(e,t){return t=c(e.options,t),a(n(e,i,new o),[],s,t)}(e,t)}},function(e,t){class r extends Error{constructor(e,t,r){super("LevelUpArrayAdapter named '"+e+"' index out of range: index "+t+"; length: "+r),this.name=`${this.constructor.name}:${e}`,this.type=e}}e.exports={LevelUpOutOfRangeError:r,BlockOutOfRangeError:class extends r{constructor(e,t){super("blocks",e,t)}}}},function(e,t,r){e.exports=d,d.Minimatch=u;var n={sep:"/"};try{n=r(2)}catch(e){}var a=d.GLOBSTAR=u.GLOBSTAR={},i=r(704),o={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},c="().*{}+?[]^$\\!".split("").reduce((function(e,t){return e[t]=!0,e}),{});var s=/\/+/;function f(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach((function(e){r[e]=t[e]})),Object.keys(e).forEach((function(t){r[t]=e[t]})),r}function d(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new u(t,r).match(e))}function u(e,t){if(!(this instanceof u))return new u(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==n.sep&&(e=e.split(n.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function l(e,t){if(t||(t=this instanceof u?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:i(e)}d.filter=function(e,t){return t=t||{},function(r,n,a){return d(r,e,t)}},d.defaults=function(e){if(!e||!Object.keys(e).length)return d;var t=d,r=function(r,n,a){return t.minimatch(r,n,f(e,a))};return r.Minimatch=function(r,n){return new t.Minimatch(r,f(e,n))},r},u.defaults=function(e){return e&&Object.keys(e).length?d.defaults(e).Minimatch:u},u.prototype.debug=function(){},u.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,r),r=this.globParts=r.map((function(e){return e.split(s)})),this.debug(this.pattern,r),r=r.map((function(e,t,r){return e.map(this.parse,this)}),this),this.debug(this.pattern,r),r=r.filter((function(e){return-1===e.indexOf(!1)})),this.debug(this.pattern,r),this.set=r},u.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=this.options,n=0;if(r.nonegate)return;for(var a=0,i=e.length;a<i&&"!"===e.charAt(a);a++)t=!t,n++;n&&(this.pattern=e.substr(n));this.negate=t},d.braceExpand=function(e,t){return l(e,t)},u.prototype.braceExpand=l,u.prototype.parse=function(e,t){if(e.length>65536)throw new TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&"**"===e)return a;if(""===e)return"";var n,i="",s=!!r.nocase,f=!1,d=[],u=[],l=!1,p=-1,h=-1,m="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",x=this;function v(){if(n){switch(n){case"*":i+="[^/]*?",s=!0;break;case"?":i+="[^/]",s=!0;break;default:i+="\\"+n}x.debug("clearStateChar %j %j",n,i),n=!1}}for(var g,y=0,A=e.length;y<A&&(g=e.charAt(y));y++)if(this.debug("%s\t%s %s %j",e,y,i,g),f&&c[g])i+="\\"+g,f=!1;else switch(g){case"/":return!1;case"\\":v(),f=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,y,i,g),l){this.debug(" in class"),"!"===g&&y===h+1&&(g="^"),i+=g;continue}x.debug("call clearStateChar %j",n),v(),n=g,r.noext&&v();continue;case"(":if(l){i+="(";continue}if(!n){i+="\\(";continue}d.push({type:n,start:y-1,reStart:i.length,open:o[n].open,close:o[n].close}),i+="!"===n?"(?:(?!(?:":"(?:",this.debug("plType %j %j",n,i),n=!1;continue;case")":if(l||!d.length){i+="\\)";continue}v(),s=!0;var w=d.pop();i+=w.close,"!"===w.type&&u.push(w),w.reEnd=i.length;continue;case"|":if(l||!d.length||f){i+="\\|",f=!1;continue}v(),i+="|";continue;case"[":if(v(),l){i+="\\"+g;continue}l=!0,h=y,p=i.length,i+=g;continue;case"]":if(y===h+1||!l){i+="\\"+g,f=!1;continue}if(l){var _=e.substring(h+1,y);try{RegExp("["+_+"]")}catch(e){var k=this.parse(_,b);i=i.substr(0,p)+"\\["+k[0]+"\\]",s=s||k[1],l=!1;continue}}s=!0,l=!1,i+=g;continue;default:v(),f?f=!1:!c[g]||"^"===g&&l||(i+="\\"),i+=g}l&&(_=e.substr(h+1),k=this.parse(_,b),i=i.substr(0,p)+"\\["+k[0],s=s||k[1]);for(w=d.pop();w;w=d.pop()){var E=i.slice(w.reStart+w.open.length);this.debug("setting tail",i,w),E=E.replace(/((?:\\{2}){0,64})(\\?)\|/g,(function(e,t,r){return r||(r="\\"),t+t+r+"|"})),this.debug("tail=%j\n %s",E,E,w,i);var S="*"===w.type?"[^/]*?":"?"===w.type?"[^/]":"\\"+w.type;s=!0,i=i.slice(0,w.reStart)+S+"\\("+E}v(),f&&(i+="\\\\");var T=!1;switch(i.charAt(0)){case".":case"[":case"(":T=!0}for(var O=u.length-1;O>-1;O--){var R=u[O],C=i.slice(0,R.reStart),B=i.slice(R.reStart,R.reEnd-8),I=i.slice(R.reEnd-8,R.reEnd),N=i.slice(R.reEnd);I+=N;var P=C.split("(").length-1,L=N;for(y=0;y<P;y++)L=L.replace(/\)[+*?]?/,"");var M="";""===(N=L)&&t!==b&&(M="$"),i=C+B+N+M+I}""!==i&&s&&(i="(?=.)"+i);T&&(i=m+i);if(t===b)return[i,s];if(!s)return function(e){return e.replace(/\\(.)/g,"$1")}(e);var j=r.nocase?"i":"";try{var F=new RegExp("^"+i+"$",j)}catch(e){return new RegExp("$.")}return F._glob=e,F._src=i,F};var b={};d.makeRe=function(e,t){return new u(e,t||{}).makeRe()},u.prototype.makeRe=function(){if(this.regexp||!1===this.regexp)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?"[^/]*?":t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",n=t.nocase?"i":"",i=e.map((function(e){return e.map((function(e){return e===a?r:"string"==typeof e?function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}(e):e._src})).join("\\/")})).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch(e){this.regexp=!1}return this.regexp},d.match=function(e,t,r){var n=new u(t,r=r||{});return e=e.filter((function(e){return n.match(e)})),n.options.nonull&&!e.length&&e.push(t),e},u.prototype.match=function(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var r=this.options;"/"!==n.sep&&(e=e.split(n.sep).join("/"));e=e.split(s),this.debug(this.pattern,"split",e);var a,i,o=this.set;for(this.debug(this.pattern,"set",o),i=e.length-1;i>=0&&!(a=e[i]);i--);for(i=0;i<o.length;i++){var c=o[i],f=e;if(r.matchBase&&1===c.length&&(f=[a]),this.matchOne(f,c,t))return!!r.flipNegate||!this.negate}return!r.flipNegate&&this.negate},u.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,o=0,c=e.length,s=t.length;i<c&&o<s;i++,o++){this.debug("matchOne loop");var f,d=t[o],u=e[i];if(this.debug(t,d,u),!1===d)return!1;if(d===a){this.debug("GLOBSTAR",[t,d,u]);var l=i,b=o+1;if(b===s){for(this.debug("** at the end");i<c;i++)if("."===e[i]||".."===e[i]||!n.dot&&"."===e[i].charAt(0))return!1;return!0}for(;l<c;){var p=e[l];if(this.debug("\nglobstar while",e,l,t,b,p),this.matchOne(e.slice(l),t.slice(b),r))return this.debug("globstar found match!",l,c,p),!0;if("."===p||".."===p||!n.dot&&"."===p.charAt(0)){this.debug("dot detected!",e,l,t,b);break}this.debug("globstar swallow a segment, and continue"),l++}return!(!r||(this.debug("\n>>> no match, partial?",e,l,t,b),l!==c))}if("string"==typeof d?(f=n.nocase?u.toLowerCase()===d.toLowerCase():u===d,this.debug("string match",d,u,f)):(f=u.match(d),this.debug("pattern match",d,u,f)),!f)return!1}if(i===c&&o===s)return!0;if(i===c)return r;if(o===s)return i===c-1&&""===e[i];throw new Error("wtf?")}},function(e,t,r){"use strict";function n(e){return"/"===e.charAt(0)}function a(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(e),r=t[1]||"",n=Boolean(r&&":"!==r.charAt(1));return Boolean(t[2]||n)}e.exports="win32"===process.platform?a:n,e.exports.posix=n,e.exports.win32=a},function(e,t,r){var n=r(297);function a(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}e.exports=n(a),e.exports.strict=n(i),a.proto=a((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return a(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})}))},function(e,t,r){"use strict";var n=r(714).version,a=r(49),i=r(763),o=r(102),c=r(318),s=r(822),f=r(823),d=r(30),u=function(){var e=this;a.packageInit(this,arguments),this.version=n,this.utils=d,this.eth=new i(this),this.shh=new s(this),this.bzz=new f(this);var t=this.setProvider;this.setProvider=function(r,n){return t.apply(e,arguments),this.eth.setProvider(r,n),this.shh.setProvider(r,n),this.bzz.setProvider(r),!0}};u.version=n,u.utils=d,u.modules={Eth:i,Net:o,Personal:c,Shh:s,Bzz:f},a.addProviders(u),e.exports=u},function(e,t,r){var n=r(0),a=r(50),i=r(3).EventEmitter,o=r(307),c=r(736),s=r(737).Validation,f=a.bufferAllocUnsafe,d=a.bufferFromString;var u="setImmediate"in global?global.setImmediate.bind(global):process.nextTick.bind(process),l=0;function b(e,t,r,n,s){if(this._debug=a.BufferingLogger("websocket:connection",++l),this._debug("constructor"),this._debug.enabled&&function(e,t){if(!e._debug.enabled)return;var r=t.emit;for(var n in t.emit=function(t){e._debug("||| Socket Event '%s'",t),r.apply(this,arguments)},t)"function"==typeof t[n]&&-1===["emit"].indexOf(n)&&function(r){var n=t[r];t[r]="on"!==r?function(){return e._debug("||| Socket method called: %s",r),n.apply(this,arguments)}:function(){return e._debug("||| Socket method called: %s (%s)",r,arguments[0]),n.apply(this,arguments)}}(n)}(this,e),i.call(this),this._pingListenerCount=0,this.on("newListener",(function(e){"ping"===e&&this._pingListenerCount++})).on("removeListener",(function(e){"ping"===e&&this._pingListenerCount--})),this.config=s,this.socket=e,this.protocol=r,this.extensions=t,this.remoteAddress=e.remoteAddress,this.closeReasonCode=-1,this.closeDescription=null,this.closeEventEmitted=!1,this.maskOutgoingPackets=n,this.maskBytes=f(4),this.frameHeader=f(10),this.bufferList=new c,this.currentFrame=new o(this.maskBytes,this.frameHeader,this.config),this.fragmentationSize=0,this.frameQueue=[],this.connected=!0,this.state="open",this.waitingForCloseResponse=!1,this.receivedEnd=!1,this.closeTimeout=this.config.closeTimeout,this.assembleFragments=this.config.assembleFragments,this.maxReceivedMessageSize=this.config.maxReceivedMessageSize,this.outputBufferFull=!1,this.inputPaused=!1,this.receivedDataHandler=this.processReceivedData.bind(this),this._closeTimerHandler=this.handleCloseTimer.bind(this),this.socket.setNoDelay(this.config.disableNagleAlgorithm),this.socket.setTimeout(0),this.config.keepalive&&!this.config.useNativeKeepalive){if("number"!=typeof this.config.keepaliveInterval)throw new Error("keepaliveInterval must be specified and numeric if keepalive is true.");if(this._keepaliveTimerHandler=this.handleKeepaliveTimer.bind(this),this.setKeepaliveTimer(),this.config.dropConnectionOnKeepaliveTimeout){if("number"!=typeof this.config.keepaliveGracePeriod)throw new Error("keepaliveGracePeriod must be specified and numeric if dropConnectionOnKeepaliveTimeout is true.");this._gracePeriodTimerHandler=this.handleGracePeriodTimer.bind(this)}}else if(this.config.keepalive&&this.config.useNativeKeepalive){if(!("setKeepAlive"in this.socket))throw new Error("Unable to use native keepalive: unsupported by this version of Node.");this.socket.setKeepAlive(!0,this.config.keepaliveInterval)}this.socket.removeAllListeners("error")}function p(e){return!(e<1e3)&&(e>=1e3&&e<=2999?-1!==[1e3,1001,1002,1003,1007,1008,1009,1010,1011,1012,1013,1014].indexOf(e):e>=3e3&&e<=3999||(e>=4e3&&e<=4999||!(e>=5e3)&&void 0))}b.CLOSE_REASON_NORMAL=1e3,b.CLOSE_REASON_GOING_AWAY=1001,b.CLOSE_REASON_PROTOCOL_ERROR=1002,b.CLOSE_REASON_UNPROCESSABLE_INPUT=1003,b.CLOSE_REASON_RESERVED=1004,b.CLOSE_REASON_NOT_PROVIDED=1005,b.CLOSE_REASON_ABNORMAL=1006,b.CLOSE_REASON_INVALID_DATA=1007,b.CLOSE_REASON_POLICY_VIOLATION=1008,b.CLOSE_REASON_MESSAGE_TOO_BIG=1009,b.CLOSE_REASON_EXTENSION_REQUIRED=1010,b.CLOSE_REASON_INTERNAL_SERVER_ERROR=1011,b.CLOSE_REASON_TLS_HANDSHAKE_FAILED=1015,b.CLOSE_DESCRIPTIONS={1e3:"Normal connection closure",1001:"Remote peer is going away",1002:"Protocol error",1003:"Unprocessable input",1004:"Reserved",1005:"Reason not provided",1006:"Abnormal closure, no further detail available",1007:"Invalid data received",1008:"Policy violation",1009:"Message too big",1010:"Extension requested by client is required",1011:"Internal Server Error",1015:"TLS Handshake Failed"},n.inherits(b,i),b.prototype._addSocketEventListeners=function(){this.socket.on("error",this.handleSocketError.bind(this)),this.socket.on("end",this.handleSocketEnd.bind(this)),this.socket.on("close",this.handleSocketClose.bind(this)),this.socket.on("drain",this.handleSocketDrain.bind(this)),this.socket.on("pause",this.handleSocketPause.bind(this)),this.socket.on("resume",this.handleSocketResume.bind(this)),this.socket.on("data",this.handleSocketData.bind(this))},b.prototype.setKeepaliveTimer=function(){this._debug("setKeepaliveTimer"),this.config.keepalive&&!this.config.useNativeKeepalive&&(this.clearKeepaliveTimer(),this.clearGracePeriodTimer(),this._keepaliveTimeoutID=setTimeout(this._keepaliveTimerHandler,this.config.keepaliveInterval))},b.prototype.clearKeepaliveTimer=function(){this._keepaliveTimeoutID&&clearTimeout(this._keepaliveTimeoutID)},b.prototype.handleKeepaliveTimer=function(){this._debug("handleKeepaliveTimer"),this._keepaliveTimeoutID=null,this.ping(),this.config.dropConnectionOnKeepaliveTimeout?this.setGracePeriodTimer():this.setKeepaliveTimer()},b.prototype.setGracePeriodTimer=function(){this._debug("setGracePeriodTimer"),this.clearGracePeriodTimer(),this._gracePeriodTimeoutID=setTimeout(this._gracePeriodTimerHandler,this.config.keepaliveGracePeriod)},b.prototype.clearGracePeriodTimer=function(){this._gracePeriodTimeoutID&&clearTimeout(this._gracePeriodTimeoutID)},b.prototype.handleGracePeriodTimer=function(){this._debug("handleGracePeriodTimer"),this._gracePeriodTimeoutID=null,this.drop(b.CLOSE_REASON_ABNORMAL,"Peer not responding.",!0)},b.prototype.handleSocketData=function(e){this._debug("handleSocketData"),this.setKeepaliveTimer(),this.bufferList.write(e),this.processReceivedData()},b.prototype.processReceivedData=function(){if(this._debug("processReceivedData"),this.connected&&!this.inputPaused){var e=this.currentFrame;if(e.addData(this.bufferList)){var t=this;if(e.protocolError)return this._debug("-- protocol error"),void process.nextTick((function(){t.drop(b.CLOSE_REASON_PROTOCOL_ERROR,e.dropReason)}));if(e.frameTooLarge)return this._debug("-- frame too large"),void process.nextTick((function(){t.drop(b.CLOSE_REASON_MESSAGE_TOO_BIG,e.dropReason)}));if(e.rsv1||e.rsv2||e.rsv3)return this._debug("-- illegal rsv flag"),void process.nextTick((function(){t.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unsupported usage of rsv bits without negotiated extension.")}));this.assembleFragments||(this._debug("-- emitting frame"),process.nextTick((function(){t.emit("frame",e)}))),process.nextTick((function(){t.processFrame(e)})),this.currentFrame=new o(this.maskBytes,this.frameHeader,this.config),this.bufferList.length>0&&u(this.receivedDataHandler)}else this._debug("-- insufficient data for frame")}},b.prototype.handleSocketError=function(e){this._debug("handleSocketError: %j",e),"closed"!==this.state?(this.closeReasonCode=b.CLOSE_REASON_ABNORMAL,this.closeDescription="Socket Error: "+e.syscall+" "+e.code,this.connected=!1,this.state="closed",this.fragmentationSize=0,a.eventEmitterListenerCount(this,"error")>0&&this.emit("error",e),this.socket.destroy(e),this._debug.printOutput()):this._debug(" --- Socket 'error' after 'close'")},b.prototype.handleSocketEnd=function(){this._debug("handleSocketEnd: received socket end. state = %s",this.state),this.receivedEnd=!0,"closed"!==this.state?"peer_requested_close"!==this.state&&"ending"!==this.state&&(this._debug(" --- UNEXPECTED socket end."),this.socket.end()):this._debug(" --- Socket 'end' after 'close'")},b.prototype.handleSocketClose=function(e){this._debug("handleSocketClose: received socket close"),this.socketHadError=e,this.connected=!1,this.state="closed",-1===this.closeReasonCode&&(this.closeReasonCode=b.CLOSE_REASON_ABNORMAL,this.closeDescription="Connection dropped by remote peer."),this.clearCloseTimer(),this.clearKeepaliveTimer(),this.clearGracePeriodTimer(),this.closeEventEmitted||(this.closeEventEmitted=!0,this._debug("-- Emitting WebSocketConnection close event"),this.emit("close",this.closeReasonCode,this.closeDescription))},b.prototype.handleSocketDrain=function(){this._debug("handleSocketDrain: socket drain event"),this.outputBufferFull=!1,this.emit("drain")},b.prototype.handleSocketPause=function(){this._debug("handleSocketPause: socket pause event"),this.inputPaused=!0,this.emit("pause")},b.prototype.handleSocketResume=function(){this._debug("handleSocketResume: socket resume event"),this.inputPaused=!1,this.emit("resume"),this.processReceivedData()},b.prototype.pause=function(){this._debug("pause: pause requested"),this.socket.pause()},b.prototype.resume=function(){this._debug("resume: resume requested"),this.socket.resume()},b.prototype.close=function(e,t){if(this.connected){if(this._debug("close: Initating clean WebSocket close sequence."),"number"!=typeof e&&(e=b.CLOSE_REASON_NORMAL),!p(e))throw new Error("Close code "+e+" is not valid.");"string"!=typeof t&&(t=b.CLOSE_DESCRIPTIONS[e]),this.closeReasonCode=e,this.closeDescription=t,this.setCloseTimer(),this.sendCloseFrame(this.closeReasonCode,this.closeDescription),this.state="ending",this.connected=!1}},b.prototype.drop=function(e,t,r){this._debug("drop"),"number"!=typeof e&&(e=b.CLOSE_REASON_PROTOCOL_ERROR),"string"!=typeof t&&(t=b.CLOSE_DESCRIPTIONS[e]),this._debug("Forcefully dropping connection. skipCloseFrame: %s, code: %d, description: %s",r,e,t),this.closeReasonCode=e,this.closeDescription=t,this.frameQueue=[],this.fragmentationSize=0,r||this.sendCloseFrame(e,t),this.connected=!1,this.state="closed",this.clearCloseTimer(),this.clearKeepaliveTimer(),this.clearGracePeriodTimer(),this.closeEventEmitted||(this.closeEventEmitted=!0,this._debug("Emitting WebSocketConnection close event"),this.emit("close",this.closeReasonCode,this.closeDescription)),this._debug("Drop: destroying socket"),this.socket.destroy()},b.prototype.setCloseTimer=function(){this._debug("setCloseTimer"),this.clearCloseTimer(),this._debug("Setting close timer"),this.waitingForCloseResponse=!0,this.closeTimer=setTimeout(this._closeTimerHandler,this.closeTimeout)},b.prototype.clearCloseTimer=function(){this._debug("clearCloseTimer"),this.closeTimer&&(this._debug("Clearing close timer"),clearTimeout(this.closeTimer),this.waitingForCloseResponse=!1,this.closeTimer=null)},b.prototype.handleCloseTimer=function(){this._debug("handleCloseTimer"),this.closeTimer=null,this.waitingForCloseResponse&&(this._debug("Close response not received from client. Forcing socket end."),this.waitingForCloseResponse=!1,this.state="closed",this.socket.end())},b.prototype.processFrame=function(e){if(this._debug("processFrame"),this._debug(" -- frame: %s",e),0!==this.frameQueue.length&&e.opcode>0&&e.opcode<8)this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Illegal frame opcode 0x"+e.opcode.toString(16)+" received in middle of fragmented message.");else switch(e.opcode){case 2:this._debug("-- Binary Frame"),this.assembleFragments&&(e.fin?(this._debug("---- Emitting 'message' event"),this.emit("message",{type:"binary",binaryData:e.binaryPayload})):(this.frameQueue.push(e),this.fragmentationSize=e.length));break;case 1:if(this._debug("-- Text Frame"),this.assembleFragments)if(e.fin){if(!s.isValidUTF8(e.binaryPayload))return void this.drop(b.CLOSE_REASON_INVALID_DATA,"Invalid UTF-8 Data Received");this._debug("---- Emitting 'message' event"),this.emit("message",{type:"utf8",utf8Data:e.binaryPayload.toString("utf8")})}else this.frameQueue.push(e),this.fragmentationSize=e.length;break;case 0:if(this._debug("-- Continuation Frame"),this.assembleFragments){if(0===this.frameQueue.length)return void this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unexpected Continuation Frame");if(this.fragmentationSize+=e.length,this.fragmentationSize>this.maxReceivedMessageSize)return void this.drop(b.CLOSE_REASON_MESSAGE_TOO_BIG,"Maximum message size exceeded.");if(this.frameQueue.push(e),e.fin){var t=0,r=f(this.fragmentationSize),n=this.frameQueue[0].opcode;switch(this.frameQueue.forEach((function(e){e.binaryPayload.copy(r,t),t+=e.binaryPayload.length})),this.frameQueue=[],this.fragmentationSize=0,n){case 2:this.emit("message",{type:"binary",binaryData:r});break;case 1:if(!s.isValidUTF8(r))return void this.drop(b.CLOSE_REASON_INVALID_DATA,"Invalid UTF-8 Data Received");this.emit("message",{type:"utf8",utf8Data:r.toString("utf8")});break;default:return void this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unexpected first opcode in fragmentation sequence: 0x"+n.toString(16))}}}break;case 9:if(this._debug("-- Ping Frame"),this._pingListenerCount>0){var a=!1;this.emit("ping",(function(){a=!0}),e.binaryPayload),a||this.pong(e.binaryPayload)}else this.pong(e.binaryPayload);break;case 10:this._debug("-- Pong Frame"),this.emit("pong",e.binaryPayload);break;case 8:if(this._debug("-- Close Frame"),this.waitingForCloseResponse)return this._debug("---- Got close response from peer. Completing closing handshake."),this.clearCloseTimer(),this.waitingForCloseResponse=!1,this.state="closed",void this.socket.end();var i;if(this._debug("---- Closing handshake initiated by peer."),this.state="peer_requested_close",e.invalidCloseFrameLength?(this.closeReasonCode=1005,i=b.CLOSE_REASON_PROTOCOL_ERROR):-1===e.closeStatus||p(e.closeStatus)?(this.closeReasonCode=e.closeStatus,i=b.CLOSE_REASON_NORMAL):(this.closeReasonCode=e.closeStatus,i=b.CLOSE_REASON_PROTOCOL_ERROR),e.binaryPayload.length>1){if(!s.isValidUTF8(e.binaryPayload))return void this.drop(b.CLOSE_REASON_INVALID_DATA,"Invalid UTF-8 Data Received");this.closeDescription=e.binaryPayload.toString("utf8")}else this.closeDescription=b.CLOSE_DESCRIPTIONS[this.closeReasonCode];this._debug("------ Remote peer %s - code: %d - %s - close frame payload length: %d",this.remoteAddress,this.closeReasonCode,this.closeDescription,e.length),this._debug("------ responding to remote peer's close request."),this.sendCloseFrame(i,null),this.connected=!1;break;default:this._debug("-- Unrecognized Opcode %d",e.opcode),this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unrecognized Opcode: 0x"+e.opcode.toString(16))}},b.prototype.send=function(e,t){if(this._debug("send"),Buffer.isBuffer(e))this.sendBytes(e,t);else{if("function"!=typeof e.toString)throw new Error("Data provided must either be a Node Buffer or implement toString()");this.sendUTF(e,t)}},b.prototype.sendUTF=function(e,t){e=d(e.toString(),"utf8"),this._debug("sendUTF: %d bytes",e.length);var r=new o(this.maskBytes,this.frameHeader,this.config);r.opcode=1,r.binaryPayload=e,this.fragmentAndSend(r,t)},b.prototype.sendBytes=function(e,t){if(this._debug("sendBytes"),!Buffer.isBuffer(e))throw new Error("You must pass a Node Buffer object to WebSocketConnection.prototype.sendBytes()");var r=new o(this.maskBytes,this.frameHeader,this.config);r.opcode=2,r.binaryPayload=e,this.fragmentAndSend(r,t)},b.prototype.ping=function(e){this._debug("ping");var t=new o(this.maskBytes,this.frameHeader,this.config);t.opcode=9,t.fin=!0,e&&(Buffer.isBuffer(e)||(e=d(e.toString(),"utf8")),e.length>125&&(this._debug("WebSocket: Data for ping is longer than 125 bytes. Truncating."),e=e.slice(0,124)),t.binaryPayload=e),this.sendFrame(t)},b.prototype.pong=function(e){this._debug("pong");var t=new o(this.maskBytes,this.frameHeader,this.config);t.opcode=10,Buffer.isBuffer(e)&&e.length>125&&(this._debug("WebSocket: Data for pong is longer than 125 bytes. Truncating."),e=e.slice(0,124)),t.binaryPayload=e,t.fin=!0,this.sendFrame(t)},b.prototype.fragmentAndSend=function(e,t){if(this._debug("fragmentAndSend"),e.opcode>7)throw new Error("You cannot fragment control frames.");var r=this.config.fragmentationThreshold,n=e.binaryPayload.length;if(!this.config.fragmentOutgoingMessages||e.binaryPayload&&n<=r)return e.fin=!0,void this.sendFrame(e,t);for(var a=Math.ceil(n/r),i=0,c=function(e){e?"function"==typeof t&&(t(e),t=null):++i===a&&"function"==typeof t&&t()},s=1;s<=a;s++){var f=new o(this.maskBytes,this.frameHeader,this.config);f.opcode=1===s?e.opcode:0,f.fin=s===a;var d=s===a?n-r*(s-1):r,u=r*(s-1);f.binaryPayload=e.binaryPayload.slice(u,u+d),this.sendFrame(f,c)}},b.prototype.sendCloseFrame=function(e,t,r){if("number"!=typeof e&&(e=b.CLOSE_REASON_NORMAL),this._debug("sendCloseFrame state: %s, reasonCode: %d, description: %s",this.state,e,t),"open"===this.state||"peer_requested_close"===this.state){var n=new o(this.maskBytes,this.frameHeader,this.config);n.fin=!0,n.opcode=8,n.closeStatus=e,"string"==typeof t&&(n.binaryPayload=d(t,"utf8")),this.sendFrame(n,r),this.socket.end()}},b.prototype.sendFrame=function(e,t){this._debug("sendFrame"),e.mask=this.maskOutgoingPackets;var r=this.socket.write(e.toBuffer(),t);return this.outputBufferFull=!r,r},e.exports=b},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.listeners={}}return e.prototype.addEventListener=function(e,t){e=e.toLowerCase(),this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t.handleEvent||t)},e.prototype.removeEventListener=function(e,t){if(e=e.toLowerCase(),this.listeners[e]){var r=this.listeners[e].indexOf(t.handleEvent||t);r<0||this.listeners[e].splice(r,1)}},e.prototype.dispatchEvent=function(e){var t=e.type.toLowerCase();if(e.target=this,this.listeners[t])for(var r=0,n=this.listeners[t];r<n.length;r++){n[r].call(this,e)}var a=this["on"+t];return a&&a.call(this,e),!0},e}();t.XMLHttpRequestEventTarget=n},function(e,t,r){r(784);var n=function(e,t){return parseInt(e.slice(2*t+2,2*t+4),16)},a=function(e){return(e.length-2)/2},i=function(e){for(var t=[],r=2,n=e.length;r<n;r+=2)t.push(parseInt(e.slice(r,r+2),16));return t},o=function(e){for(var t="0x",r=0,n=e.length;r<n;++r){var a=e[r];t+=(a<16?"0":"")+a.toString(16)}return t};e.exports={random:function(e){var t=void 0;t="undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues?window.crypto.getRandomValues(new Uint8Array(e)):r(6).randomBytes(e);for(var n="0x",a=0;a<e;++a)n+=("00"+t[a].toString(16)).slice(-2);return n},length:a,concat:function(e,t){return e.concat(t.slice(2))},flatten:function(e){return"0x"+e.reduce((function(e,t){return e+t.slice(2)}),"")},slice:function(e,t,r){return"0x"+r.slice(2*e+2,2*t+2)},reverse:function(e){for(var t="0x",r=0,n=a(e);r<n;++r)t+=e.slice(2*(n-r),2*(n-r+1));return t},pad:function e(t,r){return r.length===2*t+2?r:e(t,"0x0"+r.slice(2))},padRight:function e(t,r){return r.length===2*t+2?r:e(t,r+"0")},fromAscii:function(e){for(var t="0x",r=0;r<e.length;++r)t+=("00"+e.charCodeAt(r).toString(16)).slice(-2);return t},toAscii:function(e){for(var t="",r=2;r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.slice(r,r+2),16));return t},fromString:function(e){for(var t=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},r="0x",n=0;n!=e.length;n++){var a=e.charCodeAt(n);if(a<128)r+=t(a);else{if(a<2048)r+=t(a>>6|192);else{if(a>55295&&a<56320){if(++n==e.length)return null;var i=e.charCodeAt(n);if(i<56320||i>57343)return null;r+=t((a=65536+((1023&a)<<10)+(1023&i))>>18|240),r+=t(a>>12&63|128)}else r+=t(a>>12|224);r+=t(a>>6&63|128)}r+=t(63&a|128)}}return r},toString:function(e){for(var t="",r=0,i=a(e);r<i;){var o=n(e,r++);if(o>127){if(o>191&&o<224){if(r>=i)return null;o=(31&o)<<6|63&n(e,r)}else if(o>223&&o<240){if(r+1>=i)return null;o=(15&o)<<12|(63&n(e,r))<<6|63&n(e,++r)}else{if(!(o>239&&o<248))return null;if(r+2>=i)return null;o=(7&o)<<18|(63&n(e,r))<<12|(63&n(e,++r))<<6|63&n(e,++r)}++r}if(o<=65535)t+=String.fromCharCode(o);else{if(!(o<=1114111))return null;o-=65536,t+=String.fromCharCode(o>>10|55296),t+=String.fromCharCode(1023&o|56320)}}return t},fromNumber:function(e){var t=e.toString(16);return t.length%2==0?"0x"+t:"0x0"+t},toNumber:function(e){return parseInt(e.slice(2),16)},fromNat:function(e){return"0x0"===e?"0x":e.length%2==0?e:"0x0"+e.slice(2)},toNat:function(e){return"0"===e[2]?"0x"+e.slice(3):e},fromArray:o,toArray:i,fromUint8Array:function(e){return o([].slice.call(e,0))},toUint8Array:function(e){return new Uint8Array(i(e))}}},function(e,t,r){t.publicEncrypt=r(795),t.privateDecrypt=r(812),t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}},function(e,t,r){"use strict";const n=r(22).fromCallback,a=r(838);e.exports={readJson:n(a.readFile),readJsonSync:a.readFileSync,writeJson:n(a.writeFile),writeJsonSync:a.writeFileSync}},function(e,t){e.exports=require("zlib")},function(e,t,r){"use strict";const n=r(54);class a{constructor(e,t){this.path=e||"./",this.absolute=t,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}const i=r(76),o=r(345),c=r(105),s=r(346),f=s.Sync,d=s.Tar,u=r(90),l=n.alloc(1024),b=Symbol("onStat"),p=Symbol("ended"),h=Symbol("queue"),m=Symbol("current"),x=Symbol("process"),v=Symbol("processing"),g=Symbol("processJob"),y=Symbol("jobs"),A=Symbol("jobDone"),w=Symbol("addFSEntry"),_=Symbol("addTarEntry"),k=Symbol("stat"),E=Symbol("readdir"),S=Symbol("onreaddir"),T=Symbol("pipe"),O=Symbol("entry"),R=Symbol("entryOpt"),C=Symbol("writeEntryClass"),B=Symbol("write"),I=Symbol("ondrain"),N=r(8),P=r(2),L=r(161)(class extends i{constructor(e){super(e),e=e||Object.create(null),this.opt=e,this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=(e.prefix||"").replace(/(\\|\/)+$/,""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this[C]=s,"function"==typeof e.onwarn&&this.on("warn",e.onwarn),this.zip=null,e.gzip?("object"!=typeof e.gzip&&(e.gzip={}),this.zip=new o.Gzip(e.gzip),this.zip.on("data",e=>super.write(e)),this.zip.on("end",e=>super.end()),this.zip.on("drain",e=>this[I]()),this.on("resume",e=>this.zip.resume())):this.on("drain",this[I]),this.portable=!!e.portable,this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,this.mtime=e.mtime||null,this.filter="function"==typeof e.filter?e.filter:e=>!0,this[h]=new u,this[y]=0,this.jobs=+e.jobs||4,this[v]=!1,this[p]=!1}[B](e){return super.write(e)}add(e){return this.write(e),this}end(e){return e&&this.write(e),this[p]=!0,this[x](),this}write(e){if(this[p])throw new Error("write after end");return e instanceof c?this[_](e):this[w](e),this.flowing}[_](e){const t=P.resolve(this.cwd,e.path);if(this.prefix&&(e.path=this.prefix+"/"+e.path.replace(/^\.(\/+|$)/,"")),this.filter(e.path,e)){const r=new a(e.path,t,!1);r.entry=new d(e,this[R](r)),r.entry.on("end",e=>this[A](r)),this[y]+=1,this[h].push(r)}else e.resume();this[x]()}[w](e){const t=P.resolve(this.cwd,e);this.prefix&&(e=this.prefix+"/"+e.replace(/^\.(\/+|$)/,"")),this[h].push(new a(e,t)),this[x]()}[k](e){e.pending=!0,this[y]+=1;const t=this.follow?"stat":"lstat";N[t](e.absolute,(t,r)=>{e.pending=!1,this[y]-=1,t?this.emit("error",t):this[b](e,r)})}[b](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)||(e.ignore=!0),this[x]()}[E](e){e.pending=!0,this[y]+=1,N.readdir(e.absolute,(t,r)=>{if(e.pending=!1,this[y]-=1,t)return this.emit("error",t);this[S](e,r)})}[S](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[x]()}[x](){if(!this[v]){this[v]=!0;for(let e=this[h].head;null!==e&&this[y]<this.jobs;e=e.next)if(this[g](e.value),e.value.ignore){const t=e.next;this[h].removeNode(e),e.next=t}this[v]=!1,this[p]&&!this[h].length&&0===this[y]&&(this.zip?this.zip.end(l):(super.write(l),super.end()))}}get[m](){return this[h]&&this[h].head&&this[h].head.value}[A](e){this[h].shift(),this[y]-=1,this[x]()}[g](e){e.pending||(e.entry?e!==this[m]||e.piped||this[T](e):(e.stat||(this.statCache.has(e.absolute)?this[b](e,this.statCache.get(e.absolute)):this[k](e)),e.stat&&(e.ignore||(this.noDirRecurse||!e.stat.isDirectory()||e.readdir||(this.readdirCache.has(e.absolute)?this[S](e,this.readdirCache.get(e.absolute)):this[E](e),e.readdir))&&(e.entry=this[O](e),e.entry?e!==this[m]||e.piped||this[T](e):e.ignore=!0))))}[R](e){return{onwarn:(e,t)=>{this.warn(e,t)},noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime}}[O](e){this[y]+=1;try{return new this[C](e.path,this[R](e)).on("end",()=>this[A](e)).on("error",e=>this.emit("error",e))}catch(e){this.emit("error",e)}}[I](){this[m]&&this[m].entry&&this[m].entry.resume()}[T](e){e.piped=!0,e.readdir&&e.readdir.forEach(t=>{const r=this.prefix?e.path.slice(this.prefix.length+1)||"./":e.path,n="./"===r?"":r.replace(/\/*$/,"/");this[w](n+t)});const t=e.entry,r=this.zip;r?t.on("data",e=>{r.write(e)||t.pause()}):t.on("data",e=>{super.write(e)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}});L.Sync=class extends L{constructor(e){super(e),this[C]=f}pause(){}resume(){}[k](e){const t=this.follow?"statSync":"lstatSync";this[b](e,N[t](e.absolute))}[E](e,t){this[S](e,N.readdirSync(e.absolute))}[T](e){const t=e.entry,r=this.zip;e.readdir&&e.readdir.forEach(t=>{const r=this.prefix?e.path.slice(this.prefix.length+1)||"./":e.path,n="./"===r?"":r.replace(/\/*$/,"/");this[w](n+t)}),r?t.on("data",e=>{r.write(e)}):t.on("data",e=>{super[B](e)})}},e.exports=L},function(e,t,r){"use strict";const n=r(54),a=r(77),i=r(2);class o{constructor(e,t){this.atime=e.atime||null,this.charset=e.charset||null,this.comment=e.comment||null,this.ctime=e.ctime||null,this.gid=e.gid||null,this.gname=e.gname||null,this.linkpath=e.linkpath||null,this.mtime=e.mtime||null,this.path=e.path||null,this.size=e.size||null,this.uid=e.uid||null,this.uname=e.uname||null,this.dev=e.dev||null,this.ino=e.ino||null,this.nlink=e.nlink||null,this.global=t||!1}encode(){const e=this.encodeBody();if(""===e)return null;const t=n.byteLength(e),r=512*Math.ceil(1+t/512),o=n.allocUnsafe(r);for(let e=0;e<512;e++)o[e]=0;new a({path:("PaxHeader/"+i.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:t,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(o),o.write(e,512,t,"utf8");for(let e=t+512;e<o.length;e++)o[e]=0;return o}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(null===this[e]||void 0===this[e])return"";const t=" "+("dev"===e||"ino"===e||"nlink"===e?"SCHILY.":"")+e+"="+(this[e]instanceof Date?this[e].getTime()/1e3:this[e])+"\n",r=n.byteLength(t);let a=Math.floor(Math.log(r)/Math.log(10))+1;return r+a>=Math.pow(10,a)&&(a+=1),a+r+t}}o.parse=(e,t,r)=>new o(c(s(e),t),r);const c=(e,t)=>t?Object.keys(e).reduce((t,r)=>(t[r]=e[r],t),t):e,s=e=>e.replace(/\n$/,"").split("\n").reduce(f,Object.create(null)),f=(e,t)=>{const r=parseInt(t,10);if(r!==n.byteLength(t)+1)return e;const a=(t=t.substr((r+" ").length)).split("="),i=a.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!i)return e;const o=a.join("=");return e[i]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(i)?new Date(1e3*o):/^[0-9]+$/.test(o)?+o:o,e};e.exports=o},function(e,t,r){"use strict";e.exports=e=>class extends e{warn(e,t){if(this.strict)if(t instanceof Error)this.emit("error",t);else{const r=new Error(e);r.data=t,this.emit("error",r)}else this.emit("warn",e,t)}}},function(e,t,r){"use strict";const n=r(54),a=r(75),i=r(107),o=r(8),c=r(78),s=r(2),f=(e.exports=(e,t,r)=>{"function"==typeof e?(r=e,t=null,e={}):Array.isArray(e)&&(t=e,e={}),"function"==typeof t&&(r=t,t=null),t=t?Array.from(t):[];const n=a(e);if(n.sync&&"function"==typeof r)throw new TypeError("callback not supported for sync tar functions");if(!n.file&&"function"==typeof r)throw new TypeError("callback only supported with file option");return t.length&&d(n,t),n.noResume||f(n),n.file&&n.sync?u(n):n.file?l(n,r):b(n)},e=>{const t=e.onentry;e.onentry=t?e=>{t(e),e.resume()}:e=>e.resume()}),d=(e,t)=>{const r=new Map(t.map(e=>[e.replace(/\/+$/,""),!0])),n=e.filter,a=(e,t)=>{const n=t||s.parse(e).root||".",i=e!==n&&(r.has(e)?r.get(e):a(s.dirname(e),n));return r.set(e,i),i};e.filter=n?(e,t)=>n(e,t)&&a(e.replace(/\/+$/,"")):e=>a(e.replace(/\/+$/,""))},u=e=>{const t=b(e),r=e.file;let a,i=!0;try{const c=o.statSync(r),s=e.maxReadSize||16777216;if(c.size<s)t.end(o.readFileSync(r));else{let e=0;const i=n.allocUnsafe(s);for(a=o.openSync(r,"r");e<c.size;){let r=o.readSync(a,i,0,s,e);e+=r,t.write(i.slice(0,r))}t.end()}i=!1}finally{if(i&&a)try{o.closeSync(a)}catch(e){}}},l=(e,t)=>{const r=new i(e),n=e.maxReadSize||16777216,a=e.file,s=new Promise((e,t)=>{r.on("error",t),r.on("end",e),o.stat(a,(e,i)=>{if(e)t(e);else{const e=new c.ReadStream(a,{readSize:n,size:i.size});e.on("error",t),e.pipe(r)}})});return t?s.then(t,t):s},b=e=>new i(e)},function(e,t,r){"use strict";let n=0;const a=256,i=128,o=64,c=32,s=16,f=8,d=4,u=2,l=1;function b(){return process.getuid?process.getuid():NaN}function p(){return process.getgid?process.getgid():NaN}function h(){const e=Date.now();this._atime=new Date(e),this._ctime=new Date(e),this._birthtime=new Date(e),this._mtime=new Date(e),this._mode=438,this._uid=b(),this._gid=p(),this._id=++n,this.links=0}h.prototype.canRead=function(){const e=b(),t=p();let r=!1;return r=0===e||(e===this._uid||e!=e?(a&this._mode)===a:t===this._gid?(c&this._mode)===c:(d&this._mode)===d),r},h.prototype.canWrite=function(){const e=b(),t=p();let r=!1;return r=0===e||(e===this._uid||e!=e?(i&this._mode)===i:t===this._gid?(s&this._mode)===s:(u&this._mode)===u),r},h.prototype.canExecute=function(){const e=b(),t=p();let r=!1;return r=0===e||(e===this._uid||e!=e?(o&this._mode)===o:t===this._gid?(f&this._mode)===f:(l&this._mode)===l),r},h.prototype.getATime=function(){return this._atime},h.prototype.setATime=function(e){this._atime=e},h.prototype.getCTime=function(){return this._ctime},h.prototype.setCTime=function(e){this._ctime=e},h.prototype.getBirthtime=function(){return this._birthtime},h.prototype.setBirthtime=function(e){this._birthtime=e},h.prototype.getMTime=function(){return this._mtime},h.prototype.setMTime=function(e){this._mtime=e},h.prototype.getMode=function(){return this._mode},h.prototype.setMode=function(e){this.setCTime(new Date),this._mode=e},h.prototype.getUid=function(){return this._uid},h.prototype.setUid=function(e){this.setCTime(new Date),this._uid=e},h.prototype.getGid=function(){return this._gid},h.prototype.setGid=function(e){this.setCTime(new Date),this._gid=e},h.prototype.getStats=function(){return{dev:8675309,nlink:this.links,uid:this.getUid(),gid:this.getGid(),rdev:0,blksize:4096,ino:this._id,atime:this.getATime(),mtime:this.getMTime(),ctime:this.getCTime(),birthtime:this.getBirthtime(),atimeMs:+this.getATime(),mtimeMs:+this.getMTime(),ctimeMs:+this.getCTime(),birthtimeMs:+this.getBirthtime()}},h.prototype.toString=function(){return"["+this.constructor.name+"]"},e.exports=h},function(e,t,r){"use strict";const n=process.binding("uv"),a={};function i(e,t){if(!a.hasOwnProperty(e))throw new Error("Programmer error, invalid error code: "+e);Error.call(this);const r=a[e];let n=e+", "+r.message;t&&(n+=" '"+t+"'"),this.message=n,this.code=e,this.errno=r.errno,void 0!==t&&(this.path=t),Error.captureStackTrace(this,i)}n.errmap?n.errmap.forEach((function(e,t){const r=e[0],n=e[1];a[r]={errno:t,message:n}})):Object.keys(n).forEach((function(e){if(e.startsWith("UV_")){const t=e.slice(3),r=n[e];a[t]={errno:r,message:e}}})),i.prototype=new Error,i.codes=a,e.exports=i},function(e,t,r){var n=r(0),a=r(55),i=r(3).EventEmitter,o=r(363),c=r(956),s=r(957).Validation,f=a.bufferAllocUnsafe,d=a.bufferFromString;var u="setImmediate"in global?global.setImmediate.bind(global):process.nextTick.bind(process),l=0;function b(e,t,r,n,s){if(this._debug=a.BufferingLogger("websocket:connection",++l),this._debug("constructor"),this._debug.enabled&&function(e,t){if(!e._debug.enabled)return;var r=t.emit;for(var n in t.emit=function(t){e._debug("||| Socket Event '%s'",t),r.apply(this,arguments)},t)"function"==typeof t[n]&&-1===["emit"].indexOf(n)&&function(r){var n=t[r];t[r]="on"!==r?function(){return e._debug("||| Socket method called: %s",r),n.apply(this,arguments)}:function(){return e._debug("||| Socket method called: %s (%s)",r,arguments[0]),n.apply(this,arguments)}}(n)}(this,e),i.call(this),this._pingListenerCount=0,this.on("newListener",(function(e){"ping"===e&&this._pingListenerCount++})).on("removeListener",(function(e){"ping"===e&&this._pingListenerCount--})),this.config=s,this.socket=e,this.protocol=r,this.extensions=t,this.remoteAddress=e.remoteAddress,this.closeReasonCode=-1,this.closeDescription=null,this.closeEventEmitted=!1,this.maskOutgoingPackets=n,this.maskBytes=f(4),this.frameHeader=f(10),this.bufferList=new c,this.currentFrame=new o(this.maskBytes,this.frameHeader,this.config),this.fragmentationSize=0,this.frameQueue=[],this.connected=!0,this.state="open",this.waitingForCloseResponse=!1,this.receivedEnd=!1,this.closeTimeout=this.config.closeTimeout,this.assembleFragments=this.config.assembleFragments,this.maxReceivedMessageSize=this.config.maxReceivedMessageSize,this.outputBufferFull=!1,this.inputPaused=!1,this.receivedDataHandler=this.processReceivedData.bind(this),this._closeTimerHandler=this.handleCloseTimer.bind(this),this.socket.setNoDelay(this.config.disableNagleAlgorithm),this.socket.setTimeout(0),this.config.keepalive&&!this.config.useNativeKeepalive){if("number"!=typeof this.config.keepaliveInterval)throw new Error("keepaliveInterval must be specified and numeric if keepalive is true.");if(this._keepaliveTimerHandler=this.handleKeepaliveTimer.bind(this),this.setKeepaliveTimer(),this.config.dropConnectionOnKeepaliveTimeout){if("number"!=typeof this.config.keepaliveGracePeriod)throw new Error("keepaliveGracePeriod must be specified and numeric if dropConnectionOnKeepaliveTimeout is true.");this._gracePeriodTimerHandler=this.handleGracePeriodTimer.bind(this)}}else if(this.config.keepalive&&this.config.useNativeKeepalive){if(!("setKeepAlive"in this.socket))throw new Error("Unable to use native keepalive: unsupported by this version of Node.");this.socket.setKeepAlive(!0,this.config.keepaliveInterval)}this.socket.removeAllListeners("error")}function p(e){return!(e<1e3)&&(e>=1e3&&e<=2999?-1!==[1e3,1001,1002,1003,1007,1008,1009,1010,1011,1012,1013,1014].indexOf(e):e>=3e3&&e<=3999||(e>=4e3&&e<=4999||!(e>=5e3)&&void 0))}b.CLOSE_REASON_NORMAL=1e3,b.CLOSE_REASON_GOING_AWAY=1001,b.CLOSE_REASON_PROTOCOL_ERROR=1002,b.CLOSE_REASON_UNPROCESSABLE_INPUT=1003,b.CLOSE_REASON_RESERVED=1004,b.CLOSE_REASON_NOT_PROVIDED=1005,b.CLOSE_REASON_ABNORMAL=1006,b.CLOSE_REASON_INVALID_DATA=1007,b.CLOSE_REASON_POLICY_VIOLATION=1008,b.CLOSE_REASON_MESSAGE_TOO_BIG=1009,b.CLOSE_REASON_EXTENSION_REQUIRED=1010,b.CLOSE_REASON_INTERNAL_SERVER_ERROR=1011,b.CLOSE_REASON_TLS_HANDSHAKE_FAILED=1015,b.CLOSE_DESCRIPTIONS={1e3:"Normal connection closure",1001:"Remote peer is going away",1002:"Protocol error",1003:"Unprocessable input",1004:"Reserved",1005:"Reason not provided",1006:"Abnormal closure, no further detail available",1007:"Invalid data received",1008:"Policy violation",1009:"Message too big",1010:"Extension requested by client is required",1011:"Internal Server Error",1015:"TLS Handshake Failed"},n.inherits(b,i),b.prototype._addSocketEventListeners=function(){this.socket.on("error",this.handleSocketError.bind(this)),this.socket.on("end",this.handleSocketEnd.bind(this)),this.socket.on("close",this.handleSocketClose.bind(this)),this.socket.on("drain",this.handleSocketDrain.bind(this)),this.socket.on("pause",this.handleSocketPause.bind(this)),this.socket.on("resume",this.handleSocketResume.bind(this)),this.socket.on("data",this.handleSocketData.bind(this))},b.prototype.setKeepaliveTimer=function(){this._debug("setKeepaliveTimer"),this.config.keepalive&&!this.config.useNativeKeepalive&&(this.clearKeepaliveTimer(),this.clearGracePeriodTimer(),this._keepaliveTimeoutID=setTimeout(this._keepaliveTimerHandler,this.config.keepaliveInterval))},b.prototype.clearKeepaliveTimer=function(){this._keepaliveTimeoutID&&clearTimeout(this._keepaliveTimeoutID)},b.prototype.handleKeepaliveTimer=function(){this._debug("handleKeepaliveTimer"),this._keepaliveTimeoutID=null,this.ping(),this.config.dropConnectionOnKeepaliveTimeout?this.setGracePeriodTimer():this.setKeepaliveTimer()},b.prototype.setGracePeriodTimer=function(){this._debug("setGracePeriodTimer"),this.clearGracePeriodTimer(),this._gracePeriodTimeoutID=setTimeout(this._gracePeriodTimerHandler,this.config.keepaliveGracePeriod)},b.prototype.clearGracePeriodTimer=function(){this._gracePeriodTimeoutID&&clearTimeout(this._gracePeriodTimeoutID)},b.prototype.handleGracePeriodTimer=function(){this._debug("handleGracePeriodTimer"),this._gracePeriodTimeoutID=null,this.drop(b.CLOSE_REASON_ABNORMAL,"Peer not responding.",!0)},b.prototype.handleSocketData=function(e){this._debug("handleSocketData"),this.setKeepaliveTimer(),this.bufferList.write(e),this.processReceivedData()},b.prototype.processReceivedData=function(){if(this._debug("processReceivedData"),this.connected&&!this.inputPaused){var e=this.currentFrame;if(e.addData(this.bufferList)){var t=this;if(e.protocolError)return this._debug("-- protocol error"),void process.nextTick((function(){t.drop(b.CLOSE_REASON_PROTOCOL_ERROR,e.dropReason)}));if(e.frameTooLarge)return this._debug("-- frame too large"),void process.nextTick((function(){t.drop(b.CLOSE_REASON_MESSAGE_TOO_BIG,e.dropReason)}));if(e.rsv1||e.rsv2||e.rsv3)return this._debug("-- illegal rsv flag"),void process.nextTick((function(){t.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unsupported usage of rsv bits without negotiated extension.")}));this.assembleFragments||(this._debug("-- emitting frame"),process.nextTick((function(){t.emit("frame",e)}))),process.nextTick((function(){t.processFrame(e)})),this.currentFrame=new o(this.maskBytes,this.frameHeader,this.config),this.bufferList.length>0&&u(this.receivedDataHandler)}else this._debug("-- insufficient data for frame")}},b.prototype.handleSocketError=function(e){this._debug("handleSocketError: %j",e),"closed"!==this.state?(this.closeReasonCode=b.CLOSE_REASON_ABNORMAL,this.closeDescription="Socket Error: "+e.syscall+" "+e.code,this.connected=!1,this.state="closed",this.fragmentationSize=0,a.eventEmitterListenerCount(this,"error")>0&&this.emit("error",e),this.socket.destroy(e),this._debug.printOutput()):this._debug(" --- Socket 'error' after 'close'")},b.prototype.handleSocketEnd=function(){this._debug("handleSocketEnd: received socket end. state = %s",this.state),this.receivedEnd=!0,"closed"!==this.state?"peer_requested_close"!==this.state&&"ending"!==this.state&&(this._debug(" --- UNEXPECTED socket end."),this.socket.end()):this._debug(" --- Socket 'end' after 'close'")},b.prototype.handleSocketClose=function(e){this._debug("handleSocketClose: received socket close"),this.socketHadError=e,this.connected=!1,this.state="closed",-1===this.closeReasonCode&&(this.closeReasonCode=b.CLOSE_REASON_ABNORMAL,this.closeDescription="Connection dropped by remote peer."),this.clearCloseTimer(),this.clearKeepaliveTimer(),this.clearGracePeriodTimer(),this.closeEventEmitted||(this.closeEventEmitted=!0,this._debug("-- Emitting WebSocketConnection close event"),this.emit("close",this.closeReasonCode,this.closeDescription))},b.prototype.handleSocketDrain=function(){this._debug("handleSocketDrain: socket drain event"),this.outputBufferFull=!1,this.emit("drain")},b.prototype.handleSocketPause=function(){this._debug("handleSocketPause: socket pause event"),this.inputPaused=!0,this.emit("pause")},b.prototype.handleSocketResume=function(){this._debug("handleSocketResume: socket resume event"),this.inputPaused=!1,this.emit("resume"),this.processReceivedData()},b.prototype.pause=function(){this._debug("pause: pause requested"),this.socket.pause()},b.prototype.resume=function(){this._debug("resume: resume requested"),this.socket.resume()},b.prototype.close=function(e,t){if(this.connected){if(this._debug("close: Initating clean WebSocket close sequence."),"number"!=typeof e&&(e=b.CLOSE_REASON_NORMAL),!p(e))throw new Error("Close code "+e+" is not valid.");"string"!=typeof t&&(t=b.CLOSE_DESCRIPTIONS[e]),this.closeReasonCode=e,this.closeDescription=t,this.setCloseTimer(),this.sendCloseFrame(this.closeReasonCode,this.closeDescription),this.state="ending",this.connected=!1}},b.prototype.drop=function(e,t,r){this._debug("drop"),"number"!=typeof e&&(e=b.CLOSE_REASON_PROTOCOL_ERROR),"string"!=typeof t&&(t=b.CLOSE_DESCRIPTIONS[e]),this._debug("Forcefully dropping connection. skipCloseFrame: %s, code: %d, description: %s",r,e,t),this.closeReasonCode=e,this.closeDescription=t,this.frameQueue=[],this.fragmentationSize=0,r||this.sendCloseFrame(e,t),this.connected=!1,this.state="closed",this.clearCloseTimer(),this.clearKeepaliveTimer(),this.clearGracePeriodTimer(),this.closeEventEmitted||(this.closeEventEmitted=!0,this._debug("Emitting WebSocketConnection close event"),this.emit("close",this.closeReasonCode,this.closeDescription)),this._debug("Drop: destroying socket"),this.socket.destroy()},b.prototype.setCloseTimer=function(){this._debug("setCloseTimer"),this.clearCloseTimer(),this._debug("Setting close timer"),this.waitingForCloseResponse=!0,this.closeTimer=setTimeout(this._closeTimerHandler,this.closeTimeout)},b.prototype.clearCloseTimer=function(){this._debug("clearCloseTimer"),this.closeTimer&&(this._debug("Clearing close timer"),clearTimeout(this.closeTimer),this.waitingForCloseResponse=!1,this.closeTimer=null)},b.prototype.handleCloseTimer=function(){this._debug("handleCloseTimer"),this.closeTimer=null,this.waitingForCloseResponse&&(this._debug("Close response not received from client. Forcing socket end."),this.waitingForCloseResponse=!1,this.state="closed",this.socket.end())},b.prototype.processFrame=function(e){if(this._debug("processFrame"),this._debug(" -- frame: %s",e),0!==this.frameQueue.length&&e.opcode>0&&e.opcode<8)this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Illegal frame opcode 0x"+e.opcode.toString(16)+" received in middle of fragmented message.");else switch(e.opcode){case 2:this._debug("-- Binary Frame"),this.assembleFragments&&(e.fin?(this._debug("---- Emitting 'message' event"),this.emit("message",{type:"binary",binaryData:e.binaryPayload})):(this.frameQueue.push(e),this.fragmentationSize=e.length));break;case 1:if(this._debug("-- Text Frame"),this.assembleFragments)if(e.fin){if(!s.isValidUTF8(e.binaryPayload))return void this.drop(b.CLOSE_REASON_INVALID_DATA,"Invalid UTF-8 Data Received");this._debug("---- Emitting 'message' event"),this.emit("message",{type:"utf8",utf8Data:e.binaryPayload.toString("utf8")})}else this.frameQueue.push(e),this.fragmentationSize=e.length;break;case 0:if(this._debug("-- Continuation Frame"),this.assembleFragments){if(0===this.frameQueue.length)return void this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unexpected Continuation Frame");if(this.fragmentationSize+=e.length,this.fragmentationSize>this.maxReceivedMessageSize)return void this.drop(b.CLOSE_REASON_MESSAGE_TOO_BIG,"Maximum message size exceeded.");if(this.frameQueue.push(e),e.fin){var t=0,r=f(this.fragmentationSize),n=this.frameQueue[0].opcode;switch(this.frameQueue.forEach((function(e){e.binaryPayload.copy(r,t),t+=e.binaryPayload.length})),this.frameQueue=[],this.fragmentationSize=0,n){case 2:this.emit("message",{type:"binary",binaryData:r});break;case 1:if(!s.isValidUTF8(r))return void this.drop(b.CLOSE_REASON_INVALID_DATA,"Invalid UTF-8 Data Received");this.emit("message",{type:"utf8",utf8Data:r.toString("utf8")});break;default:return void this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unexpected first opcode in fragmentation sequence: 0x"+n.toString(16))}}}break;case 9:if(this._debug("-- Ping Frame"),this._pingListenerCount>0){var a=!1;this.emit("ping",(function(){a=!0}),e.binaryPayload),a||this.pong(e.binaryPayload)}else this.pong(e.binaryPayload);break;case 10:this._debug("-- Pong Frame"),this.emit("pong",e.binaryPayload);break;case 8:if(this._debug("-- Close Frame"),this.waitingForCloseResponse)return this._debug("---- Got close response from peer. Completing closing handshake."),this.clearCloseTimer(),this.waitingForCloseResponse=!1,this.state="closed",void this.socket.end();var i;if(this._debug("---- Closing handshake initiated by peer."),this.state="peer_requested_close",e.invalidCloseFrameLength?(this.closeReasonCode=1005,i=b.CLOSE_REASON_PROTOCOL_ERROR):-1===e.closeStatus||p(e.closeStatus)?(this.closeReasonCode=e.closeStatus,i=b.CLOSE_REASON_NORMAL):(this.closeReasonCode=e.closeStatus,i=b.CLOSE_REASON_PROTOCOL_ERROR),e.binaryPayload.length>1){if(!s.isValidUTF8(e.binaryPayload))return void this.drop(b.CLOSE_REASON_INVALID_DATA,"Invalid UTF-8 Data Received");this.closeDescription=e.binaryPayload.toString("utf8")}else this.closeDescription=b.CLOSE_DESCRIPTIONS[this.closeReasonCode];this._debug("------ Remote peer %s - code: %d - %s - close frame payload length: %d",this.remoteAddress,this.closeReasonCode,this.closeDescription,e.length),this._debug("------ responding to remote peer's close request."),this.sendCloseFrame(i,null),this.connected=!1;break;default:this._debug("-- Unrecognized Opcode %d",e.opcode),this.drop(b.CLOSE_REASON_PROTOCOL_ERROR,"Unrecognized Opcode: 0x"+e.opcode.toString(16))}},b.prototype.send=function(e,t){if(this._debug("send"),Buffer.isBuffer(e))this.sendBytes(e,t);else{if("function"!=typeof e.toString)throw new Error("Data provided must either be a Node Buffer or implement toString()");this.sendUTF(e,t)}},b.prototype.sendUTF=function(e,t){e=d(e.toString(),"utf8"),this._debug("sendUTF: %d bytes",e.length);var r=new o(this.maskBytes,this.frameHeader,this.config);r.opcode=1,r.binaryPayload=e,this.fragmentAndSend(r,t)},b.prototype.sendBytes=function(e,t){if(this._debug("sendBytes"),!Buffer.isBuffer(e))throw new Error("You must pass a Node Buffer object to WebSocketConnection.prototype.sendBytes()");var r=new o(this.maskBytes,this.frameHeader,this.config);r.opcode=2,r.binaryPayload=e,this.fragmentAndSend(r,t)},b.prototype.ping=function(e){this._debug("ping");var t=new o(this.maskBytes,this.frameHeader,this.config);t.opcode=9,t.fin=!0,e&&(Buffer.isBuffer(e)||(e=d(e.toString(),"utf8")),e.length>125&&(this._debug("WebSocket: Data for ping is longer than 125 bytes. Truncating."),e=e.slice(0,124)),t.binaryPayload=e),this.sendFrame(t)},b.prototype.pong=function(e){this._debug("pong");var t=new o(this.maskBytes,this.frameHeader,this.config);t.opcode=10,Buffer.isBuffer(e)&&e.length>125&&(this._debug("WebSocket: Data for pong is longer than 125 bytes. Truncating."),e=e.slice(0,124)),t.binaryPayload=e,t.fin=!0,this.sendFrame(t)},b.prototype.fragmentAndSend=function(e,t){if(this._debug("fragmentAndSend"),e.opcode>7)throw new Error("You cannot fragment control frames.");var r=this.config.fragmentationThreshold,n=e.binaryPayload.length;if(!this.config.fragmentOutgoingMessages||e.binaryPayload&&n<=r)return e.fin=!0,void this.sendFrame(e,t);for(var a=Math.ceil(n/r),i=0,c=function(e){e?"function"==typeof t&&(t(e),t=null):++i===a&&"function"==typeof t&&t()},s=1;s<=a;s++){var f=new o(this.maskBytes,this.frameHeader,this.config);f.opcode=1===s?e.opcode:0,f.fin=s===a;var d=s===a?n-r*(s-1):r,u=r*(s-1);f.binaryPayload=e.binaryPayload.slice(u,u+d),this.sendFrame(f,c)}},b.prototype.sendCloseFrame=function(e,t,r){if("number"!=typeof e&&(e=b.CLOSE_REASON_NORMAL),this._debug("sendCloseFrame state: %s, reasonCode: %d, description: %s",this.state,e,t),"open"===this.state||"peer_requested_close"===this.state){var n=new o(this.maskBytes,this.frameHeader,this.config);n.fin=!0,n.opcode=8,n.closeStatus=e,"string"==typeof t&&(n.binaryPayload=d(t,"utf8")),this.sendFrame(n,r),this.socket.end()}},b.prototype.sendFrame=function(e,t){this._debug("sendFrame"),e.mask=this.maskOutgoingPackets;var r=this.socket.write(e.toBuffer(),t);return this.outputBufferFull=!r,r},e.exports=b},function(e,t,r){var n=r(167),a=r(66),i=r(168).ArraySet,o=r(372).MappingList;function c(e){e||(e={}),this._file=a.getArg(e,"file",null),this._sourceRoot=a.getArg(e,"sourceRoot",null),this._skipValidation=a.getArg(e,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new o,this._sourcesContents=null}c.prototype._version=3,c.fromSourceMap=function(e){var t=e.sourceRoot,r=new c({file:e.file,sourceRoot:t});return e.eachMapping((function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=t&&(n.source=a.relative(t,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)})),e.sources.forEach((function(n){var i=n;null!==t&&(i=a.relative(t,n)),r._sources.has(i)||r._sources.add(i);var o=e.sourceContentFor(n);null!=o&&r.setSourceContent(n,o)})),r},c.prototype.addMapping=function(e){var t=a.getArg(e,"generated"),r=a.getArg(e,"original",null),n=a.getArg(e,"source",null),i=a.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,i),null!=n&&(n=String(n),this._sources.has(n)||this._sources.add(n)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:n,name:i})},c.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=a.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[a.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[a.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},c.prototype.applySourceMap=function(e,t,r){var n=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}var o=this._sourceRoot;null!=o&&(n=a.relative(o,n));var c=new i,s=new i;this._mappings.unsortedForEach((function(t){if(t.source===n&&null!=t.originalLine){var i=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=i.source&&(t.source=i.source,null!=r&&(t.source=a.join(r,t.source)),null!=o&&(t.source=a.relative(o,t.source)),t.originalLine=i.line,t.originalColumn=i.column,null!=i.name&&(t.name=i.name))}var f=t.source;null==f||c.has(f)||c.add(f);var d=t.name;null==d||s.has(d)||s.add(d)}),this),this._sources=c,this._names=s,e.sources.forEach((function(t){var n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=a.join(r,t)),null!=o&&(t=a.relative(o,t)),this.setSourceContent(t,n))}),this)},c.prototype._validateMapping=function(e,t,r,n){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},c.prototype._serializeMappings=function(){for(var e,t,r,i,o=0,c=1,s=0,f=0,d=0,u=0,l="",b=this._mappings.toArray(),p=0,h=b.length;p<h;p++){if(e="",(t=b[p]).generatedLine!==c)for(o=0;t.generatedLine!==c;)e+=";",c++;else if(p>0){if(!a.compareByGeneratedPositionsInflated(t,b[p-1]))continue;e+=","}e+=n.encode(t.generatedColumn-o),o=t.generatedColumn,null!=t.source&&(i=this._sources.indexOf(t.source),e+=n.encode(i-u),u=i,e+=n.encode(t.originalLine-1-f),f=t.originalLine-1,e+=n.encode(t.originalColumn-s),s=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=n.encode(r-d),d=r)),l+=e}return l},c.prototype._generateSourcesContent=function(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=a.relative(t,e));var r=a.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},c.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},c.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.SourceMapGenerator=c},function(e,t,r){var n=r(371);t.encode=function(e){var t,r="",a=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&a,(a>>>=5)>0&&(t|=32),r+=n.encode(t)}while(a>0);return r},t.decode=function(e,t,r){var a,i,o,c,s=e.length,f=0,d=0;do{if(t>=s)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(i=n.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));a=!!(32&i),f+=(i&=31)<<d,d+=5}while(a);r.value=(c=(o=f)>>1,1==(1&o)?-c:c),r.rest=t}},function(e,t,r){var n=r(66),a=Object.prototype.hasOwnProperty,i="undefined"!=typeof Map;function o(){this._array=[],this._set=i?new Map:Object.create(null)}o.fromArray=function(e,t){for(var r=new o,n=0,a=e.length;n<a;n++)r.add(e[n],t);return r},o.prototype.size=function(){return i?this._set.size:Object.getOwnPropertyNames(this._set).length},o.prototype.add=function(e,t){var r=i?e:n.toSetString(e),o=i?this.has(e):a.call(this._set,r),c=this._array.length;o&&!t||this._array.push(e),o||(i?this._set.set(e,c):this._set[r]=c)},o.prototype.has=function(e){if(i)return this._set.has(e);var t=n.toSetString(e);return a.call(this._set,t)},o.prototype.indexOf=function(e){if(i){var t=this._set.get(e);if(t>=0)return t}else{var r=n.toSetString(e);if(a.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},o.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},o.prototype.toArray=function(){return this._array.slice()},t.ArraySet=o},function(e,t,r){r(109);let n=r(379),a=r(456),i=r(460),o=r(461),c=r(462),s=r(463),f=r(945),d=r(81),u=r(3),l=r(99);function b(e){const t=this;u.call(this),this.options=e=t._applyDefaultOptions(e||{});let r=new s(e,this);this.engine=new n({blockTracker:new f({blockchain:r.state.blockchain})});let d=new a;this.engine.manager=r,this.engine.addProvider(new i),this.engine.addProvider(new o),this.engine.addProvider(d),this.engine.addProvider(new c),this.engine.addProvider(r),this.engine.setMaxListeners(100),this.engine.start(),this.manager=r,this.sendAsync=this.send.bind(this),this.send=this.send.bind(this),this.close=this.close.bind(this),this._queueRequest=this._queueRequest.bind(this),this._processRequestQueue=this._processRequestQueue.bind(this),d.on("data",(function(e,r){t.emit("data",e,r)}))}const p={_chainId:1,vmErrorsOnRPCResponse:!0,verbose:!1,asyncRequestProcessing:!1,logger:{log:function(){}}};b.prototype=Object.create(u.prototype),b.prototype.constructor=b,b.prototype._applyDefaultOptions=function(e){return l.merge({},p,e)},b.prototype.send=function(e,t){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.");let r=this,n=function(e){return l.cloneDeep(e)};e=Array.isArray(e)?e.map(n):n(e);let a=function(n,a){let i;if(a=l.cloneDeep(a),Array.isArray(a)){i=[];for(let t=0;t<a.length;t++)i.push(r.reportErrorInResponse(e[t],n,a[t]))}else i=r.reportErrorInResponse(e,n,a);r.options.verbose&&r.options.logger.log(" < "+JSON.stringify(i,null,2).split("\n").join("\n < ")),process.nextTick(()=>t(i.error?n:null,i))};r.options.verbose&&r.options.logger.log(" > "+JSON.stringify(e,null,2).split("\n").join("\n > ")),r.options.asyncRequestProcessing?r.engine.sendAsync(e,a):r._queueRequest(e,a)},b.prototype.close=function(e){this.manager.state.stopMining(),this.manager.state.blockchain.close(e),this.engine.stop()},b.prototype._queueRequest=function(e,t){this._requestQueue||(this._requestQueue=[]),this._requestQueue.push({payload:e,callback:t}),setImmediate(this._processRequestQueue)},b.prototype._processRequestQueue=function(){const e=this;if(e._requestInProgress)return;e._requestInProgress=!0;let t=e._requestQueue.shift();t?e.engine.sendAsync(t.payload,(r,n)=>{e._requestQueue.length>0&&setImmediate(e._processRequestQueue),t.callback(r,n),e._requestInProgress=!1}):(e._requestInProgress=!1,e._requestQueue.length>0&&setImmediate(e._processRequestQueue))},b.prototype.cleanUpErrorObject=function(e,t){if(!e||!t.error)return t;let r={error:{data:{}}};return e.message?(r.error.message=e.message,r.error.data.stack=e.stack,r.error.data.name=e.name,"code"in e&&(r.error.code=e.code)):t.error||(r.error={message:e.toString()}),l.merge(t,r)};const h=new Set(["eth_sendTransaction","eth_sendRawTransaction","personal_sendTransaction"]);b.prototype._isTransactionRequest=function(e){return h.has(e.method)},b.prototype.reportErrorInResponse=function(e,t,r){const n=this;return t?(n._isTransactionRequest(e)&&t instanceof d&&(r.result=t.hashes[0],n.options.vmErrorsOnRPCResponse?(r.error.data||(r.error.data={}),r.error.data[t.hashes[0]]=t.results[t.hashes[0]]):delete r.error),"eth_call"===e.method&&t instanceof d&&(n.options.vmErrorsOnRPCResponse?(r.error.data||(r.error.data={}),r.error.data[t.hashes[0]]=t.results[t.hashes[0]]):(r.result=t.results[t.hashes[0]].return||"0x",delete r.error)),n.cleanUpErrorObject(t,r)):r},e.exports=b},function(e,t,r){"use strict";var n=r(381),a=r(383);e.exports=function(e){var t=n(e),r=a(e);return function(e,n){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}},function(e,t,r){(function(n){var a=r(8),i=r(2),o=r(384),c=i.join,s=i.dirname,f=a.accessSync&&function(e){try{a.accessSync(e)}catch(e){return!1}return!0}||a.existsSync||i.existsSync,d={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};e.exports=t=function(e){"string"==typeof e?e={bindings:e}:e||(e={}),Object.keys(d).map((function(t){t in e||(e[t]=d[t])})),e.module_root||(e.module_root=t.getRoot(t.getFileName())),".node"!=i.extname(e.bindings)&&(e.bindings+=".node");for(var r,n,a,o=require,s=[],f=0,u=e.try.length;f<u;f++){r=c.apply(null,e.try[f].map((function(t){return e[t]||t}))),s.push(r);try{return n=e.path?o.resolve(r):o(r),e.path||(n.path=r),n}catch(e){if("MODULE_NOT_FOUND"!==e.code&&"QUALIFIED_PATH_RESOLUTION_FAILED"!==e.code&&!/not find/i.test(e.message))throw e}}throw(a=new Error("Could not locate the bindings file. Tried:\n"+s.map((function(t){return e.arrow+t})).join("\n"))).tries=s,a},t.getFileName=function(e){var t,r=Error.prepareStackTrace,a=Error.stackTraceLimit,i={};Error.stackTraceLimit=10,Error.prepareStackTrace=function(r,a){for(var i=0,o=a.length;i<o;i++)if((t=a[i].getFileName())!==n){if(!e)return;if(t!==e)return}},Error.captureStackTrace(i),Error.prepareStackTrace=r,Error.stackTraceLimit=a;return 0===t.indexOf("file://")&&(t=o(t)),t},t.getRoot=function(e){for(var t,r=s(e);;){if("."===r&&(r=process.cwd()),f(c(r,"package.json"))||f(c(r,"node_modules")))return r;if(t===r)throw new Error('Could not find module root given file: "'+e+'". Do you have a `package.json` file? ');t=r,r=c(r,"..")}}}).call(this,"/index.js")},function(e){e.exports=JSON.parse('{"COMPRESSED_TYPE_INVALID":"compressed should be a boolean","EC_PRIVATE_KEY_TYPE_INVALID":"private key should be a Buffer","EC_PRIVATE_KEY_LENGTH_INVALID":"private key length is invalid","EC_PRIVATE_KEY_RANGE_INVALID":"private key range is invalid","EC_PRIVATE_KEY_TWEAK_ADD_FAIL":"tweak out of range or resulting private key is invalid","EC_PRIVATE_KEY_TWEAK_MUL_FAIL":"tweak out of range","EC_PRIVATE_KEY_EXPORT_DER_FAIL":"couldn\'t export to DER format","EC_PRIVATE_KEY_IMPORT_DER_FAIL":"couldn\'t import from DER format","EC_PUBLIC_KEYS_TYPE_INVALID":"public keys should be an Array","EC_PUBLIC_KEYS_LENGTH_INVALID":"public keys Array should have at least 1 element","EC_PUBLIC_KEY_TYPE_INVALID":"public key should be a Buffer","EC_PUBLIC_KEY_LENGTH_INVALID":"public key length is invalid","EC_PUBLIC_KEY_PARSE_FAIL":"the public key could not be parsed or is invalid","EC_PUBLIC_KEY_CREATE_FAIL":"private was invalid, try again","EC_PUBLIC_KEY_TWEAK_ADD_FAIL":"tweak out of range or resulting public key is invalid","EC_PUBLIC_KEY_TWEAK_MUL_FAIL":"tweak out of range","EC_PUBLIC_KEY_COMBINE_FAIL":"the sum of the public keys is not valid","ECDH_FAIL":"scalar was invalid (zero or overflow)","ECDSA_SIGNATURE_TYPE_INVALID":"signature should be a Buffer","ECDSA_SIGNATURE_LENGTH_INVALID":"signature length is invalid","ECDSA_SIGNATURE_PARSE_FAIL":"couldn\'t parse signature","ECDSA_SIGNATURE_PARSE_DER_FAIL":"couldn\'t parse DER signature","ECDSA_SIGNATURE_SERIALIZE_DER_FAIL":"couldn\'t serialize signature to DER format","ECDSA_SIGN_FAIL":"nonce generation function failed or private key is invalid","ECDSA_RECOVER_FAIL":"couldn\'t recover public key from signature","MSG32_TYPE_INVALID":"message should be a Buffer","MSG32_LENGTH_INVALID":"message length is invalid","OPTIONS_TYPE_INVALID":"options should be an Object","OPTIONS_DATA_TYPE_INVALID":"options.data should be a Buffer","OPTIONS_DATA_LENGTH_INVALID":"options.data length is invalid","OPTIONS_NONCEFN_TYPE_INVALID":"options.noncefn should be a Function","RECOVERY_ID_TYPE_INVALID":"recovery should be a Number","RECOVERY_ID_VALUE_INVALID":"recovery should have value between -1 and 4","TWEAK_TYPE_INVALID":"tweak should be a Buffer","TWEAK_LENGTH_INVALID":"tweak length is invalid"}')},function(e,t,r){"use strict";var n=t;function a(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=a(e[r].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var a=e.charCodeAt(n),i=a>>8,o=255&a;i?r.push(i,o):r.push(o)}return r},n.zero2=a,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}},function(e,t,r){"use strict";var n=t;n.base=r(80),n.short=r(396),n.mont=r(397),n.edwards=r(398)},function(e,t,r){"use strict";var n=r(31).rotr32;function a(e,t,r){return e&t^~e&r}function i(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?a(t,r,n):1===e||3===e?o(t,r,n):2===e?i(t,r,n):void 0},t.ch32=a,t.maj32=i,t.p32=o,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},function(e,t,r){"use strict";var n=r(31),a=r(68),i=r(175),o=r(39),c=n.sum32,s=n.sum32_4,f=n.sum32_5,d=i.ch32,u=i.maj32,l=i.s0_256,b=i.s1_256,p=i.g0_256,h=i.g1_256,m=a.BlockHash,x=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=x,this.W=new Array(64)}n.inherits(v,m),e.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=s(h(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var a=this.h[0],i=this.h[1],m=this.h[2],x=this.h[3],v=this.h[4],g=this.h[5],y=this.h[6],A=this.h[7];for(o(this.k.length===r.length),n=0;n<r.length;n++){var w=f(A,b(v),d(v,g,y),this.k[n],r[n]),_=c(l(a),u(a,i,m));A=y,y=g,g=v,v=c(x,w),x=m,m=i,i=a,a=c(w,_)}this.h[0]=c(this.h[0],a),this.h[1]=c(this.h[1],i),this.h[2]=c(this.h[2],m),this.h[3]=c(this.h[3],x),this.h[4]=c(this.h[4],v),this.h[5]=c(this.h[5],g),this.h[6]=c(this.h[6],y),this.h[7]=c(this.h[7],A)},v.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t,r){"use strict";var n=r(31),a=r(68),i=r(39),o=n.rotr64_hi,c=n.rotr64_lo,s=n.shr64_hi,f=n.shr64_lo,d=n.sum64,u=n.sum64_hi,l=n.sum64_lo,b=n.sum64_4_hi,p=n.sum64_4_lo,h=n.sum64_5_hi,m=n.sum64_5_lo,x=a.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function g(){if(!(this instanceof g))return new g;x.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function y(e,t,r,n,a){var i=e&r^~e&a;return i<0&&(i+=4294967296),i}function A(e,t,r,n,a,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function w(e,t,r,n,a){var i=e&r^e&a^r&a;return i<0&&(i+=4294967296),i}function _(e,t,r,n,a,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function k(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function E(e,t){var r=c(e,t,28)^c(t,e,2)^c(t,e,7);return r<0&&(r+=4294967296),r}function S(e,t){var r=o(e,t,14)^o(e,t,18)^o(t,e,9);return r<0&&(r+=4294967296),r}function T(e,t){var r=c(e,t,14)^c(e,t,18)^c(t,e,9);return r<0&&(r+=4294967296),r}function O(e,t){var r=o(e,t,1)^o(e,t,8)^s(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=c(e,t,1)^c(e,t,8)^f(e,t,7);return r<0&&(r+=4294967296),r}function C(e,t){var r=o(e,t,19)^o(t,e,29)^s(e,t,6);return r<0&&(r+=4294967296),r}function B(e,t){var r=c(e,t,19)^c(t,e,29)^f(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(g,x),e.exports=g,g.blockSize=1024,g.outSize=512,g.hmacStrength=192,g.padLength=128,g.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var a=C(r[n-4],r[n-3]),i=B(r[n-4],r[n-3]),o=r[n-14],c=r[n-13],s=O(r[n-30],r[n-29]),f=R(r[n-30],r[n-29]),d=r[n-32],u=r[n-31];r[n]=b(a,i,o,c,s,f,d,u),r[n+1]=p(a,i,o,c,s,f,d,u)}},g.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],a=this.h[1],o=this.h[2],c=this.h[3],s=this.h[4],f=this.h[5],b=this.h[6],p=this.h[7],x=this.h[8],v=this.h[9],g=this.h[10],O=this.h[11],R=this.h[12],C=this.h[13],B=this.h[14],I=this.h[15];i(this.k.length===r.length);for(var N=0;N<r.length;N+=2){var P=B,L=I,M=S(x,v),j=T(x,v),F=y(x,v,g,O,R),D=A(x,v,g,O,R,C),U=this.k[N],z=this.k[N+1],H=r[N],q=r[N+1],G=h(P,L,M,j,F,D,U,z,H,q),V=m(P,L,M,j,F,D,U,z,H,q);P=k(n,a),L=E(n,a),M=w(n,a,o,c,s),j=_(n,a,o,c,s,f);var W=u(P,L,M,j),K=l(P,L,M,j);B=R,I=C,R=g,C=O,g=x,O=v,x=u(b,p,G,V),v=l(p,p,G,V),b=s,p=f,s=o,f=c,o=n,c=a,n=u(G,V,W,K),a=l(G,V,W,K)}d(this.h,0,n,a),d(this.h,2,o,c),d(this.h,4,s,f),d(this.h,6,b,p),d(this.h,8,x,v),d(this.h,10,g,O),d(this.h,12,R,C),d(this.h,14,B,I)},g.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},function(e,t){e.exports=function(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof e+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},function(e,t,r){var n=r(178);e.exports=function(e){return"string"!=typeof e?e:n(e)?e.slice(2):e}},function(e,t,r){var n=r(181).Symbol;e.exports=n},function(e,t,r){var n=r(182),a="object"==typeof self&&self&&self.Object===Object&&self,i=n||a||Function("return this")();e.exports=i},function(e,t){var r="object"==typeof global&&global&&global.Object===Object&&global;e.exports=r},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,s){if(s=(0,a.default)(s||n.default),e<=0||!t)return s(null);var f=(0,i.default)(t),d=!1,u=0,l=!1;function b(e,t){if(u-=1,e)d=!0,s(e);else{if(t===c.default||d&&u<=0)return d=!0,s(null);l||p()}}function p(){for(l=!0;u<e&&!d;){var t=f();if(null===t)return d=!0,void(u<=0&&s(null));u+=1,r(t.value,t.key,(0,o.default)(b))}l=!1}p()}};var n=s(r(116)),a=s(r(187)),i=s(r(425)),o=s(r(188)),c=s(r(185));function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){t|=0;for(var r=Math.max(e.length-t,0),n=Array(r),a=0;a<r;a++)n[a]=e[t+a];return n},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return function(r,n,a){return e(r,t,n,a)}},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=i(r(448)),a=i(r(190));function i(e){return e&&e.__esModule?e:{default:e}}t.default=(0,a.default)(n.default,1),e.exports=t.default},function(e,t,r){const n=r(3).EventEmitter,a=r(0).inherits;function i(){n.call(this),this.isLocked=!0}e.exports=i,a(i,n),i.prototype.go=function(){this.isLocked=!1,this.emit("unlock")},i.prototype.stop=function(){this.isLocked=!0,this.emit("lock")},i.prototype.await=function(e){const t=this;t.isLocked?t.once("unlock",e):setTimeout(e)}},function(e,t,r){const n=r(455),a=r(15);e.exports=function(e){return a({id:n(),jsonrpc:"2.0",params:[]},e)}},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var a=r(7),i=r(29),o=r(13),c=new a.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=function(){function e(e,t){if(void 0===e&&(e={}),void 0===t&&(t={}),t.common){if(t.chain||t.hardfork)throw new Error("Instantiation with both opts.common, and opts.chain and opts.hardfork parameter not allowed!");this._common=t.common}else{var r=t.chain?t.chain:"mainnet",n=t.hardfork?t.hardfork:"petersburg";this._common=new i.default(r,n)}var c=[{name:"nonce",length:32,allowLess:!0,default:new o.Buffer([])},{name:"gasPrice",length:32,allowLess:!0,default:new o.Buffer([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new o.Buffer([])},{name:"to",allowZero:!0,length:20,default:new o.Buffer([])},{name:"value",length:32,allowLess:!0,default:new o.Buffer([])},{name:"data",alias:"input",allowZero:!0,default:new o.Buffer([])},{name:"v",allowZero:!0,default:new o.Buffer([])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new o.Buffer([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new o.Buffer([])}];a.defineProperties(this,c,e),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)}),this._validateV(this.v),this._overrideVSetterWithValidation()}return e.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},e.prototype.hash=function(e){var t;return void 0===e&&(e=!0),t=e?this.raw:this._implementsEIP155()?this.raw.slice(0,6).concat([a.toBuffer(this.getChainId()),a.stripZeros(a.toBuffer(0)),a.stripZeros(a.toBuffer(0))]):this.raw.slice(0,6),a.rlphash(t)},e.prototype.getChainId=function(){return this._common.chainId()},e.prototype.getSenderAddress=function(){if(this._from)return this._from;var e=this.getSenderPublicKey();return this._from=a.publicToAddress(e),this._from},e.prototype.getSenderPublicKey=function(){if(!this.verifySignature())throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function(){var e=this.hash(!1);if(this._common.gteHardfork("homestead")&&1===new a.BN(this.s).cmp(c))return!1;try{var t=a.bufferToInt(this.v),r=t>=2*this.getChainId()+35&&this._common.gteHardfork("spuriousDragon");this._senderPubKey=a.ecrecover(e,t,this.r,this.s,r?this.getChainId():void 0)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function(e){this.v=new o.Buffer([]),this.s=new o.Buffer([]),this.r=new o.Buffer([]);var t=this.hash(!1),r=a.ecsign(t,e);this._implementsEIP155()&&(r.v+=2*this.getChainId()+8),Object.assign(this,r)},e.prototype.getDataFee=function(){for(var e=this.raw[5],t=new a.BN(0),r=0;r<e.length;r++)0===e[r]?t.iaddn(this._common.param("gasPrices","txDataZero")):t.iaddn(this._common.param("gasPrices","txDataNonZero"));return t},e.prototype.getBaseFee=function(){var e=this.getDataFee().iaddn(this._common.param("gasPrices","tx"));return this._common.gteHardfork("homestead")&&this.toCreationAddress()&&e.iaddn(this._common.param("gasPrices","txCreation")),e},e.prototype.getUpfrontCost=function(){return new a.BN(this.gasLimit).imul(new a.BN(this.gasPrice)).iadd(new a.BN(this.value))},e.prototype.validate=function(e){void 0===e&&(e=!1);var t=[];return this.verifySignature()||t.push("Invalid Signature"),this.getBaseFee().cmp(new a.BN(this.gasLimit))>0&&t.push(["gas limit is too low. Need at least "+this.getBaseFee()]),!1===e?0===t.length:t.join(" ")},e.prototype.serialize=function(){return a.rlp.encode(this.raw)},e.prototype.toJSON=function(e){return void 0===e&&(e=!1),{}},e.prototype._validateV=function(e){if(void 0!==e&&0!==e.length&&this._common.gteHardfork("spuriousDragon")){var t=a.bufferToInt(e);if(27!==t&&28!==t)if(!(t===2*this.getChainId()+35||t===2*this.getChainId()+36))throw new Error("Incompatible EIP155-based V "+t+" and chain id "+this.getChainId()+". See the second parameter of the Transaction constructor to set the chain id.")}},e.prototype._isSigned=function(){return this.v.length>0&&this.r.length>0&&this.s.length>0},e.prototype._overrideVSetterWithValidation=function(){var e=this,t=Object.getOwnPropertyDescriptor(this,"v");Object.defineProperty(this,"v",n({},t,{set:function(r){void 0!==r&&e._validateV(a.toBuffer(r)),t.set(r)}}))},e.prototype._implementsEIP155=function(){var e=this._common.gteHardfork("spuriousDragon");if(!this._isSigned())return e;var t=a.bufferToInt(this.v);return(t===2*this.getChainId()+35||t===2*this.getChainId()+36)&&e},e}();t.default=s},function(e,t,r){var n={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20},a=r(196),i=r(119),o=r(197),c=r(5).Buffer;e.exports=function(e,t,r,s,f){i(e,t,r,s),c.isBuffer(e)||(e=c.from(e,o)),c.isBuffer(t)||(t=c.from(t,o)),f=f||"sha1";var d=c.allocUnsafe(s),u=c.allocUnsafe(t.length+4);t.copy(u,0,0,t.length);for(var l=0,b=n[f],p=Math.ceil(s/b),h=1;h<=p;h++){u.writeUInt32BE(h,t.length);for(var m=a(f,e).update(u).digest(),x=m,v=1;v<r;v++){x=a(f,e).update(x).digest();for(var g=0;g<b;g++)m[g]^=x[g]}m.copy(d,l),l+=b}return d}},function(e,t,r){e.exports=r(6).createHmac},function(e,t){var r;process.browser?r="utf-8":r=parseInt(process.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";e.exports=r},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=r(5).Buffer,i=r(7),o=r(6),c=r(47),s=r(503),f=r(202),d=r(511);function u(e,t){if(!e)throw new Error(t||"Assertion failed")}function l(e,t){return a.concat([e.update(t),e.final()])}var b=function(e,t){if(e&&t)throw new Error("Cannot supply both a private and a public key to the constructor");if(e&&!i.isValidPrivate(e))throw new Error("Private key does not satisfy the curve requirements (ie. it is invalid)");if(t&&!i.isValidPublic(t))throw new Error("Invalid public key");this._privKey=e,this._pubKey=t};Object.defineProperty(b.prototype,"privKey",{get:function(){return u(this._privKey,"This is a public key only wallet"),this._privKey}}),Object.defineProperty(b.prototype,"pubKey",{get:function(){return this._pubKey||(this._pubKey=i.privateToPublic(this.privKey)),this._pubKey}}),b.generate=function(e){if(!e)return new b(c(32));for(var t=new i.BN("088f924eeceeda7fe92e1f5b0fffffffffffffff",16);;){var r=c(32);if(new i.BN(i.privateToAddress(r)).lte(t))return new b(r)}},b.generateVanityAddress=function(e){for("object"!==(void 0===e?"undefined":n(e))&&(e=new RegExp(e));;){var t=c(32),r=i.privateToAddress(t);if(e.test(r.toString("hex")))return new b(t)}},b.prototype.getPrivateKey=function(){return this.privKey},b.prototype.getPrivateKeyString=function(){return i.bufferToHex(this.getPrivateKey())},b.prototype.getPublicKey=function(){return this.pubKey},b.prototype.getPublicKeyString=function(){return i.bufferToHex(this.getPublicKey())},b.prototype.getAddress=function(){return i.publicToAddress(this.pubKey)},b.prototype.getAddressString=function(){return i.bufferToHex(this.getAddress())},b.prototype.getChecksumAddressString=function(){return i.toChecksumAddress(this.getAddressString())},b.prototype.toV3=function(e,t){u(this._privKey,"This is a public key only wallet");var r,n=(t=t||{}).salt||c(32),d=t.iv||c(16),l=t.kdf||"scrypt",b={dklen:t.dklen||32,salt:n.toString("hex")};if("pbkdf2"===l)b.c=t.c||262144,b.prf="hmac-sha256",r=o.pbkdf2Sync(a.from(e),n,b.c,b.dklen,"sha256");else{if("scrypt"!==l)throw new Error("Unsupported kdf");b.n=t.n||262144,b.r=t.r||8,b.p=t.p||1,r=s(a.from(e),n,b.n,b.r,b.p,b.dklen)}var p=o.createCipheriv(t.cipher||"aes-128-ctr",r.slice(0,16),d);if(!p)throw new Error("Unsupported cipher");var h=a.concat([p.update(this.privKey),p.final()]),m=i.keccak256(a.concat([r.slice(16,32),a.from(h,"hex")]));return{version:3,id:f({random:t.uuid||c(16)}),address:this.getAddress().toString("hex"),crypto:{ciphertext:h.toString("hex"),cipherparams:{iv:d.toString("hex")},cipher:t.cipher||"aes-128-ctr",kdf:l,kdfparams:b,mac:m.toString("hex")}}},b.prototype.getV3Filename=function(e){return["UTC--",(e?new Date(e):new Date).toJSON().replace(/:/g,"-"),"--",this.getAddress().toString("hex")].join("")},b.prototype.toV3String=function(e,t){return JSON.stringify(this.toV3(e,t))},b.fromPublicKey=function(e,t){return t&&(e=i.importPublic(e)),new b(null,e)},b.fromExtendedPublicKey=function(e){return u("xpub"===e.slice(0,4),"Not an extended public key"),e=d.decode(e).slice(45),b.fromPublicKey(e,!0)},b.fromPrivateKey=function(e){return new b(e)},b.fromExtendedPrivateKey=function(e){u("xprv"===e.slice(0,4),"Not an extended private key");var t=d.decode(e);return u(0===t[45],"Invalid extended private key"),b.fromPrivateKey(t.slice(46))},b.fromV1=function(e,t){u("string"==typeof t);var r="object"===(void 0===e?"undefined":n(e))?e:JSON.parse(e);if("1"!==r.Version)throw new Error("Not a V1 wallet");if("scrypt"!==r.Crypto.KeyHeader.Kdf)throw new Error("Unsupported key derivation scheme");var c=r.Crypto.KeyHeader.KdfParams,f=s(a.from(t),a.from(r.Crypto.Salt,"hex"),c.N,c.R,c.P,c.DkLen),d=a.from(r.Crypto.CipherText,"hex");if(i.keccak256(a.concat([f.slice(16,32),d])).toString("hex")!==r.Crypto.MAC)throw new Error("Key derivation failed - possibly wrong passphrase");var p=l(o.createDecipheriv("aes-128-cbc",i.keccak256(f.slice(0,16)).slice(0,16),a.from(r.Crypto.IV,"hex")),d);return new b(p)},b.fromV3=function(e,t,r){u("string"==typeof t);var c,f,d="object"===(void 0===e?"undefined":n(e))?e:JSON.parse(r?e.toLowerCase():e);if(3!==d.version)throw new Error("Not a V3 wallet");if("scrypt"===d.crypto.kdf)f=d.crypto.kdfparams,c=s(a.from(t),a.from(f.salt,"hex"),f.n,f.r,f.p,f.dklen);else{if("pbkdf2"!==d.crypto.kdf)throw new Error("Unsupported key derivation scheme");if("hmac-sha256"!==(f=d.crypto.kdfparams).prf)throw new Error("Unsupported parameters to PBKDF2");c=o.pbkdf2Sync(a.from(t),a.from(f.salt,"hex"),f.c,f.dklen,"sha256")}var p=a.from(d.crypto.ciphertext,"hex");if(i.keccak256(a.concat([c.slice(16,32),p])).toString("hex")!==d.crypto.mac)throw new Error("Key derivation failed - possibly wrong passphrase");var h=l(o.createDecipheriv(d.crypto.cipher,c.slice(0,16),a.from(d.crypto.cipherparams.iv,"hex")),p);return new b(h)},b.fromEthSale=function(e,t){u("string"==typeof t);var r="object"===(void 0===e?"undefined":n(e))?e:JSON.parse(e),c=a.from(r.encseed,"hex"),s=o.pbkdf2Sync(t,t,2e3,32,"sha256").slice(0,16),f=l(o.createDecipheriv("aes-128-cbc",s,c.slice(0,16)),c.slice(16)),d=new b(i.keccak256(f));if(d.getAddress().toString("hex")!==r.ethaddr)throw new Error("Decoded key mismatch - possibly wrong passphrase");return d},e.exports=b},function(e,t,r){e.exports={hash:r(505),hashSync:r(507)}},function(e,t){function r(e){return"function"==typeof e?Buffer("","utf8"):e instanceof Buffer?e:"string"==typeof e?new Buffer(e,"utf8"):new Buffer(String(e||""),"utf8")}function n(e){return{maxmem:i((e=null!==e&&"object"==typeof e?e:{}).maxmem)||33554432,cost:o(e.cost)||Math.pow(2,14),blockSize:c(e.blockSize)||8,parallel:c(e.parallel)||1,size:s(e.size)||64}}function a(e){return"function"==typeof e?e:null}function i(e){if("number"!=typeof e)return null;for(var t=4;t<=2048;t*=2){var r=1048576*t;if(r>e)return null;if(r==e)return r}return null}function o(e){if("number"!=typeof e)return null;for(var t=8;t<=64;t++){var r=Math.pow(2,t);if(r>e)return null;if(r==e)return r}return null}function c(e){return"number"!=typeof e?null:(e=Math.round(e))<1?null:e>256?null:e}function s(e){return"number"!=typeof e?null:(e=Math.round(e))<1?null:e>2048?null:e}e.exports=function(e,t,i,o){return{password:r(e),salt:r(t),options:n(i),callback:a(arguments[arguments.length-1])}}},function(e,t){e.exports=require("child_process")},function(e,t,r){var n=r(203),a=r(204);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var c=0;c<16;++c)t[i+c]=o[c];return t||a(o)}},function(e,t,r){var n=r(6);e.exports=function(){return n.randomBytes(16)}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,a=r;return[a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],"-",a[e[n++]],a[e[n++]],"-",a[e[n++]],a[e[n++]],"-",a[e[n++]],a[e[n++]],"-",a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]],a[e[n++]]].join("")}},function(e,t,r){var n=r(20),a=r(45).default,i=r(34),o=r(125),c=r(126),s=r(553).default,f=r(29).default,d=r(81),u=r(71),l=r(7),b=r(17),p=r(676),h=r(678),m=r(3),x=r(709),v=r(99),g=r(0).promisify;const y=l.BN;function A(e){if(m.apply(this),this.options=e=this._applyDefaultOptions(e||{}),this.logger=e.logger||console,this.data=new h(e),null!=e.trie&&null!=e.db_path)throw new Error("Can't initialize a TestRPC with a db and a custom trie.");this.pending_transactions=[],this.blockGasLimit=e.gasLimit,this.defaultTransactionGasLimit=e.defaultTransactionGasLimit,this.timeAdjustment=0}const w={gasLimit:"0x6691b7",defaultTransactionGasLimit:"0x15f90",time:null,debug:!1,hardfork:"istanbul",allowUnlimitedContractSize:!1};A.prototype=Object.create(m.prototype),A.prototype.constructor=A,A.prototype._applyDefaultOptions=function(e){return v.merge(e,w,Object.assign({},e))},A.prototype.initialize=function(e,t){var r=this;this.data.initialize((function(n){if(n)return t(n);r.latestBlock((function(n,a){if(n)return t(n);var i=r.options,o=null;if(a&&(o=a.header.stateRoot),r.stateTrie=r.createStateTrie(r.data.trie_db,o),r.vm=i.vm||r.createVMFromStateTrie(r.stateTrie,!0),i.time&&r.setTime(i.time),a)return r.emit("block",a),t();r.createGenesisBlock((function(n,a){if(n)return t(n);e=e||[],r.vm.stateManager.checkpoint(()=>{b.eachSeries(e,(function(e,t){r.vm.stateManager.putAccount(l.toBuffer(e.address),e.account,t)}),(function(e){if(e)return t(e);r.vm.stateManager.commit(()=>{r.putBlock(a,[],[],t)})}))})}))}))}))},A.prototype.createVMFromStateTrie=function(e,t){const r=this,a=f.forCustomChain("mainnet",{name:"ganache",networkId:r.options.network_id||r.forkVersion,chainId:r.options._chainId,comment:"Local test network",bootstrapNodes:[]},r.options.hardfork),i=new s({state:e,common:a,blockchain:{getBlock:function(e,t){try{e=n.number(e)}catch(e){}r.getBlock(e,t)}},activatePrecompiles:t||!1,allowUnlimitedContractSize:r.options.allowUnlimitedContractSize});return!0===r.options.debug&&i.on("step",(function(e){var t=e.opcode.name,a=e.opcode.in;if(a){var i=e.stack.slice(-a).map(e=>n.hex(e)).join(" ");r.logger.log(`${t} ${i}`)}else r.logger.log(t)})),i},A.prototype.createStateTrie=function(e,t){return new u(e,t)},A.prototype.createGenesisBlock=function(e){this.createBlock(e)},A.prototype.latestBlock=function(e){this.data.blocks.last((function(t,r){if(t)return e(t);e(null,r)}))},A.prototype.getEffectiveBlockNumber=function(e,t){return"string"!=typeof e&&(e=n.hex(e)),e.indexOf("0x")>=0?t(null,n.number(e)):"latest"===e||"pending"===e?this.getHeight(t):"earliest"===e?t(null,0):void 0},A.prototype.getBlock=function(e,t){var r=this;if("string"!=typeof e&&(e=n.hex(e)),e.indexOf("0x")>=0){var a=e;if(!(a.length>40))return this.data.blocks.get(n.number(a),t);this.data.blockHashes.get(n.hex(a),(function(e,n){return e?t(e):r.data.blocks.get(n,t)}))}else{if("latest"===e||"pending"===e)return this.latestBlock(t);if("earliest"===e)return this.data.blocks.first(t);process.nextTick(t,new Error('Invalid `blockNumber`: "'+e+'"'))}},A.prototype.putBlock=function(e,t,r,a){var i=this;e.header.stateRoot=this.stateTrie.root,this.data.blocks.length((function(o,c){if(o)return a(o);var s=[i.data.blocks.push.bind(i.data.blocks,e),i.data.blockLogs.push.bind(i.data.blockLogs,t),i.data.blockHashes.set.bind(i.data.blockHashes,n.hex(e.hash()),c)];e.transactions.forEach((function(e,t){var a=n.hex(e.hash());s.push(i.data.transactions.set.bind(i.data.transactions,a,e),i.data.transactionReceipts.set.bind(i.data.transactionReceipts,a,r[t]))})),b.parallel(s,(t,r)=>{t||i.emit("block",e),a(t,r)})}))},A.prototype.popBlock=function(e){var t=this;this.data.blocks.last((function(r,a){if(r)return e(r);if(null==a)return e(null,null);var i=[],o=n.hex(a.hash());a.transactions.forEach((function(e){var r=n.hex(e.hash());i.push(t.data.transactions.del.bind(t.data.transactions,r),t.data.transactionReceipts.del.bind(t.data.transactionReceipts,r))})),i.push(t.data.blockLogs.pop.bind(t.data.blockLogs),t.data.blockHashes.del.bind(t.data.blockHashes,o),t.data.blocks.pop.bind(t.data.blocks)),b.series(i,(function(r){if(r)return e(r);t.data.blocks.last((function(r,n){if(r)return e(r);t.vm.stateManager.setStateRoot(n.header.stateRoot,(function(r){r||(t.vm.stateManager._storageTries={}),e(r,a)}))}))}))}))},A.prototype.clearPendingTransactions=function(){this.pending_transactions=[]},A.prototype.createBlock=function(e,t,r){var a=this;"function"==typeof e?(r=e,e=null,t=!1):"function"==typeof t&&(r=t,t=!1);var o=new i;!function(t){if(e)return t(null,e);a.latestBlock(t)}((function(e,i){if(e)return r(e);if(o.header.gasLimit=a.blockGasLimit,null!=i&&t)o.header.number=i.header.number,o.header.timestamp=i.header.timestamp,o.header.parentHash=i.header.parentHash;else{var c=null!=i?n.number(i.header.number):-1;o.header.number=n.hex(c+1),o.header.timestamp=n.hex(a.currentTime()),null!=i&&(o.header.parentHash=n.hex(i.hash()))}r(null,o)}))},A.prototype.getQueuedNonce=function(e,t){var r=null,i=n.buffer(e);if(this.pending_transactions.forEach((function(e){if(e.from.equals(i)){var t=new y(e.nonce);(null===r||t.gt(r))&&(r=t)}})),null!=r)return t(null,r.iaddn(1).toArrayLike(Buffer));this.stateTrie.get(i,(function(e,r){if(e)return t(e);var n=new a(r);t(null,0===n.nonce.length?Buffer.from([0]):n.nonce)}))},A.prototype.queueTransaction=function(e){this.pending_transactions.push(e)},A.prototype.sortByPriceAndNonce=function(){var e={};this.pending_transactions.forEach(t=>{const r=t.from.toString("hex"),n=e[r];n?n.push(t):e[r]=[t]});var t=function(e,t){return parseInt(n.hex(e.nonce),16)-parseInt(n.hex(t.nonce),16)};Object.keys(e).forEach(r=>{e[r].sort(t)});var r=new p((function(e,t){return parseInt(n.hex(t.gasPrice),16)-parseInt(n.hex(e.gasPrice),16)}));Object.keys(e).forEach(t=>{r.push(e[t].shift())});const a=[];for(;r.size()>0;){const t=r.pop();let n=t.from.toString("hex");e[n].length>0&&r.push(e[n].shift()),a.push(t)}this.pending_transactions=a},A.prototype.getReadyCall=function(e,t,r,n){const a=(e,r,a)=>{if(r)return n(r);this.createBlock(a,t,(t,r)=>{if(t)return n(t);r.transactions.push(e),r.header.gasLimit=e.gasLimit;const i={tx:e,block:r,skipBalance:!0,skipNonce:!0};n(null,a.header.stateRoot,i)})};"latest"===r?this.latestBlock(a.bind(null,e)):this.getBlock(r,a.bind(null,e))},A.prototype.readyCall=function(e,t,r,n){this.getReadyCall(e,t,r,(e,t,r)=>{if(e)return void n(e);const a=this.createStateTrie(this.data.trie_db,t),i=this.createVMFromStateTrie(a);n(null,i,r)})},A.prototype.processCall=function(e,t,r){this.readyCall(e,!0,t,async(t,n,a)=>{if(t)return void r(t);const i=await n.runTx(a).catch(e=>({vmerr:e}));let o=i.vmerr;if(o&&o instanceof Error==!1&&(o=new Error("VM error: "+o)),o)return r(o,t);o=d.fromResults([e],{results:[i]}),r(o,i)})},A.prototype.estimateGas=function(e,t,r){this.getReadyCall(e,!1,t,(e,t,n)=>{if(e)return void r(e);x(()=>{const e=this.createStateTrie(this.data.trie_db,t);return this.createVMFromStateTrie(e)},n,r)})},A.prototype.processBlock=async function(e,t,r,a){"function"==typeof r&&(a=r,r=!0);const i=await e.runBlock({block:t,generate:!0,skipBlockValidation:!0}).catch(e=>({vmerr:e}));let s=i.vmerr;if(s&&s instanceof Error==!1&&(s=new Error("VM error: "+s)),s)return void a(s);s=d.fromResults(t.transactions,i);var f=[],b=[],p=0;i.results.forEach((function(e){p+=n.number(e.gasUsed)})),t.header.gasUsed=l.toBuffer(n.hex(p));const h=new u,m=new u,x=[],v=(e,t,r)=>g(e.put.bind(e))(t,r);for(var y=0;y<i.receipts.length;y++){var A=i.results[y],w=i.receipts[y],_=t.transactions[y],k=_.hash(),E=[];if(void 0===A.execResult.exceptionError)for(var S=0;S<w.logs.length;S++){for(var T=w.logs[S],O=n.hex(T[0]),R=[],C=0;C<T[1].length;C++)R.push(n.hex(T[1][C]));var B=n.hex(T[2]),I=new o({logIndex:n.hex(S),transactionIndex:n.hex(y),transactionHash:k,block:t,address:O,data:B,topics:R,type:"mined"});f.push(I),E.push(I)}let e=new c(_,t,E,A.gasUsed.toArrayLike(Buffer),w.gasUsed,A.createdAddress,w.status,n.hex(w.bitvector));b.push(e);const r=[w.status,w.gasUsed,w.bitvector,w.logs],a=l.rlp.encode(r),s=l.rlp.encode(y);x.push(v(h,s,_.serialize())),x.push(v(m,s,a))}function N(e){if(e)return a(e);a(s,t.transactions,i)}await Promise.all(x),t.header.transactionsTrie=l.toBuffer(h.root),t.header.receiptTrie=l.toBuffer(m.root),r?this.putBlock(t,f,b,N):N()},A.prototype.processNextBlock=function(e,t){var r=this;"function"==typeof e&&(t=e,e=void 0),r.sortByPriceAndNonce();for(var a=[],i=0,o=n.number(r.blockGasLimit);r.pending_transactions.length>0;){var c=r.pending_transactions[0],s=n.number(c.gasLimit);if(!(i+s<=o))break;i+=s,r.pending_transactions.shift(),a.push(c)}if(0===a.length&&r.pending_transactions.length>0){return t("Unexpected error condition: next transaction exceeds block gas limit")}this.createBlock((function(i,o){if(i)return t(i);e&&(r.data.blocks.last((function(t,a){t||a&&n.number(a.header.timestamp)>e&&r.logger.log("Waring: Setting the block timestamp ("+e+") that is earlier than the parent block one.")})),o.header.timestamp=n.hex(e),r.setTime(new Date(1e3*e))),Array.prototype.push.apply(o.transactions,a),r.processBlock(r.vm,o,!0,t)}))},A.prototype.processTransactionTrace=async function(e,t,r){const a=this,i=n.hex(e);let o,c="",s=null,f={currentDepth:-1,stack:[]},d={gas:0,returnValue:"",structLogs:[]};function u(e,r){const i=n.number(e.gasLeft),c=n.number(s.gasLimit)-i-d.gas;d.gas+=c;let u=null;if(!t.disableMemory&&(u=Buffer.from(e.memory).toString("hex"),u=u.match(/.{1,64}/g)||[],u.length>0)){const e=u[u.length-1];e.length<64&&(u[u.length-1]=e+new Array(64-e.length+1).join("0"))}let l=null;t.disableStack||(l=e.stack.map(e=>n.rpcDataHexString(e,64).replace("0x","")));let b={depth:e.depth,error:"",gas:i,gasCost:c,memory:u,op:e.opcode.name,pc:e.pc,stack:l,storage:null};t.disableStorage?(d.structLogs.push(b),r()):b=a.processStorageTrace(b,f,e,o,(function(e,t){if(e)return r(e);d.structLogs.push(t),r()}))}this.getTransactionReceipt(i,(function(e,t){if(e)return r(e);if(!t)return r(new Error("Unknown transaction "+i));let f=t.block;a.getBlock(f.header.parentHash,(function(e,t){if(e)return r(e);var l=a.createStateTrie(a.data.trie_db,t.header.stateRoot,{forkBlockNumber:n.number(t.header.number)});o=a.createVMFromStateTrie(l),a.createBlock(t,!1,(function(e,t){if(e)return r(e);t.header.timestamp=f.header.timestamp;for(var l=0;l<f.transactions.length;l++){var b=f.transactions[l];if(t.transactions.push(b),n.hex(b.hash())===i)break}function p(e){s=e,c=n.hex(e.hash()),c===i&&o.on("step",u)}function h(){c===i&&m()}function m(){o.removeListener("step",u),o.removeListener("beforeTx",p),o.removeListener("afterTx",h)}o.on("beforeTx",p),o.on("afterTx",h),o.stateManager._cache.flush=e=>e(),a.processBlock(o,t,!1,(function(e){e&&0===e.message.indexOf("VM Exception")&&(e=null),m(),r(e,d)}))}))}))}))},A.prototype.processStorageTrace=function(e,t,r,a,i){var o,c,s=r.opcode.name;switch(t.currentDepth>r.depth&&t.stack.pop(),t.currentDepth<r.depth&&t.stack.push({}),t.currentDepth=r.depth,s){case"SSTORE":{const a=r.stack,s=a.length;o=n.rpcDataHexString(a[s-1],64).replace("0x",""),c=n.rpcDataHexString(a[s-2],64).replace("0x",""),e.storage=Object.assign({},t.stack[t.currentDepth]),i(null,e),t.stack[t.currentDepth][o]=c}break;case"SLOAD":{const s=r.stack;o=n.rpcDataHexString(s[s.length-1],64).replace("0x",""),a.stateManager.getContractStorage(r.address,Buffer.from(o,"hex"),(function(r,a){if(r)return i(r);c=n.rpcDataHexString(a,64).replace("0x",""),t.stack[t.currentDepth][o]=c,e.storage=Object.assign({},t.stack[t.currentDepth]),i(null,e)}))}break;default:e.storage=Object.assign({},t.stack[t.currentDepth]),i(null,e)}},A.prototype.getAccount=function(e,t,r){var n=this;this.getBlock(t,(function(t,i){if(t)return r(t);var o=n.stateTrie,c=o.root;n.stateTrie.root=i.header.stateRoot,o.get(l.toBuffer(e),(function(e,t){if(o.root=c,e)return r(e);var n=new a(t);r(null,n)}))}))},A.prototype.getNonce=function(e,t,r){this.getAccount(e,t,(function(e,t){if(e)return r(e);r(null,t.nonce)}))},A.prototype.getBalance=function(e,t,r){this.getAccount(e,t,(function(e,t){if(e)return r(e);r(null,t.balance)}))},A.prototype.getStorage=function(e,t,r,n){var i=this;this.getBlock(r,(function(r,o){if(r)return n(r);var c=i.stateTrie,s=c.root;i.stateTrie.root=o.header.stateRoot,c.get(l.toBuffer(e),(function(e,r){if(null!=e)return c.root=s,n(e);var i=new a(r);c.root=i.stateRoot,c.get(l.setLengthLeft(l.toBuffer(t),32),(function(e,t){if(c.root=s,null!=e)return n(e);n(null,t)}))}))}))},A.prototype.getCode=function(e,t,r){var n=this;this.getBlock(t,(function(t,i){if(t)return r(t);var o=n.stateTrie,c=o.root;n.stateTrie.root=i.header.stateRoot,o.get(l.toBuffer(e),(function(e,t){if(null!=e)return o.root=c,r(e);new a(t).getCode(o,(function(e,t){if(o.root=c,e)return r(e);r(null,t)}))}))}))},A.prototype.getTransaction=function(e,t){e=n.hex(e),this.data.transactions.get(e,(function(e,r){if(e)return e.notFound?t(null,null):t(e);t(null,r)}))},A.prototype.getTransactionReceipt=function(e,t){e=n.hex(e);const r=this.pending_transactions;for(var a=0;a<r.length;a++){if(e===n.hex(r[a].hash()))return t(null,{tx:r[a]})}this.data.transactionReceipts.get(e,(function(e,r){if(e)return e.notFound?t(null,null):t(e);t(e,r)}))},A.prototype.getBlockLogs=function(e,t){var r=this;this.getEffectiveBlockNumber(e,(function(e,n){if(e)return t(e);r.data.blockLogs.get(n,t)}))},A.prototype.getHeight=function(e){this.data.blocks.length((function(t,r){if(t)return e(t);e(null,r-1)}))},A.prototype.currentTime=function(){return((new Date).getTime()/1e3|0)+this.timeAdjustment},A.prototype.increaseTime=function(e){return e<0&&(e=0),this.timeAdjustment+=e,this.timeAdjustment},A.prototype.setTime=function(e){var t=(new Date).getTime()/1e3|0,r=e.getTime()/1e3|0;this.timeAdjustment=r-t},A.prototype.close=function(e){this.data.close(e)},e.exports=A},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=r(67),i=r(38),o=r(9),c=r(19),s=r(1),f=r(16),d=r(5).Buffer;Object.assign(t,r(56)),t.MAX_INTEGER=new s("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new s("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.SHA3_NULL_S=t.KECCAK256_NULL_S,t.KECCAK256_NULL=d.from(t.KECCAK256_NULL_S,"hex"),t.SHA3_NULL=t.KECCAK256_NULL,t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.SHA3_RLP_ARRAY_S=t.KECCAK256_RLP_ARRAY_S,t.KECCAK256_RLP_ARRAY=d.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.SHA3_RLP_ARRAY=t.KECCAK256_RLP_ARRAY,t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.SHA3_RLP_S=t.KECCAK256_RLP_S,t.KECCAK256_RLP=d.from(t.KECCAK256_RLP_S,"hex"),t.SHA3_RLP=t.KECCAK256_RLP,t.BN=s,t.rlp=c,t.secp256k1=i,t.zeros=function(e){return d.allocUnsafe(e).fill(0)},t.zeroAddress=function(){var e=t.zeros(20);return t.bufferToHex(e)},t.setLengthLeft=t.setLength=function(e,r,n){var a=t.zeros(r);return e=t.toBuffer(e),n?e.length<r?(e.copy(a),a):e.slice(0,r):e.length<r?(e.copy(a,r-e.length),a):e.slice(-r)},t.setLengthRight=function(e,r){return t.setLength(e,r,!0)},t.unpad=t.stripZeros=function(e){for(var r=(e=t.stripHexPrefix(e))[0];e.length>0&&"0"===r.toString();)r=(e=e.slice(1))[0];return e},t.toBuffer=function(e){if(!d.isBuffer(e))if(Array.isArray(e))e=d.from(e);else if("string"==typeof e)e=t.isHexString(e)?d.from(t.padToEven(t.stripHexPrefix(e)),"hex"):d.from(e);else if("number"==typeof e)e=t.intToBuffer(e);else if(null==e)e=d.allocUnsafe(0);else if(s.isBN(e))e=e.toArrayLike(d);else{if(!e.toArray)throw new Error("invalid type");e=d.from(e.toArray())}return e},t.bufferToInt=function(e){return new s(t.toBuffer(e)).toNumber()},t.bufferToHex=function(e){return"0x"+(e=t.toBuffer(e)).toString("hex")},t.fromSigned=function(e){return new s(e).fromTwos(256)},t.toUnsigned=function(e){return d.from(e.toTwos(256).toArray())},t.keccak=function(e,r){return e=t.toBuffer(e),r||(r=256),a("keccak"+r).update(e).digest()},t.keccak256=function(e){return t.keccak(e)},t.sha3=t.keccak,t.sha256=function(e){return e=t.toBuffer(e),f("sha256").update(e).digest()},t.ripemd160=function(e,r){e=t.toBuffer(e);var n=f("rmd160").update(e).digest();return!0===r?t.setLength(n,32):n},t.rlphash=function(e){return t.keccak(c.encode(e))},t.isValidPrivate=function(e){return i.privateKeyVerify(e)},t.isValidPublic=function(e,t){return 64===e.length?i.publicKeyVerify(d.concat([d.from([4]),e])):!!t&&i.publicKeyVerify(e)},t.pubToAddress=t.publicToAddress=function(e,r){return e=t.toBuffer(e),r&&64!==e.length&&(e=i.publicKeyConvert(e,!1).slice(1)),o(64===e.length),t.keccak(e).slice(-20)};var u=t.privateToPublic=function(e){return e=t.toBuffer(e),i.publicKeyCreate(e,!1).slice(1)};t.importPublic=function(e){return 64!==(e=t.toBuffer(e)).length&&(e=i.publicKeyConvert(e,!1).slice(1)),e},t.ecsign=function(e,t){var r=i.sign(e,t),n={};return n.r=r.signature.slice(0,32),n.s=r.signature.slice(32,64),n.v=r.recovery+27,n},t.hashPersonalMessage=function(e){var r=t.toBuffer("Ethereum Signed Message:\n"+e.length.toString());return t.keccak(d.concat([r,e]))},t.ecrecover=function(e,r,n,a){var o=d.concat([t.setLength(n,32),t.setLength(a,32)],64),c=r-27;if(0!==c&&1!==c)throw new Error("Invalid signature v value");var s=i.recover(e,o,c);return i.publicKeyConvert(s,!1).slice(1)},t.toRpcSig=function(e,r,n){if(27!==e&&28!==e)throw new Error("Invalid recovery id");return t.bufferToHex(d.concat([t.setLengthLeft(r,32),t.setLengthLeft(n,32),t.toBuffer(e-27)]))},t.fromRpcSig=function(e){if(65!==(e=t.toBuffer(e)).length)throw new Error("Invalid signature length");var r=e[64];return r<27&&(r+=27),{v:r,r:e.slice(0,32),s:e.slice(32,64)}},t.privateToAddress=function(e){return t.publicToAddress(u(e))},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===t.addHexPrefix(e)},t.toChecksumAddress=function(e){e=t.stripHexPrefix(e).toLowerCase();for(var r=t.keccak(e).toString("hex"),n="0x",a=0;a<e.length;a++)parseInt(r[a],16)>=8?n+=e[a].toUpperCase():n+=e[a];return n},t.isValidChecksumAddress=function(e){return t.isValidAddress(e)&&t.toChecksumAddress(e)===e},t.generateAddress=function(e,r){return e=t.toBuffer(e),r=(r=new s(r)).isZero()?null:d.from(r.toArray()),t.rlphash([e,r]).slice(-20)},t.isPrecompiled=function(e){var r=t.unpad(e);return 1===r.length&&r[0]>=1&&r[0]<=8},t.addHexPrefix=function(e){return"string"!=typeof e?e:t.isHexPrefixed(e)?e:"0x"+e},t.isValidSignature=function(e,t,r,n){var a=new s("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),i=new s("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return 32===t.length&&32===r.length&&((27===e||28===e)&&(t=new s(t),r=new s(r),!(t.isZero()||t.gt(i)||r.isZero()||r.gt(i))&&(!1!==n||1!==new s(r).cmp(a))))},t.baToJSON=function(e){if(d.isBuffer(e))return"0x"+e.toString("hex");if(e instanceof Array){for(var r=[],n=0;n<e.length;n++)r.push(t.baToJSON(e[n]));return r}},t.defineProperties=function(e,r,a){if(e.raw=[],e._fields=[],e.toJSON=function(r){if(r){var n={};return e._fields.forEach((function(t){n[t]="0x"+e[t].toString("hex")})),n}return t.baToJSON(this.raw)},e.serialize=function(){return c.encode(e.raw)},r.forEach((function(r,n){function a(){return e.raw[n]}function i(a){"00"!==(a=t.toBuffer(a)).toString("hex")||r.allowZero||(a=d.allocUnsafe(0)),r.allowLess&&r.length?(a=t.stripZeros(a),o(r.length>=a.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===a.length||!r.length||o(r.length===a.length,"The field "+r.name+" must have byte length of "+r.length),e.raw[n]=a}e._fields.push(r.name),Object.defineProperty(e,r.name,{enumerable:!0,configurable:!0,get:a,set:i}),r.default&&(e[r.name]=r.default),r.alias&&Object.defineProperty(e,r.alias,{enumerable:!1,configurable:!0,set:i,get:a})})),a)if("string"==typeof a&&(a=d.from(t.stripHexPrefix(a),"hex")),d.isBuffer(a)&&(a=c.decode(a)),Array.isArray(a)){if(a.length>e._fields.length)throw new Error("wrong number of fields in data");a.forEach((function(r,n){e[e._fields[n]]=t.toBuffer(r)}))}else{if("object"!==(void 0===a?"undefined":n(a)))throw new Error("invalid data");var i=Object.keys(a);r.forEach((function(t){-1!==i.indexOf(t.name)&&(e[t.name]=a[t.name]),-1!==i.indexOf(t.alias)&&(e[t.alias]=a[t.alias])}))}}},function(e,t,r){const n=r(9),a=r(208),i=r(219),o=r(122),c=r(19),s=r(86),f=r(225),d=r(123),u=r(536),l=r(541),b=r(60).matchingNibbleLength,p=r(60).doKeysMatch,h=r(60).callTogether,m=r(60).asyncFirstSeries;function x(e,t){var r=this;this.EMPTY_TRIE_ROOT=s.SHA3_RLP,this.sem=f(1),this.db=e||a("",{db:i}),this._getDBs=[this.db],this._putDBs=[this.db],Object.defineProperty(this,"root",{set:function(e){e?(e=s.toBuffer(e),n(32===e.length,"Invalid root length. Roots are 32 bytes")):e=r.EMPTY_TRIE_ROOT,this._root=e},get:function(){return this._root}}),this.root=t}e.exports=x,x.prototype.get=function(e,t){e=s.toBuffer(e),this.findPath(e,(function(e,r,n,a){var i=null;r&&0===n.length&&(i=r.value),t(e,i)}))},x.prototype.put=function(e,t,r){var n=this;e=s.toBuffer(e),(t=s.toBuffer(t))&&""!==t.toString()?(r=h(r,n.sem.leave),n.sem.take((function(){n.root.toString("hex")!==s.SHA3_RLP.toString("hex")?n.findPath(e,(function(a,i,o,c){if(a)return r(a);n._updateNode(e,t,o,c,r)})):n._createInitialNode(e,t,r)}))):n.del(e,r)},x.prototype.del=function(e,t){var r=this;e=s.toBuffer(e),t=h(t,r.sem.leave),r.sem.take((function(){r.findPath(e,(function(n,a,i,o){if(n)return t(n);a?r._deleteNode(e,o,t):t()}))}))},x.prototype.getRaw=function(e,t){e=s.toBuffer(e),m(this._getDBs,(function(t,r){t.get(e,{keyEncoding:"binary",valueEncoding:"binary"},(function(e,t){r(null,e||!t?null:t)}))}),t)},x.prototype._lookupNode=function(e,t){d.isRawNode(e)?t(new d(e)):this.getRaw(e,(function(e,r){if(e)throw e;r&&(r=new d(c.decode(r))),t(r)}))},x.prototype._putRaw=function(e,t,r){o.each(this._putDBs,(function(r,n){r.put(e,t,{keyEncoding:"binary",valueEncoding:"binary"},n)}),r)},x.prototype.putRaw=x.prototype._putRaw,x.prototype.delRaw=function(e,t){o.each(this._putDBs,(function(t,r){t.del(e,{keyEncoding:"binary"},r)}),t)},x.prototype._putNode=function(e,t){var r=e.hash(),n=e.serialize();this._putRaw(r,n,t)},x.prototype._batchNodes=function(e,t){o.each(this._putDBs,(function(t,r){t.batch(e,{keyEncoding:"binary",valueEncoding:"binary"},r)}),t)},x.prototype.findPath=function(e,t){var r=this.root,n=[];e=d.stringToNibbles(e),this._walkTrie(r,(function(t,r,a,i){var o=r.key||[],c=e.slice(b(a,e)),s=b(c,o);if(n.push(r),"branch"===r.type)if(0===c.length)i.return(null,r,[],n);else{var f=c[0];r.getValue(f)?i.only(f):i.return(null,null,c,n)}else"leaf"===r.type?p(c,o)?i.return(null,r,[],n):i.return(null,null,c,n):"extention"===r.type&&(s!==o.length?i.return(null,null,c,n):i.next())}),t)},x.prototype._findNode=function(e,t,r,n){this.findPath(e,(function(){n.apply(null,arguments)}))},x.prototype._findValueNodes=function(e,t){this._walkTrie(this.root,(function(t,r,n,a){var i=n;r.key&&(i=n.concat(r.key)),"leaf"===r.type?e(t,r,i,a.next):"branch"===r.type&&r.value?e(t,r,i,a.next):a.next()}),t)},x.prototype._findDbNodes=function(e,t){this._walkTrie(this.root,(function(t,r,n,a){d.isRawNode(t)?a.next():e(t,r,n,a.next)}),t)},x.prototype._updateNode=function(e,t,r,n,a){var i=[],o=n.pop();e=d.stringToNibbles(e);var c=!1;if("leaf"===o.type){for(var s=0,f=0;f<n.length;f++){var u=n[f];"branch"===u.type?s++:s+=u.key.length}b(o.key,e.slice(s))===o.key.length&&0===r.length&&(c=!0)}if(c)o.value=t,n.push(o);else if("branch"===o.type)if(n.push(o),0!==r){r.shift();var l=new d("leaf",r,t);n.push(l)}else o.value=t;else{var p=o.key,h=b(p,r),m=new d("branch");if(0!==h){var x=o.key.slice(0,h),v=new d("extention",x,t);n.push(v),p.splice(0,h),r.splice(0,h)}if(n.push(m),0!==p.length){var g=p.shift();if(0!==p.length||"leaf"===o.type){o.key=p;var y=this._formatNode(o,!1,i);m.setValue(g,y)}else this._formatNode(o,!1,!0,i),m.setValue(g,o.value)}else m.value=o.value;if(0!==r.length){r.shift();var A=new d("leaf",r,t);n.push(A)}else m.value=t}this._saveStack(e,n,i,a)},x.prototype._walkTrie=function(e,t,r){var n=this;e=e||n.root,r=r||function(){};var a=!1,i=[];if(e.toString("hex")===s.SHA3_RLP.toString("hex"))return r();n._lookupNode(e,(function(s){!function e(r,s,f,d){if(!s)return d();if(a)return d();var u=!1,l={stop:function(){u=!0,d()},return:function(){a=!0,i=arguments,d()},next:function(){if(a)return d();if(u)return d();var t=s.getChildren();o.forEachOf(t,(function(t,r,a){var i=t[0],o=t[1],s=f.concat(i),d=s.length;c.execute(d,(function(t){n._lookupNode(o,(function(r){t(),e(o,r,s,a)}))}))}),d)},only:function(t){var r=s.getValue(t),a=f.slice();a.push(t);var i=a.length;c.execute(i,(function(t){n._lookupNode(r,(function(n){t(),e(r,n,a,d)}))}))}};t(r,s,f=f||[],l)}(e,s,null,(function(e){if(e)return r(e);r.apply(null,i)}))}));var c=new l(500)},x.prototype._saveStack=function(e,t,r,n){for(var a;t.length;){var i=t.pop();if("leaf"===i.type)e.splice(e.length-i.key.length);else if("extention"===i.type)e.splice(e.length-i.key.length),a&&(i.value=a);else if("branch"===i.type&&a){var o=e.pop();i.setValue(o,a)}a=this._formatNode(i,0===t.length,r)}a&&(this.root=a),this._batchNodes(r,n)},x.prototype._deleteNode=function(e,t,r){var n=t.pop(),a=t.pop(),i=[],o=this;if(Array.isArray(e)||(e=d.stringToNibbles(e)),a){if("branch"===n.type)n.value=null;else{var c=n.key;e.splice(e.length-c.length),this._formatNode(n,!1,!0,i),a.setValue(e.pop(),null),n=a,a=t.pop()}var s=[];if(n.raw.forEach((function(e,t){var r=n.getValue(t);r&&s.push([t,r])})),1===s.length){var f=s[0][1],u=s[0][0];this._lookupNode(f,(function(n){e=function(e,t,r,n,a){var i=r.key;if(n&&"branch"!==n.type){var o=n.key;"branch"===r.type?(o.push(t),e.push(t),n.key=o,a.push(n)):(i.unshift(t),e=e.concat(i),o=o.concat(i),r.key=o),a.push(r)}else{if(n&&a.push(n),"branch"===r.type){var c=new d("extention",[t],null);a.push(c),e.push(t)}else i.unshift(t),r.key=i,i.unshift(0),i.unshift(e.length),e.splice.apply(e,i);a.push(r)}return e}(e,u,n,a,t),o._saveStack(e,t,i,r)}))}else a&&t.push(a),t.push(n),o._saveStack(e,t,i,r)}else this.root=this.EMPTY_TRIE_ROOT,r()},x.prototype._createInitialNode=function(e,t,r){var n=new d("leaf",e,t);this.root=n.hash(),this._putNode(n,r)},x.prototype._formatNode=function(e,t,r,n){3===arguments.length&&(n=r,r=!1);var a=e.serialize();if(a.length>=32||t){var i=e.hash();return r&&this.isCheckpoint?n.push({type:"del",key:i}):n.push({type:"put",key:i,value:a}),i}return e.raw},x.prototype.createReadStream=function(){return new u(this)},x.prototype.copy=function(){return new x(this.db,this.root)},x.prototype.batch=function(e,t){var r=this;o.eachSeries(e,(function(e,t){"put"===e.type?r.put(e.key,e.value,t):"del"===e.type?r.del(e.key,t):t()}),t)},x.prototype.checkRoot=function(e,t){e=s.toBuffer(e),this._lookupNode(e,(function(e){t(null,!!e)}))}},function(e,t,r){var n=r(3).EventEmitter,a=r(0).inherits,i=r(0).deprecate,o=r(15),c=r(209),s=r(519),f=r(522),d=r(527),u=r(528),l=r(530),b=r(85),p=r(218),h=b.WriteError,m=b.ReadError,x=b.NotFoundError,v=b.OpenError,g=b.EncodingError,y=b.InitializationError,A=b.LevelUPError,w=p.getOptions,_=p.defaultOptions,k=p.dispatchError;function E(e,t){return"function"==typeof e?e:t}function S(e,t,r){if(!(this instanceof S))return new S(e,t,r);var a;if(n.call(this),this.setMaxListeners(1/0),"function"==typeof e?((t="object"==typeof t?t:{}).db=e,e=null):"object"==typeof e&&"function"==typeof e.db&&(t=e,e=null),"function"==typeof t&&(r=t,t={}),(!t||"function"!=typeof t.db)&&"string"!=typeof e){if(a=new y("Must provide a location for the database"),r)return process.nextTick((function(){r(a)}));throw a}t=w(t),this.options=o(_,t),this._codec=new u(this.options),this._status="new",c(this,"location",e,"e"),this.open(r)}function T(e,t,r){if(!e._isOpening()&&!e.isOpen())return k(e,new m("Database is not open"),r),!0}function O(e,t,r){k(e,new h(t),r)}function R(e,t,r){k(e,new m(t),r)}function C(e){return function(t,r){l()[e](t,r||function(){})}}a(S,n),S.prototype.open=function(e){var t,r,n=this;if(this.isOpen())return e&&process.nextTick((function(){e(null,n)})),this;if(this._isOpening())return e&&this.once("open",(function(){e(null,n)}));if(this.emit("opening"),this._status="opening",this.db=new s(this.location),"function"!=typeof this.options.db&&"function"!=typeof l)throw new A("missing db factory, you need to set options.db");t=this.options.db||l(),(r=t(this.location)).open(this.options,(function(t){if(t)return k(n,new v(t),e);n.db.setDb(r),n.db=r,n._status="open",e&&e(null,n),n.emit("open"),n.emit("ready")}))},S.prototype.close=function(e){var t=this;if(this.isOpen())this._status="closing",this.db.close((function(){t._status="closed",t.emit("closed"),e&&e.apply(null,arguments)})),this.emit("closing"),this.db=new s(this.location);else{if("closed"===this._status&&e)return process.nextTick(e);"closing"===this._status&&e?this.once("closed",e):this._isOpening()&&this.once("open",(function(){t.close(e)}))}},S.prototype.isOpen=function(){return"open"===this._status},S.prototype._isOpening=function(){return"opening"===this._status},S.prototype.isClosed=function(){return/^clos/.test(this._status)},S.prototype.get=function(e,t,r){var n,a=this;if(!T(this,0,r=E(t,r))){if(null==e||"function"!=typeof r)return R(this,"get() requires key and callback arguments",r);t=p.getOptions(t),n=this._codec.encodeKey(e,t),t.asBuffer=this._codec.valueAsBuffer(t),this.db.get(n,t,(function(n,i){if(n)return n=/notfound/i.test(n)||n.notFound?new x("Key not found in database ["+e+"]",n):new m(n),k(a,n,r);if(r){try{i=a._codec.decodeValue(i,t)}catch(e){return r(new g(e))}r(null,i)}}))}},S.prototype.put=function(e,t,r,n){var a,i,o=this;if(n=E(r,n),null==e)return O(this,"put() requires a key argument",n);T(this,0,n)||(r=w(r),a=this._codec.encodeKey(e,r),i=this._codec.encodeValue(t,r),this.db.put(a,i,r,(function(r){if(r)return k(o,new h(r),n);o.emit("put",e,t),n&&n()})))},S.prototype.del=function(e,t,r){var n,a=this;if(r=E(t,r),null==e)return O(this,"del() requires a key argument",r);T(this,0,r)||(t=w(t),n=this._codec.encodeKey(e,t),this.db.del(n,t,(function(t){if(t)return k(a,new h(t),r);a.emit("del",e),r&&r()})))},S.prototype.batch=function(e,t,r){var n,a=this;return arguments.length?(r=E(t,r),Array.isArray(e)?void(T(this,0,r)||(t=w(t),n=(n=a._codec.encodeBatch(e,t)).map((function(e){return e.type||void 0===e.key||void 0===e.value||(e.type="put"),e})),this.db.batch(n,t,(function(t){if(t)return k(a,new h(t),r);a.emit("batch",e),r&&r()})))):O(this,"batch() requires an array argument",r)):new d(this,this._codec)},S.prototype.approximateSize=i((function(e,t,r,n){var a,i,o=this;if(n=E(r,n),r=w(r),null==e||null==t||"function"!=typeof n)return R(this,"approximateSize() requires start, end and callback arguments",n);a=this._codec.encodeKey(e,r),i=this._codec.encodeKey(t,r),this.db.approximateSize(a,i,(function(e,t){if(e)return k(o,new v(e),n);n&&n(null,t)}))}),"db.approximateSize() is deprecated. Use db.db.approximateSize() instead"),S.prototype.readStream=S.prototype.createReadStream=function(e){return(e=o({keys:!0,values:!0},this.options,e)).keyEncoding=e.keyEncoding,e.valueEncoding=e.valueEncoding,(e=this._codec.encodeLtgt(e)).keyAsBuffer=this._codec.keyAsBuffer(e),e.valueAsBuffer=this._codec.valueAsBuffer(e),"number"!=typeof e.limit&&(e.limit=-1),new f(this.db.iterator(e),o(e,{decoder:this._codec.createStreamDecoder(e)}))},S.prototype.keyStream=S.prototype.createKeyStream=function(e){return this.createReadStream(o(e,{keys:!0,values:!1}))},S.prototype.valueStream=S.prototype.createValueStream=function(e){return this.createReadStream(o(e,{keys:!1,values:!0}))},S.prototype.toString=function(){return"LevelUP"},e.exports=S,e.exports.errors=r(85),e.exports.destroy=i(C("destroy"),"levelup.destroy() is deprecated. Use leveldown.destroy() instead"),e.exports.repair=i(C("repair"),"levelup.repair() is deprecated. Use leveldown.repair() instead")},function(e,t,r){
embark-dapp-template-boilerplate: ^
embark-dapp-template-boilerplate: Error: Callback was already called.
embark-dapp-template-boilerplate: at /Users/michael/repos/embark/node_modules/ganache-cli/build/ganache-core.node.cli.js:17:276
embark-dapp-template-boilerplate: at f.<anonymous> (/Users/michael/repos/embark/node_modules/ganache-cli/build/ganache-core.node.cli.js:17:2238)
embark-dapp-template-boilerplate: at f.emit (events.js:315:20)
embark-dapp-template-boilerplate: at f.destroy (/Users/michael/repos/embark/node_modules/ganache-cli/build/ganache-core.node.cli.js:29:691909)
embark-dapp-template-boilerplate: at finish (_stream_writable.js:681:14)
embark-dapp-template-boilerplate: at processTicksAndRejections (internal/process/task_queues.js:84:21)
embark-dapp-template-boilerplate: npm ERR! code ELIFECYCLE
embark-dapp-template-boilerplate: npm ERR! errno 1
embark-dapp-template-boilerplate: npm ERR! [email protected] test: `npx embark test`
embark-dapp-template-boilerplate: npm ERR! Exit status 1
embark-dapp-template-boilerplate: npm ERR!
embark-dapp-template-boilerplate: npm ERR! Failed at the [email protected] test script.
embark-dapp-template-boilerplate: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
embark-dapp-template-boilerplate: npm ERR! A complete log of this run can be found in:
embark-dapp-template-boilerplate: npm ERR! /Users/michael/.npm/_logs/2020-04-24T20_15_32_859Z-debug.log
lerna ERR! npm run test exited 1 in 'embark-dapp-template-boilerplate'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "test:dapps" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment