Skip to content

Commit

Permalink
chore(suite): gate walletconnect deeplink behind debug
Browse files Browse the repository at this point in the history
  • Loading branch information
martykan committed Feb 6, 2025
1 parent 5eac1eb commit 51b5434
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/suite/src/actions/suite/protocolActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { SUITE_BRIDGE_DEEPLINK, SUITE_WALLETCONNECT_DEEPLINK } from '@trezor/url

import * as routerActions from 'src/actions/suite/routerActions';
import type { SendFormState } from 'src/reducers/suite/protocolReducer';
import type { Dispatch } from 'src/types/suite';
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';
import type { Dispatch, GetState } from 'src/types/suite';
import { parseUri } from 'src/utils/suite/parseUri';
import { CoinProtocolInfo, getProtocolInfo } from 'src/utils/suite/protocol';

Expand All @@ -33,7 +34,7 @@ const saveCoinProtocol = (scheme: Protocol, address: string, amount?: number): P
payload: { scheme, address, amount },
});

export const handleProtocolRequest = (uri: string) => (dispatch: Dispatch) => {
export const handleProtocolRequest = (uri: string) => (dispatch: Dispatch, getState: GetState) => {
const protocol = getProtocolInfo(uri);

if (protocol && !('error' in protocol) && getNetworkSymbolForProtocol(protocol.scheme)) {
Expand All @@ -52,6 +53,10 @@ export const handleProtocolRequest = (uri: string) => (dispatch: Dispatch) => {
} else if (uri?.startsWith(SUITE_BRIDGE_DEEPLINK)) {
dispatch(routerActions.goto('suite-bridge-requested', { params: { cancelable: true } }));
} else if (uri?.startsWith(SUITE_WALLETCONNECT_DEEPLINK)) {
// This feature is currently only available in debug mode
const isDebug = selectIsDebugModeActive(getState());
if (!isDebug) return;

const parsedUri = parseUri(uri);
const wcUri = parsedUri?.searchParams?.get('uri');
if (wcUri) {
Expand Down

0 comments on commit 51b5434

Please sign in to comment.