From b7bed8ee4ce7af5b555efd408675c0aa0a675521 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Fri, 18 May 2018 19:26:46 +0200 Subject: [PATCH] abstractAccount > SelectedAccount --- src/flowtype/index.js | 4 ++-- ...ntActions.js => SelectedAccountActions.js} | 12 +++++----- src/js/actions/SendFormActions.js | 24 +++++++++---------- src/js/components/modal/ConfirmAddress.js | 14 +++++------ src/js/components/modal/index.js | 4 ++-- ...{AbstractAccount.js => SelectedAccount.js} | 20 ++++++++-------- .../wallet/account/receive/Receive.js | 6 ++--- .../wallet/account/receive/index.js | 10 ++++---- .../wallet/account/send/AdvancedForm.js | 8 +++---- .../wallet/account/send/SendForm.js | 16 ++++++------- .../components/wallet/account/send/index.js | 8 +++---- .../wallet/account/summary/Summary.js | 20 ++++++++-------- .../wallet/account/summary/SummaryDetails.js | 2 +- .../wallet/account/summary/index.js | 8 +++---- ...ntReducer.js => SelectedAccountReducer.js} | 0 src/js/reducers/index.js | 4 ++-- src/js/services/SessionStorageService.js | 6 ++--- 17 files changed, 83 insertions(+), 83 deletions(-) rename src/js/actions/{AbstractAccountActions.js => SelectedAccountActions.js} (84%) rename src/js/components/wallet/account/{AbstractAccount.js => SelectedAccount.js} (90%) rename src/js/reducers/{AbstractAccountReducer.js => SelectedAccountReducer.js} (100%) diff --git a/src/flowtype/index.js b/src/flowtype/index.js index e6254d7e..5d8ba1b7 100644 --- a/src/flowtype/index.js +++ b/src/flowtype/index.js @@ -15,7 +15,7 @@ import type { import type { Reducers, ReducersState } from '~/js/reducers'; // Actions -import type { AbstractAccountAction } from '~/js/actions/AbstractAccountActions'; +import type { SelectedAccountAction } from '~/js/actions/SelectedAccountActions'; import type { AccountAction } from '~/js/actions/AccountsActions'; import type { DiscoveryAction } from '~/js/actions/DiscoveryActions'; import type { StorageAction } from '~/js/actions/LocalStorageActions'; @@ -94,7 +94,7 @@ export type Action = | DeviceEventAction | UiEventAction - | AbstractAccountAction + | SelectedAccountAction | AccountAction | DiscoveryAction | StorageAction diff --git a/src/js/actions/AbstractAccountActions.js b/src/js/actions/SelectedAccountActions.js similarity index 84% rename from src/js/actions/AbstractAccountActions.js rename to src/js/actions/SelectedAccountActions.js index c6d7d2e1..673e32c4 100644 --- a/src/js/actions/AbstractAccountActions.js +++ b/src/js/actions/SelectedAccountActions.js @@ -3,14 +3,14 @@ import * as ACCOUNT from './constants/account'; -import { initialState } from '../reducers/AbstractAccountReducer'; +import { initialState } from '../reducers/SelectedAccountReducer'; import { findSelectedDevice } from '../reducers/TrezorConnectReducer'; import type { AsyncAction, ThunkAction, Action, GetState, Dispatch, TrezorDevice } from '~/flowtype'; -import type { State } from '../reducers/AbstractAccountReducer'; +import type { State } from '../reducers/SelectedAccountReducer'; import type { Coin } from '../reducers/LocalStorageReducer'; -export type AbstractAccountAction = { +export type SelectedAccountAction = { type: typeof ACCOUNT.INIT, state: State } | { @@ -52,15 +52,15 @@ export const init = (): ThunkAction => { export const update = (initAccountAction: () => ThunkAction): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { const { - abstractAccount, + selectedAccount, router } = getState(); - const shouldReload: boolean = (!abstractAccount || router.location.pathname !== abstractAccount.location); + const shouldReload: boolean = (!selectedAccount || router.location.pathname !== selectedAccount.location); if (shouldReload) { dispatch( dispose() ); dispatch( init() ); - if (abstractAccount !== null) + if (selectedAccount !== null) initAccountAction(); } } diff --git a/src/js/actions/SendFormActions.js b/src/js/actions/SendFormActions.js index e3c9645c..5a41e095 100644 --- a/src/js/actions/SendFormActions.js +++ b/src/js/actions/SendFormActions.js @@ -28,7 +28,7 @@ import type { RouterLocationState, TrezorDevice } from '~/flowtype'; -import type { State as AccountState } from '../reducers/AbstractAccountReducer'; +import type { State as AccountState } from '../reducers/SelectedAccountReducer'; import type { Web3Instance } from '../reducers/Web3Reducer'; import type { Config, Coin } from '../reducers/LocalStorageReducer'; import type { Token } from '../reducers/TokensReducer'; @@ -197,7 +197,7 @@ export const getFeeLevels = (symbol: string, gasPrice: BigNumber | string, gasLi export const init = (): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const { location } = getState().router; @@ -257,7 +257,7 @@ export const toggleAdvanced = (address: string): Action => { export const validation = (): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const state: State = getState().sendForm; @@ -438,7 +438,7 @@ export const onAddressChange = (address: string): ThunkAction => { export const onAmountChange = (amount: string): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; const currentState: State = getState().sendForm; const isToken: boolean = currentState.selectedCurrency !== currentState.coinSymbol; const touched = { ...currentState.touched }; @@ -464,7 +464,7 @@ export const onAmountChange = (amount: string): ThunkAction => { export const onCurrencyChange = (currency: { value: string, label: string }): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const currentState: State = getState().sendForm; const isToken: boolean = currency.value !== currentState.coinSymbol; @@ -522,7 +522,7 @@ export const onCurrencyChange = (currency: { value: string, label: string }): Th export const onSetMax = (): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const currentState: State = getState().sendForm; const isToken: boolean = currentState.selectedCurrency !== currentState.coinSymbol; @@ -568,7 +568,7 @@ export const onSetMax = (): ThunkAction => { export const onFeeLevelChange = (feeLevel: FeeLevel): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const currentState: State = getState().sendForm; const isToken: boolean = currentState.selectedCurrency !== currentState.coinSymbol; @@ -620,7 +620,7 @@ export const onFeeLevelChange = (feeLevel: FeeLevel): ThunkAction => { export const updateFeeLevels = (): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const currentState: State = getState().sendForm; const isToken: boolean = currentState.selectedCurrency !== currentState.coinSymbol; @@ -661,7 +661,7 @@ export const updateFeeLevels = (): ThunkAction => { export const onGasPriceChange = (gasPrice: string): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const currentState: State = getState().sendForm; const isToken: boolean = currentState.selectedCurrency !== currentState.coinSymbol; @@ -714,7 +714,7 @@ export const onGasPriceChange = (gasPrice: string): ThunkAction => { export const onGasLimitChange = (gasLimit: string): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const currentState: State = getState().sendForm; const isToken: boolean = currentState.selectedCurrency !== currentState.coinSymbol; @@ -808,7 +808,7 @@ export const onDataChange = (data: string): AsyncAction => { const estimateGasPrice = (): AsyncAction => { return async (dispatch: Dispatch, getState: GetState): Promise => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const web3instance: ?Web3Instance = getState().web3.filter(w3 => w3.network === accountState.network)[0]; if (!web3instance) return; @@ -841,7 +841,7 @@ export const onSend = (): AsyncAction => { //return onSendERC20(); return async (dispatch: Dispatch, getState: GetState): Promise => { - const accountState: ?AccountState = getState().abstractAccount; + const accountState: ?AccountState = getState().selectedAccount; if (!accountState) return; const currentState: State = getState().sendForm; diff --git a/src/js/components/modal/ConfirmAddress.js b/src/js/components/modal/ConfirmAddress.js index ac68783e..464feb78 100644 --- a/src/js/components/modal/ConfirmAddress.js +++ b/src/js/components/modal/ConfirmAddress.js @@ -9,9 +9,9 @@ import type { Props } from './index'; const ConfirmAddress = (props: Props) => { - const { accounts, abstractAccount } = props; - if (!abstractAccount) return null; - const account = findAccount(accounts, abstractAccount.index, abstractAccount.deviceState, abstractAccount.network); + const { accounts, selectedAccount } = props; + if (!selectedAccount) return null; + const account = findAccount(accounts, selectedAccount.index, selectedAccount.deviceState, selectedAccount.network); if (!account) return null; return ( @@ -22,7 +22,7 @@ const ConfirmAddress = (props: Props) => {

{ account.address }

- +
); @@ -54,11 +54,11 @@ export class ConfirmUnverifiedAddress extends Component { const { accounts, - abstractAccount + selectedAccount } = this.props; - if(!abstractAccount) return null; - const account = findAccount(accounts, abstractAccount.index, abstractAccount.deviceState, abstractAccount.network); + if(!selectedAccount) return null; + const account = findAccount(accounts, selectedAccount.index, selectedAccount.deviceState, selectedAccount.network); if (!account) return null; this.props.modalActions.onCancel(); diff --git a/src/js/components/modal/index.js b/src/js/components/modal/index.js index 78be82a5..03ef7cf0 100644 --- a/src/js/components/modal/index.js +++ b/src/js/components/modal/index.js @@ -36,7 +36,7 @@ type StateProps = { accounts: $ElementType, devices: $PropertyType<$ElementType, 'devices'>, connect: $ElementType, - abstractAccount: $ElementType, + selectedAccount: $ElementType, sendForm: $ElementType, receive: $ElementType, localStorage: $ElementType, @@ -128,7 +128,7 @@ const mapStateToProps: MapStateToProps = (state: St accounts: state.accounts, devices: state.connect.devices, connect: state.connect, - abstractAccount: state.abstractAccount, + selectedAccount: state.selectedAccount, sendForm: state.sendForm, receive: state.receive, localStorage: state.localStorage diff --git a/src/js/components/wallet/account/AbstractAccount.js b/src/js/components/wallet/account/SelectedAccount.js similarity index 90% rename from src/js/components/wallet/account/AbstractAccount.js rename to src/js/components/wallet/account/SelectedAccount.js index 4920de0b..37e6ab43 100644 --- a/src/js/components/wallet/account/AbstractAccount.js +++ b/src/js/components/wallet/account/SelectedAccount.js @@ -5,22 +5,22 @@ import React, { Component } from 'react'; import { Notification } from '~/js/components/common/Notification'; import { findDevice } from '~/js/reducers/TrezorConnectReducer'; -// import * as AbstractAccountActions from '~/js/actions/AbstractAccountActions'; -import { default as AbstractAccountActions } from '~/js/actions/AbstractAccountActions'; +// import * as SelectedAccountActions from '~/js/actions/SelectedAccountActions'; +import { default as SelectedAccountActions } from '~/js/actions/SelectedAccountActions'; import type { State, TrezorDevice, Action, ThunkAction } from '~/flowtype'; import type { Account } from '~/js/reducers/AccountsReducer'; import type { Discovery } from '~/js/reducers/DiscoveryReducer'; export type StateProps = { - abstractAccount: $ElementType, + selectedAccount: $ElementType, devices: $PropertyType<$ElementType, 'devices'>, discovery: $ElementType, accounts: $ElementType, } export type DispatchProps = { - abstractAccountActions: typeof AbstractAccountActions, + selectedAccountActions: typeof SelectedAccountActions, initAccount: () => ThunkAction, disposeAccount: () => Action, } @@ -34,7 +34,7 @@ export type AccountState = { deviceStatusNotification: ?React$Element; } -export default class AbstractAccount

extends Component { +export default class SelectedAccount

extends Component { state: AccountState = { device: null, @@ -44,15 +44,15 @@ export default class AbstractAccount

extends Component extends Component { const props = this.props; - const accountState = props.abstractAccount; + const accountState = props.selectedAccount; if (!accountState) { return (

); diff --git a/src/js/components/wallet/account/receive/Receive.js b/src/js/components/wallet/account/receive/Receive.js index 0ffd46ee..fa546ec7 100644 --- a/src/js/components/wallet/account/receive/Receive.js +++ b/src/js/components/wallet/account/receive/Receive.js @@ -6,13 +6,13 @@ import React, { Component } from 'react'; import Tooltip from 'rc-tooltip'; import { QRCode } from 'react-qr-svg'; -import AbstractAccount from '../AbstractAccount'; +import selectedAccount from '../SelectedAccount'; import { Notification } from '~/js/components/common/Notification'; -import type { AccountState } from '../AbstractAccount'; +import type { AccountState } from '../SelectedAccount'; import type { Props } from './index'; -export default class Receive extends AbstractAccount { +export default class Receive extends selectedAccount { render() { return super.render() || _render(this.props, this.state); } diff --git a/src/js/components/wallet/account/receive/index.js b/src/js/components/wallet/account/receive/index.js index f62400b0..b2f783f6 100644 --- a/src/js/components/wallet/account/receive/index.js +++ b/src/js/components/wallet/account/receive/index.js @@ -6,7 +6,7 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { default as ReceiveActions } from '~/js/actions/ReceiveActions'; -import { default as AbstractAccountActions } from '~/js/actions/AbstractAccountActions'; +import { default as SelectedAccountActions } from '~/js/actions/SelectedAccountActions'; import * as TokenActions from '~/js/actions/TokenActions'; import Receive from './Receive'; @@ -15,9 +15,9 @@ import type { State, Dispatch } from '~/flowtype'; import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps -} from '../AbstractAccount'; +} from '../SelectedAccount'; -import type { AccountState } from '../AbstractAccount'; +import type { AccountState } from '../SelectedAccount'; type OwnProps = { } @@ -33,7 +33,7 @@ export type Props = StateProps & DispatchProps; const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => { return { - abstractAccount: state.abstractAccount, + selectedAccount: state.selectedAccount, devices: state.connect.devices, accounts: state.accounts, discovery: state.discovery, @@ -43,7 +43,7 @@ const mapStateToProps: MapStateToProps = (state: St const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => { return { - abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), + selectedAccountActions: bindActionCreators(SelectedAccountActions, dispatch), initAccount: bindActionCreators(ReceiveActions.init, dispatch), disposeAccount: bindActionCreators(ReceiveActions.dispose, dispatch), diff --git a/src/js/components/wallet/account/send/AdvancedForm.js b/src/js/components/wallet/account/send/AdvancedForm.js index e8348883..8b51367b 100644 --- a/src/js/components/wallet/account/send/AdvancedForm.js +++ b/src/js/components/wallet/account/send/AdvancedForm.js @@ -6,7 +6,7 @@ import Tooltip from 'rc-tooltip'; import type { Props as BaseProps } from './index'; type Props = { - abstractAccount: $ElementType, + selectedAccount: $ElementType, sendForm: $ElementType, sendFormActions: $ElementType, children?: $ElementType, @@ -14,10 +14,10 @@ type Props = { const AdvancedForm = (props: Props) => { - const abstractAccount = props.abstractAccount; - if (!abstractAccount) return null; + const selectedAccount = props.selectedAccount; + if (!selectedAccount) return null; - const { network } = abstractAccount; + const { network } = selectedAccount; const { coinSymbol, selectedCurrency, diff --git a/src/js/components/wallet/account/send/SendForm.js b/src/js/components/wallet/account/send/SendForm.js index 0f79b74c..49f1fc66 100644 --- a/src/js/components/wallet/account/send/SendForm.js +++ b/src/js/components/wallet/account/send/SendForm.js @@ -7,13 +7,13 @@ import AdvancedForm from './AdvancedForm'; import PendingTransactions from './PendingTransactions'; import { FeeSelectValue, FeeSelectOption } from './FeeSelect'; import { Notification } from '~/js/components/common/Notification'; -import AbstractAccount from '../AbstractAccount'; +import SelectedAccount from '../SelectedAccount'; import { findAccountTokens } from '~/js/reducers/TokensReducer'; import type { Props } from './index'; -import type { AccountState } from '../AbstractAccount'; +import type { AccountState } from '../SelectedAccount'; -export default class Send extends AbstractAccount { +export default class Send extends SelectedAccount { render() { return super.render() || _render(this.props, this.state); } @@ -27,12 +27,12 @@ const _render = (props: Props, state: AccountState): React$Element => { discovery, deviceStatusNotification } = state; - const abstractAccount = props.abstractAccount; + const selectedAccount = props.selectedAccount; - if (!device || !account || !discovery || !abstractAccount) return
; + if (!device || !account || !discovery || !selectedAccount) return
; const tokens = findAccountTokens(props.tokens, account); - const { network } = abstractAccount; + const { network } = selectedAccount; const { address, @@ -61,7 +61,7 @@ const _render = (props: Props, state: AccountState): React$Element => { onSend, } = props.sendFormActions; - const selectedCoin = abstractAccount.coin; + const selectedCoin = selectedAccount.coin; const fiatRate = props.fiat.find(f => f.network === network); const tokensSelectData = tokens.map(t => { @@ -177,7 +177,7 @@ const _render = (props: Props, state: AccountState): React$Element => { diff --git a/src/js/components/wallet/account/send/index.js b/src/js/components/wallet/account/send/index.js index f2755af4..5946c67e 100644 --- a/src/js/components/wallet/account/send/index.js +++ b/src/js/components/wallet/account/send/index.js @@ -6,12 +6,12 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { default as SendFormActions } from '~/js/actions/SendFormActions'; -import { default as AbstractAccountActions } from '~/js/actions/AbstractAccountActions'; +import { default as SelectedAccountActions } from '~/js/actions/SelectedAccountActions'; import SendForm from './SendForm'; import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; import type { State, Dispatch } from '~/flowtype'; -import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../AbstractAccount'; +import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../SelectedAccount'; type OwnProps = { } @@ -32,7 +32,7 @@ export type Props = StateProps & DispatchProps; const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => { return { - abstractAccount: state.abstractAccount, + selectedAccount: state.selectedAccount, devices: state.connect.devices, accounts: state.accounts, discovery: state.discovery, @@ -46,7 +46,7 @@ const mapStateToProps: MapStateToProps = (state: St const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => { return { - abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), + selectedAccountActions: bindActionCreators(SelectedAccountActions, dispatch), sendFormActions: bindActionCreators(SendFormActions, dispatch), initAccount: bindActionCreators(SendFormActions.init, dispatch), disposeAccount: bindActionCreators(SendFormActions.dispose, dispatch), diff --git a/src/js/components/wallet/account/summary/Summary.js b/src/js/components/wallet/account/summary/Summary.js index 461537a7..980e702e 100644 --- a/src/js/components/wallet/account/summary/Summary.js +++ b/src/js/components/wallet/account/summary/Summary.js @@ -7,13 +7,13 @@ import { Async } from 'react-select'; import Tooltip from 'rc-tooltip'; import { resolveAfter } from '~/js/utils/promiseUtils'; -import AbstractAccount from '../AbstractAccount'; +import SelectedAccount from '../SelectedAccount'; import { Notification } from '~/js/components/common/Notification'; import SummaryDetails from './SummaryDetails.js'; import SummaryTokens from './SummaryTokens.js'; import type { Props } from './index'; -import type { AccountState } from '../AbstractAccount'; +import type { AccountState } from '../SelectedAccount'; import type { TrezorDevice } from '~/flowtype'; import type { NetworkToken } from '~/js/reducers/LocalStorageReducer'; @@ -21,7 +21,7 @@ import type { Account } from '~/js/reducers/AccountsReducer'; import type { Discovery } from '~/js/reducers/DiscoveryReducer'; import { findAccountTokens } from '~/js/reducers/TokensReducer'; -export default class Summary extends AbstractAccount { +export default class Summary extends SelectedAccount { render() { return super.render() || _render(this.props, this.state); } @@ -34,13 +34,13 @@ const _render = (props: Props, state: AccountState): React$Element => { account, deviceStatusNotification } = state; - const abstractAccount = props.abstractAccount; + const selectedAccount = props.selectedAccount; - if (!device || !account || !abstractAccount) return
; + if (!device || !account || !selectedAccount) return
; const tokens = findAccountTokens(props.tokens, account); - const explorerLink: string = `${abstractAccount.coin.explorer.address}${account.address}`; + const explorerLink: string = `${selectedAccount.coin.explorer.address}${account.address}`; const tokensTooltip = (
@@ -53,16 +53,16 @@ const _render = (props: Props, state: AccountState): React$Element => {
{ deviceStatusNotification } -

- Account #{ parseInt(abstractAccount.index) + 1 } +

+ Account #{ parseInt(selectedAccount.index) + 1 } See full transaction history

diff --git a/src/js/components/wallet/account/summary/SummaryDetails.js b/src/js/components/wallet/account/summary/SummaryDetails.js index b4598960..0435ac57 100644 --- a/src/js/components/wallet/account/summary/SummaryDetails.js +++ b/src/js/components/wallet/account/summary/SummaryDetails.js @@ -8,7 +8,7 @@ import type { Props as BaseProps } from './index'; import type { Coin } from '~/js/reducers/LocalStorageReducer'; type Props = { - // coin: $PropertyType<$ElementType, 'coin'>, + // coin: $PropertyType<$ElementType, 'coin'>, coin: Coin, summary: $ElementType, balance: string, diff --git a/src/js/components/wallet/account/summary/index.js b/src/js/components/wallet/account/summary/index.js index aaaea19d..1da9963f 100644 --- a/src/js/components/wallet/account/summary/index.js +++ b/src/js/components/wallet/account/summary/index.js @@ -6,13 +6,13 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import Summary from './Summary'; -import { default as AbstractAccountActions } from '~/js/actions/AbstractAccountActions'; +import { default as SelectedAccountActions } from '~/js/actions/SelectedAccountActions'; import * as SummaryActions from '~/js/actions/SummaryActions'; import * as TokenActions from '~/js/actions/TokenActions'; import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; import type { State, Dispatch } from '~/flowtype'; -import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../AbstractAccount'; +import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../SelectedAccount'; type OwnProps = { } @@ -34,7 +34,7 @@ export type Props = StateProps & DispatchProps; const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => { return { - abstractAccount: state.abstractAccount, + selectedAccount: state.selectedAccount, devices: state.connect.devices, accounts: state.accounts, discovery: state.discovery, @@ -48,7 +48,7 @@ const mapStateToProps: MapStateToProps = (state: St const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => { return { - abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), + selectedAccountActions: bindActionCreators(SelectedAccountActions, dispatch), initAccount: bindActionCreators(SummaryActions.init, dispatch), disposeAccount: bindActionCreators(SummaryActions.dispose, dispatch), diff --git a/src/js/reducers/AbstractAccountReducer.js b/src/js/reducers/SelectedAccountReducer.js similarity index 100% rename from src/js/reducers/AbstractAccountReducer.js rename to src/js/reducers/SelectedAccountReducer.js diff --git a/src/js/reducers/index.js b/src/js/reducers/index.js index 083fce08..973bc404 100644 --- a/src/js/reducers/index.js +++ b/src/js/reducers/index.js @@ -11,7 +11,7 @@ import notifications from './NotificationReducer.js'; import modal from './ModalReducer.js'; import web3 from './Web3Reducer.js'; import accounts from './AccountsReducer.js'; -import abstractAccount from './AbstractAccountReducer.js'; +import selectedAccount from './SelectedAccountReducer.js'; import sendForm from './SendFormReducer.js'; import receive from './ReceiveReducer.js'; import summary from './SummaryReducer.js'; @@ -30,7 +30,7 @@ const reducers = { modal, web3, accounts, - abstractAccount, + selectedAccount, sendForm, receive, summary, diff --git a/src/js/services/SessionStorageService.js b/src/js/services/SessionStorageService.js index 0cccbb04..d1033eb1 100644 --- a/src/js/services/SessionStorageService.js +++ b/src/js/services/SessionStorageService.js @@ -38,7 +38,7 @@ const save = (dispatch: Dispatch, getState: GetState): void => { if (typeof window.sessionStorage === 'undefined') return; - const accountState = getState().abstractAccount; + const accountState = getState().selectedAccount; const sendState = getState().sendForm; if (accountState && !sendState.untouched) { const value = { @@ -68,7 +68,7 @@ const load = (dispatch: Dispatch, getState: GetState): void => { if (typeof window.localStorage === 'undefined') return; - const accountState = getState().abstractAccount; + const accountState = getState().selectedAccount; const sendState = getState().sendForm; if (accountState) { @@ -122,7 +122,7 @@ const load = (dispatch: Dispatch, getState: GetState): void => { const clear = (getState: GetState) => { if (typeof window.localStorage === 'undefined') return; - const accountState = getState().abstractAccount; + const accountState = getState().selectedAccount; if (accountState) { const key: string = `SEND:${accountState.location}`; window.sessionStorage.removeItem(key);