mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-16 14:14:13 +00:00
3bea632a9a
* Progress commit -- ethereumjs-wallet typings * Add hdkey module + better wallet typing * Add provider-engine typings * Add jsdoc descriptions for hdkey constructor methods * Fix missing return type * Fix another missing return * Make provider engine options optional * Add priv/pubkey members to wallet instance * Turn into SFC + Use ethereumjs-lib * Use proper interface naming for V3Wallet * Switch to ethereumjs-wallet * Switch to ethereumjs-wallet and refactor using NewTabLink * Use proper interface naming for V3Wallet * Use proper interface naming for PublicKeyOnlyWallet * Fix broken test, re-add scryptsy to make this PR pass * Fix definition module for thirdparty wallets * Decrease n-factor to 1024, checksum address of keystore * Update typedef for react-dom from 15 to 16 * Lock react-dom, set typescript to 2.5.2
46 lines
963 B
TypeScript
46 lines
963 B
TypeScript
import { GenerateWalletAction } from 'actions/generateWallet';
|
|
import { TypeKeys } from 'actions/generateWallet/constants';
|
|
import { IFullWallet } from 'ethereumjs-wallet';
|
|
|
|
export interface State {
|
|
activeStep: string;
|
|
wallet?: IFullWallet | null;
|
|
password?: string | null;
|
|
}
|
|
|
|
export const INITIAL_STATE: State = {
|
|
activeStep: 'password',
|
|
wallet: null,
|
|
password: null
|
|
};
|
|
|
|
export function generateWallet(
|
|
state: State = INITIAL_STATE,
|
|
action: GenerateWalletAction
|
|
): State {
|
|
switch (action.type) {
|
|
case TypeKeys.GENERATE_WALLET_GENERATE_WALLET: {
|
|
return {
|
|
...state,
|
|
wallet: action.wallet,
|
|
password: action.password,
|
|
activeStep: 'download'
|
|
};
|
|
}
|
|
|
|
case TypeKeys.GENERATE_WALLET_CONTINUE_TO_PAPER: {
|
|
return {
|
|
...state,
|
|
activeStep: 'paper'
|
|
};
|
|
}
|
|
|
|
case TypeKeys.GENERATE_WALLET_RESET: {
|
|
return INITIAL_STATE;
|
|
}
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
}
|