@web3-react/network-connector
Advanced tools
Comparing version 6.1.5 to 6.1.9
@@ -11,3 +11,4 @@ 'use strict'; | ||
subClass.prototype.constructor = subClass; | ||
subClass.__proto__ = superClass; | ||
_setPrototypeOf(subClass, superClass); | ||
} | ||
@@ -14,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";var t,e=require("@web3-react/abstract-connector"),r=(t=require("tiny-invariant"))&&"object"==typeof t&&"default"in t?t.default:t;function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(){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 c(t,e,r){return(c=u()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function s(t){var e="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return c(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}var a=function(t){function e(e,r,n){var o;return(o=t.call(this)||this).code=r,o.data=n,o.name=o.constructor.name,o.message=e,o}return n(e,t),e}(s(Error)),f=function(t,e){var r=this,n=this;this.isMetaMask=!1,this.sendAsync=function(t,e){console.log("sendAsync",t.method,t.params),n.request(t.method,t.params).then((function(r){return e(null,{jsonrpc:"2.0",id:t.id,result:r})})).catch((function(t){return e(t,null)}))},this.request=function(t,e){try{return"string"!=typeof t&&(e=t.params,t=t.method),Promise.resolve(fetch(r.url,{method:"POST",body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:e})})).then((function(e){if(!e.ok)throw new a(e.status+": "+e.statusText,-32e3);return Promise.resolve(e.json()).then((function(e){var r,n,o;if("error"in e)throw new a(null==e||null==(r=e.error)?void 0:r.message,null==e||null==(n=e.error)?void 0:n.code,null==e||null==(o=e.error)?void 0:o.data);if("result"in e)return e.result;throw new a("Received unexpected JSON-RPC response to "+t+" request.",-32e3,e)}))}))}catch(t){return Promise.reject(t)}},this.chainId=t,this.url=e;var o=new URL(e);this.host=o.host,this.path=o.pathname};exports.NetworkConnector=function(t){function e(e){var n,o=e.urls,i=e.defaultChainId;return i||1===Object.keys(o).length||r(!1),(n=t.call(this,{supportedChainIds:Object.keys(o).map((function(t){return Number(t)}))})||this).currentChainId=i||Number(Object.keys(o)[0]),n.providers=Object.keys(o).reduce((function(t,e){return t[Number(e)]=new f(Number(e),o[Number(e)]),t}),{}),n}n(e,t);var o=e.prototype;return o.activate=function(){try{return Promise.resolve({provider:this.providers[this.currentChainId],chainId:this.currentChainId,account:null})}catch(t){return Promise.reject(t)}},o.getProvider=function(){try{return Promise.resolve(this.providers[this.currentChainId])}catch(t){return Promise.reject(t)}},o.getChainId=function(){try{return Promise.resolve(this.currentChainId)}catch(t){return Promise.reject(t)}},o.getAccount=function(){return Promise.resolve(null)},o.deactivate=function(){},o.changeChainId=function(t){Object.keys(this.providers).includes(t.toString())||r(!1),this.currentChainId=t,this.emitUpdate({provider:this.providers[this.currentChainId],chainId:t})},e}(e.AbstractConnector),exports.RequestError=a; | ||
"use strict";var t,e=require("@web3-react/abstract-connector"),r=(t=require("tiny-invariant"))&&"object"==typeof t&&"default"in t?t.default:t;function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(){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 c(t,e,r){return(c=u()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function s(t){var e="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return c(t,arguments,o(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,t)})(t)}var a=function(t){function e(e,r,n){var o;return(o=t.call(this)||this).code=r,o.data=n,o.name=o.constructor.name,o.message=e,o}return n(e,t),e}(s(Error)),f=function(t,e){var r=this,n=this;this.isMetaMask=!1,this.sendAsync=function(t,e){console.log("sendAsync",t.method,t.params),n.request(t.method,t.params).then((function(r){return e(null,{jsonrpc:"2.0",id:t.id,result:r})})).catch((function(t){return e(t,null)}))},this.request=function(t,e){try{return"string"!=typeof t&&(e=t.params,t=t.method),Promise.resolve(fetch(r.url,{method:"POST",body:JSON.stringify({jsonrpc:"2.0",id:1,method:t,params:e})})).then((function(e){if(!e.ok)throw new a(e.status+": "+e.statusText,-32e3);return Promise.resolve(e.json()).then((function(e){var r,n,o;if("error"in e)throw new a(null==e||null==(r=e.error)?void 0:r.message,null==e||null==(n=e.error)?void 0:n.code,null==e||null==(o=e.error)?void 0:o.data);if("result"in e)return e.result;throw new a("Received unexpected JSON-RPC response to "+t+" request.",-32e3,e)}))}))}catch(t){return Promise.reject(t)}},this.chainId=t,this.url=e;var o=new URL(e);this.host=o.host,this.path=o.pathname};exports.NetworkConnector=function(t){function e(e){var n,o=e.urls,i=e.defaultChainId;return i||1===Object.keys(o).length||r(!1),(n=t.call(this,{supportedChainIds:Object.keys(o).map((function(t){return Number(t)}))})||this).currentChainId=i||Number(Object.keys(o)[0]),n.providers=Object.keys(o).reduce((function(t,e){return t[Number(e)]=new f(Number(e),o[Number(e)]),t}),{}),n}n(e,t);var o=e.prototype;return o.activate=function(){try{return Promise.resolve({provider:this.providers[this.currentChainId],chainId:this.currentChainId,account:null})}catch(t){return Promise.reject(t)}},o.getProvider=function(){try{return Promise.resolve(this.providers[this.currentChainId])}catch(t){return Promise.reject(t)}},o.getChainId=function(){try{return Promise.resolve(this.currentChainId)}catch(t){return Promise.reject(t)}},o.getAccount=function(){return Promise.resolve(null)},o.deactivate=function(){},o.changeChainId=function(t){Object.keys(this.providers).includes(t.toString())||r(!1),this.currentChainId=t,this.emitUpdate({provider:this.providers[this.currentChainId],chainId:t})},e}(e.AbstractConnector),exports.RequestError=a; | ||
//# sourceMappingURL=network-connector.cjs.production.min.js.map |
@@ -7,3 +7,4 @@ import { AbstractConnector } from '@web3-react/abstract-connector'; | ||
subClass.prototype.constructor = subClass; | ||
subClass.__proto__ = superClass; | ||
_setPrototypeOf(subClass, superClass); | ||
} | ||
@@ -10,0 +11,0 @@ |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "6.1.5", | ||
"version": "6.1.9", | ||
"description": "A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"license": "GPL-3.0-or-later", | ||
"gitHead": "18c16023a5328bb299727d86ac4d5e67bc9e2c86" | ||
"gitHead": "fe26e6706a08ec46cef3c1711e3838d1547f7663" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
80041