@dodoex/wallet-web3 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -674
- package/dist/{alchemy-provider-5870b6fa-529a90a3.js → alchemy-provider-5870b6fa-0a3b2dbe.js} +1 -1
- package/dist/{alchemy-websocket-provider-213da986-759f6418.js → alchemy-websocket-provider-213da986-d0c3633b.js} +1 -1
- package/dist/blocto-9e74d8d2.js +1 -0
- package/dist/{ccip-faf1002d.js → ccip-96253715.js} +1 -1
- package/dist/cjs/{alchemy-provider-5870b6fa-fe0a0266.cjs → alchemy-provider-5870b6fa-f315bd2e.cjs} +1 -1
- package/dist/cjs/{alchemy-websocket-provider-213da986-21a1ca55.cjs → alchemy-websocket-provider-213da986-e564a819.cjs} +1 -1
- package/dist/cjs/{blocto-6fe4bdb0.cjs → blocto-076e6c0b.cjs} +1 -1
- package/dist/cjs/{ccip-09ffbdf5.cjs → ccip-521cfee8.cjs} +1 -1
- package/dist/cjs/controllers/ConnectController.d.ts +3 -3
- package/dist/cjs/{draggabilly-f3785214.cjs → draggabilly-2b865eba.cjs} +1 -1
- package/dist/cjs/id-d1b8bb45.cjs +1 -0
- package/dist/cjs/index-4a48412c.cjs +1 -0
- package/dist/cjs/{index-c8520c00.cjs → index-5810e4f1.cjs} +1 -1
- package/dist/cjs/index-799531a3.cjs +1 -0
- package/dist/cjs/{index-74a7d024.cjs → index-97c1aca0.cjs} +3 -3
- package/dist/cjs/{index-7e1160c2.cjs → index-9f5b41d0.cjs} +1 -1
- package/dist/cjs/index-a0b90815.cjs +28 -0
- package/dist/cjs/{index-ffc6db3b.cjs → index-b8fa0637.cjs} +2 -2
- package/dist/cjs/{index-4fe81b7c.cjs → index-c46c5dfc.cjs} +2 -2
- package/dist/cjs/index-eece89ac.cjs +1 -0
- package/dist/cjs/{index-3adb2103.cjs → index-f52d7a9d.cjs} +3 -3
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.es-0bd8aeaf.cjs +9 -0
- package/dist/cjs/{interface-420c6f54.cjs → interface-32e74a1d.cjs} +1 -1
- package/dist/cjs/lib-typedarrays-af7a37ac.cjs +1 -0
- package/dist/cjs/{portis-33db03aa.cjs → portis-a7f5a490.cjs} +2 -2
- package/dist/cjs/provider-e3b3781f.cjs +1 -0
- package/dist/cjs/providers/connector/alchemy/index.d.ts +12 -8
- package/dist/cjs/providers/connector/index.d.ts +12 -8
- package/dist/cjs/providers/wallets/index.d.ts +3 -0
- package/dist/cjs/rainbow-48b79e7b.cjs +1 -0
- package/dist/cjs/sha224-157f2666.cjs +1 -0
- package/dist/cjs/{sha256-bf11d5b9.cjs → sha256-25579a6a.cjs} +1 -1
- package/dist/cjs/{typed-data-8fabe1a4.cjs → typed-data-bde3a50b.cjs} +1 -1
- package/dist/cjs/uAuth-4077d7c6.cjs +1 -0
- package/dist/cjs/walletConnect-ddb78a91.cjs +1 -0
- package/dist/cjs/{walletLink-36f21f64.cjs → walletLink-4bf7ba75.cjs} +2 -2
- package/dist/controllers/ConnectController.d.ts +3 -3
- package/dist/{draggabilly-3fa46d2e.js → draggabilly-007eb32e.js} +1 -1
- package/dist/id-8a5cdbd4.js +1 -0
- package/dist/index-021a379f.js +28 -0
- package/dist/index-2dd0cf11.js +1 -0
- package/dist/index-2f5bd9b0.js +17 -0
- package/dist/index-64cac64c.js +1 -0
- package/dist/index-804ac0ab.js +9 -0
- package/dist/index-85af26b3.js +1 -0
- package/dist/{index-c01613a0.js → index-a89eae14.js} +1 -1
- package/dist/{index-963ba8d6.js → index-cc1e2d8c.js} +2 -2
- package/dist/index-e18cdf87.js +1 -0
- package/dist/{index-29c53851.js → index-ec79cc51.js} +3 -3
- package/dist/index.es-6b1b8ee3.js +9 -0
- package/dist/index.js +1 -1
- package/dist/{interface-6e7170f0.js → interface-e1ceccbd.js} +1 -1
- package/dist/lib-typedarrays-88b1d513.js +1 -0
- package/dist/{portis-2973f555.js → portis-6579bb55.js} +2 -2
- package/dist/provider-037ebaad.js +1 -0
- package/dist/providers/connector/alchemy/index.d.ts +12 -8
- package/dist/providers/connector/index.d.ts +12 -8
- package/dist/providers/wallets/index.d.ts +3 -0
- package/dist/rainbow-972f7199.js +1 -0
- package/dist/sha224-133835ea.js +1 -0
- package/dist/{sha256-1508dfb3.js → sha256-f271f1bd.js} +1 -1
- package/dist/{typed-data-282a4cc5.js → typed-data-b7769dfc.js} +1 -1
- package/dist/uAuth-edf28f7b.js +1 -0
- package/dist/walletConnect-db769233.js +1 -0
- package/dist/walletLink-f2c079e7.js +3 -0
- package/package.json +102 -94
- package/dist/blocto-93b5fc5f.js +0 -1
- package/dist/cjs/id-e4e53f1e.cjs +0 -1
- package/dist/cjs/index-3e22c60c.cjs +0 -1
- package/dist/cjs/index-5a91837f.cjs +0 -28
- package/dist/cjs/index-729f3021.cjs +0 -1
- package/dist/cjs/index-ed1986e9.cjs +0 -1
- package/dist/cjs/index.es-e15fde5c.cjs +0 -9
- package/dist/cjs/lib-typedarrays-4d44edfd.cjs +0 -1
- package/dist/cjs/provider-8beaa665.cjs +0 -1
- package/dist/cjs/rainbow-be577e53.cjs +0 -1
- package/dist/cjs/sha224-4ef7a67a.cjs +0 -1
- package/dist/cjs/uAuth-3a06c00b.cjs +0 -1
- package/dist/cjs/walletConnect-ca05245c.cjs +0 -1
- package/dist/id-b95b60c1.js +0 -1
- package/dist/index-235cddea.js +0 -1
- package/dist/index-40c931bd.js +0 -17
- package/dist/index-816ddd07.js +0 -9
- package/dist/index-a24bac60.js +0 -1
- package/dist/index-b58aa407.js +0 -28
- package/dist/index-ce99c6e1.js +0 -1
- package/dist/index-e6045dea.js +0 -1
- package/dist/index.es-0000f8e2.js +0 -9
- package/dist/lib-typedarrays-7d2a82a7.js +0 -1
- package/dist/provider-368389e6.js +0 -1
- package/dist/rainbow-ec9dff26.js +0 -1
- package/dist/sha224-d1d7447d.js +0 -1
- package/dist/uAuth-7b4feb32.js +0 -1
- package/dist/walletConnect-f42045ea.js +0 -1
- package/dist/walletLink-7f12834a.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("./index-
|
|
1
|
+
"use strict";var e=require("./index-a0b90815.cjs");require("@ethersproject/providers"),require("zustand"),require("@ethersproject/bytes"),require("@ethersproject/properties"),require("@ethersproject/address"),require("@ethersproject/abstract-signer"),require("buffer"),require("@ethersproject/abstract-provider"),require("@ethersproject/contracts"),require("events"),require("@ethersproject/constants"),require("@ethersproject/transactions");var t,r={exports:{}};t=r,e.commonjsGlobal,t.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=262)}([function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){(function(e){
|
|
2
2
|
/*!
|
|
3
3
|
* The buffer module from node.js, for the browser.
|
|
4
4
|
*
|
|
@@ -21,4 +21,4 @@ t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,f=(1<<s)-1,c=f>>1,u=-7,d=r?i-1:0,h=
|
|
|
21
21
|
(c) Sindre Sorhus
|
|
22
22
|
@license MIT
|
|
23
23
|
*/
|
|
24
|
-
var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,s,f=a(e),c=1;c<arguments.length;c++){for(var u in r=Object(arguments[c]))i.call(r,u)&&(f[u]=r[u]);if(n){s=n(r);for(var d=0;d<s.length;d++)o.call(r,s[d])&&(f[s[d]]=r[s[d]])}}return f}},function(e,t,r){var n=r(78);e.exports=function(e){return"string"!=typeof e?e:n(e)?e.slice(2):e}},function(e,t,r){const n=r(79),i=r(166);function o(e,t){return new Promise((r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()}))}e.exports=class extends i{constructor(e={}){if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");const t=e.pollingInterval||2e4,r=e.retryTimeout||t/10,n=void 0===e.keepEventLoopActive||e.keepEventLoopActive,i=e.setSkipCacheFlag||!1;super(Object.assign({blockResetDuration:t},e)),this._provider=e.provider,this._pollingInterval=t,this._retryTimeout=r,this._keepEventLoopActive=n,this._setSkipCacheFlag=i}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}_start(){this._performSync().catch((e=>this.emit("error",e)))}async _performSync(){for(;this._isRunning;)try{await this._updateLatestBlock(),await o(this._pollingInterval,!this._keepEventLoopActive)}catch(e){const t=new Error("PollingBlockTracker - encountered an error while attempting to update latest block:\n"+e.stack);try{this.emit("error",t)}catch(e){console.error(t)}await o(this._retryTimeout,!this._keepEventLoopActive)}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:1,method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0);const t=await n((t=>this._provider.sendAsync(e,t)))();if(t.error)throw new Error("PollingBlockTracker - encountered error fetching block:\n"+t.error);return t.result}}},function(e,t,r){r(80),r(79);const n=r(168),i=(e,t)=>e+t,o=["sync","latest"];function a(e){return Number.parseInt(e,16)}e.exports=class extends n{constructor(e={}){super(),this._blockResetDuration=e.blockResetDuration||2e4,this._blockResetTimeout,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise((e=>this.once("latest",e)))}removeAllListeners(e){e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener()}_start(){}_end(){}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e,t){o.includes(e)&&this._maybeStart()}_onRemoveListener(e,t){this._getBlockTrackerEventCount()>0||this._maybeEnd()}_maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),this._start())}_maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),this._end())}_getBlockTrackerEventCount(){return o.map((e=>this.listenerCount(e))).reduce(i)}_newPotentialLatest(e){const t=this._currentBlock;t&&a(e)<=a(t)||this._setCurrentBlock(e)}_setCurrentBlock(e){const t=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:t,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}},function(e,t){e.exports=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}}},function(e,t,r){const n=r(9),i=r(8);var o="object"==typeof Reflect?Reflect:null,a=o&&"function"==typeof o.apply?o.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function s(){i.call(this)}function f(e,t,r){try{a(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}function c(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}e.exports=s,n.inherits(s,i),s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)f(s,this,t);else{var u=s.length,d=c(s,u);for(r=0;r<u;++r)f(d[r],this,t)}return!0}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(170)),i=o(r(196));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,n.default)(i.default),e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,o){return e(n.default,t,(0,i.default)(r),o)}};var n=o(r(81)),i=o(r(12));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){var n=r(42),i=r(85);e.exports=function(e){if(!i(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,r){var n=r(82),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[s]=r:delete e[s]),i}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,o){(0,n.default)(t)(e,(0,i.default)(r),o)};var n=o(r(88)),i=o(r(12));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,n.default)(e))return function(e){var t=-1,r=e.length;return function(){return++t<r?{value:e[t],key:t}:null}}(e);var t,r,a,s,f=(0,i.default)(e);return f?function(e){var t=-1;return function(){var r=e.next();return r.done?null:(t++,{value:r.value,key:t})}}(f):(t=e,r=(0,o.default)(t),a=-1,s=r.length,function(){var e=r[++a];return a<s?{value:t[e],key:e}:null})};var n=a(r(29)),i=a(r(176)),o=a(r(177));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return n&&e[n]&&e[n]()};var n="function"==typeof Symbol&&Symbol.iterator;e.exports=t.default},function(e,t,r){var n=r(178),i=r(189),o=r(29);e.exports=function(e){return o(e)?n(e):i(e)}},function(e,t,r){var n=r(179),i=r(180),o=r(89),a=r(182),s=r(184),f=r(185),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=o(e),u=!r&&i(e),d=!r&&!u&&a(e),h=!r&&!u&&!d&&f(e),l=r||u||d||h,p=l?n(e.length,String):[],b=p.length;for(var g in e)!t&&!c.call(e,g)||l&&("length"==g||d&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||s(g,b))||p.push(g);return p}},function(e,t){e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},function(e,t,r){var n=r(181),i=r(44),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,f=n(function(){return arguments}())?n:function(e){return i(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=f},function(e,t,r){var n=r(42),i=r(44);e.exports=function(e){return i(e)&&"[object Arguments]"==n(e)}},function(e,t,r){(function(e){var n=r(83),i=r(183),o=t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===o?n.Buffer:void 0,f=(s?s.isBuffer:void 0)||i;e.exports=f}).call(this,r(37)(e))},function(e,t){e.exports=function(){return!1}},function(e,t){var r=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&r.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,r){var n=r(186),i=r(187),o=r(188),a=o&&o.isTypedArray,s=a?i(a):n;e.exports=s},function(e,t,r){var n=r(42),i=r(86),o=r(44),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!a[n(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,r){(function(e){var n=r(84),i=t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===i&&n.process,s=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s}).call(this,r(37)(e))},function(e,t,r){var n=r(190),i=r(191),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))o.call(e,r)&&"constructor"!=r&&t.push(r);return t}},function(e,t){var r=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}},function(e,t,r){var n=r(192)(Object.keys,Object);e.exports=n},function(e,t){e.exports=function(e,t){return function(r){return e(t(r))}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)((function(t,r){var i;try{i=e.apply(this,t)}catch(e){return r(e)}(0,n.default)(i)&&"function"==typeof i.then?i.then((function(e){s(r,null,e)}),(function(e){s(r,e.message?e:new Error(e))})):r(null,i)}))};var n=a(r(85)),i=a(r(194)),o=a(r(195));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){try{e(t,r)}catch(e){(0,o.default)(f,e)}}function f(e){throw e}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),r=t.pop();e.call(this,t,r)}};var n,i=(n=r(30))&&n.__esModule?n:{default:n};e.exports=t.default},function(e,t,r){(function(e,n){Object.defineProperty(t,"__esModule",{value:!0}),t.hasNextTick=t.hasSetImmediate=void 0,t.fallback=c,t.wrap=u;var i,o,a=(i=r(30))&&i.__esModule?i:{default:i},s=t.hasSetImmediate="function"==typeof e&&e,f=t.hasNextTick="object"==typeof n&&"function"==typeof n.nextTick;function c(e){setTimeout(e,0)}function u(e){return function(t){var r=(0,a.default)(arguments,1);e((function(){t.apply(null,r)}))}}o=s?e:f?n.nextTick:c,t.default=u(o)}).call(this,r(59).setImmediate,r(4))},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,o){o=o||n.default,t=t||[];var a=[],s=0,f=(0,i.default)(r);e(t,(function(e,t,r){var n=s++;f(e,(function(e,t){a[n]=t,r(e)}))}),(function(e){o(e,a)}))};var n=o(r(22)),i=o(r(12));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(198)),i=o(r(90));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(n.default,1),e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,a){(0,n.default)(t)(e,(0,i.default)((0,o.default)(r)),a)};var n=a(r(88)),i=a(r(199)),o=a(r(12));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,n){return e(t,n)}},e.exports=t.default},function(e,t,r){const n=r(8).EventEmitter,i=r(9).inherits;function o(){n.call(this),this.isLocked=!0}e.exports=o,i(o,n),o.prototype.go=function(){this.isLocked=!1,this.emit("unlock")},o.prototype.stop=function(){this.isLocked=!0,this.emit("lock")},o.prototype.await=function(e){const t=this;t.isLocked?t.once("unlock",e):setTimeout(e)}},function(e,t,r){const n=r(46);function i(e){return"never"!==s(e)}function o(e){var t=a(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function a(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":return 1;case"eth_getBlockByNumber":return 0;default:return}}function s(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":return"fork";case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"eth_blockNumber":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":return"never"}}e.exports={cacheIdentifierForPayload:function(e,t={}){if(!i(e))return null;const{includeBlockRef:r}=t,a=r?e.params:o(e);return e.method+":"+n(a)},canCache:i,blockTagForPayload:function(e){var t=a(e);return t>=e.params.length?null:e.params[t]},paramsWithoutBlockTag:o,blockTagParamIndex:a,cacheTypeForPayload:s}},function(e,t,r){t.parse=r(203),t.stringify=r(204)},function(e,t){var r,n,i,o,a={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},s=function(e){throw{name:"SyntaxError",message:e,at:r,text:i}},f=function(e){return e&&e!==n&&s("Expected '"+e+"' instead of '"+n+"'"),n=i.charAt(r),r+=1,n},c=function(){var e,t="";for("-"===n&&(t="-",f("-"));n>="0"&&n<="9";)t+=n,f();if("."===n)for(t+=".";f()&&n>="0"&&n<="9";)t+=n;if("e"===n||"E"===n)for(t+=n,f(),"-"!==n&&"+"!==n||(t+=n,f());n>="0"&&n<="9";)t+=n,f();if(e=+t,isFinite(e))return e;s("Bad number")},u=function(){var e,t,r,i="";if('"'===n)for(;f();){if('"'===n)return f(),i;if("\\"===n)if(f(),"u"===n){for(r=0,t=0;t<4&&(e=parseInt(f(),16),isFinite(e));t+=1)r=16*r+e;i+=String.fromCharCode(r)}else{if("string"!=typeof a[n])break;i+=a[n]}else i+=n}s("Bad string")},d=function(){for(;n&&n<=" ";)f()};o=function(){switch(d(),n){case"{":return function(){var e,t={};if("{"===n){if(f("{"),d(),"}"===n)return f("}"),t;for(;n;){if(e=u(),d(),f(":"),Object.hasOwnProperty.call(t,e)&&s('Duplicate key "'+e+'"'),t[e]=o(),d(),"}"===n)return f("}"),t;f(","),d()}}s("Bad object")}();case"[":return function(){var e=[];if("["===n){if(f("["),d(),"]"===n)return f("]"),e;for(;n;){if(e.push(o()),d(),"]"===n)return f("]"),e;f(","),d()}}s("Bad array")}();case'"':return u();case"-":return c();default:return n>="0"&&n<="9"?c():function(){switch(n){case"t":return f("t"),f("r"),f("u"),f("e"),!0;case"f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case"n":return f("n"),f("u"),f("l"),f("l"),null}s("Unexpected '"+n+"'")}()}},e.exports=function(e,t){var a;return i=e,r=0,n=" ",a=o(),d(),n&&s("Syntax error"),"function"==typeof t?function e(r,n){var i,o,a=r[n];if(a&&"object"==typeof a)for(i in a)Object.prototype.hasOwnProperty.call(a,i)&&(void 0!==(o=e(a,i))?a[i]=o:delete a[i]);return t.call(r,n,a)}({"":a},""):a}},function(e,t){var r,n,i,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function s(e){return o.lastIndex=0,o.test(e)?'"'+e.replace(o,(function(e){var t=a[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}e.exports=function(e,t,o){var a;if(r="",n="","number"==typeof o)for(a=0;a<o;a+=1)n+=" ";else"string"==typeof o&&(n=o);if(i=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return function e(t,o){var a,f,c,u,d,h=r,l=o[t];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(t)),"function"==typeof i&&(l=i.call(o,t,l)),typeof l){case"string":return s(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(r+=n,d=[],"[object Array]"===Object.prototype.toString.apply(l)){for(u=l.length,a=0;a<u;a+=1)d[a]=e(a,l)||"null";return c=0===d.length?"[]":r?"[\n"+r+d.join(",\n"+r)+"\n"+h+"]":"["+d.join(",")+"]",r=h,c}if(i&&"object"==typeof i)for(u=i.length,a=0;a<u;a+=1)"string"==typeof(f=i[a])&&(c=e(f,l))&&d.push(s(f)+(r?": ":":")+c);else for(f in l)Object.prototype.hasOwnProperty.call(l,f)&&(c=e(f,l))&&d.push(s(f)+(r?": ":":")+c);return c=0===d.length?"{}":r?"{\n"+r+d.join(",\n"+r)+"\n"+h+"}":"{"+d.join(",")+"}",r=h,c}}("",{"":e})}},function(e,t,r){const n=r(206),i=r(28);e.exports=function(e){return i({id:n(),jsonrpc:"2.0",params:[]},e)}},function(e,t){e.exports=function(){return Math.floor(Number.MAX_SAFE_INTEGER*Math.random())}},function(e,t,r){function n(e){return(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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=r(47),c=r(209),u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e);var t,r=(t=n,function(){var e,r=s(t);if(a()){var n=s(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return o(this,e)});function n(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r.call(this,(function(t){var r=t.blockTracker;return c(Object.assign({blockTracker:r},e))}))}return n}(f);e.exports=u},function(e,t,r){e.exports=function(){return Math.floor(Number.MAX_SAFE_INTEGER*Math.random())}},function(e,t,r){const n=r(210),i=r(211),o=[void 0,null,"<nil>"];e.exports=function(e={}){const{blockTracker:t}=e;if(!t)throw new Error("createBlockCacheMiddleware - No BlockTracker specified");const r=new a,o={perma:r,block:r,fork:r};return i((async(e,i,a)=>{if(e.skipCache)return a();const s=n.cacheTypeForPayload(e),f=o[s];if(!f)return a();if(!f.canCacheRequest(e))return a();let c,u=n.blockTagForPayload(e);if(u||(u="latest"),"earliest"===u)c="0x00";else if("latest"===u){const e=await t.getLatestBlock();r.clearBefore(e),c=e}else c=u;const d=await f.get(e,c);void 0===d?(await a(),await f.set(e,c,i.result)):i.result=d}))};class a{constructor(){this.cache={}}getBlockCacheForPayload(e,t){const r=Number.parseInt(t,16);let n=this.cache[r];if(!n){const e={};this.cache[r]=e,n=e}return n}async get(e,t){const r=this.getBlockCacheForPayload(e,t);if(r)return r[n.cacheIdentifierForPayload(e,!0)]}async set(e,t,r){this.canCacheResult(e,r)&&(this.getBlockCacheForPayload(e,t)[n.cacheIdentifierForPayload(e,!0)]=r)}canCacheRequest(e){return!!n.canCache(e)&&"pending"!==n.blockTagForPayload(e)}canCacheResult(e,t){if(!o.includes(t))return!!(!["eth_getTransactionByHash","eth_getTransactionReceipt"].includes(e.method)||t&&t.blockHash&&"0x0000000000000000000000000000000000000000000000000000000000000000"!==t.blockHash)}clearBefore(e){const t=this,r=Number.parseInt(e,16);Object.keys(t.cache).map(Number).filter((e=>e<r)).forEach((e=>delete t.cache[e]))}}},function(e,t,r){const n=r(46);function i(e){return"never"!==s(e)}function o(e){const t=a(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function a(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":return 1;case"eth_getBlockByNumber":return 0;default:return}}function s(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":case"test_permaCache":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":case"test_forkCache":return"fork";case"eth_gasPrice":case"eth_blockNumber":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"test_blockCache":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":case"test_neverCache":return"never"}}e.exports={cacheIdentifierForPayload:function(e,t){const r=t?o(e):e.params;return i(e)?e.method+":"+n(r):null},canCache:i,blockTagForPayload:function(e){let t=a(e);return t>=e.params.length?null:e.params[t]},paramsWithoutBlockTag:o,blockTagParamIndex:a,cacheTypeForPayload:s}},function(e,t){e.exports=function(e){return(t,r,n,i)=>{let o;const a=new Promise((e=>{o=e}));let s,f;e(t,r,(async()=>{f=!0,n((e=>{s=e,o()})),await a})).then((async()=>{f?(await a,s(null)):i(null)})).catch((e=>{s?s(e):i(e)}))}}},function(e,t,r){var n=r(9).inherits,i=r(31);function o(e){e=e||{},this.staticResponses=e}e.exports=o,n(o,i),o.prototype.handleRequest=function(e,t,r){var n=this.staticResponses[e.method];"function"==typeof n?n(e,t,r):void 0!==n?setTimeout((function(){return r(null,n)})):t()}},function(e,t,r){function n(e){return(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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=r(47),c=r(92),u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e);var t,r=(t=n,function(){var e,r=s(t);if(a()){var n=s(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return o(this,e)});function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r.call(this,(function(e){var t=e.blockTracker,r=e.provider;return e.engine,c({blockTracker:t,provider:r})}))}return n}(f);e.exports=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createIdRemapMiddleware=void 0;const n=r(94);t.createIdRemapMiddleware=function(){return(e,t,r,i)=>{const o=e.id,a=n.getUniqueId();e.id=a,t.id=a,r((r=>{e.id=o,t.id=o,r()}))}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createAsyncMiddleware=void 0,t.createAsyncMiddleware=function(e){return async(t,r,n,i)=>{let o;const a=new Promise((e=>{o=e}));let s=null,f=!1;const c=async()=>{f=!0,n((e=>{s=e,o()})),await a};try{await e(t,r,c),f?(await a,s(null)):i(null)}catch(e){s?s(e):i(e)}}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createScaffoldMiddleware=void 0,t.createScaffoldMiddleware=function(e){return(t,r,n,i)=>{const o=e[t.method];return void 0===o?n():"function"==typeof o?o(t,r,n,i):(r.result=o,i())}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const n=r(49);Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return n.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return n.EthereumProviderError}});const i=r(96);Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return i.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}});const o=r(219);Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return o.ethErrors}});const a=r(50);Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return a.errorCodes}})},function(e,t){e.exports=i,i.default=i,i.stable=a,i.stableStringify=a;var r=[],n=[];function i(e,t,i){var o;for(function e(t,i,o,a){var s;if("object"==typeof t&&null!==t){for(s=0;s<o.length;s++)if(o[s]===t){var f=Object.getOwnPropertyDescriptor(a,i);return void(void 0!==f.get?f.configurable?(Object.defineProperty(a,i,{value:"[Circular]"}),r.push([a,i,t,f])):n.push([t,i]):(a[i]="[Circular]",r.push([a,i,t])))}if(o.push(t),Array.isArray(t))for(s=0;s<t.length;s++)e(t[s],s,o,t);else{var c=Object.keys(t);for(s=0;s<c.length;s++){var u=c[s];e(t[u],u,o,t)}}o.pop()}}(e,"",[],void 0),o=0===n.length?JSON.stringify(e,t,i):JSON.stringify(e,s(t),i);0!==r.length;){var a=r.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}return o}function o(e,t){return e<t?-1:e>t?1:0}function a(e,t,i){var a,f=function e(t,i,a,s){var f;if("object"==typeof t&&null!==t){for(f=0;f<a.length;f++)if(a[f]===t){var c=Object.getOwnPropertyDescriptor(s,i);return void(void 0!==c.get?c.configurable?(Object.defineProperty(s,i,{value:"[Circular]"}),r.push([s,i,t,c])):n.push([t,i]):(s[i]="[Circular]",r.push([s,i,t])))}if("function"==typeof t.toJSON)return;if(a.push(t),Array.isArray(t))for(f=0;f<t.length;f++)e(t[f],f,a,t);else{var u={},d=Object.keys(t).sort(o);for(f=0;f<d.length;f++){var h=d[f];e(t[h],h,a,t),u[h]=t[h]}if(void 0===s)return u;r.push([s,i,t]),s[i]=u}a.pop()}}(e,"",[],void 0)||e;for(a=0===n.length?JSON.stringify(f,t,i):JSON.stringify(f,s(t),i);0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}return a}function s(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var i=0;i<n.length;i++){var o=n[i];if(o[1]===t&&o[0]===r){r="[Circular]",n.splice(i,1);break}}return e.call(this,t,r)}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ethErrors=void 0;const n=r(49),i=r(96),o=r(50);function a(e,t){const[r,o]=f(t);return new n.EthereumRpcError(e,r||i.getMessageFromCode(e),o)}function s(e,t){const[r,o]=f(t);return new n.EthereumProviderError(e,r||i.getMessageFromCode(e),o)}function f(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}t.ethErrors={rpc:{parse:e=>a(o.errorCodes.rpc.parse,e),invalidRequest:e=>a(o.errorCodes.rpc.invalidRequest,e),invalidParams:e=>a(o.errorCodes.rpc.invalidParams,e),methodNotFound:e=>a(o.errorCodes.rpc.methodNotFound,e),internal:e=>a(o.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return a(t,e)},invalidInput:e=>a(o.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>a(o.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>a(o.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>a(o.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>a(o.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>a(o.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>s(o.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>s(o.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>s(o.errorCodes.provider.unsupportedMethod,e),disconnected:e=>s(o.errorCodes.provider.disconnected,e),chainDisconnected:e=>s(o.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new n.EthereumProviderError(t,r,i)}}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMiddleware=void 0;const n=r(95);t.mergeMiddleware=function(e){const t=new n.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()}},function(e,t){e.exports=function(e){return(t,r,n,i)=>{const o=e[t.method];return void 0===o?n():"function"==typeof o?o(t,r,n,i):(r.result=o,i())}}},function(e,t,r){const n=r(80),i=r(223),o=r(224),{bnToHex:a,hexToInt:s,incrementHexInt:f,minBlockRef:c,blockRefIsNumber:u}=r(23);e.exports=class extends o{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new n(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map((e=>e.toLowerCase())))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const r=c(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:r}),i=await this._fetchLogs(n);this.addInitialResults(i)}async update({oldBlock:e,newBlock:t}){const r=t;let n;n=e?f(e):t;const i=Object.assign({},this.params,{fromBlock:n,toBlock:r}),o=(await this._fetchLogs(i)).filter((e=>this.matchLog(e)));this.addResults(o)}async _fetchLogs(e){return await i((t=>this.ethQuery.getLogs(e,t)))()}matchLog(e){if(s(this.params.fromBlock)>=s(e.blockNumber))return!1;if(u(this.params.toBlock)&&s(this.params.toBlock)<=s(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();return!(this.params.address&&t&&!this.params.address.includes(t))&&this.params.topics.every(((t,r)=>{let n=e.topics[r];if(!n)return!1;n=n.toLowerCase();let i=Array.isArray(t)?t:[t];return!!i.includes(null)||(i=i.map((e=>e.toLowerCase())),i.includes(n))}))}}},function(e,t,r){const n=(e,t,r,n)=>function(...i){return new t.promiseModule(((o,a)=>{t.multiArgs?i.push(((...e)=>{t.errorFirst?e[0]?a(e):(e.shift(),o(e)):o(e)})):t.errorFirst?i.push(((e,t)=>{e?a(e):o(t)})):i.push(o);const s=this===r?n:this;Reflect.apply(e,s,i)}))},i=new WeakMap;e.exports=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(null===e||"object"!==r&&"function"!==r)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===e?"null":r}\``);const o=new WeakMap,a=new Proxy(e,{apply(e,r,i){const s=o.get(e);if(s)return Reflect.apply(s,r,i);const f=t.excludeMain?e:n(e,t,a,e);return o.set(e,f),Reflect.apply(f,r,i)},get(e,r){const s=e[r];if(!((e,r)=>{let n=i.get(e);if(n||(n={},i.set(e,n)),r in n)return n[r];const o=e=>"string"==typeof e||"symbol"==typeof r?r===e:e.test(r),a=Reflect.getOwnPropertyDescriptor(e,r),s=void 0===a||a.writable||a.configurable,f=(t.include?t.include.some(o):!t.exclude.some(o))&&s;return n[r]=f,f})(e,r)||s===Function.prototype[r])return s;const f=o.get(s);if(f)return f;if("function"==typeof s){const r=n(s,t,a,e);return o.set(s,r),r}return s}});return a}},function(e,t,r){const n=r(51);e.exports=class extends n{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}},function(e,t,r){const n=r(51),i=r(52),{incrementHexInt:o}=r(23);e.exports=class extends n{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const r=t,n=o(e),a=(await i({provider:this.provider,fromBlock:n,toBlock:r})).map((e=>e.hash));this.addResults(a)}}},function(e,t,r){const n=r(51),i=r(52),{incrementHexInt:o}=r(23);e.exports=class extends n{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,r=o(e),n=await i({provider:this.provider,fromBlock:r,toBlock:t}),a=[];for(const e of n)a.push(...e.transactions);this.addResults(a)}}},function(e,t,r){var n=r(228),i=r(229),o=r(9).inherits,a=r(13),s=r(231),f=r(28),c=r(254),u=r(31),d=r(255),h=/^[0-9A-Fa-f]+$/g;function l(e){this.nonceLock=c(1),e.getAccounts&&(this.getAccounts=e.getAccounts),e.processTransaction&&(this.processTransaction=e.processTransaction),e.processMessage&&(this.processMessage=e.processMessage),e.processPersonalMessage&&(this.processPersonalMessage=e.processPersonalMessage),e.processTypedMessage&&(this.processTypedMessage=e.processTypedMessage),e.processTypedMessageV3&&(this.processTypedMessageV3=e.processTypedMessageV3),this.approveTransaction=e.approveTransaction||this.autoApprove,this.approveMessage=e.approveMessage||this.autoApprove,this.approvePersonalMessage=e.approvePersonalMessage||this.autoApprove,this.approveDecryptMessage=e.approveDecryptMessage||this.autoApprove,this.approveEncryptionPublicKey=e.approveEncryptionPublicKey||this.autoApprove,this.approveTypedMessage=e.approveTypedMessage||this.autoApprove,e.signTransaction&&(this.signTransaction=e.signTransaction||m("signTransaction")),e.signMessage&&(this.signMessage=e.signMessage||m("signMessage")),e.signPersonalMessage&&(this.signPersonalMessage=e.signPersonalMessage||m("signPersonalMessage")),e.decryptMessage&&(this.decryptMessage=e.decryptMessage||m("decryptMessage")),e.encryptionPublicKey&&(this.encryptionPublicKey=e.encryptionPublicKey||m("encryptionPublicKey")),e.signTypedMessage&&(this.signTypedMessage=e.signTypedMessage||m("signTypedMessage")),e.signTypedMessageV3&&(this.signTypedMessageV3=e.signTypedMessageV3||m("signTypedMessageV3")),e.recoverPersonalSignature&&(this.recoverPersonalSignature=e.recoverPersonalSignature),e.publishTransaction&&(this.publishTransaction=e.publishTransaction),this.estimateGas=e.estimateGas||this.estimateGas,this.getGasPrice=e.getGasPrice||this.getGasPrice}function p(e){return e.toLowerCase()}function b(e){var t=a.addHexPrefix(e);return a.isValidAddress(t)}function g(e){var t=a.addHexPrefix(e);return!a.isValidAddress(t)&&y(e)}function y(e){return"string"==typeof e&&"0x"===e.slice(0,2)&&e.slice(2).match(h)}function m(e){return function(t,r){r(new Error('ProviderEngine - HookedWalletSubprovider - Must provide "'+e+'" fn in constructor options'))}}e.exports=l,o(l,u),l.prototype.handleRequest=function(e,t,r){var i,o,a,s,c,u,d,h,l=this;switch(l._parityRequests={},l._parityRequestCount=0,e.method){case"eth_coinbase":return void l.getAccounts((function(e,t){if(e)return r(e);var n=t[0]||null;r(null,n)}));case"eth_accounts":return void l.getAccounts((function(e,t){if(e)return r(e);r(null,t)}));case"eth_sendTransaction":return i=e.params[0],void n([function(e){return l.validateTransaction(i,e)},function(e){return l.processTransaction(i,e)}],r);case"eth_signTransaction":return i=e.params[0],void n([function(e){return l.validateTransaction(i,e)},function(e){return l.processSignTransaction(i,e)}],r);case"eth_sign":return c=e.params[0],s=e.params[1],a=e.params[2]||{},o=f(a,{from:c,data:s}),void n([function(e){return l.validateMessage(o,e)},function(e){return l.processMessage(o,e)}],r);case"personal_sign":return function(){var t=e.params[0];g(e.params[1])&&b(t)?(console.warn("The eth_personalSign method requires params ordered [message, address]. This was previously handled incorrectly, and has been corrected automatically. Please switch this param order for smooth behavior in the future."),c=e.params[0],s=e.params[1]):(s=e.params[0],c=e.params[1]),a=e.params[2]||{},o=f(a,{from:c,data:s}),n([function(e){return l.validatePersonalMessage(o,e)},function(e){return l.processPersonalMessage(o,e)}],r)}();case"eth_decryptMessage":return function(){var t=e.params[0];g(e.params[1])&&b(t)?(console.warn("The eth_decryptMessage method requires params ordered [message, address]. This was previously handled incorrectly, and has been corrected automatically. Please switch this param order for smooth behavior in the future."),c=e.params[0],s=e.params[1]):(s=e.params[0],c=e.params[1]),a=e.params[2]||{},o=f(a,{from:c,data:s}),n([function(e){return l.validateDecryptMessage(o,e)},function(e){return l.processDecryptMessage(o,e)}],r)}();case"encryption_public_key":return function(){var t=e.params[0];n([function(e){return l.validateEncryptionPublicKey(t,e)},function(e){return l.processEncryptionPublicKey(t,e)}],r)}();case"personal_ecRecover":return function(){s=e.params[0];var t=e.params[1];a=e.params[2]||{},o=f(a,{sig:t,data:s}),l.recoverPersonalSignature(o,r)}();case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":return d=e.params[0],h=e.params[1],b(d)?(c=d,s=h):(s=d,c=h),a=e.params[2]||{},o=f(a,{from:c,data:s}),void n([function(e){return l.validateTypedMessage(o,e)},function(t){return"eth_signTypedData"===e.method?l.processTypedMessage(o,t):l.processTypedMessageV3(o,t)}],r);case"parity_postTransaction":return i=e.params[0],void l.parityPostTransaction(i,r);case"parity_postSign":return c=e.params[0],s=e.params[1],void l.parityPostSign(c,s,r);case"parity_checkRequest":return u=e.params[0],void l.parityCheckRequest(u,r);case"parity_defaultAccount":return void l.getAccounts((function(e,t){if(e)return r(e);var n=t[0]||null;r(null,n)}));default:return void t()}},l.prototype.getAccounts=function(e){e(null,[])},l.prototype.processTransaction=function(e,t){var r=this;n([function(t){return r.approveTransaction(e,t)},function(e,t){return r.checkApproval("transaction",e,t)},function(t){return r.finalizeAndSubmitTx(e,t)}],t)},l.prototype.processSignTransaction=function(e,t){var r=this;n([function(t){return r.approveTransaction(e,t)},function(e,t){return r.checkApproval("transaction",e,t)},function(t){return r.finalizeTx(e,t)}],t)},l.prototype.processMessage=function(e,t){var r=this;n([function(t){return r.approveMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signMessage(e,t)}],t)},l.prototype.processPersonalMessage=function(e,t){var r=this;n([function(t){return r.approvePersonalMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signPersonalMessage(e,t)}],t)},l.prototype.processDecryptMessage=function(e,t){var r=this;n([function(t){return r.approveDecryptMessage(e,t)},function(e,t){return r.checkApproval("decryptMessage",e,t)},function(t){return r.decryptMessage(e,t)}],t)},l.prototype.processEncryptionPublicKey=function(e,t){var r=this;n([function(t){return r.approveEncryptionPublicKey(e,t)},function(e,t){return r.checkApproval("encryptionPublicKey",e,t)},function(t){return r.encryptionPublicKey(e,t)}],t)},l.prototype.processTypedMessage=function(e,t){var r=this;n([function(t){return r.approveTypedMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signTypedMessage(e,t)}],t)},l.prototype.processTypedMessageV3=function(e,t){var r=this;n([function(t){return r.approveTypedMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signTypedMessageV3(e,t)}],t)},l.prototype.autoApprove=function(e,t){t(null,!0)},l.prototype.checkApproval=function(e,t,r){r(t?null:new Error("User denied "+e+" signature."))},l.prototype.parityPostTransaction=function(e,t){var r=this,n=r._parityRequestCount,i="0x".concat(n.toString(16));r._parityRequestCount++,r.emitPayload({method:"eth_sendTransaction",params:[e]},(function(e,t){if(e)r._parityRequests[i]={error:e};else{var n=t.result;r._parityRequests[i]=n}})),t(null,i)},l.prototype.parityPostSign=function(e,t,r){var n=this,i=n._parityRequestCount,o="0x".concat(i.toString(16));n._parityRequestCount++,n.emitPayload({method:"eth_sign",params:[e,t]},(function(e,t){if(e)n._parityRequests[o]={error:e};else{var r=t.result;n._parityRequests[o]=r}})),r(null,o)},l.prototype.parityCheckRequest=function(e,t){var r=this._parityRequests[e]||null;return r?r.error?t(r.error):void t(null,r):t(null,null)},l.prototype.recoverPersonalSignature=function(e,t){var r;try{r=s.recoverPersonalSignature(e)}catch(e){return t(e)}t(null,r)},l.prototype.validateTransaction=function(e,t){if(void 0===e.from)return t(new Error("Undefined address - from address required to sign transaction."));this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign transaction for this address: "'.concat(e.from,'"')))}))},l.prototype.validateMessage=function(e,t){if(void 0===e.from)return t(new Error("Undefined address - from address required to sign message."));this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign message for this address: "'.concat(e.from,'"')))}))},l.prototype.validatePersonalMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to sign personal message.")):void 0===e.data?t(new Error("Undefined message - message required to sign personal message.")):y(e.data)?void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign message for this address: "'.concat(e.from,'"')))})):t(new Error("HookedWalletSubprovider - validateMessage - message was not encoded as hex."))},l.prototype.validateDecryptMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to decrypt message.")):void 0===e.data?t(new Error("Undefined message - message required to decrypt message.")):y(e.data)?void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to decrypt message for this address: "'.concat(e.from,'"')))})):t(new Error("HookedWalletSubprovider - validateDecryptMessage - message was not encoded as hex."))},l.prototype.validateEncryptionPublicKey=function(e,t){this.validateSender(e,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to obtain encryption public key for this address: "'.concat(e,'"')))}))},l.prototype.validateTypedMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to sign typed data.")):void 0===e.data?t(new Error("Undefined data - message required to sign typed data.")):void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign message for this address: "'.concat(e.from,'"')))}))},l.prototype.validateSender=function(e,t){if(!e)return t(null,!1);this.getAccounts((function(r,n){if(r)return t(r);var i=-1!==n.map(p).indexOf(e.toLowerCase());t(null,i)}))},l.prototype.finalizeAndSubmitTx=function(e,t){var r=this;r.nonceLock.take((function(){n([r.fillInTxExtras.bind(r,e),r.signTransaction.bind(r),r.publishTransaction.bind(r)],(function(e,n){if(r.nonceLock.leave(),e)return t(e);t(null,n)}))}))},l.prototype.finalizeTx=function(e,t){var r=this;r.nonceLock.take((function(){n([r.fillInTxExtras.bind(r,e),r.signTransaction.bind(r)],(function(n,i){if(r.nonceLock.leave(),n)return t(n);t(null,{raw:i,tx:e})}))}))},l.prototype.publishTransaction=function(e,t){this.emitPayload({method:"eth_sendRawTransaction",params:[e]},(function(e,r){if(e)return t(e);t(null,r.result)}))},l.prototype.estimateGas=function(e,t){d(this.engine,e,t)},l.prototype.getGasPrice=function(e){this.emitPayload({method:"eth_gasPrice",params:[]},(function(t,r){if(t)return e(t);e(null,r.result)}))},l.prototype.fillInTxExtras=function(e,t){var r=e.from,n={};void 0===e.gasPrice&&(n.gasPrice=this.getGasPrice.bind(this)),void 0===e.nonce&&(n.nonce=this.emitPayload.bind(this,{method:"eth_getTransactionCount",params:[r,"pending"]})),void 0===e.gas&&(n.gas=this.estimateGas.bind(this,function(e){return{from:e.from,to:e.to,value:e.value,data:e.data,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce}}(e))),i(n,(function(r,n){if(r)return t(r);var i={};n.gasPrice&&(i.gasPrice=n.gasPrice),n.nonce&&(i.nonce=n.nonce.result),n.gas&&(i.gas=n.gas),t(null,f(e,i))}))}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,o.default)(t||i.default),!(0,n.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function c(t){var n=(0,f.default)(e[r++]);t.push((0,s.default)(u)),n.apply(null,t)}function u(n){if(n||r===e.length)return t.apply(null,arguments);c((0,a.default)(arguments,1))}c([])};var n=c(r(89)),i=c(r(22)),o=c(r(43)),a=c(r(30)),s=c(r(45)),f=c(r(12));function c(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,i.default)(n.default,e,t)};var n=o(r(81)),i=o(r(230));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){r=r||n.default;var s=(0,i.default)(t)?[]:{};e(t,(function(e,t,r){(0,a.default)(e)((function(e,n){arguments.length>2&&(n=(0,o.default)(arguments,1)),s[t]=n,r(e)}))}),(function(e){r(e,s)}))};var n=s(r(22)),i=s(r(29)),o=s(r(30)),a=s(r(12));function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){const n=r(13),i=r(232);function o(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const r=e.map((function(e){return"bytes"===e.type?n.toBuffer(e.value):e.value})),o=e.map((function(e){return e.type})),a=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return i.soliditySHA3(["bytes32","bytes32"],[i.soliditySHA3(new Array(e.length).fill("string"),a),i.soliditySHA3(o,r)])}function a(e,t){const r=n.toBuffer(t),i=n.fromRpcSig(r);return n.ecrecover(e,i.v,i.r,i.s)}function s(e){const t=n.toBuffer(e.data);return a(n.hashPersonalMessage(t),e.sig)}function f(e,t){for(var r=""+e;r.length<t;)r="0"+r;return r}e.exports={concatSig:function(e,t,r){const i=n.fromSigned(t),o=n.fromSigned(r),a=n.bufferToInt(e),s=f(n.toUnsigned(i).toString("hex"),64),c=f(n.toUnsigned(o).toString("hex"),64),u=n.stripHexPrefix(n.intToHex(a));return n.addHexPrefix(s.concat(c,u)).toString("hex")},normalize:function(e){if(e){if("number"==typeof e){const t=n.toBuffer(e);e=n.bufferToHex(t)}if("string"!=typeof e){var t="eth-sig-util.normalize() requires hex string or integer input.";throw new Error(t+=" received "+typeof e+": "+e)}return n.addHexPrefix(e.toLowerCase())}},personalSign:function(e,t){var r=n.toBuffer(t.data),i=n.hashPersonalMessage(r),o=n.ecsign(i,e);return n.bufferToHex(this.concatSig(o.v,o.r,o.s))},recoverPersonalSignature:function(e){const t=s(e),r=n.publicToAddress(t);return n.bufferToHex(r)},extractPublicKey:function(e){return"0x"+s(e).toString("hex")},typedSignatureHash:function(e){const t=o(e);return n.bufferToHex(t)},signTypedData:function(e,t){const r=o(t.data),i=n.ecsign(r,e);return n.bufferToHex(this.concatSig(i.v,i.r,i.s))},recoverTypedSignature:function(e){const t=a(o(e.data),e.sig),r=n.publicToAddress(t);return n.bufferToHex(r)}}},function(e,t,r){e.exports=r(233)},function(e,t,r){(function(t){const n=r(234),i=r(2);var o=function(){};function a(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}function s(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function f(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function c(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function u(e){var t=typeof e;if("string"===t)return n.isHexPrefixed(e)?new i(n.stripHexPrefix(e),16):new i(e,10);if("number"===t)return new i(e);if(e.toArray)return e;throw new Error("Argument is not a number")}function d(e){var t=/^(\w+)\((.*)\)$/.exec(e);if(3!==t.length)throw new Error("Invalid method signature");var r=/^(.+)\):\((.+)$/.exec(t[2]);if(null!==r&&3===r.length)return{method:t[1],args:r[1].split(","),retargs:r[2].split(",")};var n=t[2].split(",");return 1===n.length&&""===n[0]&&(n=[]),{method:t[1],args:n}}function h(e,r){var o,a,d,l;if("address"===e)return h("uint160",u(r));if("bool"===e)return h("uint8",r?1:0);if("string"===e)return h("bytes",t.from(r,"utf8"));if(g(e)){if(void 0===r.length)throw new Error("Not an array?");if("dynamic"!==(o=c(e))&&0!==o&&r.length>o)throw new Error("Elements exceed array size: "+o);for(l in d=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof r&&(r=JSON.parse(r)),r)d.push(h(e,r[l]));if("dynamic"===o){var p=h("uint256",r.length);d.unshift(p)}return t.concat(d)}if("bytes"===e)return r=t.from(r),d=t.concat([h("uint256",r.length),r]),r.length%32!=0&&(d=t.concat([d,n.zeros(32-r.length%32)])),d;if(e.startsWith("bytes")){if((o=s(e))<1||o>32)throw new Error("Invalid bytes<N> width: "+o);return n.setLengthRight(r,32)}if(e.startsWith("uint")){if((o=s(e))%8||o<8||o>256)throw new Error("Invalid uint<N> width: "+o);if((a=u(r)).bitLength()>o)throw new Error("Supplied uint exceeds width: "+o+" vs "+a.bitLength());if(a<0)throw new Error("Supplied uint is negative");return a.toArrayLike(t,"be",32)}if(e.startsWith("int")){if((o=s(e))%8||o<8||o>256)throw new Error("Invalid int<N> width: "+o);if((a=u(r)).bitLength()>o)throw new Error("Supplied int exceeds width: "+o+" vs "+a.bitLength());return a.toTwos(256).toArrayLike(t,"be",32)}if(e.startsWith("ufixed")){if(o=f(e),(a=u(r))<0)throw new Error("Supplied ufixed is negative");return h("uint256",a.mul(new i(2).pow(new i(o[1]))))}if(e.startsWith("fixed"))return o=f(e),h("int256",u(r).mul(new i(2).pow(new i(o[1]))));throw new Error("Unsupported or invalid type: "+e)}function l(e,r,n){var o,a,s,f;if("string"==typeof e&&(e=p(e)),"address"===e.name)return l(e.rawType,r,n).toArrayLike(t,"be",20).toString("hex");if("bool"===e.name)return l(e.rawType,r,n).toString()===new i(1).toString();if("string"===e.name){var c=l(e.rawType,r,n);return t.from(c,"utf8").toString()}if(e.isArray){for(s=[],o=e.size,"dynamic"===e.size&&(n=l("uint256",r,n).toNumber(),o=l("uint256",r,n).toNumber(),n+=32),f=0;f<o;f++){var u=l(e.subArray,r,n);s.push(u),n+=e.subArray.memoryUsage}return s}if("bytes"===e.name)return n=l("uint256",r,n).toNumber(),o=l("uint256",r,n).toNumber(),r.slice(n+32,n+32+o);if(e.name.startsWith("bytes"))return r.slice(n,n+e.size);if(e.name.startsWith("uint")){if((a=new i(r.slice(n,n+32),16,"be")).bitLength()>e.size)throw new Error("Decoded int exceeds width: "+e.size+" vs "+a.bitLength());return a}if(e.name.startsWith("int")){if((a=new i(r.slice(n,n+32),16,"be").fromTwos(256)).bitLength()>e.size)throw new Error("Decoded uint exceeds width: "+e.size+" vs "+a.bitLength());return a}if(e.name.startsWith("ufixed")){if(o=new i(2).pow(new i(e.size[1])),!(a=l("uint256",r,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}if(e.name.startsWith("fixed")){if(o=new i(2).pow(new i(e.size[1])),!(a=l("int256",r,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}throw new Error("Unsupported or invalid type: "+e.name)}function p(e){var t,r,n;if(g(e)){t=c(e);var i=e.slice(0,e.lastIndexOf("["));return i=p(i),{isArray:!0,name:e,size:t,memoryUsage:"dynamic"===t?32:i.memoryUsage*t,subArray:i}}switch(e){case"address":n="uint160";break;case"bool":n="uint8";break;case"string":n="bytes"}if(r={rawType:n,name:e,memoryUsage:32},e.startsWith("bytes")&&"bytes"!==e||e.startsWith("uint")||e.startsWith("int")?r.size=s(e):(e.startsWith("ufixed")||e.startsWith("fixed"))&&(r.size=f(e)),e.startsWith("bytes")&&"bytes"!==e&&(r.size<1||r.size>32))throw new Error("Invalid bytes<N> width: "+r.size);if((e.startsWith("uint")||e.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint<N> width: "+r.size);return r}function b(e){return"string"===e||"bytes"===e||"dynamic"===c(e)}function g(e){return e.lastIndexOf("]")===e.length-1}function y(e,t){return e.startsWith("address")||e.startsWith("bytes")?"0x"+t.toString("hex"):t.toString()}o.eventID=function(e,r){var i=e+"("+r.map(a).join(",")+")";return n.keccak256(t.from(i))},o.methodID=function(e,t){return o.eventID(e,t).slice(0,4)},o.rawEncode=function(e,r){var n=[],i=[],o=0;e.forEach((function(e){if(g(e)){var t=c(e);o+="dynamic"!==t?32*t:32}else o+=32}));for(var s=0;s<e.length;s++){var f=a(e[s]),u=h(f,r[s]);b(f)?(n.push(h("uint256",o)),i.push(u),o+=u.length):n.push(u)}return t.concat(n.concat(i))},o.rawDecode=function(e,r){var n=[];r=t.from(r);for(var i=0,o=0;o<e.length;o++){var s=p(a(e[o])),f=l(s,r,i);i+=s.memoryUsage,n.push(f)}return n},o.simpleEncode=function(e){var r=Array.prototype.slice.call(arguments).slice(1),n=d(e);if(r.length!==n.args.length)throw new Error("Argument count mismatch");return t.concat([o.methodID(n.method,n.args),o.rawEncode(n.args,r)])},o.simpleDecode=function(e,t){var r=d(e);if(!r.retargs)throw new Error("No return values in method");return o.rawDecode(r.retargs,t)},o.stringify=function(e,t){var r=[];for(var n in e){var i=e[n],o=t[n];o=/^[^\[]+\[.*\]$/.test(i)?o.map((function(e){return y(i,e)})).join(", "):y(i,o),r.push(o)}return r},o.solidityHexValue=function(e,r,i){var a,f;if(g(e)){var d=e.replace(/\[.*?\]/,"");if(!g(d)){var h=c(e);if("dynamic"!==h&&0!==h&&r.length>h)throw new Error("Elements exceed array size: "+h)}var l=r.map((function(e){return o.solidityHexValue(d,e,256)}));return t.concat(l)}if("bytes"===e)return r;if("string"===e)return t.from(r,"utf8");if("bool"===e){i=i||8;var p=Array(i/4).join("0");return t.from(r?p+"1":p+"0","hex")}if("address"===e){var b=20;return i&&(b=i/8),n.setLengthLeft(r,b)}if(e.startsWith("bytes")){if((a=s(e))<1||a>32)throw new Error("Invalid bytes<N> width: "+a);return n.setLengthRight(r,a)}if(e.startsWith("uint")){if((a=s(e))%8||a<8||a>256)throw new Error("Invalid uint<N> width: "+a);if((f=u(r)).bitLength()>a)throw new Error("Supplied uint exceeds width: "+a+" vs "+f.bitLength());return i=i||a,f.toArrayLike(t,"be",i/8)}if(e.startsWith("int")){if((a=s(e))%8||a<8||a>256)throw new Error("Invalid int<N> width: "+a);if((f=u(r)).bitLength()>a)throw new Error("Supplied int exceeds width: "+a+" vs "+f.bitLength());return i=i||a,f.toTwos(a).toArrayLike(t,"be",i/8)}throw new Error("Unsupported or invalid type: "+e)},o.solidityPack=function(e,r){if(e.length!==r.length)throw new Error("Number of types are not matching the values");for(var n=[],i=0;i<e.length;i++){var s=a(e[i]),f=r[i];n.push(o.solidityHexValue(s,f,null))}return t.concat(n)},o.soliditySHA3=function(e,t){return n.keccak256(o.solidityPack(e,t))},o.soliditySHA256=function(e,t){return n.sha256(o.solidityPack(e,t))},o.solidityRIPEMD160=function(e,t){return n.ripemd160(o.solidityPack(e,t),!0)},o.fromSerpent=function(e){for(var t,r=[],n=0;n<e.length;n++){var i=e[n];if("s"===i)r.push("bytes");else if("b"===i){for(var o="bytes",a=n+1;a<e.length&&(t=e[a])>="0"&&t<="9";)o+=e[a]-"0",a++;n=a-1,r.push(o)}else if("i"===i)r.push("int256");else{if("a"!==i)throw new Error("Unsupported or invalid type: "+i);r.push("int256[]")}}return r},o.toSerpent=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if("bytes"===n)t.push("s");else if(n.startsWith("bytes"))t.push("b"+s(n));else if("int256"===n)t.push("i");else{if("int256[]"!==n)throw new Error("Unsupported or invalid type: "+n);t.push("a")}}return t.join("")},e.exports=o}).call(this,r(1).Buffer)},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.secp256k1=t.rlp=t.BN=void 0;var o=r(53);t.secp256k1=o;var a=r(17),s=r(2);t.BN=s;var f=r(27);t.rlp=f,Object.assign(t,a),i(r(242),t),i(r(243),t),i(r(54),t),i(r(252),t),i(r(24),t),i(r(253),t)},function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}f((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(98),a=r(238);t.createPrivateKey=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,a.getRandomBytes(32)];case 1:return e=t.sent(),o.privateKeyVerify(e)?[2,e]:[3,0];case 2:return[2]}}))}))},t.createPrivateKeySync=function(){for(;;){var e=a.getRandomBytesSync(32);if(o.privateKeyVerify(e))return e}},function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(98))},function(e,t){const r="Impossible case. Please create issue.",n="The tweak was out of range or the resulted private key is invalid",i="The tweak was out of range or equal to zero",o="Unknow error on context randomization",a="Private Key is invalid",s="Public Key could not be parsed",f="Public Key serialization error",c="The sum of the public keys is not valid",u="Signature could not be parsed",d="The nonce generation function failed, or the private key was invalid",h="Public key could not be recover",l="Scalar was invalid (zero or overflow)";function p(e,t){if(!e)throw new Error(t)}function b(e,t,r){if(p(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;p(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;p(t.length===r,n)}}function g(e){p("Boolean"===m(e),"Expected compressed to be a Boolean")}function y(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),b("output",e,t),e}function m(e){return Object.prototype.toString.call(e).slice(8,-1)}e.exports=e=>({contextRandomize(t){if(1===(p(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&b("seed",t,32),e.contextRandomize(t)))throw new Error(o)},privateKeyVerify:t=>(b("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(b("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(r)}},privateKeyTweakAdd(t,r){switch(b("private key",t,32),b("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(n)}},privateKeyTweakMul(t,r){switch(b("private key",t,32),b("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(i)}},publicKeyVerify:t=>(b("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(b("private key",t,32),g(r),n=y(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(a);case 2:throw new Error(f)}},publicKeyConvert(t,r=!0,n){switch(b("public key",t,[33,65]),g(r),n=y(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(f)}},publicKeyNegate(t,n=!0,i){switch(b("public key",t,[33,65]),g(n),i=y(i,n?33:65),e.publicKeyNegate(i,t)){case 0:return i;case 1:throw new Error(s);case 2:throw new Error(r);case 3:throw new Error(f)}},publicKeyCombine(t,r=!0,n){p(Array.isArray(t),"Expected public keys to be an Array"),p(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)b("public key",e,[33,65]);switch(g(r),n=y(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(c);case 3:throw new Error(f)}},publicKeyTweakAdd(t,r,i=!0,o){switch(b("public key",t,[33,65]),b("tweak",r,32),g(i),o=y(o,i?33:65),e.publicKeyTweakAdd(o,t,r)){case 0:return o;case 1:throw new Error(s);case 2:throw new Error(n)}},publicKeyTweakMul(t,r,n=!0,o){switch(b("public key",t,[33,65]),b("tweak",r,32),g(n),o=y(o,n?33:65),e.publicKeyTweakMul(o,t,r)){case 0:return o;case 1:throw new Error(s);case 2:throw new Error(i)}},signatureNormalize(t){switch(b("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(u)}},signatureExport(t,n){b("signature",t,64);const i={output:n=y(n,72),outputlen:72};switch(e.signatureExport(i,t)){case 0:return n.slice(0,i.outputlen);case 1:throw new Error(u);case 2:throw new Error(r)}},signatureImport(t,n){switch(b("signature",t),n=y(n,64),e.signatureImport(n,t)){case 0:return n;case 1:throw new Error(u);case 2:throw new Error(r)}},ecdsaSign(t,n,i={},o){b("message",t,32),b("private key",n,32),p("Object"===m(i),"Expected options to be an Object"),void 0!==i.data&&b("options.data",i.data),void 0!==i.noncefn&&p("Function"===m(i.noncefn),"Expected options.noncefn to be a Function");const a={signature:o=y(o,64),recid:null};switch(e.ecdsaSign(a,t,n,i.data,i.noncefn)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(r)}},ecdsaVerify(t,r,n){switch(b("signature",t,64),b("message",r,32),b("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(u);case 2:throw new Error(s)}},ecdsaRecover(t,n,i,o=!0,a){switch(b("signature",t,64),p("Number"===m(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),b("message",i,32),g(o),a=y(a,o?33:65),e.ecdsaRecover(a,t,n,i)){case 0:return a;case 1:throw new Error(u);case 2:throw new Error(h);case 3:throw new Error(r)}},ecdh(t,r,n={},i){switch(b("public key",t,[33,65]),b("private key",r,32),p("Object"===m(n),"Expected options to be an Object"),void 0!==n.data&&b("options.data",n.data),void 0!==n.hashfn?(p("Function"===m(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&b("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&b("options.ybuf",n.ybuf,32),b("output",i)):i=y(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(s);case 2:throw new Error(l)}}})},function(e,t,r){const n=new(r(38).ec)("secp256k1"),i=n.curve,o=i.n.constructor;function a(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new o(t);if(r.cmp(i.p)>=0)return null;r=r.toRed(i.red);let a=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===e!==a.isOdd()&&(a=a.redNeg()),n.keyPair({pub:{x:r,y:a}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let a=new o(t),s=new o(r);if(a.cmp(i.p)>=0||s.cmp(i.p)>=0)return null;if(a=a.toRed(i.red),s=s.toRed(i.red),(6===e||7===e)&&s.isOdd()!==(7===e))return null;const f=a.redSqr().redIMul(a);return s.redSqr().redISub(f.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:a,y:s}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function s(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}e.exports={contextRandomize:()=>0,privateKeyVerify(e){const t=new o(e);return t.cmp(i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new o(e),r=i.n.sub(t).umod(i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new o(t);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(e)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new o(t);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(e)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===a(e)?1:0,publicKeyCreate(e,t){const r=new o(t);return r.cmp(i.n)>=0||r.isZero()?1:(s(e,n.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const r=a(t);return null===r?1:(s(e,r.getPublic()),0)},publicKeyNegate(e,t){const r=a(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),s(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=a(t[e]),null===r[e])return 1;let n=r[0].getPublic();for(let e=1;e<r.length;++e)n=n.add(r[e].pub);return n.isInfinity()?2:(s(e,n),0)},publicKeyTweakAdd(e,t,r){const n=a(t);if(null===n)return 1;if((r=new o(r)).cmp(i.n)>=0)return 2;const f=n.getPublic().add(i.g.mul(r));return f.isInfinity()?2:(s(e,f),0)},publicKeyTweakMul(e,t,r){const n=a(t);return null===n?1:(r=new o(r)).cmp(i.n)>=0||r.isZero()?2:(s(e,n.getPublic().mul(r)),0)},signatureNormalize(e){const t=new o(e.subarray(0,32)),r=new o(e.subarray(32,64));return t.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&e.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:a}=e;let s=a.subarray(4,37);s[0]=0,s.set(r,1);let f=33,c=0;for(;f>1&&0===s[c]&&!(128&s[c+1]);--f,++c);if(s=s.subarray(c),128&s[0])return 1;if(f>1&&0===s[0]&&!(128&s[1]))return 1;let u=a.subarray(39,72);u[0]=0,u.set(n,1);let d=33,h=0;for(;d>1&&0===u[h]&&!(128&u[h+1]);--d,++h);return u=u.subarray(h),128&u[0]||d>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+f+d,a[0]=48,a[1]=e.outputlen-2,a[2]=2,a[3]=s.length,a.set(s,4),a[4+f]=2,a[5+f]=u.length,a.set(u,6+f),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let a=t.subarray(4,4+r);if(33===a.length&&0===a[0]&&(a=a.subarray(1)),a.length>32)return 1;let s=t.subarray(6+r);if(33===s.length&&0===s[0]&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let f=new o(a);f.cmp(i.n)>=0&&(f=new o(0));let c=new o(t.subarray(6+r));return c.cmp(i.n)>=0&&(c=new o(0)),e.set(f.toArrayLike(Uint8Array,"be",32),0),e.set(c.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,a,s){if(s){const e=s;s=n=>{const i=e(t,r,null,a,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)}}const f=new o(r);if(f.cmp(i.n)>=0||f.isZero())return 1;let c;try{c=n.sign(t,r,{canonical:!0,k:s,pers:a})}catch(e){return 1}return e.signature.set(c.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(c.s.toArrayLike(Uint8Array,"be",32),32),e.recid=c.recoveryParam,0},ecdsaVerify(e,t,r){const s={r:e.subarray(0,32),s:e.subarray(32,64)},f=new o(s.r),c=new o(s.s);if(f.cmp(i.n)>=0||c.cmp(i.n)>=0)return 1;if(1===c.cmp(n.nh)||f.isZero()||c.isZero())return 3;const u=a(r);if(null===u)return 2;const d=u.getPublic();return n.verify(t,s,d)?0:3},ecdsaRecover(e,t,r,a){const f={r:t.slice(0,32),s:t.slice(32,64)},c=new o(f.r),u=new o(f.s);if(c.cmp(i.n)>=0||u.cmp(i.n)>=0)return 1;if(c.isZero()||u.isZero())return 2;let d;try{d=n.recoverPubKey(a,f,r)}catch(e){return 2}return s(e,d),0},ecdh(e,t,r,s,f,c,u){const d=a(t);if(null===d)return 1;const h=new o(r);if(h.cmp(i.n)>=0||h.isZero())return 2;const l=d.getPublic().mul(h);if(void 0===f){const t=l.encode(null,!0),r=n.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{c||(c=new Uint8Array(32));const t=l.getX().toArray("be",32);for(let e=0;e<32;++e)c[e]=t[e];u||(u=new Uint8Array(32));const r=l.getY().toArray("be",32);for(let e=0;e<32;++e)u[e]=r[e];const n=f(c,u,s);if(!(n instanceof Uint8Array&&n.length===e.length))return 2;e.set(n)}return 0}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(239);t.getRandomBytes=function(e){return new Promise((function(t,r){n(e,(function(e,n){e?r(e):t(n)}))}))},t.getRandomBytesSync=function(e){return n(e)}},function(e,t,r){(function(t,n){var i=r(3).Buffer,o=t.crypto||t.msCrypto;o&&o.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a<e;a+=65536)o.getRandomValues(r.slice(a,a+65536));else o.getRandomValues(r);return"function"==typeof t?n.nextTick((function(){t(null,r)})):r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(6),r(4))},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),i=new(r(38).ec)("secp256k1"),o=i.curve;t.privateKeyExport=function(e,t){void 0===t&&(t=!0);var r=new n(e);if(r.ucmp(o.n)>=0)throw new Error("couldn't export to DER format");var s=i.g.mul(r);return a(s.getX(),s.getY(),t)},t.privateKeyModInverse=function(t){var r=new n(t);if(r.ucmp(o.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(o.n).toArrayLike(e,"be",32)},t.signatureImport=function(t){var r=new n(t.r);r.ucmp(o.n)>=0&&(r=new n(0));var i=new n(t.s);return i.ucmp(o.n)>=0&&(i=new n(0)),e.concat([r.toArrayLike(e,"be",32),i.toArrayLike(e,"be",32)])},t.ecdhUnsafe=function(e,t,r){void 0===r&&(r=!0);var s=i.keyFromPublic(e),f=new n(t);if(f.ucmp(o.n)>=0||f.isZero())throw new Error("scalar was invalid (zero or overflow)");var c=s.pub.mul(f);return a(c.getX(),c.getY(),r)};var a=function(t,r,n){var i;return n?((i=e.alloc(33))[0]=r.isOdd()?3:2,t.toArrayLike(e,"be",32).copy(i,1)):((i=e.alloc(65))[0]=4,t.toArrayLike(e,"be",32).copy(i,1),r.toArrayLike(e,"be",32).copy(i,33)),i}}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=e.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=e.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(t,i,o){void 0===o&&(o=!0);var a=e.from(o?r:n);return t.copy(a,o?8:9),i.copy(a,o?181:214),a},t.privateKeyImport=function(e){var t=e.length,r=0;if(t<r+1||48!==e[r])return null;if(t<(r+=1)+1||!(128&e[r]))return null;var n=127&e[r];if(n<1||n>2)return null;if(t<(r+=1)+n)return null;var i=e[r+n-1]|(n>1?e[r+n-2]<<8:0);return t<(r+=n)+i||t<r+3||2!==e[r]||1!==e[r+1]||1!==e[r+2]||t<(r+=3)+2||4!==e[r]||e[r+1]>32||t<r+2+e[r+1]?null:e.slice(r+2,r+2+e[r+1])},t.signatureImportLax=function(t){var r=e.alloc(32,0),n=e.alloc(32,0),i=t.length,o=0;if(48!==t[o++])return null;var a=t[o++];if(128&a&&(o+=a-128)>i)return null;if(2!==t[o++])return null;var s=t[o++];if(128&s){if(o+(a=s-128)>i)return null;for(;a>0&&0===t[o];o+=1,a-=1);for(s=0;a>0;o+=1,a-=1)s=(s<<8)+t[o]}if(s>i-o)return null;var f=o;if(o+=s,2!==t[o++])return null;var c=t[o++];if(128&c){if(o+(a=c-128)>i)return null;for(;a>0&&0===t[o];o+=1,a-=1);for(c=0;a>0;o+=1,a-=1)c=(c<<8)+t[o]}if(c>i-o)return null;var u=o;for(o+=c;s>0&&0===t[f];s-=1,f+=1);if(s>32)return null;var d=t.slice(f,f+s);for(d.copy(r,32-d.length);c>0&&0===t[u];c-=1,u+=1);if(c>32)return null;var h=t.slice(u,u+c);return h.copy(n,32-h.length),{r:r,s:n}}}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(2);t.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=e.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=e.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=e.from(t.KECCAK256_RLP_S,"hex")}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.importPublic=t.privateToPublic=t.privateToAddress=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.isPrecompiled=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isZeroAddress=t.isValidAddress=t.zeroAddress=void 0;var n=r(41),i=r(17),o=r(53),a=r(2),s=r(24),f=r(54);t.zeroAddress=function(){var e=s.zeros(20);return s.bufferToHex(e)},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===s.addHexPrefix(e)},t.toChecksumAddress=function(e,t){e=i.stripHexPrefix(e).toLowerCase();for(var r=void 0!==t?t.toString()+"0x":"",n=f.keccak(r+e).toString("hex"),o="0x",a=0;a<e.length;a++)parseInt(n[a],16)>=8?o+=e[a].toUpperCase():o+=e[a];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(t,r){t=s.toBuffer(t);var n=new a(r);return n.isZero()?f.rlphash([t,null]).slice(-20):f.rlphash([t,e.from(n.toArray())]).slice(-20)},t.generateAddress2=function(t,r,i){var o=s.toBuffer(t),a=s.toBuffer(r),c=s.toBuffer(i);return n(20===o.length),n(32===a.length),f.keccak256(e.concat([e.from("ff","hex"),o,a,f.keccak256(c)])).slice(-20)},t.isPrecompiled=function(e){var t=s.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(t,r){return void 0===r&&(r=!1),64===t.length?o.publicKeyVerify(e.concat([e.from([4]),t])):!!r&&o.publicKeyVerify(t)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),e=s.toBuffer(e),t&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),n(64===e.length),f.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.privateToPublic=function(e){return e=s.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)},t.importPublic=function(e){return 64!==(e=s.toBuffer(e)).length&&(e=o.publicKeyConvert(e,!1).slice(1)),e}}).call(this,r(1).Buffer)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(245),i=r(246);t.keccak224=n.createHashFunction((function(){return i("keccak224")})),t.keccak256=n.createHashFunction((function(){return i("keccak256")})),t.keccak384=n.createHashFunction((function(){return i("keccak384")})),t.keccak512=n.createHashFunction((function(){return i("keccak512")}))},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.createHashFunction=function(t){return function(r){var n=t();return n.update(r),e.from(n.digest())}}}).call(this,r(1).Buffer)},function(e,t,r){e.exports=r(247)(r(250))},function(e,t,r){const n=r(248),i=r(249);e.exports=function(e){const t=n(e),r=i(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(t){const{Transform:n}=r(18);e.exports=e=>class r extends n{constructor(t,r,n,i,o){super(o),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,r){if(!t.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return t.isBuffer(e)||(e=t.from(e,r)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new r(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){const{Transform:n}=r(18);e.exports=e=>class r extends n{constructor(t,r,n,i){super(i),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,r){if(!t.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return t.isBuffer(e)||(e=t.from(e,r)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new r(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){const n=r(251);function i(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}i.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},i.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0)},i.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&n.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,n.p1600(this.state),this.count=0,this.squeezing=!0},i.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const r=t.alloc(e);for(let t=0;t<e;++t)r[t]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0);return r},i.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=i}).call(this,r(1).Buffer)},function(e,t){const r=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(e){for(let t=0;t<24;++t){const n=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],u=e[7]^e[17]^e[27]^e[37]^e[47],d=e[8]^e[18]^e[28]^e[38]^e[48],h=e[9]^e[19]^e[29]^e[39]^e[49];let l=d^(o<<1|a>>>31),p=h^(a<<1|o>>>31);const b=e[0]^l,g=e[1]^p,y=e[10]^l,m=e[11]^p,v=e[20]^l,_=e[21]^p,w=e[30]^l,E=e[31]^p,S=e[40]^l,A=e[41]^p;l=n^(s<<1|f>>>31),p=i^(f<<1|s>>>31);const k=e[2]^l,M=e[3]^p,x=e[12]^l,I=e[13]^p,T=e[22]^l,R=e[23]^p,P=e[32]^l,L=e[33]^p,B=e[42]^l,C=e[43]^p;l=o^(c<<1|u>>>31),p=a^(u<<1|c>>>31);const O=e[4]^l,N=e[5]^p,j=e[14]^l,D=e[15]^p,U=e[24]^l,z=e[25]^p,q=e[34]^l,K=e[35]^p,F=e[44]^l,V=e[45]^p;l=s^(d<<1|h>>>31),p=f^(h<<1|d>>>31);const H=e[6]^l,W=e[7]^p,Y=e[16]^l,G=e[17]^p,Z=e[26]^l,J=e[27]^p,X=e[36]^l,$=e[37]^p,Q=e[46]^l,ee=e[47]^p;l=c^(n<<1|i>>>31),p=u^(i<<1|n>>>31);const te=e[8]^l,re=e[9]^p,ne=e[18]^l,ie=e[19]^p,oe=e[28]^l,ae=e[29]^p,se=e[38]^l,fe=e[39]^p,ce=e[48]^l,ue=e[49]^p,de=b,he=g,le=m<<4|y>>>28,pe=y<<4|m>>>28,be=v<<3|_>>>29,ge=_<<3|v>>>29,ye=E<<9|w>>>23,me=w<<9|E>>>23,ve=S<<18|A>>>14,_e=A<<18|S>>>14,we=k<<1|M>>>31,Ee=M<<1|k>>>31,Se=I<<12|x>>>20,Ae=x<<12|I>>>20,ke=T<<10|R>>>22,Me=R<<10|T>>>22,xe=L<<13|P>>>19,Ie=P<<13|L>>>19,Te=B<<2|C>>>30,Re=C<<2|B>>>30,Pe=N<<30|O>>>2,Le=O<<30|N>>>2,Be=j<<6|D>>>26,Ce=D<<6|j>>>26,Oe=z<<11|U>>>21,Ne=U<<11|z>>>21,je=q<<15|K>>>17,De=K<<15|q>>>17,Ue=V<<29|F>>>3,ze=F<<29|V>>>3,qe=H<<28|W>>>4,Ke=W<<28|H>>>4,Fe=G<<23|Y>>>9,Ve=Y<<23|G>>>9,He=Z<<25|J>>>7,We=J<<25|Z>>>7,Ye=X<<21|$>>>11,Ge=$<<21|X>>>11,Ze=ee<<24|Q>>>8,Je=Q<<24|ee>>>8,Xe=te<<27|re>>>5,$e=re<<27|te>>>5,Qe=ne<<20|ie>>>12,et=ie<<20|ne>>>12,tt=ae<<7|oe>>>25,rt=oe<<7|ae>>>25,nt=se<<8|fe>>>24,it=fe<<8|se>>>24,ot=ce<<14|ue>>>18,at=ue<<14|ce>>>18;e[0]=de^~Se&Oe,e[1]=he^~Ae&Ne,e[10]=qe^~Qe&be,e[11]=Ke^~et&ge,e[20]=we^~Be&He,e[21]=Ee^~Ce&We,e[30]=Xe^~le&ke,e[31]=$e^~pe&Me,e[40]=Pe^~Fe&tt,e[41]=Le^~Ve&rt,e[2]=Se^~Oe&Ye,e[3]=Ae^~Ne&Ge,e[12]=Qe^~be&xe,e[13]=et^~ge&Ie,e[22]=Be^~He&nt,e[23]=Ce^~We&it,e[32]=le^~ke&je,e[33]=pe^~Me&De,e[42]=Fe^~tt&ye,e[43]=Ve^~rt&me,e[4]=Oe^~Ye&ot,e[5]=Ne^~Ge&at,e[14]=be^~xe&Ue,e[15]=ge^~Ie&ze,e[24]=He^~nt&ve,e[25]=We^~it&_e,e[34]=ke^~je&Ze,e[35]=Me^~De&Je,e[44]=tt^~ye&Te,e[45]=rt^~me&Re,e[6]=Ye^~ot&de,e[7]=Ge^~at&he,e[16]=xe^~Ue&qe,e[17]=Ie^~ze&Ke,e[26]=nt^~ve&we,e[27]=it^~_e&Ee,e[36]=je^~Ze&Xe,e[37]=De^~Je&$e,e[46]=ye^~Te&Pe,e[47]=me^~Re&Le,e[8]=ot^~de&Se,e[9]=at^~he&Ae,e[18]=Ue^~qe&Qe,e[19]=ze^~Ke&et,e[28]=ve^~we&Be,e[29]=_e^~Ee&Ce,e[38]=Ze^~Xe&le,e[39]=Je^~$e&pe,e[48]=Te^~Pe&Fe,e[49]=Re^~Le&Ve,e[0]^=r[2*t],e[1]^=r[2*t+1]}}},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var n=r(53),i=r(2),o=r(24),a=r(54);function s(e,t){return t?e-(2*t+35):e-27}function f(e){return 0===e||1===e}t.ecsign=function(e,t,r){var i=n.sign(e,t),o=i.recovery;return{r:i.signature.slice(0,32),s:i.signature.slice(32,64),v:r?o+(2*r+35):o+27}},t.ecrecover=function(t,r,i,a,c){var u=e.concat([o.setLength(i,32),o.setLength(a,32)],64),d=s(r,c);if(!f(d))throw new Error("Invalid signature v value");var h=n.recover(t,u,d);return n.publicKeyConvert(h,!1).slice(1)},t.toRpcSig=function(t,r,n,i){if(!f(s(t,i)))throw new Error("Invalid signature v value");return o.bufferToHex(e.concat([o.setLengthLeft(r,32),o.setLengthLeft(n,32),o.toBuffer(t)]))},t.fromRpcSig=function(e){var t=o.toBuffer(e);if(65!==t.length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},t.isValidSignature=function(e,t,r,n,o){void 0===n&&(n=!0);var a=new i("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!f(s(e,o)))return!1;var u=new i(t),d=new i(r);return!(u.isZero()||u.gt(c)||d.isZero()||d.gt(c)||n&&1===d.cmp(a))},t.hashPersonalMessage=function(t){var r=e.from("Ethereum Signed Message:\n"+t.length.toString(),"utf-8");return a.keccak(e.concat([r,t]))}}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var n=r(41),i=r(17),o=r(27),a=r(24);t.defineProperties=function(t,r,s){if(t.raw=[],t._fields=[],t.toJSON=function(e){if(void 0===e&&(e=!1),e){var r={};return t._fields.forEach((function(e){r[e]="0x"+t[e].toString("hex")})),r}return a.baToJSON(t.raw)},t.serialize=function(){return o.encode(t.raw)},r.forEach((function(r,i){function o(){return t.raw[i]}function s(o){"00"!==(o=a.toBuffer(o)).toString("hex")||r.allowZero||(o=e.allocUnsafe(0)),r.allowLess&&r.length?(o=a.stripZeros(o),n(r.length>=o.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===o.length||!r.length||n(r.length===o.length,"The field "+r.name+" must have byte length of "+r.length),t.raw[i]=o}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:o,set:s}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:s,get:o})})),s)if("string"==typeof s&&(s=e.from(i.stripHexPrefix(s),"hex")),e.isBuffer(s)&&(s=o.decode(s)),Array.isArray(s)){if(s.length>t._fields.length)throw new Error("wrong number of fields in data");s.forEach((function(e,r){t[t._fields[r]]=a.toBuffer(e)}))}else{if("object"!=typeof s)throw new Error("invalid data");var f=Object.keys(s);r.forEach((function(e){-1!==f.indexOf(e.name)&&(t[e.name]=s[e.name]),-1!==f.indexOf(e.alias)&&(t[e.alias]=s[e.alias])}))}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){var r;r=function(e){setTimeout(e,0)},void 0!==t&&t&&"function"==typeof t.nextTick&&(r=t.nextTick),e.exports=function(e){var t={capacity:e||1,current:0,queue:[],firstHere:!1,take:function(){if(!1===t.firstHere){t.current++,t.firstHere=!0;var e=1}else e=0;var r={n:1};"function"==typeof arguments[0]?r.task=arguments[0]:r.n=arguments[0],arguments.length>=2&&("function"==typeof arguments[1]?r.task=arguments[1]:r.n=arguments[1]);var n=r.task;if(r.task=function(){n(t.leave)},t.current+r.n-e>t.capacity)return 1===e&&(t.current--,t.firstHere=!1),t.queue.push(r);t.current+=r.n-e,r.task(t.leave),1===e&&(t.firstHere=!1)},leave:function(e){if(e=e||1,t.current-=e,t.queue.length){var n=t.queue[0];n.n+t.current>t.capacity||(t.queue.shift(),t.current+=n.n,r(n.task))}else if(t.current<0)throw new Error("leave called too many times.")},available:function(e){return e=e||1,t.current+e<=t.capacity}};return t}}).call(this,r(4))},function(e,t,r){var n=r(91);e.exports=function(e,t,r){e.sendAsync(n({method:"eth_estimateGas",params:[t]}),(function(e,t){if(e)return"no contract code at given address"===e.message?r(null,"0xcf08"):r(e);r(null,t.result)}))}},function(e,t,r){(function(t){var n=r(9).inherits,i=r(257),o=r(13),a=r(31),s=r(259).blockTagForPayload;function f(e){this.nonceCache={}}e.exports=f,n(f,a),f.prototype.handleRequest=function(e,r,n){var a=this;switch(e.method){case"eth_getTransactionCount":var f=s(e),c=e.params[0].toLowerCase(),u=a.nonceCache[c];return void("pending"===f?u?n(null,u):r((function(e,t,r){if(e)return r();void 0===a.nonceCache[c]&&(a.nonceCache[c]=t),r()})):r());case"eth_sendRawTransaction":return void r((function(r,n,s){if(r)return s();var f=e.params[0],c=(o.stripHexPrefix(f),t.from(o.stripHexPrefix(f),"hex"),new i(t.from(o.stripHexPrefix(f),"hex"))),u="0x"+c.getSenderAddress().toString("hex").toLowerCase(),d=o.bufferToInt(c.nonce),h=(++d).toString(16);h.length%2&&(h="0"+h),h="0x"+h,a.nonceCache[u]=h,s()}));case"evm_revert":return a.nonceCache={},void r();default:return void r()}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){var n=r(13),i=r(258),o=n.BN,a=new o("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=function(){function e(r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=r||{};var i=[{name:"nonce",length:32,allowLess:!0,default:new t([])},{name:"gasPrice",length:32,allowLess:!0,default:new t([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new t([])},{name:"to",allowZero:!0,length:20,default:new t([])},{name:"value",length:32,allowLess:!0,default:new t([])},{name:"data",alias:"input",allowZero:!0,default:new t([])},{name:"v",allowZero:!0,default:new t([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new t([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new t([])}];n.defineProperties(this,i,r),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var o=n.bufferToInt(this.v),a=Math.floor((o-35)/2);a<0&&(a=0),this._chainId=a||r.chainId||0,this._homestead=!0}return e.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},e.prototype.hash=function(e){void 0===e&&(e=!0);var t=void 0;if(e)t=this.raw;else if(this._chainId>0){var r=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,t=this.raw,this.raw=r}else t=this.raw.slice(0,6);return n.rlphash(t)},e.prototype.getChainId=function(){return this._chainId},e.prototype.getSenderAddress=function(){if(this._from)return this._from;var e=this.getSenderPublicKey();return this._from=n.publicToAddress(e),this._from},e.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function(){var e=this.hash(!1);if(this._homestead&&1===new o(this.s).cmp(a))return!1;try{var t=n.bufferToInt(this.v);this._chainId>0&&(t-=2*this._chainId+8),this._senderPubKey=n.ecrecover(e,t,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function(e){var t=this.hash(!1),r=n.ecsign(t,e);this._chainId>0&&(r.v+=2*this._chainId+8),Object.assign(this,r)},e.prototype.getDataFee=function(){for(var e=this.raw[5],t=new o(0),r=0;r<e.length;r++)0===e[r]?t.iaddn(i.txDataZeroGas.v):t.iaddn(i.txDataNonZeroGas.v);return t},e.prototype.getBaseFee=function(){var e=this.getDataFee().iaddn(i.txGas.v);return this._homestead&&this.toCreationAddress()&&e.iaddn(i.txCreation.v),e},e.prototype.getUpfrontCost=function(){return new o(this.gasLimit).imul(new o(this.gasPrice)).iadd(new o(this.value))},e.prototype.validate=function(e){var t=[];return this.verifySignature()||t.push("Invalid Signature"),this.getBaseFee().cmp(new o(this.gasLimit))>0&&t.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===e||!1===e?0===t.length:t.join(" ")},e}();e.exports=s}).call(this,r(1).Buffer)},function(e){e.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},function(e,t,r){var n=r(46);function i(e){return"never"!==s(e)}function o(e){var t=a(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function a(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":return 1;case"eth_getBlockByNumber":return 0;default:return}}function s(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":return"fork";case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"eth_blockNumber":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":return"never"}}e.exports={cacheIdentifierForPayload:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!i(e))return null;var r=t.includeBlockRef?e.params:o(e);return e.method+":"+n(r)},canCache:i,blockTagForPayload:function(e){var t=a(e);return t>=e.params.length?null:e.params[t]},paramsWithoutBlockTag:o,blockTagParamIndex:a,cacheTypeForPayload:s}},function(e,t,r){function n(e){return(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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=r(47),c=r(261),u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e);var t,r=(t=n,function(){var e,r=s(t);if(a()){var n=s(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return o(this,e)});function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r.call(this,(function(e){var t=e.blockTracker,r=e.provider,n=e.engine,i=c({blockTracker:t,provider:r}),o=i.events,a=i.middleware;return o.on("notification",(function(e){return n.emit("data",null,e)})),a}))}return n}(f);e.exports=u},function(e,t,r){const n=r(48).default,i=r(97),{createAsyncMiddleware:o}=r(93),a=r(92),{unsafeRandomBytes:s,incrementHexInt:f}=r(23),c=r(52);function u(e){return{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}e.exports=function({blockTracker:e,provider:t}){const r={},d=a({blockTracker:e,provider:t});let h=!1;const l=new n,p=i({eth_subscribe:o((async function(n,i){if(h)throw new Error("SubscriptionManager - attempting to use after destroying");const o=n.params[0],a=s(16);let l;switch(o){case"newHeads":l=function({subId:r}){const n={type:o,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const i=n,o=f(e);(await c({provider:t,fromBlock:o,toBlock:i})).map(u).forEach((e=>{b(r,e)}))}};return e.on("sync",n.update),n}({subId:a});break;case"logs":const r=n.params[1];l=function({subId:e,filter:t}){return t.on("update",(t=>b(e,t))),{type:o,destroy:async()=>await d.uninstallFilter(t.idHex)}}({subId:a,filter:await d.newLogFilter(r)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${o}"`)}return r[a]=l,void(i.result=a)})),eth_unsubscribe:o((async function(e,t){if(h)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],i=r[n];i?(delete r[n],await i.destroy(),t.result=!0):t.result=!1}))});return p.destroy=function(){l.removeAllListeners();for(const e in r)r[e].destroy(),delete r[e];h=!0},{events:l,middleware:p};function b(e,t){l.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}}},function(e,t,r){function n(e,t){var r="string"==typeof e?Object.assign({},i[e]):e;if("object"!=typeof r)throw new Error("[Portis] illegal 'network' parameter. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(!r.nodeUrl)throw new Error("[Portis] 'nodeUrl' is required. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(t&&!r.gasRelayHubAddress)throw new Error("[Portis] can't find default gas relay hub for "+e);return"string"!=typeof e||t||delete r.gasRelayHubAddress,r}r.r(t);var i={mainnet:{nodeUrl:"https://mainnet.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"1",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},ropsten:{nodeUrl:"https://ropsten.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"3",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},rinkeby:{nodeUrl:"https://rinkeby.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"4",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},goerli:{nodeUrl:"https://goerli.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"5"},ubiq:{nodeUrl:"https://rpc1.ubiqscan.io",chainId:"8"},thundercoreTestnet:{nodeUrl:"https://testnet-rpc.thundercore.com:8544",chainId:"18"},orchid:{nodeUrl:"https://public-node.rsk.co",chainId:"30"},orchidTestnet:{nodeUrl:"https://public-node.testnet.rsk.co",chainId:"31"},kovan:{nodeUrl:"https://kovan.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"42",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},classic:{nodeUrl:"https://ethereumclassic.network",chainId:"61"},sokol:{nodeUrl:"https://sokol.poa.network",chainId:"77"},core:{nodeUrl:"https://core.poa.network",chainId:"99"},xdai:{nodeUrl:"https://dai.poa.network",chainId:"100",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},thundercore:{nodeUrl:"https://mainnet-rpc.thundercore.com",chainId:"108"},fuse:{nodeUrl:"https://rpc.fusenet.io",chainId:"122"},lightstreams:{nodeUrl:"https://node.mainnet.lightstreams.io",chainId:"163"},matic:{nodeUrl:"https://polygon-rpc.com",chainId:"137"},maticMumbai:{nodeUrl:"https://rpc-mumbai.matic.today",chainId:"80001"},maticAlpha:{nodeUrl:"https://alpha.ethereum.matic.network",chainId:"4626"},maticTestnet:{nodeUrl:"https://testnet2.matic.network",chainId:"8995"}},o=function(){return!("undefined"==typeof window||!window.document)},a=!1;function s(){return new Promise((function(e,t){o()?a?e():["loaded","interactive","complete"].indexOf(document.readyState)>-1?(a=!0,e()):window.addEventListener("load",(function(){a=!0,e()}),!1):t()}))}function f(){var e="localhost"===location.hostname||"127.0.0.1"===location.hostname,t="https:"===location.protocol;if(!e&&!t)throw"[Portis] Access to the WebCrypto API is restricted to secure origins.\nIf this is a development environment please use http://localhost:"+location.port+" instead.\nOtherwise, please use an SSL certificate."}var c=r(99),u=r.n(c),d=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},h=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},l=function(){function e(t,r){this._widgetConfig=t,this._clearProviderSession=r,this._widgetUrl="https://widget.portis.io",this._onLoginCallback=function(){},this._onLogoutCallback=function(){},this._onErrorCallback=function(){},f(),t.staging?(console.warn("Please note: you are using the Portis STAGING environment."),this._widgetUrl="https://widget-staging.portis.io"):t.feature&&(console.warn("Please note: you are using the Portis FEATURE environment."),this._widgetUrl="https://widget-feature.portis.io"),e._checkIfWidgetAlreadyInitialized()}return e.prototype.getWidget=function(){return d(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return this.widgetInstance?[3,2]:(this.widgetPromise||(this.widgetPromise=this._initWidget()),e=this,[4,this.widgetPromise]);case 1:e.widgetInstance=t.sent(),t.label=2;case 2:return[2,this.widgetInstance]}}))}))},e.prototype.setDefaultEmail=function(e){this._widgetConfig.defaultEmail=e},e.prototype.setOnLoginCallback=function(e){this._onLoginCallback=e},e.prototype.setOnLogoutCallback=function(e){this._onLogoutCallback=e},e.prototype.setOnActiveWalletChangedCallback=function(e){this._onActiveWalletChangedCallback=e},e.prototype.setOnErrorCallback=function(e){this._onErrorCallback=e},e.prototype.showPortis=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.showPortis(this._widgetConfig)]}}))}))},e.prototype.getCampaignInfo=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.getCampaignInfo(e)]}}))}))},e.prototype.claimVoucher=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.claimVoucher(e,this._widgetConfig)]}}))}))},e.prototype.logout=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.logout()]}}))}))},e.prototype.getExtendedPublicKey=function(e,t){return void 0===e&&(e="m/44'/60'/0'/0/0"),void 0===t&&(t="Ethereum"),d(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.getWidget()];case 1:return[2,r.sent().communication.getExtendedPublicKey(e,t,this._widgetConfig)]}}))}))},e.prototype.importWallet=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.importWallet(e,this._widgetConfig)]}}))}))},e.prototype.isLoggedIn=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.isLoggedIn()]}}))}))},e.prototype.signBitcoinTransaction=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.signBitcoinTransaction(e,this._widgetConfig)]}}))}))},e.prototype.showBitcoinWallet=function(e){return void 0===e&&(e="m/49'/0'/0'/0/0"),d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.showBitcoinWallet(e,this._widgetConfig)]}}))}))},e.prototype.purchaseERC20=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.purchaseERC20(e,this._widgetConfig)]}}))}))},e._checkIfWidgetAlreadyInitialized=function(){document.getElementsByClassName("por_portis-container").length&&console.warn("An instance of Portis was already initialized. This is probably a mistake. Make sure that you use the same Portis instance throughout your app.")},e.prototype._initWidget=function(){return d(this,void 0,void 0,(function(){var t,r,n,i,o;return h(this,(function(a){switch(a.label){case 0:return[4,s()];case 1:return a.sent(),(t=document.createElement("style")).innerHTML="\n.por_portis-container {\n position: fixed;\n width: 0px;\n height: 0px;\n top: 0px;\n right: 0px;\n z-index: 2147483647;\n}\n\n@media (max-width: 576px) {\n .por_portis-container {\n bottom: 0;\n top: auto;\n }\n}\n\n.por_portis-widget-frame {\n position: fixed;\n width: 375px;\n height: 0;\n top: 20px;\n right: 20px;\n box-shadow: 0 5px 40px rgba(0,0,0,.16);\n border-radius: 8px;\n overflow: hidden;\n z-index: 2147483000;\n}\n\n@media (max-width: 576px) {\n .por_portis-widget-frame {\n bottom: 0;\n top: auto;\n width: 100%;\n right: 0;\n left: 0;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n}\n",(r=document.createElement("div")).className="por_portis-container",(n=document.createElement("div")).id="portis-container-"+Date.now(),n.className="por_portis-widget-frame",r.appendChild(n),document.body.appendChild(r),document.head.appendChild(t),[4,(i=u.a.connectToChild({url:this._widgetUrl,appendTo:document.getElementById(n.id),methods:{setHeight:this._setHeight.bind(this),getWindowSize:e._getWindowSize.bind(this),onLogin:this._onLogin.bind(this),onLogout:this._onLogout.bind(this),onActiveWalletChanged:this._onActiveWalletChanged.bind(this),hasOnActiveWalletChanged:this.hasOnActiveWalletChanged.bind(this),onError:this._onError.bind(this)}})).promise];case 2:return(o=a.sent()).setSdkConfig(this._widgetConfig),i.iframe.style.position="absolute",i.iframe.style.height="100%",i.iframe.style.width="100%",i.iframe.style.border="0 transparent",[2,{communication:o,widgetFrame:n}]}}))}))},e.prototype._setHeight=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return t.sent().widgetFrame.style.height=e+"px",[2]}}))}))},e._getWindowSize=function(){var e=document.getElementsByTagName("body")[0];return{width:window.innerWidth||document.documentElement.clientWidth||e.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||e.clientHeight}},e.prototype._onLogin=function(e,t,r){this._onLoginCallback&&this._onLoginCallback(e,t,r)},e.prototype._onLogout=function(){this._clearProviderSession(),this._onLogoutCallback&&this._onLogoutCallback()},e.prototype._onActiveWalletChanged=function(e){this._onActiveWalletChangedCallback&&this._onActiveWalletChangedCallback(e)},e.prototype.hasOnActiveWalletChanged=function(){return!!this._onActiveWalletChangedCallback},e.prototype._onError=function(e){this._onErrorCallback&&this._onErrorCallback(e)},e}(),p=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},b=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},g=r(13),y=g.addHexPrefix,m=g.stripHexPrefix,v=g.BN;function _(e,t){return p(this,void 0,void 0,(function(){var r,n,i,o,a;return b(this,(function(s){switch(s.label){case 0:return[4,e.getBlockByNumber("latest",!1)];case 1:return r=s.sent(),[4,w(e,t,r.gasLimit)];case 2:if(n=s.sent(),i=n.safeGas,o=n.simpleSend,a=n.gasLimitSpecified,o||a)return[2,i];s.label=3;case 3:return s.trys.push([3,5,,6]),[4,E(e,t,r.gasLimit,i)];case 4:return[2,s.sent()];case 5:return s.sent(),[2,i];case 6:return[2]}}))}))}function w(e,t,r){return p(this,void 0,void 0,(function(){var n,i;return b(this,(function(o){switch(o.label){case 0:return Boolean(t.gas)?[2,{safeGas:t.gas,simpleSend:!1,gasLimitSpecified:!0}]:(n=t.to,Boolean(n)?[4,e.getCode(n)]:[3,2]);case 1:if(!(i=o.sent())||"0x"===i||"0x0"===i){if(t.data)throw new Error("Trying to call a function on a non-contract address");return[2,{safeGas:"0x5208",simpleSend:!0,gasLimitSpecified:!1}]}o.label=2;case 2:return a=A(r),s=20,f=new v(19),c=new v(s),[2,{safeGas:k(a.mul(f).div(c)),simpleSend:!1,gasLimitSpecified:!1}]}var a,s,f,c}))}))}function E(e,t,r,n){return p(this,void 0,void 0,(function(){var i;return b(this,(function(o){switch(o.label){case 0:return t.gas=n,i=y,[4,e.estimateGas(t)];case 1:return[2,S(i.apply(void 0,[o.sent()]),r)]}}))}))}function S(e,t){var r=A(e),n=A(t).muln(.9),i=r.muln(1.5);return r.gt(n)?k(r):i.lt(n)?k(i):k(n)}function A(e){return new v(m(e),16)}function k(e){return y(e.toString(16))}var M=function(){function e(e){this.provider=e}return e.prototype.getBlockByNumber=function(e,t){return this.sendAsync("eth_getBlockByNumber",e,t)},e.prototype.getCode=function(e,t){return void 0===t&&(t="latest"),this.sendAsync("eth_getCode",e,t)},e.prototype.estimateGas=function(e){return this.sendAsync("eth_estimateGas",e)},e.prototype.sendAsync=function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return new Promise((function(n,i){t.provider.sendAsync({id:42,jsonrpc:"2.0",method:e,params:r},(function(e,t){e?i(e):n(t.result)}))}))},e}(),x=function(){return(x=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},I=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},T=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},R=r(100),P=r(207),L=r(212),B=r(213),C=r(227),O=r(256),N=r(260),j=function(){function e(e,t){this.config=e,this._getWidgetCommunication=t,this.provider=this._initProvider()}return e.prototype.setSelectedAddress=function(e){this._selectedAddress=e},e.prototype.changeNetwork=function(e,t){var r=n(e,t);this.clearSubprovider(O),this.clearSubprovider(P),this.config.network=r},e.prototype._initProvider=function(){var e=this;if(this.engine)return this.engine;this.engine=new R;var t=new M(this.engine);return this.engine.send=function(t,r){if("string"==typeof t)return new Promise((function(n,i){e.engine.sendAsync({jsonrpc:"2.0",id:42,method:t,params:r||[]},(function(e,t){e?i(e):n(t.result)}))}));if(!r){var n=null;switch(t.method){case"eth_accounts":case"eth_coinbase":n=e._selectedAddress?[e._selectedAddress]:[];break;case"net_version":n=e._network;break;case"eth_uninstallFilter":e.engine.sendAsync(t,(function(e){return e})),n=!0;break;default:var i="The Portis Web3 object does not support synchronous methods like "+t.method+" without a callback parameter.";throw new Error(i)}return{id:t.id,jsonrpc:t.jsonrpc,result:n}}e.engine.sendAsync(t,r)},this.engine.addProvider(new L({web3_clientVersion:"Portis/v"+this.config.version+"/javascript",net_listening:!0,eth_hashrate:"0x00",eth_mining:!1,eth_syncing:!0})),this.engine.addProvider(new P),this.engine.addProvider(new N),this.engine.addProvider(new B),this.engine.addProvider(new O),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,r){return I(e,void 0,void 0,(function(){return T(this,(function(e){return t.id||(t.id=42),r(),[2]}))}))}}),this.engine.addProvider(new C({getAccounts:function(t){return I(e,void 0,void 0,(function(){var e,r,n;return T(this,(function(i){switch(i.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,i.sent().getAccounts(this.config)];case 2:return e=i.sent(),r=e.error,n=e.result,!r&&n&&(this._selectedAddress=n[0]),t(r,n),[2]}}))}))},signTransaction:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i;return T(this,(function(o){switch(o.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,o.sent().signTransaction(t,this.config)];case 2:return e=o.sent(),n=e.error,i=e.result,r(n,i),[2]}}))}))},signMessage:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signMessage"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},signPersonalMessage:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signPersonalMessage"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},signTypedMessage:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signTypedMessage"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},signTypedMessageV3:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signTypedMessageV3"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},estimateGas:function(r,n){return I(e,void 0,void 0,(function(){var e;return T(this,(function(i){switch(i.label){case 0:return[4,_(t,r)];case 1:return e=i.sent(),n(null,e),[2]}}))}))},getGasPrice:function(t){return I(e,void 0,void 0,(function(){return T(this,(function(e){return t(null,""),[2]}))}))}})),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,r,n){return I(e,void 0,void 0,(function(){var e,r,i;return T(this,(function(o){switch(o.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,o.sent().relay(t,this.config)];case 2:return e=o.sent(),r=e.error,i=e.result,"net_version"===t.method&&(this._network=i,this.engine.networkVersion=this._network),n(r,i),[2]}}))}))}}),this.engine.enable=function(){return new Promise((function(t,r){e.engine.sendAsync({method:"eth_accounts"},(function(e,n){e?r(e):t(n.result)}))}))},this.engine.isConnected=function(){return!0},this.engine.isPortis=!0,this.engine.on("error",(function(e){e&&e.message&&e.message.includes("PollingBlockTracker")?console.warn("If you see this warning constantly, there might be an error with your RPC node."):console.error(e)})),this.engine.start(),this.engine},e.prototype.clearSubprovider=function(e){var t=this.provider._providers.find((function(t){return t instanceof e}));this.provider.removeProvider(t),this.provider.addProvider(new e)},e}(),D=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},U=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},z=["email","reputation"];s().then((function(){document.getElementsByClassName("por_portis-widget-frame").length&&console.warn("Portis script was already loaded. This might cause unexpected behavior. If loading with a <script> tag, please make sure that you only load it once.")})).catch((function(){}));var q=function(){function e(e,t,r){if(void 0===r&&(r={}),!o())return new Proxy(this,{get:function(e,t){return e[t]instanceof Function?function(){}:void 0}});f(),this._validateParams(e,t,r),this._config={dappId:e,network:n(t,r.gasRelay),version:"4.0.7",scope:r.scope,registerPageByDefault:r.registerPageByDefault,staging:r.staging,feature:r.feature},this._getWidgetCommunication=this._getWidgetCommunication.bind(this),this._widgetManagerInstance=new l(this.config,this._clearProviderSession),this._web3ManagerInstance=new j(this.config,this._getWidgetCommunication),this.setDefaultEmail=this.setDefaultEmail.bind(this),this.changeNetwork=this.changeNetwork.bind(this),this.getWidget=this.getWidget.bind(this),this.onLogin=this.onLogin.bind(this),this.onLogout=this.onLogout.bind(this),this.onActiveWalletChanged=this.onActiveWalletChanged.bind(this),this.onError=this.onError.bind(this),this.showPortis=this.showPortis.bind(this),this.getCampaignInfo=this.getCampaignInfo.bind(this),this.claimVoucher=this.claimVoucher.bind(this),this.getExtendedPublicKey=this.getExtendedPublicKey.bind(this),this.importWallet=this.importWallet.bind(this),this.isLoggedIn=this.isLoggedIn.bind(this),this.signBitcoinTransaction=this.signBitcoinTransaction.bind(this),this.showBitcoinWallet=this.showBitcoinWallet.bind(this)}return Object.defineProperty(e.prototype,"_widgetManager",{get:function(){return this._widgetManagerInstance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_web3Manager",{get:function(){return this._web3ManagerInstance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),e.prototype._clearProviderSession=function(){this._web3Manager.setSelectedAddress("")},e.prototype._getWidgetCommunication=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){switch(e.label){case 0:return[4,this._widgetManager.getWidget()];case 1:return[2,e.sent().communication]}}))}))},Object.defineProperty(e.prototype,"web3Provider",{get:function(){return this._web3Manager.provider},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"provider",{get:function(){return this.web3Provider},enumerable:!0,configurable:!0}),e.prototype.changeNetwork=function(e,t){this._web3Manager.changeNetwork(e,t)},e.prototype.setDefaultEmail=function(e){this._widgetManager.setDefaultEmail(e)},e.prototype.getWidget=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.getWidget()]}))}))},e.prototype.onLogin=function(e){this._widgetManager.setOnLoginCallback(e)},e.prototype.onLogout=function(e){this._widgetManager.setOnLogoutCallback(e)},e.prototype.onActiveWalletChanged=function(e){this._widgetManager.setOnActiveWalletChangedCallback(e)},e.prototype.onError=function(e){this._widgetManager.setOnErrorCallback(e)},e.prototype.showPortis=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.showPortis()]}))}))},e.prototype.getCampaignInfo=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.getCampaignInfo(e)]}))}))},e.prototype.claimVoucher=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.claimVoucher(e)]}))}))},e.prototype.logout=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.logout()]}))}))},e.prototype.getExtendedPublicKey=function(e,t){return void 0===e&&(e="m/44'/60'/0'/0/0"),void 0===t&&(t="Ethereum"),D(this,void 0,void 0,(function(){return U(this,(function(r){return[2,this._widgetManager.getExtendedPublicKey(e,t)]}))}))},e.prototype.importWallet=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.importWallet(e)]}))}))},e.prototype.isLoggedIn=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.isLoggedIn()]}))}))},e.prototype.signBitcoinTransaction=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.signBitcoinTransaction(e)]}))}))},e.prototype.showBitcoinWallet=function(e){return void 0===e&&(e="m/49'/0'/0'/0/0"),D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.showBitcoinWallet(e)]}))}))},e.prototype._validateParams=function(e,t,r){if(!e)throw new Error("[Portis] 'dappId' is required. Get your dappId here: https://dashboard.portis.io");if(!t)throw new Error("[Portis] 'network' is required. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(r.scope){if(!Array.isArray(r.scope))throw new Error("[Portis] 'scope' must be an array. Read more about it here: https://docs.portis.io/#/configuration?id=scope");if(r.scope.filter((function(e){return z.indexOf(e)<0})).length>0)throw new Error("[Portis] invalid 'scope' parameter. Read more about it here: https://docs.portis.io/#/configuration?id=scope")}if(void 0!==r.registerPageByDefault&&"boolean"!=typeof r.registerPageByDefault)throw new Error("[Portis] invalid 'registerPageByDefault' parameter, must be a boolean. Read more about it here: https://docs.portis.io/#/configuration?id=registerPageByDefault")},e}();t.default=q},function(e,t,r){function n(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}f((n=n.apply(e,t||[])).next())}))}function i(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}r.r(t);var o=function(){function e(e){if(this._maxConcurrency=e,this._queue=[],e<=0)throw new Error("semaphore must be initialized to a positive value");this._value=e}return e.prototype.acquire=function(){var e=this,t=this.isLocked(),r=new Promise((function(t){return e._queue.push(t)}));return t||this._dispatch(),r},e.prototype.runExclusive=function(e){return n(this,void 0,void 0,(function(){var t,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,this.acquire()];case 1:t=i.sent(),r=t[0],n=t[1],i.label=2;case 2:return i.trys.push([2,,4,5]),[4,e(r)];case 3:return[2,i.sent()];case 4:return n(),[7];case 5:return[2]}}))}))},e.prototype.isLocked=function(){return this._value<=0},e.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=void 0,e()}},e.prototype._dispatch=function(){var e=this,t=this._queue.shift();if(t){var r=!1;this._currentReleaser=function(){r||(r=!0,e._value++,e._dispatch())},t([this._value--,this._currentReleaser])}},e}(),a=function(){function e(){this._semaphore=new o(1)}return e.prototype.acquire=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this._semaphore.acquire()];case 1:return[2,e.sent()[1]]}}))}))},e.prototype.runExclusive=function(e){return this._semaphore.runExclusive((function(){return e()}))},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();function s(e,t,r){var o=this;return void 0===r&&(r=new Error("timeout")),{acquire:function(){return new Promise((function(a,s){return n(o,void 0,void 0,(function(){var n,o;return i(this,(function(i){switch(i.label){case 0:return n=!1,setTimeout((function(){n=!0,s(r)}),t),[4,e.acquire()];case 1:return o=i.sent(),n?(Array.isArray(o)?o[1]:o)():a(o),[2]}}))}))}))},runExclusive:function(e){return n(this,void 0,void 0,(function(){var t,r;return i(this,(function(n){switch(n.label){case 0:t=function(){},n.label=1;case 1:return n.trys.push([1,,7,8]),[4,this.acquire()];case 2:return r=n.sent(),Array.isArray(r)?(t=r[1],[4,e(r[0])]):[3,4];case 3:return[2,n.sent()];case 4:return t=r,[4,e()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:return t(),[7];case 8:return[2]}}))}))},release:function(){e.release()},isLocked:function(){return e.isLocked()}}}r.d(t,"Mutex",(function(){return a})),r.d(t,"Semaphore",(function(){return o})),r.d(t,"withTimeout",(function(){return s}))}]).default;var n=e.getDefaultExportFromCjs(r.exports);exports.default=function({chainId:t,portisParams:r},i){return e.__awaiter(this,void 0,void 0,(function*(){if(!(null==r?void 0:r.id))throw new Error("uAuthParams is not valid.");let o="";switch(t){case 1:default:o="mainnet";break;case 5:o="goerli"}const a=new n(r.id,o,r.config);return yield a.provider.enable(),a.provider._portis=a,a.provider.on("connect",i.connect),a.provider.on("disconnect",i.disconnect),a.provider.on("accountsChanged",i.accountsChanged),a.provider.on("chainChanged",i.chainChanged),a.provider.on("message",i.message),e.convertWeb3Provider(a.provider)}))};
|
|
24
|
+
var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,s,f=a(e),c=1;c<arguments.length;c++){for(var u in r=Object(arguments[c]))i.call(r,u)&&(f[u]=r[u]);if(n){s=n(r);for(var d=0;d<s.length;d++)o.call(r,s[d])&&(f[s[d]]=r[s[d]])}}return f}},function(e,t,r){var n=r(78);e.exports=function(e){return"string"!=typeof e?e:n(e)?e.slice(2):e}},function(e,t,r){const n=r(79),i=r(166);function o(e,t){return new Promise((r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()}))}e.exports=class extends i{constructor(e={}){if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");const t=e.pollingInterval||2e4,r=e.retryTimeout||t/10,n=void 0===e.keepEventLoopActive||e.keepEventLoopActive,i=e.setSkipCacheFlag||!1;super(Object.assign({blockResetDuration:t},e)),this._provider=e.provider,this._pollingInterval=t,this._retryTimeout=r,this._keepEventLoopActive=n,this._setSkipCacheFlag=i}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}_start(){this._performSync().catch((e=>this.emit("error",e)))}async _performSync(){for(;this._isRunning;)try{await this._updateLatestBlock(),await o(this._pollingInterval,!this._keepEventLoopActive)}catch(e){const t=new Error("PollingBlockTracker - encountered an error while attempting to update latest block:\n"+e.stack);try{this.emit("error",t)}catch(e){console.error(t)}await o(this._retryTimeout,!this._keepEventLoopActive)}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:1,method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0);const t=await n((t=>this._provider.sendAsync(e,t)))();if(t.error)throw new Error("PollingBlockTracker - encountered error fetching block:\n"+t.error);return t.result}}},function(e,t,r){r(80),r(79);const n=r(168),i=(e,t)=>e+t,o=["sync","latest"];function a(e){return Number.parseInt(e,16)}e.exports=class extends n{constructor(e={}){super(),this._blockResetDuration=e.blockResetDuration||2e4,this._blockResetTimeout,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise((e=>this.once("latest",e)))}removeAllListeners(e){e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener()}_start(){}_end(){}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e,t){o.includes(e)&&this._maybeStart()}_onRemoveListener(e,t){this._getBlockTrackerEventCount()>0||this._maybeEnd()}_maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),this._start())}_maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),this._end())}_getBlockTrackerEventCount(){return o.map((e=>this.listenerCount(e))).reduce(i)}_newPotentialLatest(e){const t=this._currentBlock;t&&a(e)<=a(t)||this._setCurrentBlock(e)}_setCurrentBlock(e){const t=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:t,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}},function(e,t){e.exports=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}}},function(e,t,r){const n=r(9),i=r(8);var o="object"==typeof Reflect?Reflect:null,a=o&&"function"==typeof o.apply?o.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};function s(){i.call(this)}function f(e,t,r){try{a(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}function c(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}e.exports=s,n.inherits(s,i),s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)f(s,this,t);else{var u=s.length,d=c(s,u);for(r=0;r<u;++r)f(d[r],this,t)}return!0}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(170)),i=o(r(196));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,n.default)(i.default),e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,o){return e(n.default,t,(0,i.default)(r),o)}};var n=o(r(81)),i=o(r(12));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){var n=r(42),i=r(85);e.exports=function(e){if(!i(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,r){var n=r(82),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[s]=r:delete e[s]),i}},function(e,t){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,o){(0,n.default)(t)(e,(0,i.default)(r),o)};var n=o(r(88)),i=o(r(12));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if((0,n.default)(e))return function(e){var t=-1,r=e.length;return function(){return++t<r?{value:e[t],key:t}:null}}(e);var t,r,a,s,f=(0,i.default)(e);return f?function(e){var t=-1;return function(){var r=e.next();return r.done?null:(t++,{value:r.value,key:t})}}(f):(t=e,r=(0,o.default)(t),a=-1,s=r.length,function(){var e=r[++a];return a<s?{value:t[e],key:e}:null})};var n=a(r(29)),i=a(r(176)),o=a(r(177));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return n&&e[n]&&e[n]()};var n="function"==typeof Symbol&&Symbol.iterator;e.exports=t.default},function(e,t,r){var n=r(178),i=r(189),o=r(29);e.exports=function(e){return o(e)?n(e):i(e)}},function(e,t,r){var n=r(179),i=r(180),o=r(89),a=r(182),s=r(184),f=r(185),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var r=o(e),u=!r&&i(e),d=!r&&!u&&a(e),h=!r&&!u&&!d&&f(e),l=r||u||d||h,p=l?n(e.length,String):[],b=p.length;for(var g in e)!t&&!c.call(e,g)||l&&("length"==g||d&&("offset"==g||"parent"==g)||h&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||s(g,b))||p.push(g);return p}},function(e,t){e.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}},function(e,t,r){var n=r(181),i=r(44),o=Object.prototype,a=o.hasOwnProperty,s=o.propertyIsEnumerable,f=n(function(){return arguments}())?n:function(e){return i(e)&&a.call(e,"callee")&&!s.call(e,"callee")};e.exports=f},function(e,t,r){var n=r(42),i=r(44);e.exports=function(e){return i(e)&&"[object Arguments]"==n(e)}},function(e,t,r){(function(e){var n=r(83),i=r(183),o=t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===o?n.Buffer:void 0,f=(s?s.isBuffer:void 0)||i;e.exports=f}).call(this,r(37)(e))},function(e,t){e.exports=function(){return!1}},function(e,t){var r=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&r.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,r){var n=r(186),i=r(187),o=r(188),a=o&&o.isTypedArray,s=a?i(a):n;e.exports=s},function(e,t,r){var n=r(42),i=r(86),o=r(44),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return o(e)&&i(e.length)&&!!a[n(e)]}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,r){(function(e){var n=r(84),i=t&&!t.nodeType&&t,o=i&&"object"==typeof e&&e&&!e.nodeType&&e,a=o&&o.exports===i&&n.process,s=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=s}).call(this,r(37)(e))},function(e,t,r){var n=r(190),i=r(191),o=Object.prototype.hasOwnProperty;e.exports=function(e){if(!n(e))return i(e);var t=[];for(var r in Object(e))o.call(e,r)&&"constructor"!=r&&t.push(r);return t}},function(e,t){var r=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}},function(e,t,r){var n=r(192)(Object.keys,Object);e.exports=n},function(e,t){e.exports=function(e,t){return function(r){return e(t(r))}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return(0,i.default)((function(t,r){var i;try{i=e.apply(this,t)}catch(e){return r(e)}(0,n.default)(i)&&"function"==typeof i.then?i.then((function(e){s(r,null,e)}),(function(e){s(r,e.message?e:new Error(e))})):r(null,i)}))};var n=a(r(85)),i=a(r(194)),o=a(r(195));function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t,r){try{e(t,r)}catch(e){(0,o.default)(f,e)}}function f(e){throw e}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(){var t=(0,i.default)(arguments),r=t.pop();e.call(this,t,r)}};var n,i=(n=r(30))&&n.__esModule?n:{default:n};e.exports=t.default},function(e,t,r){(function(e,n){Object.defineProperty(t,"__esModule",{value:!0}),t.hasNextTick=t.hasSetImmediate=void 0,t.fallback=c,t.wrap=u;var i,o,a=(i=r(30))&&i.__esModule?i:{default:i},s=t.hasSetImmediate="function"==typeof e&&e,f=t.hasNextTick="object"==typeof n&&"function"==typeof n.nextTick;function c(e){setTimeout(e,0)}function u(e){return function(t){var r=(0,a.default)(arguments,1);e((function(){t.apply(null,r)}))}}o=s?e:f?n.nextTick:c,t.default=u(o)}).call(this,r(59).setImmediate,r(4))},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,o){o=o||n.default,t=t||[];var a=[],s=0,f=(0,i.default)(r);e(t,(function(e,t,r){var n=s++;f(e,(function(e,t){a[n]=t,r(e)}))}),(function(e){o(e,a)}))};var n=o(r(22)),i=o(r(12));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(198)),i=o(r(90));function o(e){return e&&e.__esModule?e:{default:e}}t.default=(0,i.default)(n.default,1),e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,a){(0,n.default)(t)(e,(0,i.default)((0,o.default)(r)),a)};var n=a(r(88)),i=a(r(199)),o=a(r(12));function a(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(t,r,n){return e(t,n)}},e.exports=t.default},function(e,t,r){const n=r(8).EventEmitter,i=r(9).inherits;function o(){n.call(this),this.isLocked=!0}e.exports=o,i(o,n),o.prototype.go=function(){this.isLocked=!1,this.emit("unlock")},o.prototype.stop=function(){this.isLocked=!0,this.emit("lock")},o.prototype.await=function(e){const t=this;t.isLocked?t.once("unlock",e):setTimeout(e)}},function(e,t,r){const n=r(46);function i(e){return"never"!==s(e)}function o(e){var t=a(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function a(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":return 1;case"eth_getBlockByNumber":return 0;default:return}}function s(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":return"fork";case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"eth_blockNumber":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":return"never"}}e.exports={cacheIdentifierForPayload:function(e,t={}){if(!i(e))return null;const{includeBlockRef:r}=t,a=r?e.params:o(e);return e.method+":"+n(a)},canCache:i,blockTagForPayload:function(e){var t=a(e);return t>=e.params.length?null:e.params[t]},paramsWithoutBlockTag:o,blockTagParamIndex:a,cacheTypeForPayload:s}},function(e,t,r){t.parse=r(203),t.stringify=r(204)},function(e,t){var r,n,i,o,a={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},s=function(e){throw{name:"SyntaxError",message:e,at:r,text:i}},f=function(e){return e&&e!==n&&s("Expected '"+e+"' instead of '"+n+"'"),n=i.charAt(r),r+=1,n},c=function(){var e,t="";for("-"===n&&(t="-",f("-"));n>="0"&&n<="9";)t+=n,f();if("."===n)for(t+=".";f()&&n>="0"&&n<="9";)t+=n;if("e"===n||"E"===n)for(t+=n,f(),"-"!==n&&"+"!==n||(t+=n,f());n>="0"&&n<="9";)t+=n,f();if(e=+t,isFinite(e))return e;s("Bad number")},u=function(){var e,t,r,i="";if('"'===n)for(;f();){if('"'===n)return f(),i;if("\\"===n)if(f(),"u"===n){for(r=0,t=0;t<4&&(e=parseInt(f(),16),isFinite(e));t+=1)r=16*r+e;i+=String.fromCharCode(r)}else{if("string"!=typeof a[n])break;i+=a[n]}else i+=n}s("Bad string")},d=function(){for(;n&&n<=" ";)f()};o=function(){switch(d(),n){case"{":return function(){var e,t={};if("{"===n){if(f("{"),d(),"}"===n)return f("}"),t;for(;n;){if(e=u(),d(),f(":"),Object.hasOwnProperty.call(t,e)&&s('Duplicate key "'+e+'"'),t[e]=o(),d(),"}"===n)return f("}"),t;f(","),d()}}s("Bad object")}();case"[":return function(){var e=[];if("["===n){if(f("["),d(),"]"===n)return f("]"),e;for(;n;){if(e.push(o()),d(),"]"===n)return f("]"),e;f(","),d()}}s("Bad array")}();case'"':return u();case"-":return c();default:return n>="0"&&n<="9"?c():function(){switch(n){case"t":return f("t"),f("r"),f("u"),f("e"),!0;case"f":return f("f"),f("a"),f("l"),f("s"),f("e"),!1;case"n":return f("n"),f("u"),f("l"),f("l"),null}s("Unexpected '"+n+"'")}()}},e.exports=function(e,t){var a;return i=e,r=0,n=" ",a=o(),d(),n&&s("Syntax error"),"function"==typeof t?function e(r,n){var i,o,a=r[n];if(a&&"object"==typeof a)for(i in a)Object.prototype.hasOwnProperty.call(a,i)&&(void 0!==(o=e(a,i))?a[i]=o:delete a[i]);return t.call(r,n,a)}({"":a},""):a}},function(e,t){var r,n,i,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function s(e){return o.lastIndex=0,o.test(e)?'"'+e.replace(o,(function(e){var t=a[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}e.exports=function(e,t,o){var a;if(r="",n="","number"==typeof o)for(a=0;a<o;a+=1)n+=" ";else"string"==typeof o&&(n=o);if(i=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return function e(t,o){var a,f,c,u,d,h=r,l=o[t];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(t)),"function"==typeof i&&(l=i.call(o,t,l)),typeof l){case"string":return s(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(r+=n,d=[],"[object Array]"===Object.prototype.toString.apply(l)){for(u=l.length,a=0;a<u;a+=1)d[a]=e(a,l)||"null";return c=0===d.length?"[]":r?"[\n"+r+d.join(",\n"+r)+"\n"+h+"]":"["+d.join(",")+"]",r=h,c}if(i&&"object"==typeof i)for(u=i.length,a=0;a<u;a+=1)"string"==typeof(f=i[a])&&(c=e(f,l))&&d.push(s(f)+(r?": ":":")+c);else for(f in l)Object.prototype.hasOwnProperty.call(l,f)&&(c=e(f,l))&&d.push(s(f)+(r?": ":":")+c);return c=0===d.length?"{}":r?"{\n"+r+d.join(",\n"+r)+"\n"+h+"}":"{"+d.join(",")+"}",r=h,c}}("",{"":e})}},function(e,t,r){const n=r(206),i=r(28);e.exports=function(e){return i({id:n(),jsonrpc:"2.0",params:[]},e)}},function(e,t){e.exports=function(){return Math.floor(Number.MAX_SAFE_INTEGER*Math.random())}},function(e,t,r){function n(e){return(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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=r(47),c=r(209),u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e);var t,r=(t=n,function(){var e,r=s(t);if(a()){var n=s(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return o(this,e)});function n(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r.call(this,(function(t){var r=t.blockTracker;return c(Object.assign({blockTracker:r},e))}))}return n}(f);e.exports=u},function(e,t,r){e.exports=function(){return Math.floor(Number.MAX_SAFE_INTEGER*Math.random())}},function(e,t,r){const n=r(210),i=r(211),o=[void 0,null,"<nil>"];e.exports=function(e={}){const{blockTracker:t}=e;if(!t)throw new Error("createBlockCacheMiddleware - No BlockTracker specified");const r=new a,o={perma:r,block:r,fork:r};return i((async(e,i,a)=>{if(e.skipCache)return a();const s=n.cacheTypeForPayload(e),f=o[s];if(!f)return a();if(!f.canCacheRequest(e))return a();let c,u=n.blockTagForPayload(e);if(u||(u="latest"),"earliest"===u)c="0x00";else if("latest"===u){const e=await t.getLatestBlock();r.clearBefore(e),c=e}else c=u;const d=await f.get(e,c);void 0===d?(await a(),await f.set(e,c,i.result)):i.result=d}))};class a{constructor(){this.cache={}}getBlockCacheForPayload(e,t){const r=Number.parseInt(t,16);let n=this.cache[r];if(!n){const e={};this.cache[r]=e,n=e}return n}async get(e,t){const r=this.getBlockCacheForPayload(e,t);if(r)return r[n.cacheIdentifierForPayload(e,!0)]}async set(e,t,r){this.canCacheResult(e,r)&&(this.getBlockCacheForPayload(e,t)[n.cacheIdentifierForPayload(e,!0)]=r)}canCacheRequest(e){return!!n.canCache(e)&&"pending"!==n.blockTagForPayload(e)}canCacheResult(e,t){if(!o.includes(t))return!!(!["eth_getTransactionByHash","eth_getTransactionReceipt"].includes(e.method)||t&&t.blockHash&&"0x0000000000000000000000000000000000000000000000000000000000000000"!==t.blockHash)}clearBefore(e){const t=this,r=Number.parseInt(e,16);Object.keys(t.cache).map(Number).filter((e=>e<r)).forEach((e=>delete t.cache[e]))}}},function(e,t,r){const n=r(46);function i(e){return"never"!==s(e)}function o(e){const t=a(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function a(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":return 1;case"eth_getBlockByNumber":return 0;default:return}}function s(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":case"test_permaCache":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":case"test_forkCache":return"fork";case"eth_gasPrice":case"eth_blockNumber":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"test_blockCache":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":case"test_neverCache":return"never"}}e.exports={cacheIdentifierForPayload:function(e,t){const r=t?o(e):e.params;return i(e)?e.method+":"+n(r):null},canCache:i,blockTagForPayload:function(e){let t=a(e);return t>=e.params.length?null:e.params[t]},paramsWithoutBlockTag:o,blockTagParamIndex:a,cacheTypeForPayload:s}},function(e,t){e.exports=function(e){return(t,r,n,i)=>{let o;const a=new Promise((e=>{o=e}));let s,f;e(t,r,(async()=>{f=!0,n((e=>{s=e,o()})),await a})).then((async()=>{f?(await a,s(null)):i(null)})).catch((e=>{s?s(e):i(e)}))}}},function(e,t,r){var n=r(9).inherits,i=r(31);function o(e){e=e||{},this.staticResponses=e}e.exports=o,n(o,i),o.prototype.handleRequest=function(e,t,r){var n=this.staticResponses[e.method];"function"==typeof n?n(e,t,r):void 0!==n?setTimeout((function(){return r(null,n)})):t()}},function(e,t,r){function n(e){return(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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=r(47),c=r(92),u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e);var t,r=(t=n,function(){var e,r=s(t);if(a()){var n=s(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return o(this,e)});function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r.call(this,(function(e){var t=e.blockTracker,r=e.provider;return e.engine,c({blockTracker:t,provider:r})}))}return n}(f);e.exports=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createIdRemapMiddleware=void 0;const n=r(94);t.createIdRemapMiddleware=function(){return(e,t,r,i)=>{const o=e.id,a=n.getUniqueId();e.id=a,t.id=a,r((r=>{e.id=o,t.id=o,r()}))}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createAsyncMiddleware=void 0,t.createAsyncMiddleware=function(e){return async(t,r,n,i)=>{let o;const a=new Promise((e=>{o=e}));let s=null,f=!1;const c=async()=>{f=!0,n((e=>{s=e,o()})),await a};try{await e(t,r,c),f?(await a,s(null)):i(null)}catch(e){s?s(e):i(e)}}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createScaffoldMiddleware=void 0,t.createScaffoldMiddleware=function(e){return(t,r,n,i)=>{const o=e[t.method];return void 0===o?n():"function"==typeof o?o(t,r,n,i):(r.result=o,i())}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const n=r(49);Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return n.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return n.EthereumProviderError}});const i=r(96);Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return i.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}});const o=r(219);Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return o.ethErrors}});const a=r(50);Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return a.errorCodes}})},function(e,t){e.exports=i,i.default=i,i.stable=a,i.stableStringify=a;var r=[],n=[];function i(e,t,i){var o;for(function e(t,i,o,a){var s;if("object"==typeof t&&null!==t){for(s=0;s<o.length;s++)if(o[s]===t){var f=Object.getOwnPropertyDescriptor(a,i);return void(void 0!==f.get?f.configurable?(Object.defineProperty(a,i,{value:"[Circular]"}),r.push([a,i,t,f])):n.push([t,i]):(a[i]="[Circular]",r.push([a,i,t])))}if(o.push(t),Array.isArray(t))for(s=0;s<t.length;s++)e(t[s],s,o,t);else{var c=Object.keys(t);for(s=0;s<c.length;s++){var u=c[s];e(t[u],u,o,t)}}o.pop()}}(e,"",[],void 0),o=0===n.length?JSON.stringify(e,t,i):JSON.stringify(e,s(t),i);0!==r.length;){var a=r.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}return o}function o(e,t){return e<t?-1:e>t?1:0}function a(e,t,i){var a,f=function e(t,i,a,s){var f;if("object"==typeof t&&null!==t){for(f=0;f<a.length;f++)if(a[f]===t){var c=Object.getOwnPropertyDescriptor(s,i);return void(void 0!==c.get?c.configurable?(Object.defineProperty(s,i,{value:"[Circular]"}),r.push([s,i,t,c])):n.push([t,i]):(s[i]="[Circular]",r.push([s,i,t])))}if("function"==typeof t.toJSON)return;if(a.push(t),Array.isArray(t))for(f=0;f<t.length;f++)e(t[f],f,a,t);else{var u={},d=Object.keys(t).sort(o);for(f=0;f<d.length;f++){var h=d[f];e(t[h],h,a,t),u[h]=t[h]}if(void 0===s)return u;r.push([s,i,t]),s[i]=u}a.pop()}}(e,"",[],void 0)||e;for(a=0===n.length?JSON.stringify(f,t,i):JSON.stringify(f,s(t),i);0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}return a}function s(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var i=0;i<n.length;i++){var o=n[i];if(o[1]===t&&o[0]===r){r="[Circular]",n.splice(i,1);break}}return e.call(this,t,r)}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ethErrors=void 0;const n=r(49),i=r(96),o=r(50);function a(e,t){const[r,o]=f(t);return new n.EthereumRpcError(e,r||i.getMessageFromCode(e),o)}function s(e,t){const[r,o]=f(t);return new n.EthereumProviderError(e,r||i.getMessageFromCode(e),o)}function f(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}t.ethErrors={rpc:{parse:e=>a(o.errorCodes.rpc.parse,e),invalidRequest:e=>a(o.errorCodes.rpc.invalidRequest,e),invalidParams:e=>a(o.errorCodes.rpc.invalidParams,e),methodNotFound:e=>a(o.errorCodes.rpc.methodNotFound,e),internal:e=>a(o.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return a(t,e)},invalidInput:e=>a(o.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>a(o.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>a(o.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>a(o.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>a(o.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>a(o.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>s(o.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>s(o.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>s(o.errorCodes.provider.unsupportedMethod,e),disconnected:e=>s(o.errorCodes.provider.disconnected,e),chainDisconnected:e=>s(o.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new n.EthereumProviderError(t,r,i)}}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.mergeMiddleware=void 0;const n=r(95);t.mergeMiddleware=function(e){const t=new n.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()}},function(e,t){e.exports=function(e){return(t,r,n,i)=>{const o=e[t.method];return void 0===o?n():"function"==typeof o?o(t,r,n,i):(r.result=o,i())}}},function(e,t,r){const n=r(80),i=r(223),o=r(224),{bnToHex:a,hexToInt:s,incrementHexInt:f,minBlockRef:c,blockRefIsNumber:u}=r(23);e.exports=class extends o{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new n(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map((e=>e.toLowerCase())))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const r=c(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:r}),i=await this._fetchLogs(n);this.addInitialResults(i)}async update({oldBlock:e,newBlock:t}){const r=t;let n;n=e?f(e):t;const i=Object.assign({},this.params,{fromBlock:n,toBlock:r}),o=(await this._fetchLogs(i)).filter((e=>this.matchLog(e)));this.addResults(o)}async _fetchLogs(e){return await i((t=>this.ethQuery.getLogs(e,t)))()}matchLog(e){if(s(this.params.fromBlock)>=s(e.blockNumber))return!1;if(u(this.params.toBlock)&&s(this.params.toBlock)<=s(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();return!(this.params.address&&t&&!this.params.address.includes(t))&&this.params.topics.every(((t,r)=>{let n=e.topics[r];if(!n)return!1;n=n.toLowerCase();let i=Array.isArray(t)?t:[t];return!!i.includes(null)||(i=i.map((e=>e.toLowerCase())),i.includes(n))}))}}},function(e,t,r){const n=(e,t,r,n)=>function(...i){return new t.promiseModule(((o,a)=>{t.multiArgs?i.push(((...e)=>{t.errorFirst?e[0]?a(e):(e.shift(),o(e)):o(e)})):t.errorFirst?i.push(((e,t)=>{e?a(e):o(t)})):i.push(o);const s=this===r?n:this;Reflect.apply(e,s,i)}))},i=new WeakMap;e.exports=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(null===e||"object"!==r&&"function"!==r)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===e?"null":r}\``);const o=new WeakMap,a=new Proxy(e,{apply(e,r,i){const s=o.get(e);if(s)return Reflect.apply(s,r,i);const f=t.excludeMain?e:n(e,t,a,e);return o.set(e,f),Reflect.apply(f,r,i)},get(e,r){const s=e[r];if(!((e,r)=>{let n=i.get(e);if(n||(n={},i.set(e,n)),r in n)return n[r];const o=e=>"string"==typeof e||"symbol"==typeof r?r===e:e.test(r),a=Reflect.getOwnPropertyDescriptor(e,r),s=void 0===a||a.writable||a.configurable,f=(t.include?t.include.some(o):!t.exclude.some(o))&&s;return n[r]=f,f})(e,r)||s===Function.prototype[r])return s;const f=o.get(s);if(f)return f;if("function"==typeof s){const r=n(s,t,a,e);return o.set(s,r),r}return s}});return a}},function(e,t,r){const n=r(51);e.exports=class extends n{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}}},function(e,t,r){const n=r(51),i=r(52),{incrementHexInt:o}=r(23);e.exports=class extends n{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const r=t,n=o(e),a=(await i({provider:this.provider,fromBlock:n,toBlock:r})).map((e=>e.hash));this.addResults(a)}}},function(e,t,r){const n=r(51),i=r(52),{incrementHexInt:o}=r(23);e.exports=class extends n{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,r=o(e),n=await i({provider:this.provider,fromBlock:r,toBlock:t}),a=[];for(const e of n)a.push(...e.transactions);this.addResults(a)}}},function(e,t,r){var n=r(228),i=r(229),o=r(9).inherits,a=r(13),s=r(231),f=r(28),c=r(254),u=r(31),d=r(255),h=/^[0-9A-Fa-f]+$/g;function l(e){this.nonceLock=c(1),e.getAccounts&&(this.getAccounts=e.getAccounts),e.processTransaction&&(this.processTransaction=e.processTransaction),e.processMessage&&(this.processMessage=e.processMessage),e.processPersonalMessage&&(this.processPersonalMessage=e.processPersonalMessage),e.processTypedMessage&&(this.processTypedMessage=e.processTypedMessage),e.processTypedMessageV3&&(this.processTypedMessageV3=e.processTypedMessageV3),this.approveTransaction=e.approveTransaction||this.autoApprove,this.approveMessage=e.approveMessage||this.autoApprove,this.approvePersonalMessage=e.approvePersonalMessage||this.autoApprove,this.approveDecryptMessage=e.approveDecryptMessage||this.autoApprove,this.approveEncryptionPublicKey=e.approveEncryptionPublicKey||this.autoApprove,this.approveTypedMessage=e.approveTypedMessage||this.autoApprove,e.signTransaction&&(this.signTransaction=e.signTransaction||m("signTransaction")),e.signMessage&&(this.signMessage=e.signMessage||m("signMessage")),e.signPersonalMessage&&(this.signPersonalMessage=e.signPersonalMessage||m("signPersonalMessage")),e.decryptMessage&&(this.decryptMessage=e.decryptMessage||m("decryptMessage")),e.encryptionPublicKey&&(this.encryptionPublicKey=e.encryptionPublicKey||m("encryptionPublicKey")),e.signTypedMessage&&(this.signTypedMessage=e.signTypedMessage||m("signTypedMessage")),e.signTypedMessageV3&&(this.signTypedMessageV3=e.signTypedMessageV3||m("signTypedMessageV3")),e.recoverPersonalSignature&&(this.recoverPersonalSignature=e.recoverPersonalSignature),e.publishTransaction&&(this.publishTransaction=e.publishTransaction),this.estimateGas=e.estimateGas||this.estimateGas,this.getGasPrice=e.getGasPrice||this.getGasPrice}function p(e){return e.toLowerCase()}function b(e){var t=a.addHexPrefix(e);return a.isValidAddress(t)}function g(e){var t=a.addHexPrefix(e);return!a.isValidAddress(t)&&y(e)}function y(e){return"string"==typeof e&&"0x"===e.slice(0,2)&&e.slice(2).match(h)}function m(e){return function(t,r){r(new Error('ProviderEngine - HookedWalletSubprovider - Must provide "'+e+'" fn in constructor options'))}}e.exports=l,o(l,u),l.prototype.handleRequest=function(e,t,r){var i,o,a,s,c,u,d,h,l=this;switch(l._parityRequests={},l._parityRequestCount=0,e.method){case"eth_coinbase":return void l.getAccounts((function(e,t){if(e)return r(e);var n=t[0]||null;r(null,n)}));case"eth_accounts":return void l.getAccounts((function(e,t){if(e)return r(e);r(null,t)}));case"eth_sendTransaction":return i=e.params[0],void n([function(e){return l.validateTransaction(i,e)},function(e){return l.processTransaction(i,e)}],r);case"eth_signTransaction":return i=e.params[0],void n([function(e){return l.validateTransaction(i,e)},function(e){return l.processSignTransaction(i,e)}],r);case"eth_sign":return c=e.params[0],s=e.params[1],a=e.params[2]||{},o=f(a,{from:c,data:s}),void n([function(e){return l.validateMessage(o,e)},function(e){return l.processMessage(o,e)}],r);case"personal_sign":return function(){var t=e.params[0];g(e.params[1])&&b(t)?(console.warn("The eth_personalSign method requires params ordered [message, address]. This was previously handled incorrectly, and has been corrected automatically. Please switch this param order for smooth behavior in the future."),c=e.params[0],s=e.params[1]):(s=e.params[0],c=e.params[1]),a=e.params[2]||{},o=f(a,{from:c,data:s}),n([function(e){return l.validatePersonalMessage(o,e)},function(e){return l.processPersonalMessage(o,e)}],r)}();case"eth_decryptMessage":return function(){var t=e.params[0];g(e.params[1])&&b(t)?(console.warn("The eth_decryptMessage method requires params ordered [message, address]. This was previously handled incorrectly, and has been corrected automatically. Please switch this param order for smooth behavior in the future."),c=e.params[0],s=e.params[1]):(s=e.params[0],c=e.params[1]),a=e.params[2]||{},o=f(a,{from:c,data:s}),n([function(e){return l.validateDecryptMessage(o,e)},function(e){return l.processDecryptMessage(o,e)}],r)}();case"encryption_public_key":return function(){var t=e.params[0];n([function(e){return l.validateEncryptionPublicKey(t,e)},function(e){return l.processEncryptionPublicKey(t,e)}],r)}();case"personal_ecRecover":return function(){s=e.params[0];var t=e.params[1];a=e.params[2]||{},o=f(a,{sig:t,data:s}),l.recoverPersonalSignature(o,r)}();case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":return d=e.params[0],h=e.params[1],b(d)?(c=d,s=h):(s=d,c=h),a=e.params[2]||{},o=f(a,{from:c,data:s}),void n([function(e){return l.validateTypedMessage(o,e)},function(t){return"eth_signTypedData"===e.method?l.processTypedMessage(o,t):l.processTypedMessageV3(o,t)}],r);case"parity_postTransaction":return i=e.params[0],void l.parityPostTransaction(i,r);case"parity_postSign":return c=e.params[0],s=e.params[1],void l.parityPostSign(c,s,r);case"parity_checkRequest":return u=e.params[0],void l.parityCheckRequest(u,r);case"parity_defaultAccount":return void l.getAccounts((function(e,t){if(e)return r(e);var n=t[0]||null;r(null,n)}));default:return void t()}},l.prototype.getAccounts=function(e){e(null,[])},l.prototype.processTransaction=function(e,t){var r=this;n([function(t){return r.approveTransaction(e,t)},function(e,t){return r.checkApproval("transaction",e,t)},function(t){return r.finalizeAndSubmitTx(e,t)}],t)},l.prototype.processSignTransaction=function(e,t){var r=this;n([function(t){return r.approveTransaction(e,t)},function(e,t){return r.checkApproval("transaction",e,t)},function(t){return r.finalizeTx(e,t)}],t)},l.prototype.processMessage=function(e,t){var r=this;n([function(t){return r.approveMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signMessage(e,t)}],t)},l.prototype.processPersonalMessage=function(e,t){var r=this;n([function(t){return r.approvePersonalMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signPersonalMessage(e,t)}],t)},l.prototype.processDecryptMessage=function(e,t){var r=this;n([function(t){return r.approveDecryptMessage(e,t)},function(e,t){return r.checkApproval("decryptMessage",e,t)},function(t){return r.decryptMessage(e,t)}],t)},l.prototype.processEncryptionPublicKey=function(e,t){var r=this;n([function(t){return r.approveEncryptionPublicKey(e,t)},function(e,t){return r.checkApproval("encryptionPublicKey",e,t)},function(t){return r.encryptionPublicKey(e,t)}],t)},l.prototype.processTypedMessage=function(e,t){var r=this;n([function(t){return r.approveTypedMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signTypedMessage(e,t)}],t)},l.prototype.processTypedMessageV3=function(e,t){var r=this;n([function(t){return r.approveTypedMessage(e,t)},function(e,t){return r.checkApproval("message",e,t)},function(t){return r.signTypedMessageV3(e,t)}],t)},l.prototype.autoApprove=function(e,t){t(null,!0)},l.prototype.checkApproval=function(e,t,r){r(t?null:new Error("User denied "+e+" signature."))},l.prototype.parityPostTransaction=function(e,t){var r=this,n=r._parityRequestCount,i="0x".concat(n.toString(16));r._parityRequestCount++,r.emitPayload({method:"eth_sendTransaction",params:[e]},(function(e,t){if(e)r._parityRequests[i]={error:e};else{var n=t.result;r._parityRequests[i]=n}})),t(null,i)},l.prototype.parityPostSign=function(e,t,r){var n=this,i=n._parityRequestCount,o="0x".concat(i.toString(16));n._parityRequestCount++,n.emitPayload({method:"eth_sign",params:[e,t]},(function(e,t){if(e)n._parityRequests[o]={error:e};else{var r=t.result;n._parityRequests[o]=r}})),r(null,o)},l.prototype.parityCheckRequest=function(e,t){var r=this._parityRequests[e]||null;return r?r.error?t(r.error):void t(null,r):t(null,null)},l.prototype.recoverPersonalSignature=function(e,t){var r;try{r=s.recoverPersonalSignature(e)}catch(e){return t(e)}t(null,r)},l.prototype.validateTransaction=function(e,t){if(void 0===e.from)return t(new Error("Undefined address - from address required to sign transaction."));this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign transaction for this address: "'.concat(e.from,'"')))}))},l.prototype.validateMessage=function(e,t){if(void 0===e.from)return t(new Error("Undefined address - from address required to sign message."));this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign message for this address: "'.concat(e.from,'"')))}))},l.prototype.validatePersonalMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to sign personal message.")):void 0===e.data?t(new Error("Undefined message - message required to sign personal message.")):y(e.data)?void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign message for this address: "'.concat(e.from,'"')))})):t(new Error("HookedWalletSubprovider - validateMessage - message was not encoded as hex."))},l.prototype.validateDecryptMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to decrypt message.")):void 0===e.data?t(new Error("Undefined message - message required to decrypt message.")):y(e.data)?void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to decrypt message for this address: "'.concat(e.from,'"')))})):t(new Error("HookedWalletSubprovider - validateDecryptMessage - message was not encoded as hex."))},l.prototype.validateEncryptionPublicKey=function(e,t){this.validateSender(e,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to obtain encryption public key for this address: "'.concat(e,'"')))}))},l.prototype.validateTypedMessage=function(e,t){return void 0===e.from?t(new Error("Undefined address - from address required to sign typed data.")):void 0===e.data?t(new Error("Undefined data - message required to sign typed data.")):void this.validateSender(e.from,(function(r,n){return r?t(r):n?void t():t(new Error('Unknown address - unable to sign message for this address: "'.concat(e.from,'"')))}))},l.prototype.validateSender=function(e,t){if(!e)return t(null,!1);this.getAccounts((function(r,n){if(r)return t(r);var i=-1!==n.map(p).indexOf(e.toLowerCase());t(null,i)}))},l.prototype.finalizeAndSubmitTx=function(e,t){var r=this;r.nonceLock.take((function(){n([r.fillInTxExtras.bind(r,e),r.signTransaction.bind(r),r.publishTransaction.bind(r)],(function(e,n){if(r.nonceLock.leave(),e)return t(e);t(null,n)}))}))},l.prototype.finalizeTx=function(e,t){var r=this;r.nonceLock.take((function(){n([r.fillInTxExtras.bind(r,e),r.signTransaction.bind(r)],(function(n,i){if(r.nonceLock.leave(),n)return t(n);t(null,{raw:i,tx:e})}))}))},l.prototype.publishTransaction=function(e,t){this.emitPayload({method:"eth_sendRawTransaction",params:[e]},(function(e,r){if(e)return t(e);t(null,r.result)}))},l.prototype.estimateGas=function(e,t){d(this.engine,e,t)},l.prototype.getGasPrice=function(e){this.emitPayload({method:"eth_gasPrice",params:[]},(function(t,r){if(t)return e(t);e(null,r.result)}))},l.prototype.fillInTxExtras=function(e,t){var r=e.from,n={};void 0===e.gasPrice&&(n.gasPrice=this.getGasPrice.bind(this)),void 0===e.nonce&&(n.nonce=this.emitPayload.bind(this,{method:"eth_getTransactionCount",params:[r,"pending"]})),void 0===e.gas&&(n.gas=this.estimateGas.bind(this,function(e){return{from:e.from,to:e.to,value:e.value,data:e.data,gas:e.gas,gasPrice:e.gasPrice,nonce:e.nonce}}(e))),i(n,(function(r,n){if(r)return t(r);var i={};n.gasPrice&&(i.gasPrice=n.gasPrice),n.nonce&&(i.nonce=n.nonce.result),n.gas&&(i.gas=n.gas),t(null,f(e,i))}))}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(t=(0,o.default)(t||i.default),!(0,n.default)(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var r=0;function c(t){var n=(0,f.default)(e[r++]);t.push((0,s.default)(u)),n.apply(null,t)}function u(n){if(n||r===e.length)return t.apply(null,arguments);c((0,a.default)(arguments,1))}c([])};var n=c(r(89)),i=c(r(22)),o=c(r(43)),a=c(r(30)),s=c(r(45)),f=c(r(12));function c(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,i.default)(n.default,e,t)};var n=o(r(81)),i=o(r(230));function o(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){r=r||n.default;var s=(0,i.default)(t)?[]:{};e(t,(function(e,t,r){(0,a.default)(e)((function(e,n){arguments.length>2&&(n=(0,o.default)(arguments,1)),s[t]=n,r(e)}))}),(function(e){r(e,s)}))};var n=s(r(22)),i=s(r(29)),o=s(r(30)),a=s(r(12));function s(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default},function(e,t,r){const n=r(13),i=r(232);function o(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const r=e.map((function(e){return"bytes"===e.type?n.toBuffer(e.value):e.value})),o=e.map((function(e){return e.type})),a=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return i.soliditySHA3(["bytes32","bytes32"],[i.soliditySHA3(new Array(e.length).fill("string"),a),i.soliditySHA3(o,r)])}function a(e,t){const r=n.toBuffer(t),i=n.fromRpcSig(r);return n.ecrecover(e,i.v,i.r,i.s)}function s(e){const t=n.toBuffer(e.data);return a(n.hashPersonalMessage(t),e.sig)}function f(e,t){for(var r=""+e;r.length<t;)r="0"+r;return r}e.exports={concatSig:function(e,t,r){const i=n.fromSigned(t),o=n.fromSigned(r),a=n.bufferToInt(e),s=f(n.toUnsigned(i).toString("hex"),64),c=f(n.toUnsigned(o).toString("hex"),64),u=n.stripHexPrefix(n.intToHex(a));return n.addHexPrefix(s.concat(c,u)).toString("hex")},normalize:function(e){if(e){if("number"==typeof e){const t=n.toBuffer(e);e=n.bufferToHex(t)}if("string"!=typeof e){var t="eth-sig-util.normalize() requires hex string or integer input.";throw new Error(t+=" received "+typeof e+": "+e)}return n.addHexPrefix(e.toLowerCase())}},personalSign:function(e,t){var r=n.toBuffer(t.data),i=n.hashPersonalMessage(r),o=n.ecsign(i,e);return n.bufferToHex(this.concatSig(o.v,o.r,o.s))},recoverPersonalSignature:function(e){const t=s(e),r=n.publicToAddress(t);return n.bufferToHex(r)},extractPublicKey:function(e){return"0x"+s(e).toString("hex")},typedSignatureHash:function(e){const t=o(e);return n.bufferToHex(t)},signTypedData:function(e,t){const r=o(t.data),i=n.ecsign(r,e);return n.bufferToHex(this.concatSig(i.v,i.r,i.s))},recoverTypedSignature:function(e){const t=a(o(e.data),e.sig),r=n.publicToAddress(t);return n.bufferToHex(r)}}},function(e,t,r){e.exports=r(233)},function(e,t,r){(function(t){const n=r(234),i=r(2);var o=function(){};function a(e){return e.startsWith("int[")?"int256"+e.slice(3):"int"===e?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):"uint"===e?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):"fixed"===e?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):"ufixed"===e?"ufixed128x128":e}function s(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function f(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function c(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function u(e){var t=typeof e;if("string"===t)return n.isHexPrefixed(e)?new i(n.stripHexPrefix(e),16):new i(e,10);if("number"===t)return new i(e);if(e.toArray)return e;throw new Error("Argument is not a number")}function d(e){var t=/^(\w+)\((.*)\)$/.exec(e);if(3!==t.length)throw new Error("Invalid method signature");var r=/^(.+)\):\((.+)$/.exec(t[2]);if(null!==r&&3===r.length)return{method:t[1],args:r[1].split(","),retargs:r[2].split(",")};var n=t[2].split(",");return 1===n.length&&""===n[0]&&(n=[]),{method:t[1],args:n}}function h(e,r){var o,a,d,l;if("address"===e)return h("uint160",u(r));if("bool"===e)return h("uint8",r?1:0);if("string"===e)return h("bytes",t.from(r,"utf8"));if(g(e)){if(void 0===r.length)throw new Error("Not an array?");if("dynamic"!==(o=c(e))&&0!==o&&r.length>o)throw new Error("Elements exceed array size: "+o);for(l in d=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof r&&(r=JSON.parse(r)),r)d.push(h(e,r[l]));if("dynamic"===o){var p=h("uint256",r.length);d.unshift(p)}return t.concat(d)}if("bytes"===e)return r=t.from(r),d=t.concat([h("uint256",r.length),r]),r.length%32!=0&&(d=t.concat([d,n.zeros(32-r.length%32)])),d;if(e.startsWith("bytes")){if((o=s(e))<1||o>32)throw new Error("Invalid bytes<N> width: "+o);return n.setLengthRight(r,32)}if(e.startsWith("uint")){if((o=s(e))%8||o<8||o>256)throw new Error("Invalid uint<N> width: "+o);if((a=u(r)).bitLength()>o)throw new Error("Supplied uint exceeds width: "+o+" vs "+a.bitLength());if(a<0)throw new Error("Supplied uint is negative");return a.toArrayLike(t,"be",32)}if(e.startsWith("int")){if((o=s(e))%8||o<8||o>256)throw new Error("Invalid int<N> width: "+o);if((a=u(r)).bitLength()>o)throw new Error("Supplied int exceeds width: "+o+" vs "+a.bitLength());return a.toTwos(256).toArrayLike(t,"be",32)}if(e.startsWith("ufixed")){if(o=f(e),(a=u(r))<0)throw new Error("Supplied ufixed is negative");return h("uint256",a.mul(new i(2).pow(new i(o[1]))))}if(e.startsWith("fixed"))return o=f(e),h("int256",u(r).mul(new i(2).pow(new i(o[1]))));throw new Error("Unsupported or invalid type: "+e)}function l(e,r,n){var o,a,s,f;if("string"==typeof e&&(e=p(e)),"address"===e.name)return l(e.rawType,r,n).toArrayLike(t,"be",20).toString("hex");if("bool"===e.name)return l(e.rawType,r,n).toString()===new i(1).toString();if("string"===e.name){var c=l(e.rawType,r,n);return t.from(c,"utf8").toString()}if(e.isArray){for(s=[],o=e.size,"dynamic"===e.size&&(n=l("uint256",r,n).toNumber(),o=l("uint256",r,n).toNumber(),n+=32),f=0;f<o;f++){var u=l(e.subArray,r,n);s.push(u),n+=e.subArray.memoryUsage}return s}if("bytes"===e.name)return n=l("uint256",r,n).toNumber(),o=l("uint256",r,n).toNumber(),r.slice(n+32,n+32+o);if(e.name.startsWith("bytes"))return r.slice(n,n+e.size);if(e.name.startsWith("uint")){if((a=new i(r.slice(n,n+32),16,"be")).bitLength()>e.size)throw new Error("Decoded int exceeds width: "+e.size+" vs "+a.bitLength());return a}if(e.name.startsWith("int")){if((a=new i(r.slice(n,n+32),16,"be").fromTwos(256)).bitLength()>e.size)throw new Error("Decoded uint exceeds width: "+e.size+" vs "+a.bitLength());return a}if(e.name.startsWith("ufixed")){if(o=new i(2).pow(new i(e.size[1])),!(a=l("uint256",r,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}if(e.name.startsWith("fixed")){if(o=new i(2).pow(new i(e.size[1])),!(a=l("int256",r,n)).mod(o).isZero())throw new Error("Decimals not supported yet");return a.div(o)}throw new Error("Unsupported or invalid type: "+e.name)}function p(e){var t,r,n;if(g(e)){t=c(e);var i=e.slice(0,e.lastIndexOf("["));return i=p(i),{isArray:!0,name:e,size:t,memoryUsage:"dynamic"===t?32:i.memoryUsage*t,subArray:i}}switch(e){case"address":n="uint160";break;case"bool":n="uint8";break;case"string":n="bytes"}if(r={rawType:n,name:e,memoryUsage:32},e.startsWith("bytes")&&"bytes"!==e||e.startsWith("uint")||e.startsWith("int")?r.size=s(e):(e.startsWith("ufixed")||e.startsWith("fixed"))&&(r.size=f(e)),e.startsWith("bytes")&&"bytes"!==e&&(r.size<1||r.size>32))throw new Error("Invalid bytes<N> width: "+r.size);if((e.startsWith("uint")||e.startsWith("int"))&&(r.size%8||r.size<8||r.size>256))throw new Error("Invalid int/uint<N> width: "+r.size);return r}function b(e){return"string"===e||"bytes"===e||"dynamic"===c(e)}function g(e){return e.lastIndexOf("]")===e.length-1}function y(e,t){return e.startsWith("address")||e.startsWith("bytes")?"0x"+t.toString("hex"):t.toString()}o.eventID=function(e,r){var i=e+"("+r.map(a).join(",")+")";return n.keccak256(t.from(i))},o.methodID=function(e,t){return o.eventID(e,t).slice(0,4)},o.rawEncode=function(e,r){var n=[],i=[],o=0;e.forEach((function(e){if(g(e)){var t=c(e);o+="dynamic"!==t?32*t:32}else o+=32}));for(var s=0;s<e.length;s++){var f=a(e[s]),u=h(f,r[s]);b(f)?(n.push(h("uint256",o)),i.push(u),o+=u.length):n.push(u)}return t.concat(n.concat(i))},o.rawDecode=function(e,r){var n=[];r=t.from(r);for(var i=0,o=0;o<e.length;o++){var s=p(a(e[o])),f=l(s,r,i);i+=s.memoryUsage,n.push(f)}return n},o.simpleEncode=function(e){var r=Array.prototype.slice.call(arguments).slice(1),n=d(e);if(r.length!==n.args.length)throw new Error("Argument count mismatch");return t.concat([o.methodID(n.method,n.args),o.rawEncode(n.args,r)])},o.simpleDecode=function(e,t){var r=d(e);if(!r.retargs)throw new Error("No return values in method");return o.rawDecode(r.retargs,t)},o.stringify=function(e,t){var r=[];for(var n in e){var i=e[n],o=t[n];o=/^[^\[]+\[.*\]$/.test(i)?o.map((function(e){return y(i,e)})).join(", "):y(i,o),r.push(o)}return r},o.solidityHexValue=function(e,r,i){var a,f;if(g(e)){var d=e.replace(/\[.*?\]/,"");if(!g(d)){var h=c(e);if("dynamic"!==h&&0!==h&&r.length>h)throw new Error("Elements exceed array size: "+h)}var l=r.map((function(e){return o.solidityHexValue(d,e,256)}));return t.concat(l)}if("bytes"===e)return r;if("string"===e)return t.from(r,"utf8");if("bool"===e){i=i||8;var p=Array(i/4).join("0");return t.from(r?p+"1":p+"0","hex")}if("address"===e){var b=20;return i&&(b=i/8),n.setLengthLeft(r,b)}if(e.startsWith("bytes")){if((a=s(e))<1||a>32)throw new Error("Invalid bytes<N> width: "+a);return n.setLengthRight(r,a)}if(e.startsWith("uint")){if((a=s(e))%8||a<8||a>256)throw new Error("Invalid uint<N> width: "+a);if((f=u(r)).bitLength()>a)throw new Error("Supplied uint exceeds width: "+a+" vs "+f.bitLength());return i=i||a,f.toArrayLike(t,"be",i/8)}if(e.startsWith("int")){if((a=s(e))%8||a<8||a>256)throw new Error("Invalid int<N> width: "+a);if((f=u(r)).bitLength()>a)throw new Error("Supplied int exceeds width: "+a+" vs "+f.bitLength());return i=i||a,f.toTwos(a).toArrayLike(t,"be",i/8)}throw new Error("Unsupported or invalid type: "+e)},o.solidityPack=function(e,r){if(e.length!==r.length)throw new Error("Number of types are not matching the values");for(var n=[],i=0;i<e.length;i++){var s=a(e[i]),f=r[i];n.push(o.solidityHexValue(s,f,null))}return t.concat(n)},o.soliditySHA3=function(e,t){return n.keccak256(o.solidityPack(e,t))},o.soliditySHA256=function(e,t){return n.sha256(o.solidityPack(e,t))},o.solidityRIPEMD160=function(e,t){return n.ripemd160(o.solidityPack(e,t),!0)},o.fromSerpent=function(e){for(var t,r=[],n=0;n<e.length;n++){var i=e[n];if("s"===i)r.push("bytes");else if("b"===i){for(var o="bytes",a=n+1;a<e.length&&(t=e[a])>="0"&&t<="9";)o+=e[a]-"0",a++;n=a-1,r.push(o)}else if("i"===i)r.push("int256");else{if("a"!==i)throw new Error("Unsupported or invalid type: "+i);r.push("int256[]")}}return r},o.toSerpent=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if("bytes"===n)t.push("s");else if(n.startsWith("bytes"))t.push("b"+s(n));else if("int256"===n)t.push("i");else{if("int256[]"!==n)throw new Error("Unsupported or invalid type: "+n);t.push("a")}}return t.join("")},e.exports=o}).call(this,r(1).Buffer)},function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.secp256k1=t.rlp=t.BN=void 0;var o=r(53);t.secp256k1=o;var a=r(17),s=r(2);t.BN=s;var f=r(27);t.rlp=f,Object.assign(t,a),i(r(242),t),i(r(243),t),i(r(54),t),i(r(252),t),i(r(24),t),i(r(253),t)},function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}f((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(98),a=r(238);t.createPrivateKey=function(){return n(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,a.getRandomBytes(32)];case 1:return e=t.sent(),o.privateKeyVerify(e)?[2,e]:[3,0];case 2:return[2]}}))}))},t.createPrivateKeySync=function(){for(;;){var e=a.getRandomBytesSync(32);if(o.privateKeyVerify(e))return e}},function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(98))},function(e,t){const r="Impossible case. Please create issue.",n="The tweak was out of range or the resulted private key is invalid",i="The tweak was out of range or equal to zero",o="Unknow error on context randomization",a="Private Key is invalid",s="Public Key could not be parsed",f="Public Key serialization error",c="The sum of the public keys is not valid",u="Signature could not be parsed",d="The nonce generation function failed, or the private key was invalid",h="Public key could not be recover",l="Scalar was invalid (zero or overflow)";function p(e,t){if(!e)throw new Error(t)}function b(e,t,r){if(p(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;p(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;p(t.length===r,n)}}function g(e){p("Boolean"===m(e),"Expected compressed to be a Boolean")}function y(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),b("output",e,t),e}function m(e){return Object.prototype.toString.call(e).slice(8,-1)}e.exports=e=>({contextRandomize(t){if(1===(p(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&b("seed",t,32),e.contextRandomize(t)))throw new Error(o)},privateKeyVerify:t=>(b("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(b("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(r)}},privateKeyTweakAdd(t,r){switch(b("private key",t,32),b("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(n)}},privateKeyTweakMul(t,r){switch(b("private key",t,32),b("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(i)}},publicKeyVerify:t=>(b("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(b("private key",t,32),g(r),n=y(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(a);case 2:throw new Error(f)}},publicKeyConvert(t,r=!0,n){switch(b("public key",t,[33,65]),g(r),n=y(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(f)}},publicKeyNegate(t,n=!0,i){switch(b("public key",t,[33,65]),g(n),i=y(i,n?33:65),e.publicKeyNegate(i,t)){case 0:return i;case 1:throw new Error(s);case 2:throw new Error(r);case 3:throw new Error(f)}},publicKeyCombine(t,r=!0,n){p(Array.isArray(t),"Expected public keys to be an Array"),p(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)b("public key",e,[33,65]);switch(g(r),n=y(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(c);case 3:throw new Error(f)}},publicKeyTweakAdd(t,r,i=!0,o){switch(b("public key",t,[33,65]),b("tweak",r,32),g(i),o=y(o,i?33:65),e.publicKeyTweakAdd(o,t,r)){case 0:return o;case 1:throw new Error(s);case 2:throw new Error(n)}},publicKeyTweakMul(t,r,n=!0,o){switch(b("public key",t,[33,65]),b("tweak",r,32),g(n),o=y(o,n?33:65),e.publicKeyTweakMul(o,t,r)){case 0:return o;case 1:throw new Error(s);case 2:throw new Error(i)}},signatureNormalize(t){switch(b("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(u)}},signatureExport(t,n){b("signature",t,64);const i={output:n=y(n,72),outputlen:72};switch(e.signatureExport(i,t)){case 0:return n.slice(0,i.outputlen);case 1:throw new Error(u);case 2:throw new Error(r)}},signatureImport(t,n){switch(b("signature",t),n=y(n,64),e.signatureImport(n,t)){case 0:return n;case 1:throw new Error(u);case 2:throw new Error(r)}},ecdsaSign(t,n,i={},o){b("message",t,32),b("private key",n,32),p("Object"===m(i),"Expected options to be an Object"),void 0!==i.data&&b("options.data",i.data),void 0!==i.noncefn&&p("Function"===m(i.noncefn),"Expected options.noncefn to be a Function");const a={signature:o=y(o,64),recid:null};switch(e.ecdsaSign(a,t,n,i.data,i.noncefn)){case 0:return a;case 1:throw new Error(d);case 2:throw new Error(r)}},ecdsaVerify(t,r,n){switch(b("signature",t,64),b("message",r,32),b("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(u);case 2:throw new Error(s)}},ecdsaRecover(t,n,i,o=!0,a){switch(b("signature",t,64),p("Number"===m(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),b("message",i,32),g(o),a=y(a,o?33:65),e.ecdsaRecover(a,t,n,i)){case 0:return a;case 1:throw new Error(u);case 2:throw new Error(h);case 3:throw new Error(r)}},ecdh(t,r,n={},i){switch(b("public key",t,[33,65]),b("private key",r,32),p("Object"===m(n),"Expected options to be an Object"),void 0!==n.data&&b("options.data",n.data),void 0!==n.hashfn?(p("Function"===m(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&b("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&b("options.ybuf",n.ybuf,32),b("output",i)):i=y(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(s);case 2:throw new Error(l)}}})},function(e,t,r){const n=new(r(38).ec)("secp256k1"),i=n.curve,o=i.n.constructor;function a(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new o(t);if(r.cmp(i.p)>=0)return null;r=r.toRed(i.red);let a=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===e!==a.isOdd()&&(a=a.redNeg()),n.keyPair({pub:{x:r,y:a}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let a=new o(t),s=new o(r);if(a.cmp(i.p)>=0||s.cmp(i.p)>=0)return null;if(a=a.toRed(i.red),s=s.toRed(i.red),(6===e||7===e)&&s.isOdd()!==(7===e))return null;const f=a.redSqr().redIMul(a);return s.redSqr().redISub(f.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:a,y:s}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function s(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}e.exports={contextRandomize:()=>0,privateKeyVerify(e){const t=new o(e);return t.cmp(i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new o(e),r=i.n.sub(t).umod(i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new o(t);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(e)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new o(t);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(e)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===a(e)?1:0,publicKeyCreate(e,t){const r=new o(t);return r.cmp(i.n)>=0||r.isZero()?1:(s(e,n.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const r=a(t);return null===r?1:(s(e,r.getPublic()),0)},publicKeyNegate(e,t){const r=a(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),s(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=a(t[e]),null===r[e])return 1;let n=r[0].getPublic();for(let e=1;e<r.length;++e)n=n.add(r[e].pub);return n.isInfinity()?2:(s(e,n),0)},publicKeyTweakAdd(e,t,r){const n=a(t);if(null===n)return 1;if((r=new o(r)).cmp(i.n)>=0)return 2;const f=n.getPublic().add(i.g.mul(r));return f.isInfinity()?2:(s(e,f),0)},publicKeyTweakMul(e,t,r){const n=a(t);return null===n?1:(r=new o(r)).cmp(i.n)>=0||r.isZero()?2:(s(e,n.getPublic().mul(r)),0)},signatureNormalize(e){const t=new o(e.subarray(0,32)),r=new o(e.subarray(32,64));return t.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&e.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:a}=e;let s=a.subarray(4,37);s[0]=0,s.set(r,1);let f=33,c=0;for(;f>1&&0===s[c]&&!(128&s[c+1]);--f,++c);if(s=s.subarray(c),128&s[0])return 1;if(f>1&&0===s[0]&&!(128&s[1]))return 1;let u=a.subarray(39,72);u[0]=0,u.set(n,1);let d=33,h=0;for(;d>1&&0===u[h]&&!(128&u[h+1]);--d,++h);return u=u.subarray(h),128&u[0]||d>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+f+d,a[0]=48,a[1]=e.outputlen-2,a[2]=2,a[3]=s.length,a.set(s,4),a[4+f]=2,a[5+f]=u.length,a.set(u,6+f),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let a=t.subarray(4,4+r);if(33===a.length&&0===a[0]&&(a=a.subarray(1)),a.length>32)return 1;let s=t.subarray(6+r);if(33===s.length&&0===s[0]&&(s=s.slice(1)),s.length>32)throw new Error("S length is too long");let f=new o(a);f.cmp(i.n)>=0&&(f=new o(0));let c=new o(t.subarray(6+r));return c.cmp(i.n)>=0&&(c=new o(0)),e.set(f.toArrayLike(Uint8Array,"be",32),0),e.set(c.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,a,s){if(s){const e=s;s=n=>{const i=e(t,r,null,a,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)}}const f=new o(r);if(f.cmp(i.n)>=0||f.isZero())return 1;let c;try{c=n.sign(t,r,{canonical:!0,k:s,pers:a})}catch(e){return 1}return e.signature.set(c.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(c.s.toArrayLike(Uint8Array,"be",32),32),e.recid=c.recoveryParam,0},ecdsaVerify(e,t,r){const s={r:e.subarray(0,32),s:e.subarray(32,64)},f=new o(s.r),c=new o(s.s);if(f.cmp(i.n)>=0||c.cmp(i.n)>=0)return 1;if(1===c.cmp(n.nh)||f.isZero()||c.isZero())return 3;const u=a(r);if(null===u)return 2;const d=u.getPublic();return n.verify(t,s,d)?0:3},ecdsaRecover(e,t,r,a){const f={r:t.slice(0,32),s:t.slice(32,64)},c=new o(f.r),u=new o(f.s);if(c.cmp(i.n)>=0||u.cmp(i.n)>=0)return 1;if(c.isZero()||u.isZero())return 2;let d;try{d=n.recoverPubKey(a,f,r)}catch(e){return 2}return s(e,d),0},ecdh(e,t,r,s,f,c,u){const d=a(t);if(null===d)return 1;const h=new o(r);if(h.cmp(i.n)>=0||h.isZero())return 2;const l=d.getPublic().mul(h);if(void 0===f){const t=l.encode(null,!0),r=n.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{c||(c=new Uint8Array(32));const t=l.getX().toArray("be",32);for(let e=0;e<32;++e)c[e]=t[e];u||(u=new Uint8Array(32));const r=l.getY().toArray("be",32);for(let e=0;e<32;++e)u[e]=r[e];const n=f(c,u,s);if(!(n instanceof Uint8Array&&n.length===e.length))return 2;e.set(n)}return 0}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(239);t.getRandomBytes=function(e){return new Promise((function(t,r){n(e,(function(e,n){e?r(e):t(n)}))}))},t.getRandomBytesSync=function(e){return n(e)}},function(e,t,r){(function(t,n){var i=r(3).Buffer,o=t.crypto||t.msCrypto;o&&o.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(e);if(e>0)if(e>65536)for(var a=0;a<e;a+=65536)o.getRandomValues(r.slice(a,a+65536));else o.getRandomValues(r);return"function"==typeof t?n.nextTick((function(){t(null,r)})):r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(6),r(4))},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),i=new(r(38).ec)("secp256k1"),o=i.curve;t.privateKeyExport=function(e,t){void 0===t&&(t=!0);var r=new n(e);if(r.ucmp(o.n)>=0)throw new Error("couldn't export to DER format");var s=i.g.mul(r);return a(s.getX(),s.getY(),t)},t.privateKeyModInverse=function(t){var r=new n(t);if(r.ucmp(o.n)>=0||r.isZero())throw new Error("private key range is invalid");return r.invm(o.n).toArrayLike(e,"be",32)},t.signatureImport=function(t){var r=new n(t.r);r.ucmp(o.n)>=0&&(r=new n(0));var i=new n(t.s);return i.ucmp(o.n)>=0&&(i=new n(0)),e.concat([r.toArrayLike(e,"be",32),i.toArrayLike(e,"be",32)])},t.ecdhUnsafe=function(e,t,r){void 0===r&&(r=!0);var s=i.keyFromPublic(e),f=new n(t);if(f.ucmp(o.n)>=0||f.isZero())throw new Error("scalar was invalid (zero or overflow)");var c=s.pub.mul(f);return a(c.getX(),c.getY(),r)};var a=function(t,r,n){var i;return n?((i=e.alloc(33))[0]=r.isOdd()?3:2,t.toArrayLike(e,"be",32).copy(i,1)):((i=e.alloc(65))[0]=4,t.toArrayLike(e,"be",32).copy(i,1),r.toArrayLike(e,"be",32).copy(i,33)),i}}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=e.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),n=e.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);t.privateKeyExport=function(t,i,o){void 0===o&&(o=!0);var a=e.from(o?r:n);return t.copy(a,o?8:9),i.copy(a,o?181:214),a},t.privateKeyImport=function(e){var t=e.length,r=0;if(t<r+1||48!==e[r])return null;if(t<(r+=1)+1||!(128&e[r]))return null;var n=127&e[r];if(n<1||n>2)return null;if(t<(r+=1)+n)return null;var i=e[r+n-1]|(n>1?e[r+n-2]<<8:0);return t<(r+=n)+i||t<r+3||2!==e[r]||1!==e[r+1]||1!==e[r+2]||t<(r+=3)+2||4!==e[r]||e[r+1]>32||t<r+2+e[r+1]?null:e.slice(r+2,r+2+e[r+1])},t.signatureImportLax=function(t){var r=e.alloc(32,0),n=e.alloc(32,0),i=t.length,o=0;if(48!==t[o++])return null;var a=t[o++];if(128&a&&(o+=a-128)>i)return null;if(2!==t[o++])return null;var s=t[o++];if(128&s){if(o+(a=s-128)>i)return null;for(;a>0&&0===t[o];o+=1,a-=1);for(s=0;a>0;o+=1,a-=1)s=(s<<8)+t[o]}if(s>i-o)return null;var f=o;if(o+=s,2!==t[o++])return null;var c=t[o++];if(128&c){if(o+(a=c-128)>i)return null;for(;a>0&&0===t[o];o+=1,a-=1);for(c=0;a>0;o+=1,a-=1)c=(c<<8)+t[o]}if(c>i-o)return null;var u=o;for(o+=c;s>0&&0===t[f];s-=1,f+=1);if(s>32)return null;var d=t.slice(f,f+s);for(d.copy(r,32-d.length);c>0&&0===t[u];c-=1,u+=1);if(c>32)return null;var h=t.slice(u,u+c);return h.copy(n,32-h.length),{r:r,s:n}}}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.KECCAK256_RLP=t.KECCAK256_RLP_S=t.KECCAK256_RLP_ARRAY=t.KECCAK256_RLP_ARRAY_S=t.KECCAK256_NULL=t.KECCAK256_NULL_S=t.TWO_POW256=t.MAX_INTEGER=void 0;var n=r(2);t.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),t.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),t.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",t.KECCAK256_NULL=e.from(t.KECCAK256_NULL_S,"hex"),t.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",t.KECCAK256_RLP_ARRAY=e.from(t.KECCAK256_RLP_ARRAY_S,"hex"),t.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",t.KECCAK256_RLP=e.from(t.KECCAK256_RLP_S,"hex")}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.importPublic=t.privateToPublic=t.privateToAddress=t.publicToAddress=t.pubToAddress=t.isValidPublic=t.isValidPrivate=t.isPrecompiled=t.generateAddress2=t.generateAddress=t.isValidChecksumAddress=t.toChecksumAddress=t.isZeroAddress=t.isValidAddress=t.zeroAddress=void 0;var n=r(41),i=r(17),o=r(53),a=r(2),s=r(24),f=r(54);t.zeroAddress=function(){var e=s.zeros(20);return s.bufferToHex(e)},t.isValidAddress=function(e){return/^0x[0-9a-fA-F]{40}$/.test(e)},t.isZeroAddress=function(e){return t.zeroAddress()===s.addHexPrefix(e)},t.toChecksumAddress=function(e,t){e=i.stripHexPrefix(e).toLowerCase();for(var r=void 0!==t?t.toString()+"0x":"",n=f.keccak(r+e).toString("hex"),o="0x",a=0;a<e.length;a++)parseInt(n[a],16)>=8?o+=e[a].toUpperCase():o+=e[a];return o},t.isValidChecksumAddress=function(e,r){return t.isValidAddress(e)&&t.toChecksumAddress(e,r)===e},t.generateAddress=function(t,r){t=s.toBuffer(t);var n=new a(r);return n.isZero()?f.rlphash([t,null]).slice(-20):f.rlphash([t,e.from(n.toArray())]).slice(-20)},t.generateAddress2=function(t,r,i){var o=s.toBuffer(t),a=s.toBuffer(r),c=s.toBuffer(i);return n(20===o.length),n(32===a.length),f.keccak256(e.concat([e.from("ff","hex"),o,a,f.keccak256(c)])).slice(-20)},t.isPrecompiled=function(e){var t=s.unpad(e);return 1===t.length&&t[0]>=1&&t[0]<=8},t.isValidPrivate=function(e){return o.privateKeyVerify(e)},t.isValidPublic=function(t,r){return void 0===r&&(r=!1),64===t.length?o.publicKeyVerify(e.concat([e.from([4]),t])):!!r&&o.publicKeyVerify(t)},t.pubToAddress=function(e,t){return void 0===t&&(t=!1),e=s.toBuffer(e),t&&64!==e.length&&(e=o.publicKeyConvert(e,!1).slice(1)),n(64===e.length),f.keccak(e).slice(-20)},t.publicToAddress=t.pubToAddress,t.privateToAddress=function(e){return t.publicToAddress(t.privateToPublic(e))},t.privateToPublic=function(e){return e=s.toBuffer(e),o.publicKeyCreate(e,!1).slice(1)},t.importPublic=function(e){return 64!==(e=s.toBuffer(e)).length&&(e=o.publicKeyConvert(e,!1).slice(1)),e}}).call(this,r(1).Buffer)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(245),i=r(246);t.keccak224=n.createHashFunction((function(){return i("keccak224")})),t.keccak256=n.createHashFunction((function(){return i("keccak256")})),t.keccak384=n.createHashFunction((function(){return i("keccak384")})),t.keccak512=n.createHashFunction((function(){return i("keccak512")}))},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.createHashFunction=function(t){return function(r){var n=t();return n.update(r),e.from(n.digest())}}}).call(this,r(1).Buffer)},function(e,t,r){e.exports=r(247)(r(250))},function(e,t,r){const n=r(248),i=r(249);e.exports=function(e){const t=n(e),r=i(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(t){const{Transform:n}=r(18);e.exports=e=>class r extends n{constructor(t,r,n,i,o){super(o),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,r){if(!t.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return t.isBuffer(e)||(e=t.from(e,r)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new r(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){const{Transform:n}=r(18);e.exports=e=>class r extends n{constructor(t,r,n,i){super(i),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,r){if(!t.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return t.isBuffer(e)||(e=t.from(e,r)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new r(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){const n=r(251);function i(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}i.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},i.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0)},i.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&n.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,n.p1600(this.state),this.count=0,this.squeezing=!0},i.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const r=t.alloc(e);for(let t=0;t<e;++t)r[t]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0);return r},i.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},e.exports=i}).call(this,r(1).Buffer)},function(e,t){const r=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];t.p1600=function(e){for(let t=0;t<24;++t){const n=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],u=e[7]^e[17]^e[27]^e[37]^e[47],d=e[8]^e[18]^e[28]^e[38]^e[48],h=e[9]^e[19]^e[29]^e[39]^e[49];let l=d^(o<<1|a>>>31),p=h^(a<<1|o>>>31);const b=e[0]^l,g=e[1]^p,y=e[10]^l,m=e[11]^p,v=e[20]^l,_=e[21]^p,w=e[30]^l,E=e[31]^p,S=e[40]^l,A=e[41]^p;l=n^(s<<1|f>>>31),p=i^(f<<1|s>>>31);const k=e[2]^l,M=e[3]^p,x=e[12]^l,I=e[13]^p,T=e[22]^l,R=e[23]^p,P=e[32]^l,L=e[33]^p,B=e[42]^l,C=e[43]^p;l=o^(c<<1|u>>>31),p=a^(u<<1|c>>>31);const O=e[4]^l,N=e[5]^p,j=e[14]^l,D=e[15]^p,U=e[24]^l,z=e[25]^p,q=e[34]^l,K=e[35]^p,F=e[44]^l,V=e[45]^p;l=s^(d<<1|h>>>31),p=f^(h<<1|d>>>31);const H=e[6]^l,W=e[7]^p,Y=e[16]^l,G=e[17]^p,Z=e[26]^l,J=e[27]^p,X=e[36]^l,$=e[37]^p,Q=e[46]^l,ee=e[47]^p;l=c^(n<<1|i>>>31),p=u^(i<<1|n>>>31);const te=e[8]^l,re=e[9]^p,ne=e[18]^l,ie=e[19]^p,oe=e[28]^l,ae=e[29]^p,se=e[38]^l,fe=e[39]^p,ce=e[48]^l,ue=e[49]^p,de=b,he=g,le=m<<4|y>>>28,pe=y<<4|m>>>28,be=v<<3|_>>>29,ge=_<<3|v>>>29,ye=E<<9|w>>>23,me=w<<9|E>>>23,ve=S<<18|A>>>14,_e=A<<18|S>>>14,we=k<<1|M>>>31,Ee=M<<1|k>>>31,Se=I<<12|x>>>20,Ae=x<<12|I>>>20,ke=T<<10|R>>>22,Me=R<<10|T>>>22,xe=L<<13|P>>>19,Ie=P<<13|L>>>19,Te=B<<2|C>>>30,Re=C<<2|B>>>30,Pe=N<<30|O>>>2,Le=O<<30|N>>>2,Be=j<<6|D>>>26,Ce=D<<6|j>>>26,Oe=z<<11|U>>>21,Ne=U<<11|z>>>21,je=q<<15|K>>>17,De=K<<15|q>>>17,Ue=V<<29|F>>>3,ze=F<<29|V>>>3,qe=H<<28|W>>>4,Ke=W<<28|H>>>4,Fe=G<<23|Y>>>9,Ve=Y<<23|G>>>9,He=Z<<25|J>>>7,We=J<<25|Z>>>7,Ye=X<<21|$>>>11,Ge=$<<21|X>>>11,Ze=ee<<24|Q>>>8,Je=Q<<24|ee>>>8,Xe=te<<27|re>>>5,$e=re<<27|te>>>5,Qe=ne<<20|ie>>>12,et=ie<<20|ne>>>12,tt=ae<<7|oe>>>25,rt=oe<<7|ae>>>25,nt=se<<8|fe>>>24,it=fe<<8|se>>>24,ot=ce<<14|ue>>>18,at=ue<<14|ce>>>18;e[0]=de^~Se&Oe,e[1]=he^~Ae&Ne,e[10]=qe^~Qe&be,e[11]=Ke^~et&ge,e[20]=we^~Be&He,e[21]=Ee^~Ce&We,e[30]=Xe^~le&ke,e[31]=$e^~pe&Me,e[40]=Pe^~Fe&tt,e[41]=Le^~Ve&rt,e[2]=Se^~Oe&Ye,e[3]=Ae^~Ne&Ge,e[12]=Qe^~be&xe,e[13]=et^~ge&Ie,e[22]=Be^~He&nt,e[23]=Ce^~We&it,e[32]=le^~ke&je,e[33]=pe^~Me&De,e[42]=Fe^~tt&ye,e[43]=Ve^~rt&me,e[4]=Oe^~Ye&ot,e[5]=Ne^~Ge&at,e[14]=be^~xe&Ue,e[15]=ge^~Ie&ze,e[24]=He^~nt&ve,e[25]=We^~it&_e,e[34]=ke^~je&Ze,e[35]=Me^~De&Je,e[44]=tt^~ye&Te,e[45]=rt^~me&Re,e[6]=Ye^~ot&de,e[7]=Ge^~at&he,e[16]=xe^~Ue&qe,e[17]=Ie^~ze&Ke,e[26]=nt^~ve&we,e[27]=it^~_e&Ee,e[36]=je^~Ze&Xe,e[37]=De^~Je&$e,e[46]=ye^~Te&Pe,e[47]=me^~Re&Le,e[8]=ot^~de&Se,e[9]=at^~he&Ae,e[18]=Ue^~qe&Qe,e[19]=ze^~Ke&et,e[28]=ve^~we&Be,e[29]=_e^~Ee&Ce,e[38]=Ze^~Xe&le,e[39]=Je^~$e&pe,e[48]=Te^~Pe&Fe,e[49]=Re^~Le&Ve,e[0]^=r[2*t],e[1]^=r[2*t+1]}}},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.hashPersonalMessage=t.isValidSignature=t.fromRpcSig=t.toRpcSig=t.ecrecover=t.ecsign=void 0;var n=r(53),i=r(2),o=r(24),a=r(54);function s(e,t){return t?e-(2*t+35):e-27}function f(e){return 0===e||1===e}t.ecsign=function(e,t,r){var i=n.sign(e,t),o=i.recovery;return{r:i.signature.slice(0,32),s:i.signature.slice(32,64),v:r?o+(2*r+35):o+27}},t.ecrecover=function(t,r,i,a,c){var u=e.concat([o.setLength(i,32),o.setLength(a,32)],64),d=s(r,c);if(!f(d))throw new Error("Invalid signature v value");var h=n.recover(t,u,d);return n.publicKeyConvert(h,!1).slice(1)},t.toRpcSig=function(t,r,n,i){if(!f(s(t,i)))throw new Error("Invalid signature v value");return o.bufferToHex(e.concat([o.setLengthLeft(r,32),o.setLengthLeft(n,32),o.toBuffer(t)]))},t.fromRpcSig=function(e){var t=o.toBuffer(e);if(65!==t.length)throw new Error("Invalid signature length");var r=t[64];return r<27&&(r+=27),{v:r,r:t.slice(0,32),s:t.slice(32,64)}},t.isValidSignature=function(e,t,r,n,o){void 0===n&&(n=!0);var a=new i("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),c=new i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!f(s(e,o)))return!1;var u=new i(t),d=new i(r);return!(u.isZero()||u.gt(c)||d.isZero()||d.gt(c)||n&&1===d.cmp(a))},t.hashPersonalMessage=function(t){var r=e.from("Ethereum Signed Message:\n"+t.length.toString(),"utf-8");return a.keccak(e.concat([r,t]))}}).call(this,r(1).Buffer)},function(e,t,r){(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.defineProperties=void 0;var n=r(41),i=r(17),o=r(27),a=r(24);t.defineProperties=function(t,r,s){if(t.raw=[],t._fields=[],t.toJSON=function(e){if(void 0===e&&(e=!1),e){var r={};return t._fields.forEach((function(e){r[e]="0x"+t[e].toString("hex")})),r}return a.baToJSON(t.raw)},t.serialize=function(){return o.encode(t.raw)},r.forEach((function(r,i){function o(){return t.raw[i]}function s(o){"00"!==(o=a.toBuffer(o)).toString("hex")||r.allowZero||(o=e.allocUnsafe(0)),r.allowLess&&r.length?(o=a.stripZeros(o),n(r.length>=o.length,"The field "+r.name+" must not have more "+r.length+" bytes")):r.allowZero&&0===o.length||!r.length||n(r.length===o.length,"The field "+r.name+" must have byte length of "+r.length),t.raw[i]=o}t._fields.push(r.name),Object.defineProperty(t,r.name,{enumerable:!0,configurable:!0,get:o,set:s}),r.default&&(t[r.name]=r.default),r.alias&&Object.defineProperty(t,r.alias,{enumerable:!1,configurable:!0,set:s,get:o})})),s)if("string"==typeof s&&(s=e.from(i.stripHexPrefix(s),"hex")),e.isBuffer(s)&&(s=o.decode(s)),Array.isArray(s)){if(s.length>t._fields.length)throw new Error("wrong number of fields in data");s.forEach((function(e,r){t[t._fields[r]]=a.toBuffer(e)}))}else{if("object"!=typeof s)throw new Error("invalid data");var f=Object.keys(s);r.forEach((function(e){-1!==f.indexOf(e.name)&&(t[e.name]=s[e.name]),-1!==f.indexOf(e.alias)&&(t[e.alias]=s[e.alias])}))}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){var r;r=function(e){setTimeout(e,0)},void 0!==t&&t&&"function"==typeof t.nextTick&&(r=t.nextTick),e.exports=function(e){var t={capacity:e||1,current:0,queue:[],firstHere:!1,take:function(){if(!1===t.firstHere){t.current++,t.firstHere=!0;var e=1}else e=0;var r={n:1};"function"==typeof arguments[0]?r.task=arguments[0]:r.n=arguments[0],arguments.length>=2&&("function"==typeof arguments[1]?r.task=arguments[1]:r.n=arguments[1]);var n=r.task;if(r.task=function(){n(t.leave)},t.current+r.n-e>t.capacity)return 1===e&&(t.current--,t.firstHere=!1),t.queue.push(r);t.current+=r.n-e,r.task(t.leave),1===e&&(t.firstHere=!1)},leave:function(e){if(e=e||1,t.current-=e,t.queue.length){var n=t.queue[0];n.n+t.current>t.capacity||(t.queue.shift(),t.current+=n.n,r(n.task))}else if(t.current<0)throw new Error("leave called too many times.")},available:function(e){return e=e||1,t.current+e<=t.capacity}};return t}}).call(this,r(4))},function(e,t,r){var n=r(91);e.exports=function(e,t,r){e.sendAsync(n({method:"eth_estimateGas",params:[t]}),(function(e,t){if(e)return"no contract code at given address"===e.message?r(null,"0xcf08"):r(e);r(null,t.result)}))}},function(e,t,r){(function(t){var n=r(9).inherits,i=r(257),o=r(13),a=r(31),s=r(259).blockTagForPayload;function f(e){this.nonceCache={}}e.exports=f,n(f,a),f.prototype.handleRequest=function(e,r,n){var a=this;switch(e.method){case"eth_getTransactionCount":var f=s(e),c=e.params[0].toLowerCase(),u=a.nonceCache[c];return void("pending"===f?u?n(null,u):r((function(e,t,r){if(e)return r();void 0===a.nonceCache[c]&&(a.nonceCache[c]=t),r()})):r());case"eth_sendRawTransaction":return void r((function(r,n,s){if(r)return s();var f=e.params[0],c=(o.stripHexPrefix(f),t.from(o.stripHexPrefix(f),"hex"),new i(t.from(o.stripHexPrefix(f),"hex"))),u="0x"+c.getSenderAddress().toString("hex").toLowerCase(),d=o.bufferToInt(c.nonce),h=(++d).toString(16);h.length%2&&(h="0"+h),h="0x"+h,a.nonceCache[u]=h,s()}));case"evm_revert":return a.nonceCache={},void r();default:return void r()}}}).call(this,r(1).Buffer)},function(e,t,r){(function(t){var n=r(13),i=r(258),o=n.BN,a=new o("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=function(){function e(r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=r||{};var i=[{name:"nonce",length:32,allowLess:!0,default:new t([])},{name:"gasPrice",length:32,allowLess:!0,default:new t([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new t([])},{name:"to",allowZero:!0,length:20,default:new t([])},{name:"value",length:32,allowLess:!0,default:new t([])},{name:"data",alias:"input",allowZero:!0,default:new t([])},{name:"v",allowZero:!0,default:new t([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new t([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new t([])}];n.defineProperties(this,i,r),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var o=n.bufferToInt(this.v),a=Math.floor((o-35)/2);a<0&&(a=0),this._chainId=a||r.chainId||0,this._homestead=!0}return e.prototype.toCreationAddress=function(){return""===this.to.toString("hex")},e.prototype.hash=function(e){void 0===e&&(e=!0);var t=void 0;if(e)t=this.raw;else if(this._chainId>0){var r=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,t=this.raw,this.raw=r}else t=this.raw.slice(0,6);return n.rlphash(t)},e.prototype.getChainId=function(){return this._chainId},e.prototype.getSenderAddress=function(){if(this._from)return this._from;var e=this.getSenderPublicKey();return this._from=n.publicToAddress(e),this._from},e.prototype.getSenderPublicKey=function(){if(!(this._senderPubKey&&this._senderPubKey.length||this.verifySignature()))throw new Error("Invalid Signature");return this._senderPubKey},e.prototype.verifySignature=function(){var e=this.hash(!1);if(this._homestead&&1===new o(this.s).cmp(a))return!1;try{var t=n.bufferToInt(this.v);this._chainId>0&&(t-=2*this._chainId+8),this._senderPubKey=n.ecrecover(e,t,this.r,this.s)}catch(e){return!1}return!!this._senderPubKey},e.prototype.sign=function(e){var t=this.hash(!1),r=n.ecsign(t,e);this._chainId>0&&(r.v+=2*this._chainId+8),Object.assign(this,r)},e.prototype.getDataFee=function(){for(var e=this.raw[5],t=new o(0),r=0;r<e.length;r++)0===e[r]?t.iaddn(i.txDataZeroGas.v):t.iaddn(i.txDataNonZeroGas.v);return t},e.prototype.getBaseFee=function(){var e=this.getDataFee().iaddn(i.txGas.v);return this._homestead&&this.toCreationAddress()&&e.iaddn(i.txCreation.v),e},e.prototype.getUpfrontCost=function(){return new o(this.gasLimit).imul(new o(this.gasPrice)).iadd(new o(this.value))},e.prototype.validate=function(e){var t=[];return this.verifySignature()||t.push("Invalid Signature"),this.getBaseFee().cmp(new o(this.gasLimit))>0&&t.push(["gas limit is too low. Need at least "+this.getBaseFee()]),void 0===e||!1===e?0===t.length:t.join(" ")},e}();e.exports=s}).call(this,r(1).Buffer)},function(e){e.exports={genesisGasLimit:{v:5e3,d:"Gas limit of the Genesis block."},genesisDifficulty:{v:17179869184,d:"Difficulty of the Genesis block."},genesisNonce:{v:"0x0000000000000042",d:"the geneis nonce"},genesisExtraData:{v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},genesisHash:{v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},genesisStateRoot:{v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be."},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations."},minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be."},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},maximumExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis."},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs."},stackLimit:{v:1024,d:"Maximum size of VM stack allowed."},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack."},tierStepGas:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},expGas:{v:10,d:"Once per EXP instuction."},expByteGas:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},sha3Gas:{v:30,d:"Once per SHA3 operation."},sha3WordGas:{v:6,d:"Once per word of the SHA3 operation's data."},sloadGas:{v:50,d:"Once per SLOAD operation."},sstoreSetGas:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},sstoreResetGas:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},sstoreRefundGas:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},jumpdestGas:{v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},logGas:{v:375,d:"Per LOG* operation."},logDataGas:{v:8,d:"Per byte in a LOG* operation's data."},logTopicGas:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},createGas:{v:32e3,d:"Once per CREATE operation & contract-creation transaction."},callGas:{v:40,d:"Once per CALL operation & message call transaction."},callStipend:{v:2300,d:"Free gas given at beginning of call."},callValueTransferGas:{v:9e3,d:"Paid for CALL when the value transfor is non-zero."},callNewAccountGas:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},suicideRefundGas:{v:24e3,d:"Refunded following a suicide operation."},memoryGas:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation."},createDataGas:{v:200,d:""},txGas:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},txCreation:{v:32e3,d:"the cost of creating a contract via tx"},txDataZeroGas:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},txDataNonZeroGas:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},copyGas:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},ecrecoverGas:{v:3e3,d:""},sha256Gas:{v:60,d:""},sha256WordGas:{v:12,d:""},ripemd160Gas:{v:600,d:""},ripemd160WordGas:{v:120,d:""},identityGas:{v:15,d:""},identityWordGas:{v:3,d:""},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},ommerReward:{v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},niblingReward:{v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},homeSteadForkNumber:{v:115e4,d:"the block that the Homestead fork started at"},homesteadRepriceForkNumber:{v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},freeBlockPeriod:{v:2}}},function(e,t,r){var n=r(46);function i(e){return"never"!==s(e)}function o(e){var t=a(e);return t>=e.params.length?e.params:"eth_getBlockByNumber"===e.method?e.params.slice(1):e.params.slice(0,t)}function a(e){switch(e.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":return 1;case"eth_getBlockByNumber":return 0;default:return}}function s(e){switch(e.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":return"fork";case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"eth_blockNumber":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":return"never"}}e.exports={cacheIdentifierForPayload:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!i(e))return null;var r=t.includeBlockRef?e.params:o(e);return e.method+":"+n(r)},canCache:i,blockTagForPayload:function(e){var t=a(e);return t>=e.params.length?null:e.params[t]},paramsWithoutBlockTag:o,blockTagParamIndex:a,cacheTypeForPayload:s}},function(e,t,r){function n(e){return(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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=r(47),c=r(261),u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(n,e);var t,r=(t=n,function(){var e,r=s(t);if(a()){var n=s(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return o(this,e)});function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r.call(this,(function(e){var t=e.blockTracker,r=e.provider,n=e.engine,i=c({blockTracker:t,provider:r}),o=i.events,a=i.middleware;return o.on("notification",(function(e){return n.emit("data",null,e)})),a}))}return n}(f);e.exports=u},function(e,t,r){const n=r(48).default,i=r(97),{createAsyncMiddleware:o}=r(93),a=r(92),{unsafeRandomBytes:s,incrementHexInt:f}=r(23),c=r(52);function u(e){return{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}e.exports=function({blockTracker:e,provider:t}){const r={},d=a({blockTracker:e,provider:t});let h=!1;const l=new n,p=i({eth_subscribe:o((async function(n,i){if(h)throw new Error("SubscriptionManager - attempting to use after destroying");const o=n.params[0],a=s(16);let l;switch(o){case"newHeads":l=function({subId:r}){const n={type:o,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const i=n,o=f(e);(await c({provider:t,fromBlock:o,toBlock:i})).map(u).forEach((e=>{b(r,e)}))}};return e.on("sync",n.update),n}({subId:a});break;case"logs":const r=n.params[1];l=function({subId:e,filter:t}){return t.on("update",(t=>b(e,t))),{type:o,destroy:async()=>await d.uninstallFilter(t.idHex)}}({subId:a,filter:await d.newLogFilter(r)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${o}"`)}return r[a]=l,void(i.result=a)})),eth_unsubscribe:o((async function(e,t){if(h)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],i=r[n];i?(delete r[n],await i.destroy(),t.result=!0):t.result=!1}))});return p.destroy=function(){l.removeAllListeners();for(const e in r)r[e].destroy(),delete r[e];h=!0},{events:l,middleware:p};function b(e,t){l.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}}},function(e,t,r){function n(e,t){var r="string"==typeof e?Object.assign({},i[e]):e;if("object"!=typeof r)throw new Error("[Portis] illegal 'network' parameter. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(!r.nodeUrl)throw new Error("[Portis] 'nodeUrl' is required. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(t&&!r.gasRelayHubAddress)throw new Error("[Portis] can't find default gas relay hub for "+e);return"string"!=typeof e||t||delete r.gasRelayHubAddress,r}r.r(t);var i={mainnet:{nodeUrl:"https://mainnet.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"1",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},ropsten:{nodeUrl:"https://ropsten.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"3",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},rinkeby:{nodeUrl:"https://rinkeby.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"4",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},goerli:{nodeUrl:"https://goerli.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"5"},ubiq:{nodeUrl:"https://rpc1.ubiqscan.io",chainId:"8"},thundercoreTestnet:{nodeUrl:"https://testnet-rpc.thundercore.com:8544",chainId:"18"},orchid:{nodeUrl:"https://public-node.rsk.co",chainId:"30"},orchidTestnet:{nodeUrl:"https://public-node.testnet.rsk.co",chainId:"31"},kovan:{nodeUrl:"https://kovan.infura.io/v3/faa4639b090f46499f29d894da0551a0",chainId:"42",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},classic:{nodeUrl:"https://ethereumclassic.network",chainId:"61"},sokol:{nodeUrl:"https://sokol.poa.network",chainId:"77"},core:{nodeUrl:"https://core.poa.network",chainId:"99"},xdai:{nodeUrl:"https://dai.poa.network",chainId:"100",gasRelayHubAddress:"0xD216153c06E857cD7f72665E0aF1d7D82172F494"},thundercore:{nodeUrl:"https://mainnet-rpc.thundercore.com",chainId:"108"},fuse:{nodeUrl:"https://rpc.fusenet.io",chainId:"122"},lightstreams:{nodeUrl:"https://node.mainnet.lightstreams.io",chainId:"163"},matic:{nodeUrl:"https://polygon-rpc.com",chainId:"137"},maticMumbai:{nodeUrl:"https://rpc-mumbai.matic.today",chainId:"80001"},maticAlpha:{nodeUrl:"https://alpha.ethereum.matic.network",chainId:"4626"},maticTestnet:{nodeUrl:"https://testnet2.matic.network",chainId:"8995"}},o=function(){return!("undefined"==typeof window||!window.document)},a=!1;function s(){return new Promise((function(e,t){o()?a?e():["loaded","interactive","complete"].indexOf(document.readyState)>-1?(a=!0,e()):window.addEventListener("load",(function(){a=!0,e()}),!1):t()}))}function f(){var e="localhost"===location.hostname||"127.0.0.1"===location.hostname,t="https:"===location.protocol;if(!e&&!t)throw"[Portis] Access to the WebCrypto API is restricted to secure origins.\nIf this is a development environment please use http://localhost:"+location.port+" instead.\nOtherwise, please use an SSL certificate."}var c=r(99),u=r.n(c),d=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},h=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},l=function(){function e(t,r){this._widgetConfig=t,this._clearProviderSession=r,this._widgetUrl="https://widget.portis.io",this._onLoginCallback=function(){},this._onLogoutCallback=function(){},this._onErrorCallback=function(){},f(),t.staging?(console.warn("Please note: you are using the Portis STAGING environment."),this._widgetUrl="https://widget-staging.portis.io"):t.feature&&(console.warn("Please note: you are using the Portis FEATURE environment."),this._widgetUrl="https://widget-feature.portis.io"),e._checkIfWidgetAlreadyInitialized()}return e.prototype.getWidget=function(){return d(this,void 0,void 0,(function(){var e;return h(this,(function(t){switch(t.label){case 0:return this.widgetInstance?[3,2]:(this.widgetPromise||(this.widgetPromise=this._initWidget()),e=this,[4,this.widgetPromise]);case 1:e.widgetInstance=t.sent(),t.label=2;case 2:return[2,this.widgetInstance]}}))}))},e.prototype.setDefaultEmail=function(e){this._widgetConfig.defaultEmail=e},e.prototype.setOnLoginCallback=function(e){this._onLoginCallback=e},e.prototype.setOnLogoutCallback=function(e){this._onLogoutCallback=e},e.prototype.setOnActiveWalletChangedCallback=function(e){this._onActiveWalletChangedCallback=e},e.prototype.setOnErrorCallback=function(e){this._onErrorCallback=e},e.prototype.showPortis=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.showPortis(this._widgetConfig)]}}))}))},e.prototype.getCampaignInfo=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.getCampaignInfo(e)]}}))}))},e.prototype.claimVoucher=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.claimVoucher(e,this._widgetConfig)]}}))}))},e.prototype.logout=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.logout()]}}))}))},e.prototype.getExtendedPublicKey=function(e,t){return void 0===e&&(e="m/44'/60'/0'/0/0"),void 0===t&&(t="Ethereum"),d(this,void 0,void 0,(function(){return h(this,(function(r){switch(r.label){case 0:return[4,this.getWidget()];case 1:return[2,r.sent().communication.getExtendedPublicKey(e,t,this._widgetConfig)]}}))}))},e.prototype.importWallet=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.importWallet(e,this._widgetConfig)]}}))}))},e.prototype.isLoggedIn=function(){return d(this,void 0,void 0,(function(){return h(this,(function(e){switch(e.label){case 0:return[4,this.getWidget()];case 1:return[2,e.sent().communication.isLoggedIn()]}}))}))},e.prototype.signBitcoinTransaction=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.signBitcoinTransaction(e,this._widgetConfig)]}}))}))},e.prototype.showBitcoinWallet=function(e){return void 0===e&&(e="m/49'/0'/0'/0/0"),d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.showBitcoinWallet(e,this._widgetConfig)]}}))}))},e.prototype.purchaseERC20=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return[2,t.sent().communication.purchaseERC20(e,this._widgetConfig)]}}))}))},e._checkIfWidgetAlreadyInitialized=function(){document.getElementsByClassName("por_portis-container").length&&console.warn("An instance of Portis was already initialized. This is probably a mistake. Make sure that you use the same Portis instance throughout your app.")},e.prototype._initWidget=function(){return d(this,void 0,void 0,(function(){var t,r,n,i,o;return h(this,(function(a){switch(a.label){case 0:return[4,s()];case 1:return a.sent(),(t=document.createElement("style")).innerHTML="\n.por_portis-container {\n position: fixed;\n width: 0px;\n height: 0px;\n top: 0px;\n right: 0px;\n z-index: 2147483647;\n}\n\n@media (max-width: 576px) {\n .por_portis-container {\n bottom: 0;\n top: auto;\n }\n}\n\n.por_portis-widget-frame {\n position: fixed;\n width: 375px;\n height: 0;\n top: 20px;\n right: 20px;\n box-shadow: 0 5px 40px rgba(0,0,0,.16);\n border-radius: 8px;\n overflow: hidden;\n z-index: 2147483000;\n}\n\n@media (max-width: 576px) {\n .por_portis-widget-frame {\n bottom: 0;\n top: auto;\n width: 100%;\n right: 0;\n left: 0;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n}\n",(r=document.createElement("div")).className="por_portis-container",(n=document.createElement("div")).id="portis-container-"+Date.now(),n.className="por_portis-widget-frame",r.appendChild(n),document.body.appendChild(r),document.head.appendChild(t),[4,(i=u.a.connectToChild({url:this._widgetUrl,appendTo:document.getElementById(n.id),methods:{setHeight:this._setHeight.bind(this),getWindowSize:e._getWindowSize.bind(this),onLogin:this._onLogin.bind(this),onLogout:this._onLogout.bind(this),onActiveWalletChanged:this._onActiveWalletChanged.bind(this),hasOnActiveWalletChanged:this.hasOnActiveWalletChanged.bind(this),onError:this._onError.bind(this)}})).promise];case 2:return(o=a.sent()).setSdkConfig(this._widgetConfig),i.iframe.style.position="absolute",i.iframe.style.height="100%",i.iframe.style.width="100%",i.iframe.style.border="0 transparent",[2,{communication:o,widgetFrame:n}]}}))}))},e.prototype._setHeight=function(e){return d(this,void 0,void 0,(function(){return h(this,(function(t){switch(t.label){case 0:return[4,this.getWidget()];case 1:return t.sent().widgetFrame.style.height=e+"px",[2]}}))}))},e._getWindowSize=function(){var e=document.getElementsByTagName("body")[0];return{width:window.innerWidth||document.documentElement.clientWidth||e.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||e.clientHeight}},e.prototype._onLogin=function(e,t,r){this._onLoginCallback&&this._onLoginCallback(e,t,r)},e.prototype._onLogout=function(){this._clearProviderSession(),this._onLogoutCallback&&this._onLogoutCallback()},e.prototype._onActiveWalletChanged=function(e){this._onActiveWalletChangedCallback&&this._onActiveWalletChangedCallback(e)},e.prototype.hasOnActiveWalletChanged=function(){return!!this._onActiveWalletChangedCallback},e.prototype._onError=function(e){this._onErrorCallback&&this._onErrorCallback(e)},e}(),p=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},b=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},g=r(13),y=g.addHexPrefix,m=g.stripHexPrefix,v=g.BN;function _(e,t){return p(this,void 0,void 0,(function(){var r,n,i,o,a;return b(this,(function(s){switch(s.label){case 0:return[4,e.getBlockByNumber("latest",!1)];case 1:return r=s.sent(),[4,w(e,t,r.gasLimit)];case 2:if(n=s.sent(),i=n.safeGas,o=n.simpleSend,a=n.gasLimitSpecified,o||a)return[2,i];s.label=3;case 3:return s.trys.push([3,5,,6]),[4,E(e,t,r.gasLimit,i)];case 4:return[2,s.sent()];case 5:return s.sent(),[2,i];case 6:return[2]}}))}))}function w(e,t,r){return p(this,void 0,void 0,(function(){var n,i;return b(this,(function(o){switch(o.label){case 0:return Boolean(t.gas)?[2,{safeGas:t.gas,simpleSend:!1,gasLimitSpecified:!0}]:(n=t.to,Boolean(n)?[4,e.getCode(n)]:[3,2]);case 1:if(!(i=o.sent())||"0x"===i||"0x0"===i){if(t.data)throw new Error("Trying to call a function on a non-contract address");return[2,{safeGas:"0x5208",simpleSend:!0,gasLimitSpecified:!1}]}o.label=2;case 2:return a=A(r),s=20,f=new v(19),c=new v(s),[2,{safeGas:k(a.mul(f).div(c)),simpleSend:!1,gasLimitSpecified:!1}]}var a,s,f,c}))}))}function E(e,t,r,n){return p(this,void 0,void 0,(function(){var i;return b(this,(function(o){switch(o.label){case 0:return t.gas=n,i=y,[4,e.estimateGas(t)];case 1:return[2,S(i.apply(void 0,[o.sent()]),r)]}}))}))}function S(e,t){var r=A(e),n=A(t).muln(.9),i=r.muln(1.5);return r.gt(n)?k(r):i.lt(n)?k(i):k(n)}function A(e){return new v(m(e),16)}function k(e){return y(e.toString(16))}var M=function(){function e(e){this.provider=e}return e.prototype.getBlockByNumber=function(e,t){return this.sendAsync("eth_getBlockByNumber",e,t)},e.prototype.getCode=function(e,t){return void 0===t&&(t="latest"),this.sendAsync("eth_getCode",e,t)},e.prototype.estimateGas=function(e){return this.sendAsync("eth_estimateGas",e)},e.prototype.sendAsync=function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return new Promise((function(n,i){t.provider.sendAsync({id:42,jsonrpc:"2.0",method:e,params:r},(function(e,t){e?i(e):n(t.result)}))}))},e}(),x=function(){return(x=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},I=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},T=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},R=r(100),P=r(207),L=r(212),B=r(213),C=r(227),O=r(256),N=r(260),j=function(){function e(e,t){this.config=e,this._getWidgetCommunication=t,this.provider=this._initProvider()}return e.prototype.setSelectedAddress=function(e){this._selectedAddress=e},e.prototype.changeNetwork=function(e,t){var r=n(e,t);this.clearSubprovider(O),this.clearSubprovider(P),this.config.network=r},e.prototype._initProvider=function(){var e=this;if(this.engine)return this.engine;this.engine=new R;var t=new M(this.engine);return this.engine.send=function(t,r){if("string"==typeof t)return new Promise((function(n,i){e.engine.sendAsync({jsonrpc:"2.0",id:42,method:t,params:r||[]},(function(e,t){e?i(e):n(t.result)}))}));if(!r){var n=null;switch(t.method){case"eth_accounts":case"eth_coinbase":n=e._selectedAddress?[e._selectedAddress]:[];break;case"net_version":n=e._network;break;case"eth_uninstallFilter":e.engine.sendAsync(t,(function(e){return e})),n=!0;break;default:var i="The Portis Web3 object does not support synchronous methods like "+t.method+" without a callback parameter.";throw new Error(i)}return{id:t.id,jsonrpc:t.jsonrpc,result:n}}e.engine.sendAsync(t,r)},this.engine.addProvider(new L({web3_clientVersion:"Portis/v"+this.config.version+"/javascript",net_listening:!0,eth_hashrate:"0x00",eth_mining:!1,eth_syncing:!0})),this.engine.addProvider(new P),this.engine.addProvider(new N),this.engine.addProvider(new B),this.engine.addProvider(new O),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,r){return I(e,void 0,void 0,(function(){return T(this,(function(e){return t.id||(t.id=42),r(),[2]}))}))}}),this.engine.addProvider(new C({getAccounts:function(t){return I(e,void 0,void 0,(function(){var e,r,n;return T(this,(function(i){switch(i.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,i.sent().getAccounts(this.config)];case 2:return e=i.sent(),r=e.error,n=e.result,!r&&n&&(this._selectedAddress=n[0]),t(r,n),[2]}}))}))},signTransaction:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i;return T(this,(function(o){switch(o.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,o.sent().signTransaction(t,this.config)];case 2:return e=o.sent(),n=e.error,i=e.result,r(n,i),[2]}}))}))},signMessage:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signMessage"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},signPersonalMessage:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signPersonalMessage"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},signTypedMessage:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signTypedMessage"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},signTypedMessageV3:function(t,r){return I(e,void 0,void 0,(function(){var e,n,i,o,a;return T(this,(function(s){switch(s.label){case 0:return[4,this._getWidgetCommunication()];case 1:return e=s.sent(),n=x({},t,{messageStandard:"signTypedMessageV3"}),[4,e.signMessage(n,this.config)];case 2:return i=s.sent(),o=i.error,a=i.result,r(o,a),[2]}}))}))},estimateGas:function(r,n){return I(e,void 0,void 0,(function(){var e;return T(this,(function(i){switch(i.label){case 0:return[4,_(t,r)];case 1:return e=i.sent(),n(null,e),[2]}}))}))},getGasPrice:function(t){return I(e,void 0,void 0,(function(){return T(this,(function(e){return t(null,""),[2]}))}))}})),this.engine.addProvider({setEngine:function(e){return e},handleRequest:function(t,r,n){return I(e,void 0,void 0,(function(){var e,r,i;return T(this,(function(o){switch(o.label){case 0:return[4,this._getWidgetCommunication()];case 1:return[4,o.sent().relay(t,this.config)];case 2:return e=o.sent(),r=e.error,i=e.result,"net_version"===t.method&&(this._network=i,this.engine.networkVersion=this._network),n(r,i),[2]}}))}))}}),this.engine.enable=function(){return new Promise((function(t,r){e.engine.sendAsync({method:"eth_accounts"},(function(e,n){e?r(e):t(n.result)}))}))},this.engine.isConnected=function(){return!0},this.engine.isPortis=!0,this.engine.on("error",(function(e){e&&e.message&&e.message.includes("PollingBlockTracker")?console.warn("If you see this warning constantly, there might be an error with your RPC node."):console.error(e)})),this.engine.start(),this.engine},e.prototype.clearSubprovider=function(e){var t=this.provider._providers.find((function(t){return t instanceof e}));this.provider.removeProvider(t),this.provider.addProvider(new e)},e}(),D=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}f((n=n.apply(e,t||[])).next())}))},U=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},z=["email","reputation"];s().then((function(){document.getElementsByClassName("por_portis-widget-frame").length&&console.warn("Portis script was already loaded. This might cause unexpected behavior. If loading with a <script> tag, please make sure that you only load it once.")})).catch((function(){}));var q=function(){function e(e,t,r){if(void 0===r&&(r={}),!o())return new Proxy(this,{get:function(e,t){return e[t]instanceof Function?function(){}:void 0}});f(),this._validateParams(e,t,r),this._config={dappId:e,network:n(t,r.gasRelay),version:"4.0.7",scope:r.scope,registerPageByDefault:r.registerPageByDefault,staging:r.staging,feature:r.feature},this._getWidgetCommunication=this._getWidgetCommunication.bind(this),this._widgetManagerInstance=new l(this.config,this._clearProviderSession),this._web3ManagerInstance=new j(this.config,this._getWidgetCommunication),this.setDefaultEmail=this.setDefaultEmail.bind(this),this.changeNetwork=this.changeNetwork.bind(this),this.getWidget=this.getWidget.bind(this),this.onLogin=this.onLogin.bind(this),this.onLogout=this.onLogout.bind(this),this.onActiveWalletChanged=this.onActiveWalletChanged.bind(this),this.onError=this.onError.bind(this),this.showPortis=this.showPortis.bind(this),this.getCampaignInfo=this.getCampaignInfo.bind(this),this.claimVoucher=this.claimVoucher.bind(this),this.getExtendedPublicKey=this.getExtendedPublicKey.bind(this),this.importWallet=this.importWallet.bind(this),this.isLoggedIn=this.isLoggedIn.bind(this),this.signBitcoinTransaction=this.signBitcoinTransaction.bind(this),this.showBitcoinWallet=this.showBitcoinWallet.bind(this)}return Object.defineProperty(e.prototype,"_widgetManager",{get:function(){return this._widgetManagerInstance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_web3Manager",{get:function(){return this._web3ManagerInstance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),e.prototype._clearProviderSession=function(){this._web3Manager.setSelectedAddress("")},e.prototype._getWidgetCommunication=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){switch(e.label){case 0:return[4,this._widgetManager.getWidget()];case 1:return[2,e.sent().communication]}}))}))},Object.defineProperty(e.prototype,"web3Provider",{get:function(){return this._web3Manager.provider},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"provider",{get:function(){return this.web3Provider},enumerable:!0,configurable:!0}),e.prototype.changeNetwork=function(e,t){this._web3Manager.changeNetwork(e,t)},e.prototype.setDefaultEmail=function(e){this._widgetManager.setDefaultEmail(e)},e.prototype.getWidget=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.getWidget()]}))}))},e.prototype.onLogin=function(e){this._widgetManager.setOnLoginCallback(e)},e.prototype.onLogout=function(e){this._widgetManager.setOnLogoutCallback(e)},e.prototype.onActiveWalletChanged=function(e){this._widgetManager.setOnActiveWalletChangedCallback(e)},e.prototype.onError=function(e){this._widgetManager.setOnErrorCallback(e)},e.prototype.showPortis=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.showPortis()]}))}))},e.prototype.getCampaignInfo=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.getCampaignInfo(e)]}))}))},e.prototype.claimVoucher=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.claimVoucher(e)]}))}))},e.prototype.logout=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.logout()]}))}))},e.prototype.getExtendedPublicKey=function(e,t){return void 0===e&&(e="m/44'/60'/0'/0/0"),void 0===t&&(t="Ethereum"),D(this,void 0,void 0,(function(){return U(this,(function(r){return[2,this._widgetManager.getExtendedPublicKey(e,t)]}))}))},e.prototype.importWallet=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.importWallet(e)]}))}))},e.prototype.isLoggedIn=function(){return D(this,void 0,void 0,(function(){return U(this,(function(e){return[2,this._widgetManager.isLoggedIn()]}))}))},e.prototype.signBitcoinTransaction=function(e){return D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.signBitcoinTransaction(e)]}))}))},e.prototype.showBitcoinWallet=function(e){return void 0===e&&(e="m/49'/0'/0'/0/0"),D(this,void 0,void 0,(function(){return U(this,(function(t){return[2,this._widgetManager.showBitcoinWallet(e)]}))}))},e.prototype._validateParams=function(e,t,r){if(!e)throw new Error("[Portis] 'dappId' is required. Get your dappId here: https://dashboard.portis.io");if(!t)throw new Error("[Portis] 'network' is required. Read more about it here: https://docs.portis.io/#/configuration?id=network");if(r.scope){if(!Array.isArray(r.scope))throw new Error("[Portis] 'scope' must be an array. Read more about it here: https://docs.portis.io/#/configuration?id=scope");if(r.scope.filter((function(e){return z.indexOf(e)<0})).length>0)throw new Error("[Portis] invalid 'scope' parameter. Read more about it here: https://docs.portis.io/#/configuration?id=scope")}if(void 0!==r.registerPageByDefault&&"boolean"!=typeof r.registerPageByDefault)throw new Error("[Portis] invalid 'registerPageByDefault' parameter, must be a boolean. Read more about it here: https://docs.portis.io/#/configuration?id=registerPageByDefault")},e}();t.default=q},function(e,t,r){function n(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{f(n.next(e))}catch(e){o(e)}}function s(e){try{f(n.throw(e))}catch(e){o(e)}}function f(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}f((n=n.apply(e,t||[])).next())}))}function i(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}r.r(t);var o=function(){function e(e){if(this._maxConcurrency=e,this._queue=[],e<=0)throw new Error("semaphore must be initialized to a positive value");this._value=e}return e.prototype.acquire=function(){var e=this,t=this.isLocked(),r=new Promise((function(t){return e._queue.push(t)}));return t||this._dispatch(),r},e.prototype.runExclusive=function(e){return n(this,void 0,void 0,(function(){var t,r,n;return i(this,(function(i){switch(i.label){case 0:return[4,this.acquire()];case 1:t=i.sent(),r=t[0],n=t[1],i.label=2;case 2:return i.trys.push([2,,4,5]),[4,e(r)];case 3:return[2,i.sent()];case 4:return n(),[7];case 5:return[2]}}))}))},e.prototype.isLocked=function(){return this._value<=0},e.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=void 0,e()}},e.prototype._dispatch=function(){var e=this,t=this._queue.shift();if(t){var r=!1;this._currentReleaser=function(){r||(r=!0,e._value++,e._dispatch())},t([this._value--,this._currentReleaser])}},e}(),a=function(){function e(){this._semaphore=new o(1)}return e.prototype.acquire=function(){return n(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this._semaphore.acquire()];case 1:return[2,e.sent()[1]]}}))}))},e.prototype.runExclusive=function(e){return this._semaphore.runExclusive((function(){return e()}))},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();function s(e,t,r){var o=this;return void 0===r&&(r=new Error("timeout")),{acquire:function(){return new Promise((function(a,s){return n(o,void 0,void 0,(function(){var n,o;return i(this,(function(i){switch(i.label){case 0:return n=!1,setTimeout((function(){n=!0,s(r)}),t),[4,e.acquire()];case 1:return o=i.sent(),n?(Array.isArray(o)?o[1]:o)():a(o),[2]}}))}))}))},runExclusive:function(e){return n(this,void 0,void 0,(function(){var t,r;return i(this,(function(n){switch(n.label){case 0:t=function(){},n.label=1;case 1:return n.trys.push([1,,7,8]),[4,this.acquire()];case 2:return r=n.sent(),Array.isArray(r)?(t=r[1],[4,e(r[0])]):[3,4];case 3:return[2,n.sent()];case 4:return t=r,[4,e()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:return t(),[7];case 8:return[2]}}))}))},release:function(){e.release()},isLocked:function(){return e.isLocked()}}}r.d(t,"Mutex",(function(){return a})),r.d(t,"Semaphore",(function(){return o})),r.d(t,"withTimeout",(function(){return s}))}]).default;var n=e.getDefaultExportFromCjs(r.exports);exports.default=async function({chainId:t,portisParams:r},i){if(!r?.id)throw new Error("uAuthParams is not valid.");let o="";switch(t){case 1:default:o="mainnet";break;case 5:o="goerli"}const a=new n(r.id,o,r.config);return await a.provider.enable(),a.provider._portis=a,a.provider.on("connect",i.connect),a.provider.on("disconnect",i.disconnect),a.provider.on("accountsChanged",i.accountsChanged),a.provider.on("chainChanged",i.chainChanged),a.provider.on("message",i.message),e.convertWeb3Provider(a.provider)};
|