diff --git a/src/actions/accounts.js b/src/actions/accounts.js index feb6bf0c..5a2fd2a2 100644 --- a/src/actions/accounts.js +++ b/src/actions/accounts.js @@ -7,8 +7,6 @@ import db from 'helpers/db' import type { Dispatch } from 'redux' -import { startSyncAccounts } from 'renderer/events' - function sortAccounts(accounts, orderAccounts) { const [order, sort] = orderAccounts.split('|') diff --git a/src/components/DashboardPage/index.js b/src/components/DashboardPage/index.js index 88624e81..de18f997 100644 --- a/src/components/DashboardPage/index.js +++ b/src/components/DashboardPage/index.js @@ -17,7 +17,6 @@ import type { Account } from '@ledgerhq/live-common/lib/types' import type { T } from 'types/common' import { colors } from 'styles/theme' -import { runJob } from 'renderer/events' import { getVisibleAccounts } from 'reducers/accounts' import { getCounterValueCode, localeSelector } from 'reducers/settings' @@ -36,7 +35,6 @@ import AccountCard from './AccountCard' import AccountsOrder from './AccountsOrder' const mapStateToProps = state => ({ - devices: state.devices, accounts: getVisibleAccounts(state), counterValue: getCounterValueCode(state), locale: localeSelector(state), @@ -133,55 +131,13 @@ class DashboardPage extends PureComponent { _cacheBalance = null render() { - const { push, accounts, t, counterValue, devices } = this.props + const { push, accounts, t, counterValue } = this.props const { accountsChunk, selectedTime, daysCount } = this.state const timeFrame = this.handleGreeting() const totalAccounts = accounts.length - const { currentDevice } = devices - return ( - {currentDevice && ( - - - {currentDevice.path} - - - )} - diff --git a/src/internals/usb/wallet/scanAccountsOnDevice.js b/src/internals/usb/wallet/scanAccountsOnDevice.js index 83a84e08..a2f599e3 100644 --- a/src/internals/usb/wallet/scanAccountsOnDevice.js +++ b/src/internals/usb/wallet/scanAccountsOnDevice.js @@ -26,7 +26,7 @@ type Props = { onAccountScanned: Function, } -export default async function scanAccountsOnDevice(props: Props): AccountRaw[] { +export default async function scanAccountsOnDevice(props: Props): Promise { const { devicePath, currencyId, onAccountScanned } = props // instanciate app on device @@ -134,11 +134,13 @@ async function buildRawAccount({ ops, }: { njsAccount: NJSAccount, + // $FlowFixMe wallet: NJSWallet, currencyId: string, accountIndex: number, core: Object, hwApp: Object, + // $FlowFixMe ops: NJSOperation[], }) { const jsCurrency = getCryptoCurrencyById(currencyId) @@ -178,6 +180,7 @@ async function buildRawAccount({ return { id: hash, hash, + address: '', senders: op.getSenders(), recipients: op.getRecipients(), // TODO: find why NJSAmount not working @@ -217,8 +220,11 @@ async function buildRawAccount({ */ function createXPUB(depth, fingerprint, childnum, chaincode, publicKey, network) { let xpub = toHexInt(network) + // $FlowFixMe xpub += padStart(depth.toString(16), 2, '0') + // $FlowFixMe xpub += padStart(fingerprint.toString(16), 8, '0') + // $FlowFixMe xpub += padStart(childnum.toString(16), 8, '0') xpub += chaincode xpub += publicKey diff --git a/src/reducers/accounts.js b/src/reducers/accounts.js index dfeeeaf6..0d82ec80 100644 --- a/src/reducers/accounts.js +++ b/src/reducers/accounts.js @@ -7,7 +7,7 @@ import { createAccountModel } from '@ledgerhq/live-common/lib/models/account' import every from 'lodash/every' import get from 'lodash/get' import reduce from 'lodash/reduce' -import type { Account } from '@ledgerhq/live-common/lib/types' +import type { Account, AccountRaw } from '@ledgerhq/live-common/lib/types' import type { State } from 'reducers' @@ -116,7 +116,10 @@ export function canCreateAccount(state: State): boolean { } export function decodeAccount(account: AccountRaw): Account { - return accountModel.decode({ data: account }) + return accountModel.decode({ + data: account, + version: 0, // TODO: should we keep v0 ? + }) } // Yeah. `any` should be `AccountRaw[]` but it can also be a map