})},l.prototype._on=function(){vart=this._generateEventOptions.apply(this,arguments);this._checkListener("newListener",t.event.name,t.callback),this._checkListener("removeListener",t.event.name,t.callback);vare=newu({subscription:{params:1,inputFormatter:[a.inputLogFormatter],outputFormatter:this._decodeEventABI.bind(t.event)},subscribeMethod:"eth_subscribe",unsubscribeMethod:"eth_unsubscribe",requestManager:this._web3._requestManager});returne.subscribe("logs",t.params,t.callback||function(){}),e},l.prototype.getPastEvents=function(){vart=this._generateEventOptions.apply(this,arguments),e=newo({name:"getPastLogs",call:"eth_getLogs",params:1,inputFormatter:[a.inputLogFormatter],outputFormatter:this._decodeEventABI.bind(t.event)});e.setRequestManager(this._web3._requestManager);varn=e.buildCall();returne=null,n(t.params,t.callback)},l.prototype._createTxObject=function(){vart={};return"function"===this.method.type&&(t.call=this.parent._executeMethod.bind(t,"call"),t.call.request=this.parent._executeMethod.bind(t,"call",!0),t.send=this.parent._executeMethod.bind(t,"send"),t.send.request=this.parent._executeMethod.bind(t,"send",!0)),t.encodeABI=this.parent._encodeMethodABI.bind(t),t.estimateGas=this.parent._executeMethod.bind(t,"estimate"),t.arguments=arguments,t._method=this.method,t._parent=this.parent,t},l.prototype._methodReturnCallback=function(t,e,n,i,o){vars=this;return"call"===n&&(o=s._parent._decodeMethodReturn(s._method.outputs,o)),i?r._fireError(i,t.promise,t.reject,e):(e&&e(null,o),t.promise.emit("data",o),"send"===n?s._parent._web3.eth.subscribe("newBlocks",{},function(e,n,i){returne?(i.unsubscribe(),r._fireError(e,t.promise,t.reject)):voids._parent._web3.eth.getTransactionReceipt(o,function(e,n){if(e)returni.unsubscribe(),r._fireError(e,t.promise,t.reject);if(n){if(i.unsubscribe(),n.outOfGas)returnr._fireError(newError("Transaction ran out of gas."),t.promise,t.reject);t.promise.emit("receipt",n),t.resolve(n),t.promise.removeAllListeners()}})}):(t.resolve(o),t.promise.removeAllListeners()),void0)},l.prototype._processExecuteArguments=function(t,e){varn={};if(n.type=t.shift(),n.callback=this._parent._getCallback(t),"call"===n.type&&t[t.length-1]!==!0&&(r.isString(t[t.length-1])||isFinite(t[t.length-1]))&&(n.defaultBlock=t.pop()),n.options=r.isObject(t[t.length-1])?t.pop():{},n.generateRequest=t[t.length-1]===!0&&t.pop(),n.options=this._parent._fillWithDefaultOptions(n.options),n.options.data=this.encodeABI(),!r.isAddress(this._parent.options.address))thrownewError("This contract object doesn't have address set yet, please set an address first.");returnn.options.to=this._parent.options.address,n.options.data?n:r._fireError(newError("Couldn't find a matching contract method, or the number of parameters is wrong."),e.promise,e.reject,n.callback)},l.prototype._executeMethod=function(){vart=i(),e=this._parent._processExecuteArguments.call(this,Array.prototype.slice.call(arguments),t);if(e.generateRequest){varn={params:[a.inputCallFormatter(e.options),a.inputDefaultBlockNumberFormatter(e.defaultBlock)],callback:e.callback};return"call"===e.type?(n.method="eth_call",n.format=this._parent._decodeMethodReturn.bind(null,this._method.outputs)):n.method="eth_sendTransaction",n}varo=this._parent._methodReturnCallback.bind(this,t,e.callback,e.type);switch(e.type){case"estimate":this._parent._web3.eth.estimateGas(e.options,o);break;case"call":this._parent._web3.eth.call(e.options,e.defaultBlock,o);break;case"send":if(!r.isAddress(e.options.from))returnr._fireError(newError('No "from" address specified in neither the given options, nor the default options.'),t.promise,t.reject,e.callback);this._parent._web3.eth.sendTransaction(e.options,o)}returnt.promise},e.exports=l},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./eventifiedPromise.js":26,"./formatters":28,"./method.js":31,"./subscription.js":44}],25:[function(t,e,n){e.exports={InvalidNumberOfParams:function(){returnnewError("Invalid number of input parameters")},InvalidConnection:function(t){returnnewError("CONNECTIONERROR:
this.subscriptions[t]={callback:r,type:n,name:e}},s.prototype.removeSubscription=function(t,e){varn=this;this.subscriptions[t]&&(this.send({method:this.subscriptions[t].type+"_unsubscribe",params:[t]},e),deleten.subscriptions[t])},s.prototype.setProvider=function(t){vare=this;this.provider&&this.reset(),this.provider=t,this.provider&&this.provider.on&&this.provider.on("notification",function(t,n){t?Object.keys(e.subscriptions).forEach(function(n){e.subscriptions[n].callback&&e.subscriptions[n].callback(t)}):e.subscriptions[n.params.subscription]&&e.subscriptions[n.params.subscription].callback&&e.subscriptions[n.params.subscription].callback(null,n.params.result)})},s.prototype.reset=function(t){vare=this;Object.keys(this.subscriptions).forEach(function(n){t&&"syncing"===e.subscriptions[n].name||e.removeSubscription(n)}),this.provider.reset&&this.provider.reset()},e.exports=s},{"../utils/utils":20,"./errors":25,"./jsonrpc":30}],43:[function(t,e,n){varr=function(){this.defaultBlock="latest",this.defaultAccount=void0};e.exports=r},{}],44:[function(t,e,n){varr=t("../utils/utils"),i=t("./errors"),o=t("eventemitter3"),s=function(t){vare=newo;this.id=null,this.callback=null,this._reconnectIntervalId=null,this.options={subscription:t.subscription,subscribeMethod:t.subscribeMethod,unsubscribeMethod:t.unsubscribeMethod,requestManager:t.requestManager},this.emit=e.emit,this.on=e.on,this.once=e.once,this.off=e.off,this.listeners=e.listeners,this.listenerCount=e.listenerCount,this.addListener=e.addListener,this.removeListener=e.removeListener,this.removeAllListeners=e.removeAllListeners,this.setMaxListeners=e.setMaxListeners,this.getMaxListeners=e.getMaxListeners};s.prototype._extractCallback=function(t){if(r.isFunction(t[t.length-1]))returnt.pop()},s.prototype._validateArgs=function(t){vare=this.options.subscription;if(e||(e={}),e.params||(e.params=0),t.length!==e.params+1)throwi.InvalidNumberOfParams()},s.prototype._formatInput=function(t){vare=this.options.subscription;if(!e||!e.inputFormatter)returnt;varn=e.inputFormatter.map(function(e,n){returne?e(t[n+1]):t[n+1]});returnn.unshift(t[0]),n},s.prototype._formatOutput=function(t){vare=this.options.subscription;returne&&e.outputFormatter&&t?e.outputFormatter(t):t},s.prototype._toPayload=function(t){this.callback=this._extractCallback(t);vare=this._formatInput(t);returnthis._validateArgs(e),{method:this.options.subscribeMethod,params:e}},s.prototype.unsubscribe=function(t){this.options.requestManager.removeSubscription(this.id,t),this.id=null,this.removeAllListeners(),clearInterval(this._reconnectIntervalId)},s.prototype.subscribe=function(){vart=this,e=arguments,n=this._toPayload(Array.prototype.slice.call(arguments));if(!this.options.requestManager.provider.on)thrownewError("The current provider doesn't support subscriptions",this.options.requestManager.provider);if(this.options.params=n.params[1],"logs"===n.params[0]&&r.isObject(n.params[1])&&n.params[1].hasOwnProperty("fromBlock")&&isFinite(n.params[1].fromBlock)&&this.options.requestManager.send({method:"eth_getLogs",params:[n.params[1]]},function(e,n){e?(t.callback(e,null,t),t.emit("error",e)):n.forEach(function(e){varn=t._formatOutput(e);t.callback(null,n,t),t.emit("data",n)})}),t.callback)return"object"==typeofn.params[1]&&deleten.params[1].fromBlock,this.options.requestManager.send(n,function(i,o){!i&&o?(t.id=o,t.options.requestManager.addSubscription(t.id,n.params[0],"eth",function(n,i){r.isArray(i)&&(i=i[0]);varo=t._formatOutput(i);n?(t.options.requestManager.removeSubscription(t.id),t.options.requestManager.provider.once&&(t._reconnectIntervalId=setInterval(function(){t.options.requestManager.provider.reconnect()},500),t.options.requestManager.provider.once("connect",function(){clearInterval(t._reconnectIntervalId),t.subscribe.apply(t,e)})),t.emit("error",n)):o.removed?t.emit("changed",o):t.emit("data",o),t.callback(n,o,t)})):t.callback(i,null,t)}),this;thrownewError("Subscriptions require a callback as the last parameter!")},e.exports=s},{"../utils/utils":20,"./errors":25,eventemitter3:83}
},i.prototype._resizeTo=function(t){vare=this._capacity;this._capacity=t;varn=this._front,i=this._length,o=n+i&e-1;r(this,0,this,e,o)},e.exports=i},{}],27:[function(t,e,n){"use strict";e.exports=function(e,n,r,i){functiono(t,o){varc=r(t);if(cinstanceofe)returna(c);if(t=s.asArray(t),null===t)returni("expecting an array or an iterable object but got "+s.classString(t));varu=newe(n);void0!==o&&u._propagateFrom(o,3);for(varl=u._fulfill,f=u._reject,p=0,h=t.length;p<h;++p){vard=t[p];(void0!==d||pint)&&e.cast(d)._then(l,f,void0,u,null)}returnu}vars=t("./util"),a=function(t){returnt.then(function(e){returno(e,t)})};e.race=function(t){returno(t,void0)},e.prototype.race=function(){returno(this,void0)}}},{"./util":36}],28:[function(t,e,n){"use strict";e.exports=function(e,n,r,i,o,s){functiona(t,n,r,i){this.constructor$(t);vars=p();this._fn=null===s?n:h.domainBind(s,n),void0!==r&&(r=e.resolve(r),r._attachCancellationCallback(this)),this._initialValue=r,this._currentCancellable=null,i===o?this._eachValues=Array(this._length):0===i?this._eachValues=null:this._eachValues=void0,this._promise._captureStackTrace(),this._init$(void0,-5)}functionc(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}functionu(t,e,n,i){if("function"!=typeofe)returnr("expecting a function but got "+h.classString(e));varo=newa(t,e,n,i);returno.promise()}functionl(t){this.accum=t,this.array._gotAccum(t);varn=i(this.value,this.array._promise);returnninstanceofe?(this.array._currentCancellable=n,n._then(f,void0,void0,this,void0)):f.call(this,n)}functionf(t){varn=this.array,r=n._promise,i=d(n._fn);r._pushContext();varo;o=void0!==n._eachValues?i.call(r._boundValue(),t,this.index,this.length):i.call(r._boundValue(),this.accum,t,this.index,this.length),oinstanceofe&&(n._currentCancellable=o);vara=r._popContext();returns.checkForgottenReturns(o,a,void0!==n._eachValues?"Promise.each":"Promise.reduce",r),o}varp=e._getDomain,h=t("./util"),d=h.tryCatch;h.inherits(a,n),a.prototype._gotAccum=function(t){void0!==this._eachValues&&null!==this._eachValues&&t!==o&&this._eachValues.push(t)},a.prototype._eachComplete=function(t){returnnull!==this._eachValues&&this._eachValues.push(t),this._eachValues},a.prototype._init=function(){},a.prototype._resolveEmptyArray=function(){this._resolve(void0!==this._eachValues?this._eachValues:this._initialValue)},a.prototype.shouldCopyValues=function(){return!1},a.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},a.prototype._resultCancelled=function(t){returnt===this._initialValue?this._cancel():void(this._isResolved()||(this._resultCancelled$(),this._currentCancellableinstanceofe&&this._currentCancellable.cancel(),this._initialValueinstanceofe&&this._initialValue.cancel()))},a.prototype._iterate=function(t){this._values=t;varn,r,i=t.length;if(void0!==this._initialValue?(n=this._initialValue,r=0):(n=e.resolve(t[0]),r=1),this._currentCancellable=n,!n.isRejected())for(;r<i;++r){varo={accum:null,value:t[r],index:r,length:i,array:this};n=n._then(l,void0,void0,o,void0)}void0!==this._eachValues&&(n=n._then(this._eachComplete,void0,void0,this,void0)),n._then(c,c,void0,n,this)},e.prototype.reduce=function(t,e){returnu(this,t,e,null)},e.reduce=function(t,e,n,r){returnu(t,e,n,r)}}},{"./util":36}],29:[function(t,e,n){"use strict";varr,i=t("./util"),o=function(){thrownewError("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")},s=i.getNativePromise();if(i.isNode&&"undefined"==typeofMutationObserver){vara=global.setImmediate,c=process.nextTick;r=i.isRecentNode?function(t){a.call(global,t)}:function(t){c.call(process,t)}}elseif("function"==typeofs&&"function"==typeofs.resolve){varu=s.resolve();r=function(t){u.then(t)}}elser="undefined"==typeofMutationObserver||"undefined"!=typeofwindow&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeofsetImmediate?function(t){setImmediate(t)}:"undefined"!=typeofsetTimeout?function(t){setTimeout(t,0)}:o:function(){vart=document.createElement("div"),e={attr
z=a,n},D.toNumber=function(){vart=this;return+t||(t.s?0*t.s:NaN)},D.toPower=D.pow=function(t){varn,r,i=y(t<0?-t:+t),o=this;if(!W(t,-F,F,23,"exponent")&&(!isFinite(t)||i>F&&(t/=0)||parseFloat(t)!=t&&!(t=NaN)))returnnewe(Math.pow(+o,t));for(n=$?v($/C+2):0,r=newe(N);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=y(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}returnt<0&&(r=N.div(r)),n?P(r,$,M):r},D.toPrecision=function(t,e){returnh(this,null!=t&&W(t,1,j,24,"precision")?0|t:null,e,24)},D.toString=function(t){vare,r=this,i=r.s,s=r.e;returnnull===s?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&W(t,2,64,25,"base")?n(f(e,s),0|t,10,i):s<=H||s>=q?l(e,s):f(e,s),i<0&&r.c[0]&&(e="-"+e)),e},D.truncated=D.trunc=function(){returnP(newe(this),this.e+1,1)},D.valueOf=D.toJSON=function(){returnthis.toString()},null!=t&&e.config(t),e}functioni(t){vare=0|t;returnt>0||t===e?e:e-1}functiono(t){for(vare,n,r=1,i=t.length,o=t[0]+"";r<i;){for(e=t[r++]+"",n=C-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););returno.slice(0,i+1||1)}functions(t,e){varn,r,i=t.c,o=e.c,s=t.s,a=e.s,c=t.e,u=e.e;if(!s||!a)returnnull;if(n=i&&!i[0],r=o&&!o[0],n||r)returnn?r?0:-a:s;if(s!=a)returns;if(n=s<0,r=c==u,!i||!o)returnr?0:!i^n?1:-1;if(!r)returnc>u^n?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])returni[s]>o[s]^n?1:-1;returnc==u?0:c>u^n?1:-1}functiona(t,e,n){return(t=p(t))>=e&&t<=n}functionc(t){return"[object Array]"==Object.prototype.toString.call(t)}functionu(t,e,n){for(varr,i,o=[0],s=0,a=t.length;s<a;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=k.indexOf(t.charAt(s++));r<o.length;r++)o[r]>n-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}returno.reverse()}functionl(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}functionf(t,e){varn,r;if(e<0){for(r="0.";++e;r+="0");t=r+t}elseif(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}elsee<n&&(t=t.slice(0,e)+"."+t.slice(e));returnt}functionp(t){returnt=parseFloat(t),t<0?v(t):y(t)}varh,d,m,_=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=Math.ceil,y=Math.floor,g=" not a boolean or binary digit",b="rounding mode",w="number type has more than 15 significant digits",k="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",x=1e14,C=14,F=9007199254740991,E=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],S=1e7,j=1e9;if(h=r(),"function"==typeofdefine&&define.amd)define(function(){returnh});elseif("undefined"!=typeofe&&e.exports){if(e.exports=h,!d)try{d=t("crypto")}catch(t){}}elsen.BigNumber=h}(this)},{crypto:48}],web3:[function(t,e,n){varr=t("./lib/web3");"undefined"!=typeofwindow&&"undefined"==typeofwindow.Web3&&(window.Web3=r),e.exports=r},{"./lib/web3":22}]},{},["web3"]);