View on GitHub
File Changes
  isMainnet: boolean,
  buildLabel: string,
  timestamp: string,
-
  createdAt: Date,
  messages: {
    walletAddressLabel: string,
    recoveryPhraseLabel: string,
  activeItem: string,
  isActiveScreen: Function,
  onWalletNavItemClick: Function,
-
  hasNotification: boolean,
+
  hasNotification?: boolean,
};

                      
@observer
  activeItem: string,
  isActiveNavItem: Function,
  onNavItemClick: Function,
-
  hasNotification: boolean,
+
  hasNotification?: boolean,
};

                      
@observer
});

                      
type Props = {
-
  mnemonicsConfirmationDate: Date,
  walletCreationDate: Date,
  openDialogAction: Function,
  isDialogOpen: Function,
  walletRecoveryPhraseStep1Container: Node,
  walletRecoveryPhraseStep2Container: Node,
  walletRecoveryPhraseStep3Container: Node,
  walletRecoveryPhraseStep4Container: Node,
+
  mnemonicsConfirmationDate: ?Date,
+
  mnemonicsConfirmationStatus: string,
+
  mnemonicsConfirmationStatusType: string,
};

                      
@observer
  }

                      
  get recoveryPhraseStatus() {
-
    const { mnemonicsConfirmationDate, walletCreationDate } = this.props;
-
    const dateToCheck = mnemonicsConfirmationDate || walletCreationDate;
-
    const daysSinceDate = moment().diff(moment(dateToCheck), 'days');
-
    let status = 'ok';
-
    if (daysSinceDate > MNEMONICS_CHECKING_NOTIFICATION)
-
      status = 'notification';
-
    else if (daysSinceDate > MNEMONICS_CHECKING_WARNING) status = 'warning';
-
    const type = mnemonicsConfirmationDate ? 'alreadyChecked' : 'neverChecked';
-
    const statuses = this.statuses[type];
-
    const { icon, message } = statuses[status];
+
    const {
+
      walletCreationDate,
+
      mnemonicsConfirmationDate,
+
      mnemonicsConfirmationStatus,
+
      mnemonicsConfirmationStatusType,
+
    } = this.props;
+

                      
+
    const statuses = this.statuses[mnemonicsConfirmationStatusType];
+
    const { icon, message } = statuses[mnemonicsConfirmationStatus];
    const timeAgo = moment(mnemonicsConfirmationDate).fromNow();
-
    const timeUntilWarning = 'few months, more or less';
-
    const timeUntilNotification = 'couple of days, more or less';
+
    const fromNowToWarning = moment().add(MNEMONICS_CHECKING_WARNING, 'days');
+
    const fromNowToNotification = moment().add(
+
      MNEMONICS_CHECKING_NOTIFICATION,
+
      'days'
+
    );
+
    const timeUntilWarning = moment(walletCreationDate).diff(
+
      fromNowToWarning,
+
      'days'
+
    );
+
    const timeUntilNotification = moment(walletCreationDate).diff(
+
      fromNowToNotification,
+
      'days'
+
    );
    return {
      icon,
      message,
-
      type,
-
      status,
      timeAgo,
      timeUntilWarning,
      timeUntilNotification,
      walletRecoveryPhraseStep2Container,
      walletRecoveryPhraseStep3Container,
      walletRecoveryPhraseStep4Container,
+
      mnemonicsConfirmationStatus,
    } = this.props;
    const {
      icon,
      message,
-
      status,
      timeAgo,
      timeUntilWarning,
      timeUntilNotification,
    } = this.recoveryPhraseStatus;

                      
    const validationStatusStyles = classnames([
      styles.validationStatus,
-
      styles[`validationStatus${capitalize(status)}`],
+
      styles[`validationStatus${capitalize(mnemonicsConfirmationStatus)}`],
    ]);

                      
    return (
    safetyAgreement: false,
  };

                      
-
  onToggleSafetyAgreement = checked => {
+
  onToggleSafetyAgreement = (checked: boolean) => {
    this.setState({
      safetyAgreement: checked,
    });
    safetyAgreement: false,
  };

                      
-
  onToggleSafetyAgreement = checked => {
+
  onToggleSafetyAgreement = (checked: boolean) => {
    this.setState({
      safetyAgreement: checked,
    });
  walletRecoveryPhraseStep2Container: Node,
  walletRecoveryPhraseStep3Container: Node,
  walletRecoveryPhraseStep4Container: Node,
-
  mnemonicsConfirmationDate?: Date,
+
  mnemonicsConfirmationDate: ?Date,
+
  mnemonicsConfirmationStatus: string,
+
  mnemonicsConfirmationStatusType: string,
};

                      
@observer
      walletRecoveryPhraseStep3Container,
      walletRecoveryPhraseStep4Container,
      mnemonicsConfirmationDate,
+
      mnemonicsConfirmationStatus,
+
      mnemonicsConfirmationStatusType,
    } = this.props;

                      
    const assuranceLevelOptions = assuranceLevels.map(assurance => ({

                      
          <WalletRecoveryPhrase
            mnemonicsConfirmationDate={mnemonicsConfirmationDate}
+
            mnemonicsConfirmationStatus={mnemonicsConfirmationStatus}
+
            mnemonicsConfirmationStatusType={mnemonicsConfirmationStatusType}
            walletCreationDate={walletCreationDate}
            openDialogAction={openDialogAction}
            isDialogOpen={isDialogOpen}
      0
    );
    const hasNotification =
+
      wallets.active &&
      wallets.active.mnemonicsConfirmationStatus ===
-
      WalletStatuses.NOTIFICATION;
+
        WalletStatuses.NOTIFICATION;

                      
    return (
      <MainLayout>
import WalletSettings from '../../components/wallet/settings/WalletSettings';
import type { InjectedProps } from '../../types/injectedPropsType';
import { isValidWalletName } from '../../utils/validations';
-
// import { getWalletLocalData } from '../../utils/walletLocalStorage.js';
import ChangeSpendingPasswordDialogContainer from './dialogs/settings/ChangeSpendingPasswordDialogContainer';
import DeleteWalletDialogContainer from './dialogs/settings/DeleteWalletDialogContainer';
import ExportWalletToFileDialogContainer from './dialogs/settings/ExportWalletToFileDialogContainer';
        isSpendingPasswordSet={activeWallet.hasPassword}
        spendingPasswordUpdateDate={activeWallet.passwordUpdateDate}
        mnemonicsConfirmationDate={activeWallet.mnemonicsConfirmationDate}
+
        mnemonicsConfirmationStatus={activeWallet.mnemonicsConfirmationStatus}
+
        mnemonicsConfirmationStatusType={
+
          activeWallet.mnemonicsConfirmationStatusType
+
        }
        isDialogOpen={uiDialogs.isOpen}
        walletId={activeWallet.id}
        walletName={activeWallet.name}
  updateWalletLocalData = () => {
    const { wallets } = this.props.stores;
    const activeWallet = wallets.active;
-
    activeWallet.updateWalletLocalData();
+
    if (activeWallet) activeWallet.updateWalletLocalData();
  };

                      
-
  handleVerify = successful => {
+
  handleVerify = (successful: boolean) => {
    const dialog = successful
      ? WalletRecoveryPhraseStep3Dialog
      : WalletRecoveryPhraseStep4Dialog;
  isDelegated?: boolean,
  delegatedStakePool?: StakePool,
  createdAt: Date,
+
  mnemonicsConfirmationDate: ?Date,
+
  mnemonicsConfirmationStatus: string,
+
  mnemonicsConfirmationStatusType: string,
};

                      
export default class Wallet {
  };

                      
  getWalletStatus = (mnemonicsConfirmationDate: ?Date) => {
-
    const { walletCreationDate } = this;
-
    const dateToCheck = mnemonicsConfirmationDate || walletCreationDate;
+
    const { createdAt } = this;
+
    const dateToCheck = mnemonicsConfirmationDate || createdAt;
    const daysSinceDate = moment().diff(moment(dateToCheck), 'days');
    let status = WalletStatuses.OK;
    if (daysSinceDate > MNEMONICS_CHECKING_NOTIFICATION)

                      
export type WalletLocalData = {
  id: string,
-
  mnemonicsConfirmationDate: ?Date,
+
  mnemonicsConfirmationDate?: ?Date,
};

                      
export const getWalletLocalData = (

                      
export const updateWalletLocalData = (updatedWalletData: {
  id: string,
-
  mnemonicsConfirmationDate: Date,
}): Promise<void> =>
  new Promise(async (resolve, reject) => {
    const walletId = updatedWalletData.id;
        info: '100 ADA',
        isConnected: true,
        isLegacy: false,
+
        mnemonicsConfirmationStatus: 'ok',
      },
      {
        id: '2',
        title: 'Second',
        info: '200 ADA',
        isConnected: true,
        isLegacy: false,
+
        mnemonicsConfirmationStatus: 'ok',
      },
      {
        id: '3',
        title: 'Third',
        info: '300 ADA',
        isConnected: true,
        isLegacy: false,
+
        mnemonicsConfirmationStatus: 'ok',
      },
    ],
    activeWalletId: '1',
          isRestoreActive: false,
          restoreProgress: 0,
          isLegacy: false,
+
          createdAt: new Date(),
+
          mnemonicsConfirmationDate: new Date(),
+
          mnemonicsConfirmationStatus: 'ok',
+
          mnemonicsConfirmationStatusType: 'neverChecked',
        },
        {
          id: '2',
          isRestoreActive: false,
          restoreProgress: 0,
          isLegacy: false,
+
          createdAt: new Date(),
+
          mnemonicsConfirmationDate: new Date(),
+
          mnemonicsConfirmationStatus: 'ok',
+
          mnemonicsConfirmationStatusType: 'neverChecked',
        },
        {
          id: '3',
          isRestoreActive: false,
          restoreProgress: 0,
          isLegacy: false,
+
          createdAt: new Date(),
+
          mnemonicsConfirmationDate: new Date(),
+
          mnemonicsConfirmationStatus: 'ok',
+
          mnemonicsConfirmationStatusType: 'neverChecked',
        },
        {
          id: '4',
          isRestoreActive: false,
          restoreProgress: 0,
          isLegacy: false,
+
          createdAt: new Date(),
+
          mnemonicsConfirmationDate: new Date(),
+
          mnemonicsConfirmationStatus: 'ok',
+
          mnemonicsConfirmationStatusType: 'neverChecked',
        },
      ]}
      isActiveWallet={id => id === '2'}
    inactiveStakePercentage: 24,
    isDelegated: true,
    delegatedStakePool: STAKE_POOLS[0],
+
    createdAt: new Date(),
+
    mnemonicsConfirmationDate: new Date(),
+
    mnemonicsConfirmationStatus: 'ok',
+
    mnemonicsConfirmationStatusType: 'neverChecked',
  }),
  new Wallet({
    id: 'wallet2',
    inactiveStakePercentage: 35,
    isDelegated: true,
    delegatedStakePool: STAKE_POOLS[1],
+
    createdAt: new Date(),
+
    mnemonicsConfirmationDate: new Date(),
+
    mnemonicsConfirmationStatus: 'ok',
+
    mnemonicsConfirmationStatusType: 'neverChecked',
  }),
  new Wallet({
    id: 'wallet3',
    isLegacy: false,
    inactiveStakePercentage: 0,
    isDelegated: false,
+
    createdAt: new Date(),
+
    mnemonicsConfirmationDate: new Date(),
+
    mnemonicsConfirmationStatus: 'ok',
+
    mnemonicsConfirmationStatusType: 'neverChecked',
  }),
];

                      
      .subtract(MNEMONICS_CHECKING_NOTIFICATION + 10, 'days')
      .toDate();

                      
-
  let walletCreationDate;
-
  let mnemonicsConfirmationDate;
-

                      
-
  if (type === 'alreadyChecked') mnemonicsConfirmationDate = date;
-
  else walletCreationDate = date;
+
  const mnemonicsConfirmationDate = date;
+
  const walletCreationDate = date;

                      
  return {
    mnemonicsConfirmationDate,
          onClose={action('Export Wallet - onClose')}
        />
      }
-
      walletRecoveryPhraseStep1Container={<WalletRecoveryPhraseStep1Dialog />}
-
      walletRecoveryPhraseStep2Container={<WalletRecoveryPhraseStep2Dialog />}
-
      walletRecoveryPhraseStep3Container={<WalletRecoveryPhraseStep3Dialog />}
-
      walletRecoveryPhraseStep4Container={<WalletRecoveryPhraseStep4Dialog />}
+
      walletRecoveryPhraseStep1Container={
+
        <WalletRecoveryPhraseStep1Dialog
+
          onClose={action('onClose')}
+
          onContinue={action('onContinue')}
+
        />
+
      }
+
      walletRecoveryPhraseStep2Container={
+
        <WalletRecoveryPhraseStep2Dialog
+
          onClose={action('onClose')}
+
          onVerify={action('onVerify')}
+
        />
+
      }
+
      walletRecoveryPhraseStep3Container={
+
        <WalletRecoveryPhraseStep3Dialog onClose={action('onClose')} />
+
      }
+
      walletRecoveryPhraseStep4Container={
+
        <WalletRecoveryPhraseStep4Dialog
+
          onClose={action('onClose')}
+
          onVerifyAgain={action('onVerifyAgain')}
+
        />
+
      }
      walletCreationDate={walletCreationDate}
      mnemonicsConfirmationDate={mnemonicsConfirmationDate}
+
      mnemonicsConfirmationStatus={status}
+
      mnemonicsConfirmationStatusType={type}
    />
  );
};
      isRestoreActive: get(wallet, 'syncState.tag', 'synced') === 'restoring',
      restoreProgress: get(wallet, 'syncState.data.percentage.quantity', 0),
      isLegacy: wallet.isLegacy,
+
      mnemonicsConfirmationStatus: wallet.mnemonicsConfirmationStatus,
    }));

                      
  getSidebarMenus = (
import faker from 'faker';
import moment from 'moment';
import BigNumber from 'bignumber.js';
+
import {
+
  WalletStatuses,
+
  WalletStatusesType,
+
} from '../../../source/renderer/app/domains/Wallet';
import {
  WalletTransaction,
  transactionStates,
    passwordUpdateDate: new Date(),
    syncState: { data: null, tag: 'synced' },
    isLegacy: false,
+
    mnemonicsConfirmationDate: new Date(),
+
    mnemonicsConfirmationStatus: WalletStatuses.OK,
+
    mnemonicsConfirmationStatusType: WalletStatusesType.NEVER_CHECKED,
  });

                      
export const generateTransaction = (