diff --git a/packages/dai-plugin-governance/src/GovPollingService.js b/packages/dai-plugin-governance/src/GovPollingService.js index 170b314d0..82f4b2c7b 100644 --- a/packages/dai-plugin-governance/src/GovPollingService.js +++ b/packages/dai-plugin-governance/src/GovPollingService.js @@ -2,6 +2,7 @@ import { PrivateService } from '@makerdao/services-core'; import { POLLING } from './utils/constants'; import { MKR } from './utils/constants'; import BigNumber from 'bignumber.js'; +import { fromBuffer } from './utils/helpers'; const POSTGRES_MAX_INT = 2147483647; @@ -29,6 +30,15 @@ export default class GovPollingService extends PrivateService { return this._pollingContract().vote(pollId, optionId); } + voteRankedChoice(pollId, rankings) { + const byteArray = new Uint8Array(32); + rankings.forEach((optionIndex, i) => { + byteArray[byteArray.length - i - 1] = optionIndex + 1; + }); + const optionId = fromBuffer(byteArray).toString(); + return this._pollingContract().vote(pollId, optionId); + } + _pollingContract() { return this.get('smartContract').getContractByName(POLLING); } @@ -71,6 +81,13 @@ export default class GovPollingService extends PrivateService { ); } + async getOptionVotingForRankedChoice(address, pollId) { + return this.get('govQueryApi').getOptionVotingForRankedChoice( + address.toLowerCase(), + pollId + ); + } + async getNumUniqueVoters(pollId) { return this.get('govQueryApi').getNumUniqueVoters(pollId); } @@ -105,7 +122,12 @@ export default class GovPollingService extends PrivateService { BigNumber(0) ); - const tally = { rounds: 1, winner: null, options: {} }; + const tally = { + rounds: 1, + winner: null, + totalMkrParticipation, + options: {} + }; const defaultOptionObj = { firstChoice: BigNumber(0), transfer: BigNumber(0), diff --git a/packages/dai-plugin-governance/src/GovQueryApiService.js b/packages/dai-plugin-governance/src/GovQueryApiService.js index d0ff4253f..a7b878cd2 100644 --- a/packages/dai-plugin-governance/src/GovQueryApiService.js +++ b/packages/dai-plugin-governance/src/GovQueryApiService.js @@ -110,6 +110,19 @@ export default class QueryApi extends PublicService { return response.currentVote.nodes[0].optionId; } + async getOptionVotingForRankedChoice(address, pollId) { + const query = `{ + currentVoteRankedChoice(argAddress: "${address}", argPollId: ${pollId}){ + nodes{ + optionIdRaw + } + } + }`; + const response = await this.getQueryResponse(this.serverUrl, query); + if (!response.currentVote.nodes[0]) return null; + return response.currentVote.nodes[0].optionId; + } + async getBlockNumber(unixTime) { const query = `{ timeToBlockNumber(argUnix: ${unixTime}){ @@ -130,14 +143,16 @@ export default class QueryApi extends PublicService { }`; const response = await this.getQueryResponseMemoized(this.serverUrl, query); - return response.voteMkrWeightsAtTimeRankedChoice.nodes.map(vote => { - const ballotBuffer = toBuffer(vote.optionIdRaw, { endian: 'little' }); - const ballot = paddedArray(32 - ballotBuffer.length, ballotBuffer); - return { - ...vote, - ballot - }; - }); + return response.voteMkrWeightsAtTimeRankedChoice.nodes + .filter(vote => vote.optionIdRaw !== '0') + .map(vote => { + const ballotBuffer = toBuffer(vote.optionIdRaw, { endian: 'little' }); + const ballot = paddedArray(32 - ballotBuffer.length, ballotBuffer); + return { + ...vote, + ballot + }; + }); } async getMkrSupport(pollId, unixTime) { diff --git a/packages/dai-plugin-governance/umd/index.js b/packages/dai-plugin-governance/umd/index.js new file mode 100644 index 000000000..21b13ac4b --- /dev/null +++ b/packages/dai-plugin-governance/umd/index.js @@ -0,0 +1,3 @@ +/*! For license information please see index.js.LICENSE.txt */ +!function webpackUniversalModuleDefinition(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["@makerdao/dai-plugin-governance"]=r():t["@makerdao/dai-plugin-governance"]=r()}(window,(function(){return function(t){var r={};function __webpack_require__(i){if(r[i])return r[i].exports;var a=r[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,__webpack_require__),a.l=!0,a.exports}return __webpack_require__.m=t,__webpack_require__.c=r,__webpack_require__.d=function(t,r,i){__webpack_require__.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:i})},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.t=function(t,r){if(1&r&&(t=__webpack_require__(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(__webpack_require__.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var a in t)__webpack_require__.d(i,a,function(r){return t[r]}.bind(null,a));return i},__webpack_require__.n=function(t){var r=t&&t.__esModule?function getDefault(){return t.default}:function getModuleExports(){return t};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=80)}([function(t,r){var i=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=i)},function(t,r){t.exports=function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}},function(t,r,i){var a=i(39)("wks"),u=i(29),c=i(7).Symbol,l="function"==typeof c;(t.exports=function(t){return a[t]||(a[t]=l&&c[t]||(l?c:u)("Symbol."+t))}).store=a},function(t,r){t.exports=function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}},function(t,r){function _defineProperties(t,r){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:[];if((0,u.default)(this,ServiceBase),r||(r=this.constructor.role),this.constructor.dependencies&&(i=this.constructor.dependencies),void 0===p.default[t])throw new Error("Invalid ServiceType: "+t);_defineLifeCycleMethods.call(this,t),this._serviceManager=_buildServiceManager.call(this,t,r,i),_installLifeCycleHooks.call(this,this._serviceManager),_guardLifeCycleMethods.call(this)}return(0,c.default)(ServiceBase,[{key:"manager",value:function manager(){return this._serviceManager}},{key:"get",value:function get(t){return this._serviceManager.dependency(t)}}]),ServiceBase}();r.default=y},function(t,r,i){var a=i(17)(Object,"create");t.exports=a},function(t,r,i){var a=i(73);t.exports=function assocIndexOf(t,r){for(var i=t.length;i--;)if(a(t[i][0],r))return i;return-1}},function(t,r,i){var a=i(79);t.exports=function getMapData(t,r){var i=t.__data__;return a(r)?i["string"==typeof r?"string":"hash"]:i.map}},function(t,r,i){var a=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.DependencyNotResolvedError=r.UnknownDependencyError=r.InvalidServiceError=r.default=void 0;var u=a(i(3)),c=a(i(34)),l=a(i(4)),p=a(i(1)),d=a(i(5)),y=a(i(6)),h=a(i(2)),v=a(i(15)),g=a(i(40));function _createSuper(t){var r=function _isNativeReflectConstruct(){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(t){return!1}}();return function(){var i,a=(0,h.default)(t);if(r){var u=(0,h.default)(this).constructor;i=Reflect.construct(a,arguments,u)}else i=a.apply(this,arguments);return(0,y.default)(this,i)}}var m=function(t){(0,d.default)(InvalidServiceError,t);var r=_createSuper(InvalidServiceError);function InvalidServiceError(t){return(0,p.default)(this,InvalidServiceError),r.call(this,t)}return InvalidServiceError}((0,v.default)(Error));r.InvalidServiceError=m;var b=function(t){(0,d.default)(UnknownDependencyError,t);var r=_createSuper(UnknownDependencyError);function UnknownDependencyError(t,i){return(0,p.default)(this,UnknownDependencyError),r.call(this,"Injected service "+i+" is not a dependency of "+t)}return UnknownDependencyError}((0,v.default)(Error));r.UnknownDependencyError=b;var _=function(t){(0,d.default)(DependencyNotResolvedError,t);var r=_createSuper(DependencyNotResolvedError);function DependencyNotResolvedError(t,i){return(0,p.default)(this,DependencyNotResolvedError),r.call(this,"Dependency "+i+" of service "+t+" is unavailable.")}return DependencyNotResolvedError}((0,v.default)(Error));function _waitForDependencies(t){return Promise.all(this.dependencies().map((function(r){return t(r)})))}r.DependencyNotResolvedError=_;var w=function(t){(0,d.default)(ServiceManager,t);var r=_createSuper(ServiceManager);function ServiceManager(t){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if((0,p.default)(this,ServiceManager),i=r.call(this,u,c,l),!t)throw new Error("Service name must not be empty.");return i._name=t,i._dependencies=a,i._injections={},a.forEach((function(t){return i._injections[t]=null})),i}return(0,l.default)(ServiceManager,null,[{key:"isValidService",value:function isValidService(t){return null!==t&&"object"===(0,u.default)(t)&&"function"==typeof t.manager}}]),(0,l.default)(ServiceManager,[{key:"name",value:function name(){return this._name}},{key:"dependencies",value:function dependencies(){return this._dependencies}},{key:"inject",value:function inject(t,r){if(void 0===this._injections[t])throw new b(this.name(),t);if(!ServiceManager.isValidService(r))throw new m("Cannot inject invalid service in "+this.name());return this._injections[t]=r,this}},{key:"dependency",value:function dependency(t){if(!this._injections[t])throw new _(this.name(),t);return this._injections[t]}},{key:"initialize",value:function initialize(){var t=this;return this.initializeDependencies().then((function(){return(0,c.default)((0,h.default)(ServiceManager.prototype),"initialize",t).call(t,t._settings)}))}},{key:"connect",value:function connect(){var t=this;return this.connectDependencies().then((function(){return(0,c.default)((0,h.default)(ServiceManager.prototype),"connect",t).call(t)}))}},{key:"authenticate",value:function authenticate(){var t=this;return this.authenticateDependencies().then((function(){return(0,c.default)((0,h.default)(ServiceManager.prototype),"authenticate",t).call(t)}))}},{key:"initializeDependencies",value:function initializeDependencies(){var t=this;return _waitForDependencies.call(this,(function(r){return t.dependency(r).manager().initialize()}))}},{key:"connectDependencies",value:function connectDependencies(){var t=this;return _waitForDependencies.call(this,(function(r){return t.dependency(r).manager().connect()}))}},{key:"authenticateDependencies",value:function authenticateDependencies(){var t=this;return _waitForDependencies.call(this,(function(r){return t.dependency(r).manager().authenticate()}))}},{key:"createService",value:function createService(){var t=this;return{manager:function manager(){return t}}}}]),ServiceManager}(g.default);r.default=w},function(t,r){function _setPrototypeOf(r,i){return t.exports=_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,r){return t.__proto__=r,t},_setPrototypeOf(r,i)}t.exports=_setPrototypeOf},function(t,r,i){var a=i(2),u=i(14),c=i(37),l=i(38);function _wrapNativeSuper(r){var i="function"==typeof Map?new Map:void 0;return t.exports=_wrapNativeSuper=function _wrapNativeSuper(t){if(null===t||!c(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(t))return i.get(t);i.set(t,Wrapper)}function Wrapper(){return l(t,arguments,a(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),u(Wrapper,t)},_wrapNativeSuper(r)}t.exports=_wrapNativeSuper},function(t,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default={CREATED:"CREATED",INITIALIZING:"INITIALIZING",OFFLINE:"OFFLINE",CONNECTING:"CONNECTING",ONLINE:"ONLINE",AUTHENTICATING:"AUTHENTICATING",READY:"READY",ERROR:"ERROR"}},function(t,r,i){var a=i(58),u=i(65);t.exports=function getNative(t,r){var i=u(t,r);return a(i)?i:void 0}},function(t,r,i){var a=i(25),u=i(60),c=i(61),l=a?a.toStringTag:void 0;t.exports=function baseGetTag(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":l&&l in Object(t)?u(t):c(t)}},function(t,r){t.exports=function isObjectLike(t){return null!=t&&"object"==(0,l.default)(t)}},function(t,r,i){var a=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.default=function standardizeConfig(t,r,i){if(r instanceof Array)return"boolean"==typeof r[0]&&i?[resolveNameForBoolean(t,r[0],i),r[1]]:r;var a,l={};switch((0,u.default)(r)){case"string":case"function":a=r;break;case"object":r instanceof c.default?a=r:(a=!i||resolveNameForBoolean(t,!0,i),l=r);break;case"boolean":a=i?resolveNameForBoolean(t,r,i):r;break;default:throw new Error("could not parse settings for ".concat(t,":"),r)}return[a,l]};var u=a(i(3)),c=a(i(9));function resolveNameForBoolean(t,r,i){var a,u=i.defaults,c=i.disabled;if(r){if(!(a=u[t]))throw new Error('The "'.concat(t,'" service has no default'))}else if(!(a=c[t]))throw new Error('The "'.concat(t,'" service cannot be disabled'));return a}},function(t,r,i){var a=i(3);function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return t},t}t.exports=function _interopRequireWildcard(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var r=_getRequireWildcardCache();if(r&&r.has(t))return r.get(t);var i={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){var l=u?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(i,c,l):i[c]=t[c]}return i.default=t,r&&r.set(t,i),i}},function(t,r,i){var a=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.IllegalStateError=void 0;var u=a(i(3)),c=a(i(4)),l=a(i(1)),p=a(i(5)),d=a(i(6)),y=a(i(2));var h=function(t){(0,p.default)(IllegalStateError,t);var r=function _createSuper(t){var r=function _isNativeReflectConstruct(){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(t){return!1}}();return function(){var i,a=(0,y.default)(t);if(r){var u=(0,y.default)(this).constructor;i=Reflect.construct(a,arguments,u)}else i=a.apply(this,arguments);return(0,d.default)(this,i)}}(IllegalStateError);function IllegalStateError(){return(0,l.default)(this,IllegalStateError),r.apply(this,arguments)}return IllegalStateError}((0,a(i(15)).default)(Error));r.IllegalStateError=h;var v=function(){function StateMachine(t,r){if((0,l.default)(this,StateMachine),"object"!==(0,u.default)(r))throw new Error("StateMachine transitions parameter must be an object.");if(Object.keys(r).filter((function(t){return r.hasOwnProperty(t)&&!(r[t]instanceof Array)})).length>0)throw new Error("Illegal StateMachine transition found: not an array.");if(Object.keys(r).filter((function(t){return r.hasOwnProperty(t)&&r[t].filter((function(t){return!r[t]})).length>0})).length>0)throw new Error("Illegal StateMachine transition found: target state not in transition map.");if(!(r[t]instanceof Array))throw new Error("Initial state "+t+" is not set in the transitions map.");this._state=t,this._nextStates=r,this._stateChangedHandlers=[]}return(0,c.default)(StateMachine,[{key:"onStateChanged",value:function onStateChanged(t){this._stateChangedHandlers.push(t)}},{key:"state",value:function state(){return this._state}},{key:"inState",value:function inState(t){return t instanceof Array||(t=[t]),t.indexOf(this._state)>=0}},{key:"assertState",value:function assertState(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!this.inState(t))throw new h("Illegal operation for state "+this._state+(r.length>0?": "+r:""))}},{key:"transitionTo",value:function transitionTo(t){if(void 0===this._nextStates[t])throw new h("Cannot set illegal state: "+t);if(t!==this._state){if(this._nextStates[this._state].indexOf(t)<0)throw new h("Illegal state transition: "+this._state+" to "+t);var r=this._state;this._state=t,this._stateChangedHandlers.forEach((function(i){return i(r,t)}))}return this}}]),StateMachine}();r.default=v},function(t,r,i){var a=i(52);t.exports=function uniq(t){return t&&t.length?a(t):[]}},function(t,r,i){var a=i(18),u=i(27);t.exports=function isFunction(t){if(!u(t))return!1;var r=a(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}},function(t,r,i){var a=i(8).Symbol;t.exports=a},function(t,r,i){(function(r){var i="object"==(0,l.default)(r)&&r&&r.Object===Object&&r;t.exports=i}).call(this,i(59))},function(t,r){t.exports=function isObject(t){var r=(0,l.default)(t);return null!=t&&("object"==r||"function"==r)}},function(t,r){t.exports=function setToArray(t){var r=-1,i=Array(t.size);return t.forEach((function(t){i[++r]=t})),i}},function(t,r,i){var a=i(21),u=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.orderServices=orderServices,Object.defineProperty(r,"InvalidServiceError",{enumerable:!0,get:function get(){return _.InvalidServiceError}}),r.ServiceNotFoundError=r.ServiceAlreadyRegisteredError=r.ExtractedServiceError=r.default=void 0;var c=u(i(95)),l=u(i(97)),p=u(i(4)),d=u(i(1)),y=u(i(5)),h=u(i(6)),v=u(i(2)),g=u(i(15)),m=u(i(98)),b=u(i(23)),_=a(i(13)),w=u(i(119));function _createForOfIteratorHelper(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(t,r):void 0}}(t))){var r=0,i=function F(){};return{s:i,n:function n(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u,c=!0,l=!1;return{s:function s(){a=t[Symbol.iterator]()},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){l=!0,u=t},f:function f(){try{c||null==a.return||a.return()}finally{if(l)throw u}}}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,a=new Array(r);i1&&void 0!==arguments[1]?arguments[1]:null;if(!_.default.isValidService(t))throw new _.InvalidServiceError("Service must be an object with manager() method returning a valid ServiceManager");r=r||t.manager().name();var i=this.service(r,!1);if(void 0!==i&&i!==t)throw new x(r);return this._services[r]=t,this}},{key:"service",value:function service(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=["exchange"];if(!t)throw new Error("Provide a service name.");if(!this._services[t]&&r&&i.includes(t))throw new O(t);if(!this._services[t]&&r)throw new S(t);return this._services[t]}},{key:"getRegisteredServiceNames",value:function getRegisteredServiceNames(){return Object.keys(this._services)}},{key:"injectDependencies",value:function injectDependencies(){var t,r=_createForOfIteratorHelper((0,m.default)(this._services));try{for(r.s();!(t=r.n()).done;){var i,a=t.value.manager(),u=_createForOfIteratorHelper(a.dependencies());try{for(u.s();!(i=u.n()).done;){var c=i.value;if(!this._services[c])throw new S(c);a.inject(c,this._services[c])}}catch(t){u.e(t)}finally{u.f()}}}catch(t){r.e(t)}finally{r.f()}}},{key:"initialize",value:function initialize(){return this._waitForServices((function(t){return t.manager().initialize()}))}},{key:"connect",value:function connect(){return this._waitForServices((function(t){return t.manager().connect()}))}},{key:"authenticate",value:function authenticate(){var t=this;return this._waitForServices((function(t){return t.manager().authenticate()})).then((function(){t.isAuthenticated=!0}))}},{key:"_waitForServices",value:(t=(0,l.default)(c.default.mark((function _callee(t){var r,i,a;return c.default.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:this._orderedServiceNames||(this._orderedServiceNames=orderServices((0,m.default)(this._services))),r=_createForOfIteratorHelper(this._orderedServiceNames),u.prev=2,r.s();case 4:if((i=r.n()).done){u.next=13;break}if(a=i.value,this._services[a]){u.next=9;break}throw new Error("No service for ".concat(a));case 9:return u.next=11,t(this._services[a]);case 11:u.next=4;break;case 13:u.next=18;break;case 15:u.prev=15,u.t0=u.catch(2),r.e(u.t0);case 18:return u.prev=18,r.f(),u.finish(18);case 21:case"end":return u.stop()}}),_callee,this,[[2,15,18,21]])}))),function _waitForServices(r){return t.apply(this,arguments)})}]),Container}();r.default=k},function(t,r){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function get(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function get(){return t.i}}),t.webpackPolyfill=1),t}},function(t,r){t.exports=function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,r,i){t.exports=i(33)},function(t,r,i){var a=i(0);Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"standardizeConfig",{enumerable:!0,get:function get(){return u.default}}),Object.defineProperty(r,"ServiceProvider",{enumerable:!0,get:function get(){return c.default}}),Object.defineProperty(r,"Container",{enumerable:!0,get:function get(){return l.default}}),Object.defineProperty(r,"LocalService",{enumerable:!0,get:function get(){return p.default}}),Object.defineProperty(r,"PublicService",{enumerable:!0,get:function get(){return d.default}}),Object.defineProperty(r,"PrivateService",{enumerable:!0,get:function get(){return y.default}}),Object.defineProperty(r,"ServiceManager",{enumerable:!0,get:function get(){return h.default}}),Object.defineProperty(r,"StateMachine",{enumerable:!0,get:function get(){return v.default}});var u=a(i(20)),c=a(i(45)),l=a(i(29)),p=a(i(120)),d=a(i(121)),y=a(i(122)),h=a(i(13)),v=a(i(22))},function(t,r,i){var a=i(35);function _get(r,i,u){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=_get=Reflect.get:t.exports=_get=function _get(t,r,i){var u=a(t,r);if(u){var c=Object.getOwnPropertyDescriptor(u,r);return c.get?c.get.call(i):c.value}},_get(r,i,u||r)}t.exports=_get},function(t,r,i){var a=i(2);t.exports=function _superPropBase(t,r){for(;!Object.prototype.hasOwnProperty.call(t,r)&&null!==(t=a(t)););return t}},function(t,r){t.exports=function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,r){t.exports=function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}},function(t,r,i){var a=i(14),u=i(39);function _construct(r,i,c){return u()?t.exports=_construct=Reflect.construct:t.exports=_construct=function _construct(t,r,i){var u=[null];u.push.apply(u,r);var c=new(Function.bind.apply(t,u));return i&&a(c,i.prototype),c},_construct.apply(null,arguments)}t.exports=_construct},function(t,r){t.exports=function _isNativeReflectConstruct(){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(t){return!1}}},function(t,r,i){var a=i(21),u=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var c=u(i(1)),l=u(i(4)),p=u(i(22)),d=u(i(16)),y=a(i(7)),h=(0,u(i(41)).default)("dai:ServiceManagerBase");function _promisify(t){return new Promise((function(r,i){try{r(t())}catch(t){i(t.message)}}))}var v=function(){function ServiceManagerBase(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if((0,c.default)(this,ServiceManagerBase),null!==t&&"function"!=typeof t)throw new Error("Invalid argument init: not a function or null.");if(null===t&&(t=function init(){return Promise.resolve()}),null!==r&&"function"!=typeof r)throw new Error("Invalid argument connect: not a function or null.");if(null===r&&null!==i&&(r=function connect(){return Promise.resolve()}),null!==i&&"function"!=typeof i)throw new Error("Invalid argument auth: not a function or null.");this._init=t,this._connect=r,this._auth=i,this._type=null===i?null===r?y.default.LOCAL:y.default.PUBLIC:y.default.PRIVATE,this._state=new p.default(d.default.CREATED,y.serviceTypeTransitions[this._type]),this._initPromise=null,this._connectPromise=null,this._authPromise=null}return(0,l.default)(ServiceManagerBase,[{key:"initialize",value:function initialize(t){var r=this;if(this._state.inState(d.default.CREATED)){if(this._initPromise)throw new Error("Unexpected init promise in state CREATED.");this._state.transitionTo(d.default.INITIALIZING),this._initPromise=_promisify((function(){return r._init(t)})).then((function(){return r._state.transitionTo(r._type===y.default.LOCAL?d.default.READY:d.default.OFFLINE)}),(function(t){throw h(t),r._state.transitionTo(d.default.CREATED),t}))}return this._initPromise}},{key:"connect",value:function connect(){var t=this;return this._type===y.default.LOCAL?this.initialize():(this._state.inState([d.default.CREATED,d.default.INITIALIZING,d.default.OFFLINE])&&null===this._connectPromise&&(this._connectPromise=this.initialize().then((function(){return t._state.transitionTo(d.default.CONNECTING),_promisify((function(){return t._connect((function(){return t._disconnect()}))})).then((function(){t._state.inState(d.default.CONNECTING)&&t._state.transitionTo(t._type===y.default.PUBLIC?d.default.READY:d.default.ONLINE)}),(function(r){throw h("connect error:",r),t._state.inState(d.default.CONNECTING)&&t._state.transitionTo(d.default.OFFLINE),r}))}))),this._connectPromise)}},{key:"authenticate",value:function authenticate(){var t=this;return this._type!==y.default.PRIVATE?this.connect():(this._state.inState([d.default.CREATED,d.default.INITIALIZING,d.default.OFFLINE,d.default.CONNECTING,d.default.ONLINE])&&null===this._authPromise&&(this._authPromise=this.connect().then((function(){return t._state.transitionTo(d.default.AUTHENTICATING),_promisify((function(){return t._auth((function(){return t._deauthenticate()}))})).then((function(){t._state.inState(d.default.AUTHENTICATING)&&t._state.transitionTo(d.default.READY)}),(function(r){h("authenticate error: "+r),t._state.inState(d.default.AUTHENTICATING)&&t._state.transitionTo(d.default.ONLINE)}))}))),this._authPromise)}},{key:"settings",value:function settings(t){return this._settings=t,this}},{key:"state",value:function state(){return this._state.state()}},{key:"type",value:function type(){return this._type}},{key:"isInitialized",value:function isInitialized(){return!this._state.inState([d.default.CREATED,d.default.INITIALIZING])}},{key:"isConnected",value:function isConnected(){return this._type===y.default.LOCAL?null:this._state.inState([d.default.ONLINE,d.default.AUTHENTICATING,d.default.READY])}},{key:"isAuthenticated",value:function isAuthenticated(){return this._type===y.default.PRIVATE?this._state.inState(d.default.READY):null}},{key:"isReady",value:function isReady(){return this._state.inState(d.default.READY)}},{key:"onInitialized",value:function onInitialized(t){return this._state.onStateChanged((function(r,i){r!==d.default.INITIALIZING||i!==d.default.OFFLINE&&i!==d.default.READY||t()})),this}},{key:"onConnected",value:function onConnected(t){return this._state.onStateChanged((function(r,i){r!==d.default.CONNECTING||i!==d.default.ONLINE&&i!==d.default.READY||t()})),this}},{key:"onDisconnected",value:function onDisconnected(t){return this._state.onStateChanged((function(r,i){i!==d.default.OFFLINE||r!==d.default.ONLINE&&r!==d.default.READY||t()})),this}},{key:"onAuthenticated",value:function onAuthenticated(t){return this._state.onStateChanged((function(r,i){r===d.default.AUTHENTICATING&&i===d.default.READY&&t()})),this}},{key:"onDeauthenticated",value:function onDeauthenticated(t){return this.type()===y.default.PRIVATE&&this._state.onStateChanged((function(r,i){i!==d.default.OFFLINE&&i!==d.default.ONLINE||r!==d.default.READY||t()})),this}},{key:"onReady",value:function onReady(t){return this._state.onStateChanged((function(r,i){i===d.default.READY&&t()})),this}},{key:"onStateChanged",value:function onStateChanged(t){return this._state.onStateChanged(t),this}},{key:"_disconnect",value:function _disconnect(){if(this._type===y.default.LOCAL)throw new Error("_disconnect must not be called on a Local Service");this._state.inState(d.default.AUTHENTICATING)&&this._deauthenticate(),this._state.inState([d.default.READY,d.default.ONLINE,d.default.CONNECTING])&&(this._authPromise=null,this._connectPromise=null,this._state.transitionTo(d.default.OFFLINE))}},{key:"_deauthenticate",value:function _deauthenticate(){if(this._type!==y.default.PRIVATE)throw new Error("_deauthenticate must not be called on a Local or Public Service");this._state.inState([d.default.READY,d.default.AUTHENTICATING])&&(this._authPromise=null,this._state.transitionTo(d.default.ONLINE))}}]),ServiceManagerBase}();r.default=v},function(t,r,i){(function(a){function load(){var t;try{t=r.storage.debug}catch(t){}return!t&&void 0!==a&&"env"in a&&(t=a.env.DEBUG),t}(r=t.exports=i(43)).log=function log(){return"object"==("undefined"==typeof console?"undefined":(0,l.default)(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},r.formatArgs=function formatArgs(t){var i=this.useColors;if(t[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+t[0]+(i?"%c ":" ")+"+"+r.humanize(this.diff),i){var a="color: "+this.color;t.splice(1,0,a,"color: inherit");var u=0,c=0;t[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(u++,"%c"===t&&(c=u))})),t.splice(c,0,a)}},r.save=function save(t){try{null==t?r.storage.removeItem("debug"):r.storage.debug=t}catch(t){}},r.load=load,r.useColors=function useColors(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function localstorage(){try{return window.localStorage}catch(t){}}(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},r.enable(load())}).call(this,i(42))},function(t,r){var i,a,u=t.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(t){if(i===setTimeout)return setTimeout(t,0);if((i===defaultSetTimout||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(r){try{return i.call(null,t,0)}catch(r){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(t){i=defaultSetTimout}try{a="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(t){a=defaultClearTimeout}}();var c,l=[],p=!1,d=-1;function cleanUpNextTick(){p&&c&&(p=!1,c.length?l=c.concat(l):d=-1,l.length&&drainQueue())}function drainQueue(){if(!p){var t=runTimeout(cleanUpNextTick);p=!0;for(var r=l.length;r;){for(c=l,l=[];++d1)for(var i=1;i0)return function parse(t){if(!((t=String(t)).length>100)){var r=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(r){var l=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*l;case"days":case"day":case"d":return l*c;case"hours":case"hour":case"hrs":case"hr":case"h":return l*u;case"minutes":case"minute":case"mins":case"min":case"m":return l*a;case"seconds":case"second":case"secs":case"sec":case"s":return l*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}}}(t);if("number"===p&&!1===isNaN(t))return r.long?function fmtLong(t){return plural(t,c,"day")||plural(t,u,"hour")||plural(t,a,"minute")||plural(t,i,"second")||t+" ms"}(t):function fmtShort(t){return t>=c?Math.round(t/c)+"d":t>=u?Math.round(t/u)+"h":t>=a?Math.round(t/a)+"m":t>=i?Math.round(t/i)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,r,i){var a=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var u=a(i(3)),c=a(i(46)),l=a(i(1)),p=a(i(4)),d=a(i(23)),y=a(i(29)),h=a(i(20));function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,a=new Array(r);i1&&void 0!==arguments[1]?arguments[1]:{},i=r.services,a=void 0===i?{}:i,u=r.defaults,c=void 0===u?{}:u,p=r.disabled,d=void 0===p?{}:p;(0,l.default)(this,ServiceProvider),this._config=t,this._services=a,this._resolver={defaults:c,disabled:d}}return(0,p.default)(ServiceProvider,[{key:"supports",value:function supports(t){return!!this._services[t]}},{key:"buildContainer",value:function buildContainer(){var t=new y.default;for(var r in this._config){var i=(0,h.default)(r,this._config[r],this._resolver),a=(0,c.default)(i,2),l=a[0],p=a[1],d=void 0;if("object"==(0,u.default)(l))d=l;else if("function"==typeof l)d=new l;else{if(!this.supports(l)&&"exchange"===r)throw new Error("This service has been extracted from dai.js. Please refer to the documentation to add it as a plugin: \n\n https://github.com/makerdao/dai.js/wiki/Basic-Usage-(Plugins)");if(!this.supports(l))throw new Error("Unsupported service in configuration: "+l);d=new this._services[l]}var v=d.manager().name();if(v!==r)throw new Error('Role mismatch: "'.concat(v,'", "').concat(r,'"'));d.manager().settings(p),t.register(d,r)}return this._registerDependencies(t),t.injectDependencies(),this._container=t,t}},{key:"_registerDependencies",value:function _registerDependencies(t){var r=t.getRegisteredServiceNames(),i=r.reduce((function(r,i){var a=t.service(i).manager().dependencies();return(0,d.default)(r.concat(a))}),[]).filter((function(t){return!r.includes(t)}));if(0!==i.length){var a,u=function _createForOfIteratorHelper(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(t,r):void 0}}(t))){var r=0,i=function F(){};return{s:i,n:function n(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function e(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u,c=!0,l=!1;return{s:function s(){a=t[Symbol.iterator]()},n:function n(){var t=a.next();return c=t.done,t},e:function e(t){l=!0,u=t},f:function f(){try{c||null==a.return||a.return()}finally{if(l)throw u}}}}(i);try{for(u.s();!(a=u.n()).done;){var c=a.value,l=this._resolver.defaults[c];if("string"==typeof l&&(l=this._services[l]),!l)throw new Error('No service found for "'.concat(c,'"'));t.register(new l,c)}}catch(t){u.e(t)}finally{u.f()}this._registerDependencies(t)}}},{key:"service",value:function service(t){return this._container||this.buildContainer(),this._container.service(t)}}]),ServiceProvider}();r.default=v},function(t,r,i){var a=i(47),u=i(48),c=i(49),l=i(51);t.exports=function _slicedToArray(t,r){return a(t)||u(t,r)||c(t,r)||l()}},function(t,r){t.exports=function _arrayWithHoles(t){if(Array.isArray(t))return t}},function(t,r){t.exports=function _iterableToArrayLimit(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var i=[],a=!0,u=!1,c=void 0;try{for(var l,p=t[Symbol.iterator]();!(a=(l=p.next()).done)&&(i.push(l.value),!r||i.length!==r);a=!0);}catch(t){u=!0,c=t}finally{try{a||null==p.return||p.return()}finally{if(u)throw c}}return i}}},function(t,r,i){var a=i(50);t.exports=function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return a(t,r);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,r):void 0}}},function(t,r){t.exports=function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var i=0,a=new Array(r);i=200){var _=r?null:p(t);if(_)return d(_);g=!1,h=l,b=new a}else b=r?[]:m;t:for(;++y-1}},function(t,r,i){var a=i(11);t.exports=function listCacheSet(t,r){var i=this.__data__,u=a(i,t);return u<0?(++this.size,i.push([t,r])):i[u][1]=r,this}},function(t,r,i){var a=i(17)(i(8),"Map");t.exports=a},function(t,r,i){var a=i(12);t.exports=function mapCacheDelete(t){var r=a(this,t).delete(t);return this.size-=r?1:0,r}},function(t,r){t.exports=function isKeyable(t){var r=(0,l.default)(t);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}},function(t,r,i){var a=i(12);t.exports=function mapCacheGet(t){return a(this,t).get(t)}},function(t,r,i){var a=i(12);t.exports=function mapCacheHas(t){return a(this,t).has(t)}},function(t,r,i){var a=i(12);t.exports=function mapCacheSet(t,r){var i=a(this,t),u=i.size;return i.set(t,r),this.size+=i.size==u?0:1,this}},function(t,r){t.exports=function setCacheAdd(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},function(t,r){t.exports=function setCacheHas(t){return this.__data__.has(t)}},function(t,r,i){var a=i(86);t.exports=function arrayIncludes(t,r){return!(null==t||!t.length)&&a(t,r,0)>-1}},function(t,r,i){var a=i(87),u=i(88),c=i(89);t.exports=function baseIndexOf(t,r,i){return r==r?c(t,r,i):a(t,u,i)}},function(t,r){t.exports=function baseFindIndex(t,r,i,a){for(var u=t.length,c=i+(a?1:-1);a?c--:++c=0;--a){var u=this.tryEntries[a],c=u.completion;if("root"===u.tryLoc)return handle("end");if(u.tryLoc<=this.prev){var l=i.call(u,"catchLoc"),p=i.call(u,"finallyLoc");if(l&&p){if(this.prev=0;--a){var u=this.tryEntries[a];if(u.tryLoc<=this.prev&&i.call(u,"finallyLoc")&&this.prev=0;--r){var i=this.tryEntries[r];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),resetTryEntry(i),d}},catch:function _catch(t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc===t){var a=i.completion;if("throw"===a.type){var u=a.arg;resetTryEntry(i)}return u}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,r,i){return this.delegate={iterator:values(t),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=void 0),d}},t}(t.exports);try{regeneratorRuntime=a}catch(t){Function("r","regeneratorRuntime = r")(a)}},function(t,r){function asyncGeneratorStep(t,r,i,a,u,c,l){try{var p=t[c](l),d=p.value}catch(t){return void i(t)}p.done?r(d):Promise.resolve(d).then(a,u)}t.exports=function _asyncToGenerator(t){return function(){var r=this,i=arguments;return new Promise((function(a,u){var c=t.apply(r,i);function _next(t){asyncGeneratorStep(c,a,u,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(c,a,u,_next,_throw,"throw",t)}_next(void 0)}))}}},function(t,r,i){var a=i(99),u=i(101);t.exports=function values(t){return null==t?[]:a(t,u(t))}},function(t,r,i){var a=i(100);t.exports=function baseValues(t,r){return a(r,(function(r){return t[r]}))}},function(t,r){t.exports=function arrayMap(t,r){for(var i=-1,a=null==t?0:t.length,u=Array(a);++i-1&&t%1==0&&t1&&void 0!==arguments[1]?arguments[1]:[];return(0,u.default)(this,LocalService),r.call(this,d.default.LOCAL,t,i)}return LocalService}(a(i(9)).default);r.default=y},function(t,r,i){var a=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var u=a(i(1)),c=a(i(5)),l=a(i(6)),p=a(i(2)),d=a(i(7));var y=function(t){(0,c.default)(PublicService,t);var r=function _createSuper(t){var r=function _isNativeReflectConstruct(){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(t){return!1}}();return function(){var i,a=(0,p.default)(t);if(r){var u=(0,p.default)(this).constructor;i=Reflect.construct(a,arguments,u)}else i=a.apply(this,arguments);return(0,l.default)(this,i)}}(PublicService);function PublicService(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(0,u.default)(this,PublicService),r.call(this,d.default.PUBLIC,t,i)}return PublicService}(a(i(9)).default);r.default=y},function(t,r,i){var a=i(0);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var u=a(i(1)),c=a(i(5)),l=a(i(6)),p=a(i(2)),d=a(i(7));var y=function(t){(0,c.default)(PrivateService,t);var r=function _createSuper(t){var r=function _isNativeReflectConstruct(){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(t){return!1}}();return function(){var i,a=(0,p.default)(t);if(r){var u=(0,p.default)(this).constructor;i=Reflect.construct(a,arguments,u)}else i=a.apply(this,arguments);return(0,l.default)(this,i)}}(PrivateService);function PrivateService(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return(0,u.default)(this,PrivateService),r.call(this,d.default.PRIVATE,t,i)}return PrivateService}(a(i(9)).default);r.default=y}])}))}).call(this,i(141)(t))},function(t,r,i){var a=i(8),u=i(22);t.exports=i(9)?function(t,r,i){return a.f(t,r,u(1,i))}:function(t,r,i){return t[r]=i,t}},function(t,r){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,r){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,r,i){var a=i(54),u=i(36);t.exports=function(t){return a(u(t))}},function(t,r){t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},function(t,r,i){var a=i(36);t.exports=function(t){return Object(a(t))}},function(t,r){t.exports={}},function(t,r,i){var a=i(136),u=i(137),c=i(68),l=i(138);t.exports=function _slicedToArray(t,r){return a(t)||u(t,r)||c(t,r)||l()}},function(t,r,i){Object.defineProperty(r,"__esModule",{value:!0}),r.getCurrency=r.netIdtoSpockUrlStaging=r.netIdtoSpockUrl=r.netIdToName=void 0;var a=i(49),u=i(5);r.netIdToName=function netIdToName(t){switch(parseInt(t,10)){case 1:return"mainnet";case 42:return"kovan";case 999:return"ganache";default:return""}};r.netIdtoSpockUrl=function netIdtoSpockUrl(t){switch(parseInt(t,10)){case 1:return u.MAINNET_URL;case 42:return u.KOVAN_URL;default:return u.STAGING_MAINNET_URL}};r.netIdtoSpockUrlStaging=function netIdtoSpockUrlStaging(t){switch(parseInt(t,10)){case 1:return u.STAGING_MAINNET_URL;case 42:return u.KOVAN_URL;default:return u.STAGING_MAINNET_URL}};var c=(0,a.createGetCurrency)({MKR:u.MKR});r.getCurrency=c},function(t,r,i){var a=i(53),u=i(40);t.exports=Object.keys||function keys(t){return a(t,u)}},function(t,r){t.exports=!0},function(t,r){var i=0,a=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+a).toString(36))}},function(t,r){r.f={}.propertyIsEnumerable},function(t,r){function _typeof(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=_typeof=function _typeof(t){return typeof t}:t.exports=_typeof=function _typeof(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(r)}t.exports=_typeof},function(t,r){t.exports=function _defineProperty(t,r,i){return r in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}},function(t,r,i){var a=i(84);t.exports=function(t,r,i){if(a(t),void 0===r)return t;switch(i){case 1:return function(i){return t.call(r,i)};case 2:return function(i,a){return t.call(r,i,a)};case 3:return function(i,a,u){return t.call(r,i,a,u)}}return function(){return t.apply(r,arguments)}}},function(t,r,i){var a=i(19);t.exports=function(t,r){if(!a(t))return t;var i,u;if(r&&"function"==typeof(i=t.toString)&&!a(u=i.call(t)))return u;if("function"==typeof(i=t.valueOf)&&!a(u=i.call(t)))return u;if(!r&&"function"==typeof(i=t.toString)&&!a(u=i.call(t)))return u;throw TypeError("Can't convert object to primitive value")}},function(t,r){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,r){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,r){var i=Math.ceil,a=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?a:i)(t)}},function(t,r,i){var a=i(39)("keys"),u=i(29);t.exports=function(t){return a[t]||(a[t]=u(t))}},function(t,r,i){var a=i(0),u=i(7),c=u["__core-js_shared__"]||(u["__core-js_shared__"]={});(t.exports=function(t,r){return c[t]||(c[t]=void 0!==r?r:{})})("versions",[]).push({version:a.version,mode:i(28)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,r){r.f=Object.getOwnPropertySymbols},function(t,r,i){var a=i(93)(!0);i(61)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,r=this._t,i=this._i;return i>=r.length?{value:void 0,done:!0}:(t=a(r,i),this._i+=t.length,{value:t,done:!1})}))},function(t,r,i){var a=i(12),u=i(95),c=i(40),l=i(38)("IE_PROTO"),Empty=function(){},createDict=function(){var t,r=i(52)("iframe"),a=c.length;for(r.style.display="none",i(96).appendChild(r),r.src="javascript:",(t=r.contentWindow.document).open(),t.write("