Skip to content

Commit

Permalink
Detect connected wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
lserra-iov authored and alexjavabraz committed Nov 8, 2023
1 parent 010f167 commit ecd202d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/common/store/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ export const PEGIN_TX_IS_HD_WALLET = 'PEGIN_TX_IS_HD_WALLET';
// Session getters
export const SESSION_IN_TX_FLOW = 'SESSION_IN_TX_FLOW';
export const SESSION_IS_LEDGER_CONNECTED = 'SESSION_IS_LEDGER_CONNECTED';
export const SESSION_IS_TREZOR_CONNECTED = 'SESSION_IS_TREZOR_CONNECTED';
export const SESSION_IS_METAMASK_CONNECTED = 'SESSION_IS_METAMASK_CONNECTED';
export const SESSION_IS_RLOGIN_DEFINED = 'SESSION_IS_RLOGIN_DEFINED';

// environment
export const BTC_NETWORK_MAINNET = 'main';
Expand Down
4 changes: 4 additions & 0 deletions src/common/store/session/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ import { RootState } from '@/common/types/store';
export const getters: GetterTree<SessionState, RootState> = {
[constants.SESSION_IN_TX_FLOW]: (state): boolean => state.txType !== undefined,
[constants.SESSION_IS_LEDGER_CONNECTED]: (state): boolean => !!(state.rLogin?.provider.isLedger),
[constants.SESSION_IS_TREZOR_CONNECTED]: (state): boolean => !!(state.rLogin?.provider.isTrezor),
[constants.SESSION_IS_METAMASK_CONNECTED]:
(state): boolean => !!(state.rLogin?.provider.isMetamask),
[constants.SESSION_IS_RLOGIN_DEFINED]: (state): boolean => state.rLogin !== undefined,
};

0 comments on commit ecd202d

Please sign in to comment.