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 {