From 34730c6f12bf0a06f307bd750751b0811dc944fa Mon Sep 17 00:00:00 2001 From: less Date: Sun, 1 Dec 2024 15:50:57 +0700 Subject: [PATCH] fix: injected MetaMask flag overwrite --- package.json | 2 +- src/utils.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 32a3469..fed4f03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@snapshot-labs/lock", - "version": "0.2.9", + "version": "0.2.10", "repository": "snapshot-labs/lock", "license": "MIT", "main": "dist/lock.cjs.js", diff --git a/src/utils.ts b/src/utils.ts index 8f8c0f0..54bcdd1 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -5,9 +5,15 @@ export function getInjected() { if (!web3) return; + let injected = { + name: 'Injected', + id: 'web3', + icon: 'ipfs://QmXUov1JMszHkizCf3HvmcKWKm9PrG2KHpd5bDnE5YbZN8' + }; + for (const wallet of wallets) { if (web3[wallet.flag]) { - return { + injected = { name: wallet.name, id: wallet.id, icon: wallet.icon @@ -15,9 +21,5 @@ export function getInjected() { } } - return { - name: 'Injected', - id: 'web3', - icon: 'ipfs://QmXUov1JMszHkizCf3HvmcKWKm9PrG2KHpd5bDnE5YbZN8' - }; + return injected; }