diff --git a/src/components/DashboardPage.js b/src/components/DashboardPage.js index 2f2951fd..f8de952d 100644 --- a/src/components/DashboardPage.js +++ b/src/components/DashboardPage.js @@ -123,7 +123,7 @@ class DashboardPage extends PureComponent { align="center" justify="center" borderColor="mouse" - style={{ borderStyle: 'dashed', cursor: 'pointer' }} + style={{ borderStyle: 'dashed', cursor: 'pointer', textAlign: 'center' }} onClick={() => openModal('add-account')} > {`+ ${t('addAccount.title')}`} diff --git a/src/components/SideBar/Item.js b/src/components/SideBar/Item.js index d433fca7..d7c6106b 100644 --- a/src/components/SideBar/Item.js +++ b/src/components/SideBar/Item.js @@ -10,7 +10,6 @@ import { connect } from 'react-redux' import { openModal, isModalOpened } from 'reducers/modals' import type { MapStateToProps } from 'react-redux' -import type { Element } from 'react' import type { Location } from 'react-router' import Box from 'components/base/Box' diff --git a/src/components/base/Button/index.js b/src/components/base/Button/index.js index 9e6665c2..fdfb4067 100644 --- a/src/components/base/Button/index.js +++ b/src/components/base/Button/index.js @@ -13,6 +13,7 @@ const Base = styled.button.attrs({ ${fontSize}; ${fontWeight}; border-radius: 5px; + cursor: pointer; border: none; height: 40px; box-shadow: ${p => (p.withShadow ? 'rgba(0, 0, 0, 0.2) 0 3px 10px' : '')}; @@ -27,7 +28,7 @@ const Button = ({ primary, ...props }: Props) => { if (primary) { return } - return + return } Button.defaultProps = { diff --git a/src/components/base/Select/index.js b/src/components/base/Select/index.js index 6f2281e1..5e0ab01d 100644 --- a/src/components/base/Select/index.js +++ b/src/components/base/Select/index.js @@ -40,6 +40,7 @@ const TriggerBtn = styled(Box).attrs({ width: 100%; color: ${p => p.theme.colors.steel}; background: ${p => p.theme.colors.white}; + cursor: pointer; &:focus { outline: none; box-shadow: rgba(0, 0, 0, 0.05) 0 2px 2px; diff --git a/src/helpers/btc.js b/src/helpers/btc.js index d47a04ed..cdfd1762 100644 --- a/src/helpers/btc.js +++ b/src/helpers/btc.js @@ -70,11 +70,13 @@ export function getTransactions(addresses: Array) { } export async function getAccount({ + allAddresses = [], currentIndex = 0, hdnode, segwit, network, }: { + allAddresses?: Array, currentIndex?: number, hdnode: Object, segwit: boolean, @@ -84,7 +86,6 @@ export async function getAccount({ const script = segwit ? parseInt(network.scriptHash, 10) : parseInt(network.pubKeyHash, 10) let transactions = [] - let allAddresses = [] let lastAddress = null const pubKeyToSegwitAddress = (pubKey, scriptVersion) => { @@ -135,7 +136,7 @@ export async function getAccount({ const addresses = results.reduce((result, v) => [...result, ...v], []) const listAddresses = addresses.map(a => a.address) - allAddresses = [...allAddresses, ...listAddresses] + allAddresses = [...new Set([...allAddresses, ...listAddresses])] const { txs } = await getTransactions(listAddresses) @@ -153,6 +154,7 @@ export async function getAccount({ result += v.balance return result }, 0), + allAddresses, transactions, ...(lastAddress !== null ? { @@ -166,7 +168,7 @@ export async function getAccount({ } }) - if (currentIndex > 0) { + if (allAddresses.length === 0 && currentIndex > 0) { for (let i = currentIndex; i--; ) { allAddresses = [ ...allAddresses, diff --git a/src/renderer/events.js b/src/renderer/events.js index d2aa4baa..2d7e738a 100644 --- a/src/renderer/events.js +++ b/src/renderer/events.js @@ -41,8 +41,10 @@ export function startSyncAccounts(accounts: Accounts) { sendEvent('accounts', 'sync.all', { accounts: Object.entries(accounts).map(([id, account]: [string, any]) => { const currentIndex = get(account, 'data.currentIndex', 0) + const allAddresses = get(account, 'data.allAddresses', []) return { id, + allAddresses, currentIndex, } }),