Skip to content

Commit

Permalink
smaller identity list and word wrapping, catch balance provider calls
Browse files Browse the repository at this point in the history
  • Loading branch information
backslash47 committed Jan 14, 2019
1 parent a963563 commit e2bc4d0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cyano-wallet",
"version": "0.7.4",
"version": "0.7.5",
"private": true,
"scripts": {
"lint": "tslint -p .",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Cyano wallet",
"author": "Matus Zamborsky <[email protected]>",
"description": "Cyano wallet - an Ontology wallet",
"version": "0.7.4",
"version": "0.7.5",

"browser_action": {
"default_title": "Open the wallet"
Expand Down
38 changes: 21 additions & 17 deletions src/background/balanceProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/popup/components/identityList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface Props {

export const IdentityList: React.SFC<Props> = (props) => (
<View>
<List className="identityList" divided={true}>
<List className="identityList" divided={true} size="small">
{props.identities.map((identity, i) => (
<List.Item key={i} onClick={(e) => props.onClick(identity)}>
<List.Icon
Expand All @@ -40,7 +40,7 @@ export const IdentityList: React.SFC<Props> = (props) => (
props.onDel(identity);
}}
/>
<List.Content verticalAlign="middle">
<List.Content verticalAlign="middle" className="wrap small">
{identity === props.selectedIdentity ? <List.Header>{identity}</List.Header> : <span>{identity}</span>}
</List.Content>
</List.Item>
Expand Down

0 comments on commit e2bc4d0

Please sign in to comment.