diff --git a/src/js/actions/AbstractAccountActions.js b/src/js/actions/AbstractAccountActions.js index 884f72ca..f00ff6bf 100644 --- a/src/js/actions/AbstractAccountActions.js +++ b/src/js/actions/AbstractAccountActions.js @@ -32,7 +32,7 @@ export const init = (): ThunkAction => { if (!coin) return; const state: State = { - index: parseInt(urlParams.address), + index: parseInt(urlParams.account), deviceState: selected.state || '0', deviceId: selected.features ? selected.features.device_id : '0', deviceInstance: selected.instance, diff --git a/src/js/actions/DiscoveryActions.js b/src/js/actions/DiscoveryActions.js index aa2cf87d..7807af2b 100644 --- a/src/js/actions/DiscoveryActions.js +++ b/src/js/actions/DiscoveryActions.js @@ -115,7 +115,7 @@ export const start = (device: TrezorDevice, network: string, ignoreCompleted?: b // start from beginning dispatch( begin(device, network) ); } else { - dispatch( discoverAddress(device, discoveryProcess) ); + dispatch( discoverAccount(device, discoveryProcess) ); } } } @@ -189,7 +189,7 @@ const begin = (device: TrezorDevice, network: string): AsyncAction => { } } -const discoverAddress = (device: TrezorDevice, discoveryProcess: Discovery): AsyncAction => { +const discoverAccount = (device: TrezorDevice, discoveryProcess: Discovery): AsyncAction => { return async (dispatch: Dispatch, getState: GetState): Promise => { const derivedKey = discoveryProcess.hdKey.derive(`m/${discoveryProcess.accountIndex}`); @@ -296,7 +296,7 @@ const discoverAddress = (device: TrezorDevice, discoveryProcess: Discovery): Asy const addressIsEmpty = nonce < 1 && !balance.greaterThan(0); if (!addressIsEmpty) { - dispatch( discoverAddress(device, discoveryProcess) ); + dispatch( discoverAccount(device, discoveryProcess) ); } else { // release acquired sesssion await TrezorConnect.getFeatures({ diff --git a/src/js/actions/TrezorConnectActions.js b/src/js/actions/TrezorConnectActions.js index 49a5be71..69be2f75 100644 --- a/src/js/actions/TrezorConnectActions.js +++ b/src/js/actions/TrezorConnectActions.js @@ -234,7 +234,7 @@ export const onSelectDevice = (device: TrezorDevice | Device): ThunkAction => { const deviceId: string = device.features.device_id; const urlParams: RouterLocationState = getState().router.location.state; - // let url: string = `/device/${ device.features.device_id }/network/ethereum/address/0`; + // let url: string = `/device/${ device.features.device_id }/network/ethereum/account/0`; let url: string = `/device/${ deviceId }`; let instance: ?number; // check if device is not TrezorDevice type @@ -250,7 +250,7 @@ export const onSelectDevice = (device: TrezorDevice | Device): ThunkAction => { } } // check if current location is not set to this device - //dispatch( push(`/device/${ device.features.device_id }/network/etc/address/0`) ); + //dispatch( push(`/device/${ device.features.device_id }/network/etc/account/0`) ); if (urlParams.deviceInstance !== instance || urlParams.device !== deviceId) { dispatch( push(url) ); @@ -498,7 +498,7 @@ export const selectDuplicatedDevice = (): AsyncAction => { } -export function addAddress(): ThunkAction { +export function addAccount(): ThunkAction { return (dispatch: Dispatch, getState: GetState): void => { const selected = findSelectedDevice(getState().connect); if (!selected) return; diff --git a/src/js/components/wallet/account/AbstractAccount.js b/src/js/components/wallet/account/AbstractAccount.js index 6f619c43..e008f111 100644 --- a/src/js/components/wallet/account/AbstractAccount.js +++ b/src/js/components/wallet/account/AbstractAccount.js @@ -71,7 +71,7 @@ export default class AbstractAccount

extends Component; + deviceStatusNotification = ; } this.setState({ @@ -93,7 +93,7 @@ export default class AbstractAccount

extends Component); + return (

); } const { @@ -106,9 +106,12 @@ export default class AbstractAccount

extends ComponentDevice with state {accountState.deviceState} not found); } + // account not found. checking why... if (!account) { if (!discovery || discovery.waitingForDevice) { + if (device.connected) { + // case 1: device is connected but discovery not started yet (probably waiting for auth) if (device.available) { return (

@@ -116,6 +119,7 @@ export default class AbstractAccount

extends Component ); } else { + // case 2: device is unavailable (created with different passphrase settings) account cannot be accessed return (

extends Component extends Component
); } else if (discovery.completed) { + // case 5: account not found and discovery is completed return (
); } else { + // case 6: discovery is not completed yet return (
diff --git a/src/js/components/wallet/account/AccountTabs.js b/src/js/components/wallet/account/AccountTabs.js index 03c8bd4b..e9963622 100644 --- a/src/js/components/wallet/account/AccountTabs.js +++ b/src/js/components/wallet/account/AccountTabs.js @@ -79,8 +79,7 @@ class Indicator extends Component { const AccountTabs = (props: any) => { const urlParams = props.match.params; - //const urlParams = props.match ? props.match.params : { address: '0' }; - const basePath = `/device/${urlParams.device}/network/${urlParams.network}/address/${urlParams.address}`; + const basePath = `/device/${urlParams.device}/network/${urlParams.network}/account/${urlParams.account}`; return (
diff --git a/src/js/components/wallet/account/DeviceSettingsTabs.js b/src/js/components/wallet/account/DeviceSettingsTabs.js index b1536a71..c58695a2 100644 --- a/src/js/components/wallet/account/DeviceSettingsTabs.js +++ b/src/js/components/wallet/account/DeviceSettingsTabs.js @@ -18,8 +18,7 @@ type State = { const AccountTabs = (props: any): any => { const urlParams = props.match.params; - //const urlParams = props.match ? props.match.params : { address: '0' }; - const basePath = `/device/${urlParams.device}/network/${urlParams.network}/address/${urlParams.address}`; + const basePath = `/device/${urlParams.device}/network/${urlParams.network}/account/${urlParams.account}`; return (
diff --git a/src/js/components/wallet/aside/AccountSelection.js b/src/js/components/wallet/aside/AccountSelection.js index 70d97aa9..d8f03f88 100644 --- a/src/js/components/wallet/aside/AccountSelection.js +++ b/src/js/components/wallet/aside/AccountSelection.js @@ -29,36 +29,36 @@ const AccountSelection = (props: Props): ?React$Element => { const fiatRate = props.fiat.find(f => f.network === selectedCoin.network); - const deviceAddresses: Array = findDeviceAccounts(accounts, selected, location.state.network); - let selectedAccounts = deviceAddresses.map((address, i) => { - // const url: string = `${baseUrl}/network/${location.state.network}/address/${i}`; - const url: string = location.pathname.replace(/address+\/([0-9]*)/, `address/${i}`); + const deviceAccounts: Array = findDeviceAccounts(accounts, selected, location.state.network); + let selectedAccounts = deviceAccounts.map((account, i) => { + // const url: string = `${baseUrl}/network/${location.state.network}/account/${i}`; + const url: string = location.pathname.replace(/account+\/([0-9]*)/, `account/${i}`); let balance: string = 'Loading...'; - if (address.balance !== '') { + if (account.balance !== '') { if (fiatRate) { - const accountBalance = new BigNumber(address.balance); + const accountBalance = new BigNumber(account.balance); const fiat = accountBalance.times(fiatRate.value).toFixed(2); - balance = `${ address.balance } ${ selectedCoin.symbol } / $${ fiat }`; + balance = `${ account.balance } ${ selectedCoin.symbol } / $${ fiat }`; } else { - balance = `${ address.balance } ${ selectedCoin.symbol }`; + balance = `${ account.balance } ${ selectedCoin.symbol }`; } } return ( - { `Address #${(address.index + 1 )}` } - { address.loaded ? balance : "Loading..." } + { `Account #${(account.index + 1 )}` } + { account.loaded ? balance : "Loading..." } ) }); if (selectedAccounts.length < 1) { if (selected.connected) { - const url: string = location.pathname.replace(/address+\/([0-9]*)/, `address/0`); + const url: string = location.pathname.replace(/account+\/([0-9]*)/, `account/0`); selectedAccounts = ( - Address #1 + Account #1 Loading... ) @@ -72,17 +72,17 @@ const AccountSelection = (props: Props): ?React$Element => { if (discovery.completed) { // TODO: add only if last one is not empty //if (selectedAccounts.length > 0 && selectedAccounts[selectedAccounts.length - 1]) - const lastAccount = deviceAddresses[deviceAddresses.length - 1]; + const lastAccount = deviceAccounts[deviceAccounts.length - 1]; if (lastAccount && (new BigNumber(lastAccount.balance).greaterThan(0) || lastAccount.nonce > 0)) { discoveryStatus = ( -
- Add address +
+ Add account
); } else { const tooltip = (
- To add a new address, last address must have some transactions. + To add a new account, last account must have some transactions.
) discoveryStatus = ( @@ -90,17 +90,17 @@ const AccountSelection = (props: Props): ?React$Element => { arrowContent={
} overlay={ tooltip } placement="top"> -
- Add address +
+ Add account
); } - } else if (!selected.connected) { + } else if (!selected.connected || !selected.available) { discoveryStatus = (
- Addresses could not be loaded + Accounts could not be loaded { `Connect ${ selected.instanceLabel } device` }
); diff --git a/src/js/components/wallet/aside/CoinSelection.js b/src/js/components/wallet/aside/CoinSelection.js index 0c625f11..c877ded9 100644 --- a/src/js/components/wallet/aside/CoinSelection.js +++ b/src/js/components/wallet/aside/CoinSelection.js @@ -21,7 +21,7 @@ const CoinSelection = (props: Props): React$Element => { } const walletCoins = config.coins.map(item => { - const url = `${ baseUrl }/network/${ item.network }/address/0`; + const url = `${ baseUrl }/network/${ item.network }/account/0`; const className = `coin ${ item.network }` return ( diff --git a/src/js/components/wallet/aside/index.js b/src/js/components/wallet/aside/index.js index fd451133..63dd8035 100644 --- a/src/js/components/wallet/aside/index.js +++ b/src/js/components/wallet/aside/index.js @@ -30,7 +30,7 @@ type StateProps = { type DispatchProps = { toggleDeviceDropdown: typeof toggleDeviceDropdown, - addAddress: typeof TrezorConnectActions.addAddress, + addAccount: typeof TrezorConnectActions.addAccount, acquireDevice: typeof TrezorConnectActions.acquire, forgetDevice: typeof TrezorConnectActions.forget, duplicateDevice: typeof TrezorConnectActions.duplicateDevice, @@ -56,7 +56,7 @@ const mapDispatchToProps: MapDispatchToProps return { //onAccountSelect: bindActionCreators(AccountActions.onAccountSelect, dispatch), toggleDeviceDropdown: bindActionCreators(toggleDeviceDropdown, dispatch), - addAddress: bindActionCreators(TrezorConnectActions.addAddress, dispatch), + addAccount: bindActionCreators(TrezorConnectActions.addAccount, dispatch), acquireDevice: bindActionCreators(TrezorConnectActions.acquire, dispatch), forgetDevice: bindActionCreators(TrezorConnectActions.forget, dispatch), duplicateDevice: bindActionCreators(TrezorConnectActions.duplicateDevice, dispatch), diff --git a/src/js/components/wallet/index.js b/src/js/components/wallet/index.js index a20c6a37..58d25deb 100644 --- a/src/js/components/wallet/index.js +++ b/src/js/components/wallet/index.js @@ -25,7 +25,7 @@ const Content = (props: Props) => { return (
diff --git a/src/js/components/wallet/summary/Summary.js b/src/js/components/wallet/summary/Summary.js index 2149817c..10ece739 100644 --- a/src/js/components/wallet/summary/Summary.js +++ b/src/js/components/wallet/summary/Summary.js @@ -54,7 +54,7 @@ const _render = (props: Props, state: AccountState): React$Element => { { deviceStatusNotification }

- Address #{ parseInt(abstractAccount.index) + 1 } + Account #{ parseInt(abstractAccount.index) + 1 } See full transaction history

diff --git a/src/js/reducers/DiscoveryReducer.js b/src/js/reducers/DiscoveryReducer.js index 454a7876..53773cea 100644 --- a/src/js/reducers/DiscoveryReducer.js +++ b/src/js/reducers/DiscoveryReducer.js @@ -76,7 +76,7 @@ const complete = (state: State, action: DiscoveryCompleteAction): State => { return newState; } -const addressCreate = (state: State, action: AccountCreateAction): State => { +const accountCreate = (state: State, action: AccountCreateAction): State => { const index: number = findIndex(state, action.network, action.device.state || '0'); const newState: State = [ ...state ]; newState[index].accountIndex++; @@ -159,7 +159,7 @@ export default function discovery(state: State = initialState, action: Action): case DISCOVERY.START : return start(state, action); case ACCOUNT.CREATE : - return addressCreate(state, action); + return accountCreate(state, action); case DISCOVERY.STOP : return stop(state, action); case DISCOVERY.COMPLETE : diff --git a/src/js/router/index.js b/src/js/router/index.js index 750a3fa9..86ce6e7c 100644 --- a/src/js/router/index.js +++ b/src/js/router/index.js @@ -35,11 +35,11 @@ export default ( - - - - - + + + + + diff --git a/src/js/services/RouterService.js b/src/js/services/RouterService.js index 6c7e4837..9d5bc22a 100644 --- a/src/js/services/RouterService.js +++ b/src/js/services/RouterService.js @@ -65,10 +65,10 @@ const validation = (api: MiddlewareAPI, params: RouterLocationState): boolean => const { config } = api.getState().localStorage; const coin = config.coins.find(coin => coin.network === params.network); if (!coin) return false; - if (!params.address) return false; + if (!params.account) return false; } - if (params.address) { + if (params.account) { } diff --git a/src/styles/aside.less b/src/styles/aside.less index 7fbf05c6..b68a30c8 100644 --- a/src/styles/aside.less +++ b/src/styles/aside.less @@ -514,7 +514,7 @@ aside { - .add-address { + .add-account { position: relative; padding: 8px 0 8px 20px; cursor: pointer;