import React, { Component } from 'react'; import { connect } from 'react-redux'; import WalletDecrypt, { DISABLE_WALLETS } from 'components/WalletDecrypt'; import translate, { translateRaw } from 'translations'; import { showNotification, TShowNotification } from 'actions/notifications'; import { resetWallet, TResetWallet } from 'actions/wallet'; import { ISignedMessage } from 'libs/signing'; import { IFullWallet } from 'libs/wallet'; import { AppState } from 'reducers'; import SignButton from './SignButton'; import { isWalletFullyUnlocked } from 'selectors/wallet'; import './index.scss'; import { TextArea, CodeBlock } from 'components/ui'; interface Props { wallet: IFullWallet; unlocked: boolean; showNotification: TShowNotification; resetWallet: TResetWallet; } interface State { message: string; signedMessage: ISignedMessage | null; } const initialState: State = { message: '', signedMessage: null }; const messagePlaceholder = translateRaw('SIGN_MSG_PLACEHOLDER'); export class SignMessage extends Component { public state: State = initialState; public componentWillUnmount() { this.props.resetWallet(); } public render() { const { wallet, unlocked } = this.props; const { message, signedMessage } = this.state; return (
{unlocked ? (