From e2bc4d05109080e5e4229ed5745bc4b6457b8f77 Mon Sep 17 00:00:00 2001 From: Matus Zamborsky Date: Mon, 14 Jan 2019 10:44:44 +0100 Subject: [PATCH] smaller identity list and word wrapping, catch balance provider calls --- package.json | 2 +- public/manifest.json | 2 +- src/background/balanceProvider.ts | 38 +++++++++++++++------------ src/popup/components/identityList.tsx | 4 +-- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index bedc6da..a05606f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyano-wallet", - "version": "0.7.4", + "version": "0.7.5", "private": true, "scripts": { "lint": "tslint -p .", diff --git a/public/manifest.json b/public/manifest.json index fcb9bb1..ac4139e 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -4,7 +4,7 @@ "name": "Cyano wallet", "author": "Matus Zamborsky ", "description": "Cyano wallet - an Ontology wallet", - "version": "0.7.4", + "version": "0.7.5", "browser_action": { "default_title": "Open the wallet" diff --git a/src/background/balanceProvider.ts b/src/background/balanceProvider.ts index 6efbb31..96139f3 100644 --- a/src/background/balanceProvider.ts +++ b/src/background/balanceProvider.ts @@ -29,28 +29,32 @@ export async function refreshBalance(store: GlobalStore) { const tokens = state.settings.tokens; if (walletEncoded !== null) { - const balance = await getBalance(); - const unboundOng = await getUnboundOng(); - - const tokenBalances: TokenAmountState[] = []; - - for (const token of tokens) { - try { - const amount = await getTokenBalanceOwn(token.contract); - tokenBalances.push({ contract: token.contract, amount }); - } catch (e) { - // tslint:disable-next-line:no-console - console.warn('Failed to load balance of token: ', token.contract); + try { + const balance = await getBalance(); + const unboundOng = await getUnboundOng(); + + const tokenBalances: TokenAmountState[] = []; + + for (const token of tokens) { + try { + const amount = await getTokenBalanceOwn(token.contract); + tokenBalances.push({ contract: token.contract, amount }); + } catch (e) { + // tslint:disable-next-line:no-console + console.warn('Failed to load balance of token: ', token.contract); + } } - } - store.dispatch(Actions.runtime.setBalance(balance.ong, balance.ont, unboundOng, 0, tokenBalances)); + store.dispatch(Actions.runtime.setBalance(balance.ong, balance.ont, unboundOng, 0, tokenBalances)); - const address = getAddress(walletEncoded); + const address = getAddress(walletEncoded); - const transfers = await getTransferList(address); + const transfers = await getTransferList(address); - store.dispatch(Actions.runtime.setTransfers(transfers)); + store.dispatch(Actions.runtime.setTransfers(transfers)); + } catch (e) { + // ignore + } } } diff --git a/src/popup/components/identityList.tsx b/src/popup/components/identityList.tsx index 63cd971..a12bee2 100644 --- a/src/popup/components/identityList.tsx +++ b/src/popup/components/identityList.tsx @@ -28,7 +28,7 @@ interface Props { export const IdentityList: React.SFC = (props) => ( - + {props.identities.map((identity, i) => ( props.onClick(identity)}> = (props) => ( props.onDel(identity); }} /> - + {identity === props.selectedIdentity ? {identity} : {identity}}