Skip to content

Commit

Permalink
fix: prevent GET_ACCOUNTS from redirecting to app
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCQL committed Oct 4, 2023
1 parent db3d64e commit 3d391cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## `v0.0.34`

### Fixes

- Prevent redirecting users to the mobile app when querying for the user's account via WalletConnect (on first connect)

## `v0.0.33`

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cosmes",
"version": "0.0.33",
"version": "0.0.34",
"private": false,
"packageManager": "[email protected]",
"sideEffects": false,
Expand Down
6 changes: 5 additions & 1 deletion src/wallet/walletconnect/WalletConnectV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ export class WalletConnectV2 {
throw new Error("Session not found for " + chainId);
}
const { topic } = JSON.parse(session) as StorageSession;
if (isMobile()) {
if (
isMobile() &&
// GET_ACCOUNTS does not require the user to authorise
method !== Method.GET_ACCOUNTS
) {
window.location.href = isAndroid()
? this.mobileAppDetails.android
: this.mobileAppDetails.ios;
Expand Down

0 comments on commit 3d391cd

Please sign in to comment.