Skip to content

Commit

Permalink
Merge pull request #126 from argentlabs/fix/argent-ww-mobile-connectors
Browse files Browse the repository at this point in the history
fix: remove ensure wallet in argent mobile and argent webwallet
  • Loading branch information
bluecco authored Aug 20, 2024
2 parents f4fee9b + 071acfb commit 2d6a64e
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 2d6a64e

Please sign in to comment.