diff --git a/src/actions/accounts.js b/src/actions/accounts.js index dd859e16..192d3920 100644 --- a/src/actions/accounts.js +++ b/src/actions/accounts.js @@ -1,11 +1,11 @@ // @flow import sortBy from 'lodash/sortBy' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import db from 'helpers/db' import type { Dispatch } from 'redux' -import type { Account } from 'types/common' import { fetchCounterValues } from 'actions/counterValues' @@ -44,10 +44,7 @@ export const updateOrderAccounts: UpdateOrderAccounts = (orderAccounts: string) export type AddAccount = Account => (Function, Function) => void export const addAccount: AddAccount = payload => (dispatch, getState) => { const { settings: { counterValue, orderAccounts }, accounts } = getState() - dispatch({ - type: 'ADD_ACCOUNT', - payload, - }) + dispatch({ type: 'ADD_ACCOUNT', payload }) dispatch(updateOrderAccounts(orderAccounts)) // Start sync accounts the first time you add an account diff --git a/src/components/AccountPage/AccountHeader.js b/src/components/AccountPage/AccountHeader.js index f90d2191..e9b34b57 100644 --- a/src/components/AccountPage/AccountHeader.js +++ b/src/components/AccountPage/AccountHeader.js @@ -4,7 +4,7 @@ import React, { PureComponent } from 'react' import { getIconByCoinType } from '@ledgerhq/currencies/react' import styled from 'styled-components' -import type { Account } from 'types/common' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import Box from 'components/base/Box' import Text from 'components/base/Text' diff --git a/src/components/AccountPage/index.js b/src/components/AccountPage/index.js index bbb60a7e..863a0463 100644 --- a/src/components/AccountPage/index.js +++ b/src/components/AccountPage/index.js @@ -6,10 +6,11 @@ import { connect } from 'react-redux' import { translate } from 'react-i18next' import { Redirect } from 'react-router' import styled from 'styled-components' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import { MODAL_SEND, MODAL_RECEIVE, MODAL_SETTINGS_ACCOUNT } from 'config/constants' -import type { T, Account } from 'types/common' +import type { T } from 'types/common' import { darken } from 'styles/helpers' diff --git a/src/components/BalanceSummary/index.js b/src/components/BalanceSummary/index.js index 53f6fdc4..495ba4e1 100644 --- a/src/components/BalanceSummary/index.js +++ b/src/components/BalanceSummary/index.js @@ -1,11 +1,9 @@ // @flow import React, { Fragment } from 'react' - +import type { Account } from '@ledgerhq/wallet-common/lib/types' import { getFiatUnit } from '@ledgerhq/currencies' -import type { Account } from 'types/common' - import Chart from 'components/base/Chart' import Box, { Card } from 'components/base/Box' import CalculateBalance from 'components/CalculateBalance' diff --git a/src/components/CalculateBalance.js b/src/components/CalculateBalance.js index d64f6d0e..a579dc38 100644 --- a/src/components/CalculateBalance.js +++ b/src/components/CalculateBalance.js @@ -2,8 +2,7 @@ import { PureComponent } from 'react' import { connect } from 'react-redux' - -import type { Account } from 'types/common' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import calculateBalance from 'helpers/balance' diff --git a/src/components/DashboardPage/AccountCard.js b/src/components/DashboardPage/AccountCard.js index 0533fce9..aeffb05f 100644 --- a/src/components/DashboardPage/AccountCard.js +++ b/src/components/DashboardPage/AccountCard.js @@ -2,8 +2,7 @@ import React from 'react' import { getIconByCoinType } from '@ledgerhq/currencies/react' - -import type { Account } from 'types/common' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import Chart from 'components/base/Chart' import Bar from 'components/base/Bar' diff --git a/src/components/DashboardPage/index.js b/src/components/DashboardPage/index.js index e01ea60c..e0eef9de 100644 --- a/src/components/DashboardPage/index.js +++ b/src/components/DashboardPage/index.js @@ -5,12 +5,13 @@ import { compose } from 'redux' import { translate } from 'react-i18next' import { connect } from 'react-redux' import { push } from 'react-router-redux' +import type { Account, Operation } from '@ledgerhq/wallet-common/lib/types' import chunk from 'lodash/chunk' import get from 'lodash/get' import sortBy from 'lodash/sortBy' -import type { Account, Operation, T } from 'types/common' +import type { T } from 'types/common' import { getVisibleAccounts } from 'reducers/accounts' import { getCounterValue } from 'reducers/settings' @@ -71,7 +72,7 @@ const getAllOperations = accounts => { return result }, []) - return sortBy(allOperations, t => t.receivedAt) + return sortBy(allOperations, t => t.date) .reverse() .slice(0, ALL_OPERATIONS_LIMIT) } diff --git a/src/components/DeviceMonit/index.js b/src/components/DeviceMonit/index.js index 7b0496e6..6cf55ed9 100644 --- a/src/components/DeviceMonit/index.js +++ b/src/components/DeviceMonit/index.js @@ -3,10 +3,11 @@ import React, { PureComponent } from 'react' import { connect } from 'react-redux' import { ipcRenderer } from 'electron' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import { sendEvent } from 'renderer/events' import { getCurrentDevice } from 'reducers/devices' -import type { Device, Account } from 'types/common' +import type { Device } from 'types/common' const mapStateToProps = state => ({ currentDevice: getCurrentDevice(state), diff --git a/src/components/IsUnlocked.js b/src/components/IsUnlocked.js index 6994c2df..a7269af5 100644 --- a/src/components/IsUnlocked.js +++ b/src/components/IsUnlocked.js @@ -5,8 +5,9 @@ import { connect } from 'react-redux' import { compose } from 'redux' import { translate } from 'react-i18next' import bcrypt from 'bcryptjs' +import type { Account } from '@ledgerhq/wallet-common/lib/types' -import type { Settings, Account, T } from 'types/common' +import type { Settings, T } from 'types/common' import get from 'lodash/get' diff --git a/src/components/OperationsList/index.js b/src/components/OperationsList/index.js index 27c963e1..7722ea8e 100644 --- a/src/components/OperationsList/index.js +++ b/src/components/OperationsList/index.js @@ -7,11 +7,12 @@ import { connect } from 'react-redux' import { compose } from 'redux' import { translate } from 'react-i18next' import { getIconByCoinType } from '@ledgerhq/currencies/react' +import type { Account, Operation as OperationType } from '@ledgerhq/wallet-common/lib/types' import noop from 'lodash/noop' import isEqual from 'lodash/isEqual' -import type { Account, Operation as OperationType, T } from 'types/common' +import type { T } from 'types/common' import { MODAL_OPERATION_DETAILS } from 'config/constants' @@ -117,7 +118,7 @@ const Operation = ({ onAccountClick, onOperationClick, t, - tx, + op, withAccount, }: { account: Account, @@ -125,21 +126,21 @@ const Operation = ({ onAccountClick: Function, onOperationClick: Function, t: T, - tx: OperationType, + op: OperationType, withAccount?: boolean, }) => { const { unit } = account - const time = moment(tx.receivedAt) + const time = moment(op.date) const Icon = getIconByCoinType(account.currency.coinType) - const type = tx.amount > 0 ? 'from' : 'to' + const type = op.amount > 0 ? 'from' : 'to' return ( - onOperationClick({ operation: tx, account, type })}> + onOperationClick({ operation: op, account, type })}> @@ -176,19 +177,19 @@ const Operation = ({ )} -
+
- + @@ -260,17 +261,18 @@ export class OperationsList extends Component { - {operations.map(tx => { - const acc = account || tx.account + {operations.map(op => { + // $FlowFixMe + const acc = account || op.account return ( ) diff --git a/src/components/OperationsList/stories.js b/src/components/OperationsList/stories.js index b82027c6..262f50bb 100644 --- a/src/components/OperationsList/stories.js +++ b/src/components/OperationsList/stories.js @@ -16,9 +16,7 @@ const unit = getDefaultUnitByCoinType(0) const account = ({ name }) => ({ ...accounts[0], - settings: { - minConfirmations: 10, - }, + minConfirmations: 10, currency: getCurrencyByCoinType(0), name, coinType: 0, @@ -39,7 +37,7 @@ const operations = [ address: '5c6ea1716520c7d6e038d36a3223faced3c', hash: '5c6ea1716520c7d6e038d36a3223faced3c4b8f7ffb69d9fb5bd527d562fdb62', amount: 130000000, - receivedAt: '2018-01-09T16:03:52Z', + date: '2018-01-09T16:03:52Z', confirmations: 1, account: account({ name: 'Account 1', @@ -49,7 +47,7 @@ const operations = [ address: '5c6ea1716520c7d6e038d36a3223faced3c', hash: '5c6ea1716520c7d6e038d36a3223faced3c4b8f7ffb69d9fb5bd527d562fdb62', amount: 130000000, - receivedAt: '2018-01-09T16:03:52Z', + date: '2018-01-09T16:03:52Z', confirmations: 11, account: account({ name: 'Account 1', @@ -59,7 +57,7 @@ const operations = [ address: '27416a48caab90fab053b507b8b6b9d4', hash: '27416a48caab90fab053b507b8b6b9d48fba75421d3bfdbae4b85f64024bc9c4', amount: -65000000, - receivedAt: '2018-01-09T16:02:40Z', + date: '2018-01-09T16:02:40Z', confirmations: 11, account: account({ name: 'Account 2', @@ -69,7 +67,7 @@ const operations = [ address: '27416a48caab90fab053b507b8b6b9d4', hash: '27416a48caab90fab053b507b8b6b9d48fba75421d3bfdbae4b85f64024bc9c4', amount: -65000000, - receivedAt: '2018-01-09T16:02:40Z', + date: '2018-01-09T16:02:40Z', confirmations: 1, account: account({ name: 'Account 2', diff --git a/src/components/ReceiveBox.js b/src/components/ReceiveBox.js index c191b4af..f4ca2ed8 100644 --- a/src/components/ReceiveBox.js +++ b/src/components/ReceiveBox.js @@ -4,8 +4,9 @@ import React, { PureComponent } from 'react' import { connect } from 'react-redux' import styled from 'styled-components' import { ipcRenderer } from 'electron' +import type { Account } from '@ledgerhq/wallet-common/lib/types' -import type { Account, Device } from 'types/common' +import type { Device } from 'types/common' import { getCurrentDevice } from 'reducers/devices' import { sendEvent } from 'renderer/events' diff --git a/src/components/RequestAmount/index.js b/src/components/RequestAmount/index.js index 6177c1bc..5216cc01 100644 --- a/src/components/RequestAmount/index.js +++ b/src/components/RequestAmount/index.js @@ -6,11 +6,12 @@ import { translate } from 'react-i18next' import styled from 'styled-components' import { connect } from 'react-redux' import { getDefaultUnitByCoinType, getFiatUnit } from '@ledgerhq/currencies' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import isNaN from 'lodash/isNaN' import noop from 'lodash/noop' -import type { T, Account } from 'types/common' +import type { T } from 'types/common' import { getCounterValue } from 'reducers/settings' import { getLastCounterValueBySymbol } from 'reducers/counterValues' diff --git a/src/components/SelectAccount/index.js b/src/components/SelectAccount/index.js index 7e5bcf9a..cc1f322f 100644 --- a/src/components/SelectAccount/index.js +++ b/src/components/SelectAccount/index.js @@ -5,8 +5,9 @@ import { connect } from 'react-redux' import { translate } from 'react-i18next' import noop from 'lodash/noop' import { getIconByCoinType } from '@ledgerhq/currencies/react' +import type { Account } from '@ledgerhq/wallet-common/lib/types' -import type { T, Account } from 'types/common' +import type { T } from 'types/common' import { getVisibleAccounts } from 'reducers/accounts' diff --git a/src/components/SideBar/index.js b/src/components/SideBar/index.js index 8d59241a..919a8706 100644 --- a/src/components/SideBar/index.js +++ b/src/components/SideBar/index.js @@ -6,10 +6,11 @@ import { translate } from 'react-i18next' import styled from 'styled-components' import { connect } from 'react-redux' import { getIconByCoinType } from '@ledgerhq/currencies/react' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import { MODAL_SEND, MODAL_RECEIVE, MODAL_ADD_ACCOUNT } from 'config/constants' -import type { Account, T } from 'types/common' +import type { T } from 'types/common' import { openModal } from 'reducers/modals' import { getVisibleAccounts } from 'reducers/accounts' diff --git a/src/components/modals/AddAccount/ImportAccounts.js b/src/components/modals/AddAccount/ImportAccounts.js index 74554e5b..592ca202 100644 --- a/src/components/modals/AddAccount/ImportAccounts.js +++ b/src/components/modals/AddAccount/ImportAccounts.js @@ -2,8 +2,9 @@ import React, { PureComponent } from 'react' import { translate } from 'react-i18next' +import type { Account } from '@ledgerhq/wallet-common/lib/types' -import type { T, Account } from 'types/common' +import type { T } from 'types/common' import Box from 'components/base/Box' import Button from 'components/base/Button' diff --git a/src/components/modals/AddAccount/RestoreAccounts.js b/src/components/modals/AddAccount/RestoreAccounts.js index 2addc888..7d73b3c3 100644 --- a/src/components/modals/AddAccount/RestoreAccounts.js +++ b/src/components/modals/AddAccount/RestoreAccounts.js @@ -2,13 +2,12 @@ import React from 'react' import styled from 'styled-components' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import Box from 'components/base/Box' import Button from 'components/base/Button' import Text from 'components/base/Text' -import type { Account } from 'types/common' - const Container = styled(Box)` border: 1px solid ${p => p.theme.colors.alertRed}; ` diff --git a/src/components/modals/AddAccount/index.js b/src/components/modals/AddAccount/index.js index 8638a343..11065cfd 100644 --- a/src/components/modals/AddAccount/index.js +++ b/src/components/modals/AddAccount/index.js @@ -7,12 +7,13 @@ import { translate } from 'react-i18next' import { ipcRenderer } from 'electron' import differenceBy from 'lodash/differenceBy' import { listCurrencies, getDefaultUnitByCoinType } from '@ledgerhq/currencies' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import type { Currency } from '@ledgerhq/currencies' import { MODAL_ADD_ACCOUNT } from 'config/constants' -import type { Account, Device, T } from 'types/common' +import type { Device, T } from 'types/common' import { closeModal } from 'reducers/modals' import { canCreateAccount, getAccounts, getArchivedAccounts } from 'reducers/accounts' diff --git a/src/components/modals/OperationDetails.js b/src/components/modals/OperationDetails.js index 0d3f5aa8..ef251d4f 100644 --- a/src/components/modals/OperationDetails.js +++ b/src/components/modals/OperationDetails.js @@ -54,8 +54,8 @@ const OperationDetails = ({ t }: { t: T }) => ( render={({ data, onClose }) => { const { operation, account, type } = data - const { name, unit, settings: { minConfirmations } } = account - const { id, amount, confirmations, receivedAt, from, to } = operation + const { name, unit, minConfirmations } = account + const { id, amount, confirmations, date, from, to } = operation const isConfirmed = confirmations >= minConfirmations @@ -90,7 +90,7 @@ const OperationDetails = ({ t }: { t: T }) => ( color="grey" fontSize={5} style={{ lineHeight: 1 }} - time={receivedAt} + time={date} unit={unit} value={amount} /> @@ -104,7 +104,7 @@ const OperationDetails = ({ t }: { t: T }) => ( Date - {moment(receivedAt).format('LLL')} + {moment(date).format('LLL')} diff --git a/src/components/modals/Receive/index.js b/src/components/modals/Receive/index.js index 475a2057..1a16aca3 100644 --- a/src/components/modals/Receive/index.js +++ b/src/components/modals/Receive/index.js @@ -2,6 +2,7 @@ import React, { PureComponent, Fragment } from 'react' import { translate } from 'react-i18next' +import type { Account as AccountType } from '@ledgerhq/wallet-common/lib/types' import get from 'lodash/get' @@ -15,7 +16,7 @@ import ReceiveBox from 'components/ReceiveBox' import RequestAmount from 'components/RequestAmount' import SelectAccount from 'components/SelectAccount' -import type { Account as AccountType, T } from 'types/common' +import type { T } from 'types/common' type Props = { t: T, diff --git a/src/components/modals/Send/01-step-amount.js b/src/components/modals/Send/01-step-amount.js index 69f49591..7592a8d5 100644 --- a/src/components/modals/Send/01-step-amount.js +++ b/src/components/modals/Send/01-step-amount.js @@ -1,9 +1,10 @@ // @flow import React, { Fragment } from 'react' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import type { Unit } from '@ledgerhq/currencies' -import type { Account, T } from 'types/common' +import type { T } from 'types/common' import type { DoubleVal } from 'components/RequestAmount' import Box from 'components/base/Box' diff --git a/src/components/modals/Send/02-step-connect-device.js b/src/components/modals/Send/02-step-connect-device.js index b11f91cf..930b0ccd 100644 --- a/src/components/modals/Send/02-step-connect-device.js +++ b/src/components/modals/Send/02-step-connect-device.js @@ -1,9 +1,9 @@ // @flow import React from 'react' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import DeviceMonit from 'components/DeviceMonit' -import type { Account } from 'types/common' type Props = { account: Account | null, diff --git a/src/components/modals/Send/Footer.js b/src/components/modals/Send/Footer.js index 94ad6469..03295127 100644 --- a/src/components/modals/Send/Footer.js +++ b/src/components/modals/Send/Footer.js @@ -1,8 +1,9 @@ // @flow import React from 'react' +import type { Account } from '@ledgerhq/wallet-common/lib/types' -import type { T, Account } from 'types/common' +import type { T } from 'types/common' import type { DoubleVal } from 'components/RequestAmount' import { ModalFooter } from 'components/base/Modal' diff --git a/src/components/modals/Send/index.js b/src/components/modals/Send/index.js index d0e06911..443191b9 100644 --- a/src/components/modals/Send/index.js +++ b/src/components/modals/Send/index.js @@ -5,9 +5,10 @@ import { compose } from 'redux' import { connect } from 'react-redux' import { translate } from 'react-i18next' import get from 'lodash/get' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import type { Unit } from '@ledgerhq/currencies' -import type { T, Account } from 'types/common' +import type { T } from 'types/common' import type { DoubleVal } from 'components/RequestAmount' import { MODAL_SEND } from 'config/constants' diff --git a/src/components/modals/SettingsAccount.js b/src/components/modals/SettingsAccount.js index f15690e7..8bca9901 100644 --- a/src/components/modals/SettingsAccount.js +++ b/src/components/modals/SettingsAccount.js @@ -4,11 +4,10 @@ import React, { PureComponent } from 'react' import { connect } from 'react-redux' import get from 'lodash/get' import { push } from 'react-router-redux' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import { MODAL_SETTINGS_ACCOUNT } from 'config/constants' -import type { Account } from 'types/common' - import { updateAccount, removeAccount } from 'actions/accounts' import { setDataModal, closeModal } from 'reducers/modals' @@ -73,7 +72,7 @@ class SettingsAccount extends PureComponent { : {}), settings: { ...account.settings, - minConfirmations: minConfirmations || account.settings.minConfirmations, + minConfirmations: minConfirmations || account.minConfirmations, }, } } @@ -89,10 +88,7 @@ class SettingsAccount extends PureComponent { window.requestAnimationFrame(() => { updateAccount({ ...account, - settings: { - ...account.settings, - minConfirmations: Number(minConfirmations), - }, + minConfirmations: Number(minConfirmations), }) }) } @@ -205,7 +201,7 @@ class SettingsAccount extends PureComponent { type="number" min={1} max={100} - value={account.settings.minConfirmations} + value={account.minConfirmations} onChange={this.handleChangeMinConfirmations(account)} /> diff --git a/src/helpers/balance.js b/src/helpers/balance.js index 347594ca..fdb20571 100644 --- a/src/helpers/balance.js +++ b/src/helpers/balance.js @@ -2,14 +2,13 @@ import moment from 'moment' import { getDefaultUnitByCoinType } from '@ledgerhq/currencies' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import find from 'lodash/find' import first from 'lodash/first' import isUndefined from 'lodash/isUndefined' import last from 'lodash/last' -import type { Account } from 'types/common' - type DateInterval = { start: string, end: string, diff --git a/src/helpers/btc.js b/src/helpers/btc.js index 33caa4a3..83bb323a 100644 --- a/src/helpers/btc.js +++ b/src/helpers/btc.js @@ -2,13 +2,12 @@ import ledger from 'ledger-test-library' import bitcoin from 'bitcoinjs-lib' +import type { Operation } from '@ledgerhq/wallet-common/lib/types' import groupBy from 'lodash/groupBy' import noop from 'lodash/noop' import uniqBy from 'lodash/uniqBy' -import type { Operation } from 'types/common' - const GAP_LIMIT_ADDRESSES = 20 export const networks = [ @@ -31,21 +30,25 @@ export function computeOperation(addresses: Array) { .filter(i => addresses.includes(i.address)) .reduce((acc, cur) => acc + cur.value, 0) const amount = outputVal - inputVal + console.warn('assiging a fake account id and blockHeight to operation') return { id: t.hash, + hash: t.hash, address: t.amount > 0 ? t.inputs[0].address : t.outputs[0].address, from: t.inputs.map(t => t.address), to: t.outputs.map(t => t.address), amount, confirmations: t.confirmations, - receivedAt: t.received_at, + date: t.received_at, + accountId: 'abcd', + blockHeight: 0, } } } export function getBalanceByDay(operations: Operation[]) { const txsByDate = groupBy(operations, tx => { - const [date] = new Date(tx.receivedAt).toISOString().split('T') + const [date] = new Date(tx.date).toISOString().split('T') return date }) diff --git a/src/reducers/accounts.js b/src/reducers/accounts.js index 5b72063c..d971216a 100644 --- a/src/reducers/accounts.js +++ b/src/reducers/accounts.js @@ -5,38 +5,29 @@ import { handleActions } from 'redux-actions' import every from 'lodash/every' import get from 'lodash/get' import reduce from 'lodash/reduce' -import defaultsDeep from 'lodash/defaultsDeep' +import type { Account, AccountRaw } from '@ledgerhq/wallet-common/lib/types' import { getDefaultUnitByCoinType, getCurrencyByCoinType } from '@ledgerhq/currencies' import type { State } from 'reducers' -import type { Account } from 'types/common' export type AccountsState = Account[] const state: AccountsState = [] function orderAccountsOperations(account: Account) { const { operations } = account - operations.sort((a, b) => new Date(b.receivedAt) - new Date(a.receivedAt)) + operations.sort((a, b) => new Date(b.date) - new Date(a.date)) return { ...account, operations, } } -function applyDefaults(account) { - return defaultsDeep(account, { - settings: { - minConfirmations: 2, - }, - }) -} - const handlers: Object = { SET_ACCOUNTS: ( state: AccountsState, { payload: accounts }: { payload: Account[] }, - ): AccountsState => accounts.map(applyDefaults), + ): AccountsState => accounts, ADD_ACCOUNT: ( state: AccountsState, @@ -120,7 +111,6 @@ export function deserializeAccounts(accounts: Account[]) { operations: account.operations, path: account.path, rootPath: account.rootPath, - settings: account.settings, unit: account.unit, })) } diff --git a/src/renderer/events.js b/src/renderer/events.js index 4ce0404e..ff5d5af6 100644 --- a/src/renderer/events.js +++ b/src/renderer/events.js @@ -4,8 +4,7 @@ import { ipcRenderer } from 'electron' import objectPath from 'object-path' import debug from 'debug' import { getDefaultUnitByCoinType } from '@ledgerhq/currencies' - -import type { Account } from 'types/common' +import type { Account } from '@ledgerhq/wallet-common/lib/types' import { CHECK_UPDATE_DELAY, SYNC_ACCOUNT_DELAY, SYNC_COUNTER_VALUES_DELAY } from 'config/constants' diff --git a/src/types/common.js b/src/types/common.js index 3ab2f0b7..cea60865 100644 --- a/src/types/common.js +++ b/src/types/common.js @@ -1,7 +1,5 @@ // @flow -import type { Unit, Currency } from '@ledgerhq/currencies' - export type Device = { vendorId: string, productId: string, @@ -10,43 +8,6 @@ export type Device = { export type Devices = Array -// -------------------- Operations - -export type Operation = { - id: string, - account?: Account, - address: string, - from: Array, - to: Array, - amount: number, - receivedAt: string, - confirmations: number, -} - -// -------------------- Accounts - -export type AccountSettings = { - minConfirmations: number, -} - -export type Account = { - address: string, - addresses: Array, - archived?: boolean, - balance: number, - balanceByDay: Object, - coinType: number, - currency: Currency, - id: string, - index: number, - name: string, - path: string, - rootPath: string, - operations: Operation[], - unit: Unit, - settings: AccountSettings, -} - // -------------------- Settings export type SettingsProfile = { @@ -55,12 +16,15 @@ export type SettingsProfile = { value: string, }, } + export type SettingsDisplay = { language: string, } + export type SettingsMoney = { counterValue: string, } + export type Settings = SettingsProfile & SettingsDisplay & SettingsMoney export type T = (string, ?Object) => string diff --git a/yarn.lock b/yarn.lock index c8481443..bf374774 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7969,9 +7969,6 @@ ledger-test-library@KhalilBellakrid/ledger-test-library-nodejs#7d37482: dependencies: axios "^0.17.1" bindings "^1.3.0" - electron "^1.8.2" - electron-builder "^20.0.4" - electron-rebuild "^1.7.3" nan "^2.6.2" prebuild-install "^2.2.2"