From 055dfbf227c991af9f6bd7936de52f04038323d6 Mon Sep 17 00:00:00 2001 From: Wan <495709+wa0x6e@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:11:03 +0700 Subject: [PATCH] fix: fix deprecated usage of `selectedAddress` (#105) * fix: fix deprecated usage of `selectedAddress` * chore: bump version --- connectors/injected.ts | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/connectors/injected.ts b/connectors/injected.ts index c93a31b..d60596d 100644 --- a/connectors/injected.ts +++ b/connectors/injected.ts @@ -19,8 +19,8 @@ export default class Connector extends LockConnector { async isLoggedIn() { if (!window['ethereum']) return false; - if (window['ethereum'].selectedAddress) return true; + if (window['ethereum'].request({method: 'eth_accounts'})) return true; await new Promise((r) => setTimeout(r, 400)); - return !!window['ethereum'].selectedAddress; + return !!window['ethereum'].request({method: 'eth_accounts'}); } } diff --git a/package.json b/package.json index 1fc84dd..ea6a06e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@snapshot-labs/lock", - "version": "0.2.2", + "version": "0.2.3", "repository": "snapshot-labs/lock", "license": "MIT", "main": "dist/lock.cjs.js",