-
Notifications
You must be signed in to change notification settings - Fork 11
/
ethjs-rpc.min.js
1 lines (1 loc) · 4.94 KB
/
ethjs-rpc.min.js
1
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("EthRPC",[],e):"object"==typeof exports?exports.EthRPC=e():t.EthRPC=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,n){(function(t,r){function o(t,e){this._id=t,this._clearFn=e}var i=n(5).nextTick,u=Function.prototype.apply,c=Array.prototype.slice,l={},s=0;e.setTimeout=function(){return new o(u.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new o(u.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0>e||(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},e.setImmediate="function"==typeof t?t:function(t){var n=s++,r=arguments.length>=2&&c.call(arguments,1);return l[n]=!0,i(function(){l[n]&&(r?t.apply(null,r):t.call(null),e.clearImmediate(n))}),n},e.clearImmediate="function"==typeof r?r:function(t){delete l[t]}}).call(e,n(0).setImmediate,n(0).clearImmediate)},function(t,e,n){"use strict";var r=n(3),o=n(4);t.exports=function(t){if(!r(t.then))throw new TypeError("Expected a promise");return function(e){t.then(function(t){o(e,null,t)},function(t){o(e,t)})}}},function(t,e,n){"use strict";function r(t,e){var n=this,o=e||{};if(!(this instanceof r))throw Error('[ethjs-rpc] the EthRPC object requires the "new" flag in order to function normally (i.e. `const eth = new EthRPC(provider);`).');n.options=Object.assign({jsonSpace:o.jsonSpace||0,max:o.max||9999999999999}),n.idCounter=Math.floor(Math.random()*n.options.max),(n.setProvider=function(t){if("object"!=typeof t)throw Error("[ethjs-rpc] the EthRPC object requires that the first input 'provider' must be an object, got '"+typeof t+"' (i.e. 'const eth = new EthRPC(provider);')");n.currentProvider=t})(t)}function o(t,e){return Object.assign({},{id:e,jsonrpc:"2.0",params:[]},t)}var i=n(1);t.exports=r,r.prototype.sendAsync=function(t,e){var n=this;n.idCounter=n.idCounter%n.options.max;var r=o(t,n.idCounter++),u=new Promise(function(t,e){n.currentProvider.sendAsync(r,function(o,i){var u=i||{};if(o||u.error){var c="[ethjs-rpc] "+(u.error&&"rpc"||"")+" error with payload "+JSON.stringify(r,null,n.options.jsonSpace)+" "+(o?o+"":JSON.stringify(u.error,null,n.options.jsonSpace)),l=Error(c);return l.value=o||u.error,void e(l)}t(u.result)})});return e?i(u)(e):u}},function(t,e){"use strict";var n=Object.prototype.toString;t.exports=function(t){return"[object Function]"===n.call(t)}},function(t,e,n){"use strict";(function(e){t.exports="function"==typeof e?e:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}}).call(e,n(0).setImmediate)},function(t,e){function n(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function o(t){if(a===setTimeout)return setTimeout(t,0);if((a===n||!a)&&setTimeout)return a=setTimeout,setTimeout(t,0);try{return a(t,0)}catch(e){try{return a.call(null,t,0)}catch(e){return a.call(this,t,0)}}}function i(t){if(f===clearTimeout)return clearTimeout(t);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function u(){h&&m&&(h=!1,m.length?d=m.concat(d):y=-1,d.length&&c())}function c(){if(!h){var t=o(u);h=!0;for(var e=d.length;e;){for(m=d,d=[];++y<e;)m&&m[y].run();y=-1,e=d.length}m=null,h=!1,i(t)}}function l(t,e){this.fun=t,this.array=e}function s(){}var a,f,p=t.exports={};!function(){try{a="function"==typeof setTimeout?setTimeout:n}catch(t){a=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(t){f=r}}();var m,d=[],h=!1,y=-1;p.nextTick=function(t){var e=Array(arguments.length-1);if(arguments.length>1)for(var n=1;arguments.length>n;n++)e[n-1]=arguments[n];d.push(new l(t,e)),1!==d.length||h||o(c)},l.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=s,p.addListener=s,p.once=s,p.off=s,p.removeListener=s,p.removeAllListeners=s,p.emit=s,p.prependListener=s,p.prependOnceListener=s,p.listeners=function(t){return[]},p.binding=function(t){throw Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(t){throw Error("process.chdir is not supported")},p.umask=function(){return 0}}])});