From 071acfb1c62ccc241f5723835db387ff2ab64488 Mon Sep 17 00:00:00 2001 From: bluecco Date: Mon, 19 Aug 2024 14:06:13 +0200 Subject: [PATCH] fix: remove ensure wallet in argent mobile and argent webwallet connectors when request is invoked --- src/connectors/argentMobile/index.ts | 17 ++++++++--------- src/connectors/webwallet/index.ts | 12 ++++++++---- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/connectors/argentMobile/index.ts b/src/connectors/argentMobile/index.ts index 51809ce..27904b8 100644 --- a/src/connectors/argentMobile/index.ts +++ b/src/connectors/argentMobile/index.ts @@ -56,18 +56,19 @@ export class ArgentMobileBaseConnector extends Connector { } async ready(): Promise { - // check if session is valid and retrieve the wallet - // if no sessions, it will show the login modal - await this.ensureWallet() if (!this._wallet) { return false } - const permissions = await this._wallet.request({ - type: "wallet_getPermissions", - }) + try { + const permissions = await this._wallet.request({ + type: "wallet_getPermissions", + }) - return (permissions as Permission[]).includes(Permission.ACCOUNTS) + return (permissions as Permission[]).includes(Permission.ACCOUNTS) + } catch { + return false + } } get id(): string { @@ -150,8 +151,6 @@ export class ArgentMobileBaseConnector extends Connector { async request( call: RequestFnCall, ): Promise { - this.ensureWallet() - if (!this._wallet) { throw new ConnectorNotConnectedError() } diff --git a/src/connectors/webwallet/index.ts b/src/connectors/webwallet/index.ts index d736db4..e8ab863 100644 --- a/src/connectors/webwallet/index.ts +++ b/src/connectors/webwallet/index.ts @@ -54,11 +54,15 @@ export class WebWalletConnector extends Connector { } this._wallet = _wallet - const permissions = await this._wallet.request({ - type: "wallet_getPermissions", - }) + try { + const permissions = await this._wallet.request({ + type: "wallet_getPermissions", + }) - return (permissions as Permission[]).includes(Permission.ACCOUNTS) + return (permissions as Permission[]).includes(Permission.ACCOUNTS) + } catch { + return false + } } get id(): string {