William O'Beirne 2309d05c06 Disable more wallets conditionally + explain why (#924)
* Add more wallet disables, move all into selector.

* Add reasons for disabled wallets.

* Disable read only in lite send.

* Fix view address showing insecure icon.
2018-01-26 14:08:39 -06:00

32 lines
882 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { MiscWalletName, SecureWalletName, WalletName } from 'config';
export interface DisabledWallets {
wallets: WalletName[];
reasons: {
[key: string]: string;
};
}
enum WalletMode {
READ_ONLY = 'READ_ONLY',
UNABLE_TO_SIGN = 'UNABLE_TO_SIGN'
}
// Duplicating reasons is kind of tedious, but saves having to run through a
// bunch of loops to format it differently
export const DISABLE_WALLETS: { [key in WalletMode]: DisabledWallets } = {
[WalletMode.READ_ONLY]: {
wallets: [MiscWalletName.VIEW_ONLY],
reasons: {
[MiscWalletName.VIEW_ONLY]: 'Read only is not allowed'
}
},
[WalletMode.UNABLE_TO_SIGN]: {
wallets: [SecureWalletName.TREZOR, MiscWalletName.VIEW_ONLY],
reasons: {
[SecureWalletName.TREZOR]: 'This wallet cant sign messages',
[MiscWalletName.VIEW_ONLY]: 'This wallet cant sign messages'
}
}
};