@oasisdex/injected-connector
Advanced tools
Comparing version 6.1.10 to 6.1.11
interface Ethereum { | ||
sendAsync: unknown; | ||
request: unknown; | ||
enable: () => Promise<string[]>; | ||
@@ -4,0 +4,0 @@ on?: (method: string, listener: (...args: any[]) => void) => void; |
@@ -273,6 +273,8 @@ 'use strict'; | ||
var _temp6 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_requestAccounts').then(function (sendReturn) { | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_requestAccounts' | ||
}).then(function (sendReturn) { | ||
return parseSendReturn(sendReturn)[0]; | ||
})).then(function (_window$ethereum$send) { | ||
account = _window$ethereum$send; | ||
})).then(function (_window$ethereum$requ) { | ||
account = _window$ethereum$requ; | ||
}); | ||
@@ -307,3 +309,3 @@ }, function (error) { | ||
try { | ||
chainId = parseSendReturn(window.ethereum.sendAsync({ | ||
chainId = parseSendReturn(window.ethereum.request({ | ||
method: 'net_version' | ||
@@ -330,4 +332,6 @@ })); | ||
var _temp14 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('net_version').then(parseSendReturn)).then(function (_window$ethereum$send3) { | ||
chainId = _window$ethereum$send3; | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'net_version' | ||
}).then(parseSendReturn)).then(function (_window$ethereum$requ3) { | ||
chainId = _window$ethereum$requ3; | ||
}); | ||
@@ -352,4 +356,6 @@ }, function () { | ||
var _temp13 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_chainId').then(parseSendReturn)).then(function (_window$ethereum$send2) { | ||
chainId = _window$ethereum$send2; | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_chainId' | ||
}).then(parseSendReturn)).then(function (_window$ethereum$requ2) { | ||
chainId = _window$ethereum$requ2; | ||
}); | ||
@@ -371,3 +377,3 @@ }, function () { | ||
if (!account) { | ||
account = parseSendReturn(window.ethereum.sendAsync({ | ||
account = parseSendReturn(window.ethereum.request({ | ||
method: 'eth_accounts' | ||
@@ -406,6 +412,8 @@ }))[0]; | ||
var _temp21 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_accounts').then(function (sendReturn) { | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_accounts' | ||
}).then(function (sendReturn) { | ||
return parseSendReturn(sendReturn)[0]; | ||
})).then(function (_window$ethereum$send4) { | ||
account = _window$ethereum$send4; | ||
})).then(function (_window$ethereum$requ4) { | ||
account = _window$ethereum$requ4; | ||
}); | ||
@@ -437,3 +445,5 @@ }, function () { | ||
return Promise.resolve(_catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_accounts').then(function (sendReturn) { | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_accounts' | ||
}).then(function (sendReturn) { | ||
if (parseSendReturn(sendReturn).length > 0) { | ||
@@ -440,0 +450,0 @@ return true; |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("@web3-react/abstract-connector");function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function t(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,n){return(o=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function i(){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 u(e,n,t){return(u=i()?Reflect.construct:function(e,n,t){var r=[null];r.push.apply(r,n);var i=new(Function.bind.apply(e,r));return t&&o(i,t.prototype),i}).apply(null,arguments)}function c(e){var n="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return u(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),o(t,e)})(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}function s(e){return e.hasOwnProperty("result")?e.result:e}require("tiny-warning"),"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f=function(e){function n(){var n;return(n=e.call(this)||this).name=n.constructor.name,n.message="No Ethereum provider was found on window.ethereum.",n}return t(n,e),n}(c(Error)),d=function(e){function n(){var n;return(n=e.call(this)||this).name=n.constructor.name,n.message="The user rejected the request.",n}return t(n,e),n}(c(Error));exports.InjectedConnector=function(e){function r(n){var t;return(t=e.call(this,n)||this).handleChainChanged=t.handleChainChanged.bind(h(t)),t.handleAccountsChanged=t.handleAccountsChanged.bind(h(t)),t.handleDisconnect=t.handleDisconnect.bind(h(t)),t}t(r,e);var o=r.prototype;return o.handleChainChanged=function(e){this.emitUpdate({chainId:e,provider:window.ethereum})},o.handleAccountsChanged=function(e){0===e.length?this.emitDeactivate():this.emitUpdate({account:e[0]})},o.handleDisconnect=function(e,n){this.emitDeactivate()},o.activate=function(){try{var e,t=function(t){if(r)return t;function o(){return n({provider:window.ethereum},e?{account:e}:{})}var i=function(){if(!e)return Promise.resolve(window.ethereum.enable().then((function(e){return e&&s(e)[0]}))).then((function(n){e=n}))}();return i&&i.then?i.then(o):o()},r=!1;if(!window.ethereum)throw new f;window.ethereum.on&&(window.ethereum.on("chainChanged",this.handleChainChanged),window.ethereum.on("accountsChanged",this.handleAccountsChanged),window.ethereum.on("disconnect",this.handleDisconnect)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var o=a((function(){return Promise.resolve(window.ethereum.sendAsync("eth_requestAccounts").then((function(e){return s(e)[0]}))).then((function(n){e=n}))}),(function(e){if(4001===e.code)throw new d}));return Promise.resolve(o&&o.then?o.then(t):t(o))}catch(e){return Promise.reject(e)}},o.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(e){return Promise.reject(e)}},o.getChainId=function(){try{var e,n=function(){function n(){if(!e)try{e=s(window.ethereum.sendAsync({method:"net_version"}))}catch(e){}return e||(e=window.ethereum.isDapper?s(window.ethereum.cachedResults.net_version):window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),e}var t=function(){if(!e){var n=a((function(){return Promise.resolve(window.ethereum.sendAsync("net_version").then(s)).then((function(n){e=n}))}),(function(){}));if(n&&n.then)return n.then((function(){}))}}();return t&&t.then?t.then(n):n()};if(!window.ethereum)throw new f;var t=a((function(){return Promise.resolve(window.ethereum.sendAsync("eth_chainId").then(s)).then((function(n){e=n}))}),(function(){}));return Promise.resolve(t&&t.then?t.then(n):n())}catch(e){return Promise.reject(e)}},o.getAccount=function(){try{var e,n=function(){function n(){return e||(e=s(window.ethereum.sendAsync({method:"eth_accounts"}))[0]),e}var t=function(){if(!e){var n=a((function(){return Promise.resolve(window.ethereum.enable().then((function(e){return s(e)[0]}))).then((function(n){e=n}))}),(function(){}));if(n&&n.then)return n.then((function(){}))}}();return t&&t.then?t.then(n):n()};if(!window.ethereum)throw new f;var t=a((function(){return Promise.resolve(window.ethereum.sendAsync("eth_accounts").then((function(e){return s(e)[0]}))).then((function(n){e=n}))}),(function(){}));return Promise.resolve(t&&t.then?t.then(n):n())}catch(e){return Promise.reject(e)}},o.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("disconnect",this.handleDisconnect))},o.isAuthorized=function(){try{return window.ethereum?Promise.resolve(a((function(){return Promise.resolve(window.ethereum.sendAsync("eth_accounts").then((function(e){return s(e).length>0})))}),(function(){return!1}))):Promise.resolve(!1)}catch(e){return Promise.reject(e)}},r}(e.AbstractConnector),exports.NoEthereumProviderError=f,exports.UserRejectedRequestError=d; | ||
"use strict";var e=require("@web3-react/abstract-connector");function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(){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 u(e,t,n){return(u=i()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return u(e,arguments,r(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,e)})(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function s(e){return e.hasOwnProperty("result")?e.result:e}require("tiny-warning"),"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var f=function(e){function t(){var t;return(t=e.call(this)||this).name=t.constructor.name,t.message="No Ethereum provider was found on window.ethereum.",t}return n(t,e),t}(c(Error)),d=function(e){function t(){var t;return(t=e.call(this)||this).name=t.constructor.name,t.message="The user rejected the request.",t}return n(t,e),t}(c(Error));exports.InjectedConnector=function(e){function r(t){var n;return(n=e.call(this,t)||this).handleChainChanged=n.handleChainChanged.bind(h(n)),n.handleAccountsChanged=n.handleAccountsChanged.bind(h(n)),n.handleDisconnect=n.handleDisconnect.bind(h(n)),n}n(r,e);var o=r.prototype;return o.handleChainChanged=function(e){this.emitUpdate({chainId:e,provider:window.ethereum})},o.handleAccountsChanged=function(e){0===e.length?this.emitDeactivate():this.emitUpdate({account:e[0]})},o.handleDisconnect=function(e,t){this.emitDeactivate()},o.activate=function(){try{var e,n=function(n){if(r)return n;function o(){return t({provider:window.ethereum},e?{account:e}:{})}var i=function(){if(!e)return Promise.resolve(window.ethereum.enable().then((function(e){return e&&s(e)[0]}))).then((function(t){e=t}))}();return i&&i.then?i.then(o):o()},r=!1;if(!window.ethereum)throw new f;window.ethereum.on&&(window.ethereum.on("chainChanged",this.handleChainChanged),window.ethereum.on("accountsChanged",this.handleAccountsChanged),window.ethereum.on("disconnect",this.handleDisconnect)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var o=a((function(){return Promise.resolve(window.ethereum.request({method:"eth_requestAccounts"}).then((function(e){return s(e)[0]}))).then((function(t){e=t}))}),(function(e){if(4001===e.code)throw new d}));return Promise.resolve(o&&o.then?o.then(n):n(o))}catch(e){return Promise.reject(e)}},o.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(e){return Promise.reject(e)}},o.getChainId=function(){try{var e,t=function(){function t(){if(!e)try{e=s(window.ethereum.request({method:"net_version"}))}catch(e){}return e||(e=window.ethereum.isDapper?s(window.ethereum.cachedResults.net_version):window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),e}var n=function(){if(!e){var t=a((function(){return Promise.resolve(window.ethereum.request({method:"net_version"}).then(s)).then((function(t){e=t}))}),(function(){}));if(t&&t.then)return t.then((function(){}))}}();return n&&n.then?n.then(t):t()};if(!window.ethereum)throw new f;var n=a((function(){return Promise.resolve(window.ethereum.request({method:"eth_chainId"}).then(s)).then((function(t){e=t}))}),(function(){}));return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},o.getAccount=function(){try{var e,t=function(){function t(){return e||(e=s(window.ethereum.request({method:"eth_accounts"}))[0]),e}var n=function(){if(!e){var t=a((function(){return Promise.resolve(window.ethereum.enable().then((function(e){return s(e)[0]}))).then((function(t){e=t}))}),(function(){}));if(t&&t.then)return t.then((function(){}))}}();return n&&n.then?n.then(t):t()};if(!window.ethereum)throw new f;var n=a((function(){return Promise.resolve(window.ethereum.request({method:"eth_accounts"}).then((function(e){return s(e)[0]}))).then((function(t){e=t}))}),(function(){}));return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},o.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("disconnect",this.handleDisconnect))},o.isAuthorized=function(){try{return window.ethereum?Promise.resolve(a((function(){return Promise.resolve(window.ethereum.request({method:"eth_accounts"}).then((function(e){return s(e).length>0})))}),(function(){return!1}))):Promise.resolve(!1)}catch(e){return Promise.reject(e)}},r}(e.AbstractConnector),exports.NoEthereumProviderError=f,exports.UserRejectedRequestError=d; | ||
//# sourceMappingURL=injected-connector.cjs.production.min.js.map |
@@ -269,6 +269,8 @@ import { AbstractConnector } from '@web3-react/abstract-connector'; | ||
var _temp6 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_requestAccounts').then(function (sendReturn) { | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_requestAccounts' | ||
}).then(function (sendReturn) { | ||
return parseSendReturn(sendReturn)[0]; | ||
})).then(function (_window$ethereum$send) { | ||
account = _window$ethereum$send; | ||
})).then(function (_window$ethereum$requ) { | ||
account = _window$ethereum$requ; | ||
}); | ||
@@ -303,3 +305,3 @@ }, function (error) { | ||
try { | ||
chainId = parseSendReturn(window.ethereum.sendAsync({ | ||
chainId = parseSendReturn(window.ethereum.request({ | ||
method: 'net_version' | ||
@@ -326,4 +328,6 @@ })); | ||
var _temp14 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('net_version').then(parseSendReturn)).then(function (_window$ethereum$send3) { | ||
chainId = _window$ethereum$send3; | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'net_version' | ||
}).then(parseSendReturn)).then(function (_window$ethereum$requ3) { | ||
chainId = _window$ethereum$requ3; | ||
}); | ||
@@ -348,4 +352,6 @@ }, function () { | ||
var _temp13 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_chainId').then(parseSendReturn)).then(function (_window$ethereum$send2) { | ||
chainId = _window$ethereum$send2; | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_chainId' | ||
}).then(parseSendReturn)).then(function (_window$ethereum$requ2) { | ||
chainId = _window$ethereum$requ2; | ||
}); | ||
@@ -367,3 +373,3 @@ }, function () { | ||
if (!account) { | ||
account = parseSendReturn(window.ethereum.sendAsync({ | ||
account = parseSendReturn(window.ethereum.request({ | ||
method: 'eth_accounts' | ||
@@ -402,6 +408,8 @@ }))[0]; | ||
var _temp21 = _catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_accounts').then(function (sendReturn) { | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_accounts' | ||
}).then(function (sendReturn) { | ||
return parseSendReturn(sendReturn)[0]; | ||
})).then(function (_window$ethereum$send4) { | ||
account = _window$ethereum$send4; | ||
})).then(function (_window$ethereum$requ4) { | ||
account = _window$ethereum$requ4; | ||
}); | ||
@@ -433,3 +441,5 @@ }, function () { | ||
return Promise.resolve(_catch(function () { | ||
return Promise.resolve(window.ethereum.sendAsync('eth_accounts').then(function (sendReturn) { | ||
return Promise.resolve(window.ethereum.request({ | ||
method: 'eth_accounts' | ||
}).then(function (sendReturn) { | ||
if (parseSendReturn(sendReturn).length > 0) { | ||
@@ -436,0 +446,0 @@ return true; |
@@ -5,2 +5,6 @@ export declare type SendReturnResult = { | ||
export declare type SendReturn = any; | ||
export declare type Request = ({ method, params }: { | ||
method: string; | ||
params?: any[]; | ||
}) => Promise<SendReturn>; | ||
export declare type Send = (method: string, params?: any[]) => Promise<SendReturnResult | SendReturn>; | ||
@@ -7,0 +11,0 @@ export declare type SendOld = ({ method }: { |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "6.1.10", | ||
"version": "6.1.11", | ||
"description": "A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
"license": "GPL-3.0-or-later", | ||
"gitHead": "6af954c1d804ff6fbe574c2d8a784c6b3d4b6328" | ||
"gitHead": "91b6daa5a5785e145f6b519debeb352e96ca94cb" | ||
} |
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
176236
825