@web3auth/metamask-adapter
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -126,3 +126,3 @@ /******/ (() => { // webpackBootstrap | ||
if (chainId !== this.chainConfig.chainId) { | ||
if (!this.getChainConfig(this.chainConfig.chainId)) await this.addChain(this.chainConfig, true); | ||
await this.addChain(this.chainConfig, true); | ||
await this.switchChain(this.chainConfig, true); | ||
@@ -132,6 +132,9 @@ } | ||
if (!this.provider) throw base_namespaceObject.WalletLoginError.notConnectedError("Failed to connect with provider"); | ||
this.provider.once("disconnect", () => { | ||
const disconnectHandler = () => { | ||
var _this$provider; | ||
// ready to be connected again | ||
this.disconnect(); | ||
}); | ||
(_this$provider = this.provider) === null || _this$provider === void 0 ? void 0 : _this$provider.removeListener("disconnect", disconnectHandler); | ||
}; | ||
this.provider.on("disconnect", disconnectHandler); | ||
this.emit(base_namespaceObject.ADAPTER_EVENTS.CONNECTED, { | ||
@@ -152,3 +155,3 @@ adapter: base_namespaceObject.WALLET_ADAPTERS.METAMASK, | ||
async disconnect() { | ||
var _this$provider; | ||
var _this$provider2; | ||
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { | ||
@@ -158,3 +161,3 @@ cleanup: false | ||
await super.disconnectSession(); | ||
(_this$provider = this.provider) === null || _this$provider === void 0 ? void 0 : _this$provider.removeAllListeners(); | ||
(_this$provider2 = this.provider) === null || _this$provider2 === void 0 ? void 0 : _this$provider2.removeAllListeners(); | ||
if (options.cleanup) { | ||
@@ -161,0 +164,0 @@ this.status = base_namespaceObject.ADAPTER_STATUS.NOT_READY; |
@@ -60,3 +60,3 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
if (chainId !== this.chainConfig.chainId) { | ||
if (!this.getChainConfig(this.chainConfig.chainId)) await this.addChain(this.chainConfig, true); | ||
await this.addChain(this.chainConfig, true); | ||
await this.switchChain(this.chainConfig, true); | ||
@@ -66,6 +66,9 @@ } | ||
if (!this.provider) throw WalletLoginError.notConnectedError("Failed to connect with provider"); | ||
this.provider.once("disconnect", () => { | ||
const disconnectHandler = () => { | ||
var _this$provider; | ||
// ready to be connected again | ||
this.disconnect(); | ||
}); | ||
(_this$provider = this.provider) === null || _this$provider === void 0 ? void 0 : _this$provider.removeListener("disconnect", disconnectHandler); | ||
}; | ||
this.provider.on("disconnect", disconnectHandler); | ||
this.emit(ADAPTER_EVENTS.CONNECTED, { | ||
@@ -86,3 +89,3 @@ adapter: WALLET_ADAPTERS.METAMASK, | ||
async disconnect() { | ||
var _this$provider; | ||
var _this$provider2; | ||
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { | ||
@@ -92,3 +95,3 @@ cleanup: false | ||
await super.disconnectSession(); | ||
(_this$provider = this.provider) === null || _this$provider === void 0 ? void 0 : _this$provider.removeAllListeners(); | ||
(_this$provider2 = this.provider) === null || _this$provider2 === void 0 ? void 0 : _this$provider2.removeAllListeners(); | ||
if (options.cleanup) { | ||
@@ -95,0 +98,0 @@ this.status = ADAPTER_STATUS.NOT_READY; |
{ | ||
"name": "@web3auth/metamask-adapter", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "metamask wallet adapter for web3auth", | ||
@@ -58,3 +58,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "82f054192a0f892f5e749ad7bc3f5df5bf12b2d8" | ||
"gitHead": "6e1f73cbb8e4b165ce00d9338a2d173942c4997d" | ||
} |
@@ -85,3 +85,3 @@ import detectEthereumProvider from "@metamask/detect-provider"; | ||
if (chainId !== (this.chainConfig as CustomChainConfig).chainId) { | ||
if (!this.getChainConfig((this.chainConfig as CustomChainConfig).chainId)) await this.addChain(this.chainConfig as CustomChainConfig, true); | ||
await this.addChain(this.chainConfig as CustomChainConfig, true); | ||
await this.switchChain(this.chainConfig as CustomChainConfig, true); | ||
@@ -91,6 +91,8 @@ } | ||
if (!this.provider) throw WalletLoginError.notConnectedError("Failed to connect with provider"); | ||
this.provider.once("disconnect", () => { | ||
const disconnectHandler = () => { | ||
// ready to be connected again | ||
this.disconnect(); | ||
}); | ||
this.provider?.removeListener("disconnect", disconnectHandler); | ||
}; | ||
this.provider.on("disconnect", disconnectHandler); | ||
this.emit(ADAPTER_EVENTS.CONNECTED, { adapter: WALLET_ADAPTERS.METAMASK, reconnected: this.rehydrated } as CONNECTED_EVENT_DATA); | ||
@@ -97,0 +99,0 @@ return this.provider; |
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 too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1854025
1968