Skip to content

Commit

Permalink
fix: remove ensure wallet in argent mobile and argent webwallet conne…
Browse files Browse the repository at this point in the history
…ctors when request is invoked
  • Loading branch information
bluecco committed Aug 19, 2024
1 parent f4fee9b commit 071acfb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
17 changes: 8 additions & 9 deletions src/connectors/argentMobile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,19 @@ export class ArgentMobileBaseConnector extends Connector {
}

async ready(): Promise<boolean> {
// 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 {
Expand Down Expand Up @@ -150,8 +151,6 @@ export class ArgentMobileBaseConnector extends Connector {
async request<T extends RpcMessage["type"]>(
call: RequestFnCall<T>,
): Promise<RpcTypeToMessageMap[T]["result"]> {
this.ensureWallet()

if (!this._wallet) {
throw new ConnectorNotConnectedError()
}
Expand Down
12 changes: 8 additions & 4 deletions src/connectors/webwallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 071acfb

Please sign in to comment.