diff --git a/package.json b/package.json index 07a111e93..1e962e0cc 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "decompress-zip": "^0.3.0", "electron-log": "^2.2.6", "electron-store": "^1.1.0", - "emerald-js": "git+https://github.com/ethereumproject/emerald-js.git#v0.0.11", + "emerald-js": "git+https://github.com/ethereumproject/emerald-js.git#v0.0.12", "es6-promise": "4.1.1", "ethereumjs-abi": "0.6.4", "ethereumjs-tx": "1.3.3", diff --git a/src/components/accounts/SecondaryMenu/index.js b/src/components/accounts/SecondaryMenu/index.js index e72fba0af..ca2b62218 100644 --- a/src/components/accounts/SecondaryMenu/index.js +++ b/src/components/accounts/SecondaryMenu/index.js @@ -7,6 +7,9 @@ import { api } from 'lib/rpc/api'; import saveAs from 'lib/saveAs'; import screen from '../../../store/wallet/screen'; import { gotoScreen } from '../../../store/wallet/screen/screenActions'; +import { unhideAccount } from 'store/vault/accounts/accountActions'; +import history from '../../../store/wallet/history'; +import accounts from '../../../store/vault/accounts'; const renderHide = (chain, account, onHide, precision = 3) => { const balance = account.get('balance'); @@ -72,7 +75,13 @@ export default connect( }, onUnhide: (chain) => () => { const address = ownProps.account.get('id'); - //dispatch(screen.actions.showDialog('hide-account', address)); + dispatch(unhideAccount(address)); + // refresh account data + dispatch(history.actions.refreshTrackedTransactions()); + dispatch(accounts.actions.loadAccountsList()); + dispatch(accounts.actions.loadPendingTransactions()); + + dispatch(screen.actions.gotoScreen('home')); }, onExport: (chain) => () => { const address = ownProps.account.get('id'); diff --git a/src/store/vault/accounts/accountActions.js b/src/store/vault/accounts/accountActions.js index 52b563b1b..2c6a4809a 100644 --- a/src/store/vault/accounts/accountActions.js +++ b/src/store/vault/accounts/accountActions.js @@ -345,3 +345,14 @@ export function hideAccount(accountId: string) { }).catch(screen.actions.catchError(dispatch)); }; } + +export function unhideAccount(accountId: string) { + return (dispatch, getState, api) => { + const chain = currentChain(getState()); + + return api.emerald.unhideAccount(accountId, chain) + .then((result) => { + return result; + }).catch(screen.actions.catchError(dispatch)); + }; +} \ No newline at end of file diff --git a/src/store/vault/tokens/tokenActions.js b/src/store/vault/tokens/tokenActions.js index 52cfe021e..736ee1857 100644 --- a/src/store/vault/tokens/tokenActions.js +++ b/src/store/vault/tokens/tokenActions.js @@ -90,16 +90,13 @@ export function loadTokenList() { dispatch({ type: 'TOKEN/LOADING', }); - api.geth.call('emerald_contracts', []).then((result) => { - const tokens = result ? result.filter((contract) => { - contract.features = contract.features || []; - return contract.features.indexOf('erc20') >= 0; - }) : []; - dispatch({ - type: 'TOKEN/SET_LIST', - tokens, - }); - tokens.map((token) => dispatch(loadTokenDetails(token))); + api.emerald.listContracts(chain).then((result) => { + const tokens = result; + dispatch({ + type: 'TOKEN/SET_LIST', + tokens, + }); + tokens.map((token) => dispatch(loadTokenDetails(token))); }); }; } @@ -107,7 +104,7 @@ export function loadTokenList() { export function addToken(token: TokenInfo) { return (dispatch, getState, api) => { const chain = launcher.selectors.getChainName(getState()); - return api.emerald.addContract(token.address, token.symbol, chain).then(() => { + return api.emerald.importContract(token.address, token.symbol, '', chain).then(() => { // TODO: maybe replace with on action dispatch({ type: 'TOKEN/ADD_TOKEN', diff --git a/src/store/wallet/settings/settingsActions.js b/src/store/wallet/settings/settingsActions.js index 969acea1a..093f9dcb9 100644 --- a/src/store/wallet/settings/settingsActions.js +++ b/src/store/wallet/settings/settingsActions.js @@ -11,6 +11,13 @@ export function loadSettings() { type: ActionTypes.SET_LOCALE_CURRENCY, currency: localeCurrency, }); + + const localStorageShowHiddenAccounts = localStorage.getItem('showHiddenAccounts') || "false"; + let showHiddenAccounts = JSON.parse(localStorageShowHiddenAccounts); + dispatch({ + type: ActionTypes.SET_SHOW_HIDDEN_ACCOUNTS, + show: showHiddenAccounts + }); } }; } diff --git a/src/store/wallet/settings/settingsReducers.js b/src/store/wallet/settings/settingsReducers.js index 0fe4a551f..4beea2832 100644 --- a/src/store/wallet/settings/settingsReducers.js +++ b/src/store/wallet/settings/settingsReducers.js @@ -38,6 +38,10 @@ function onExchangeRates(state, action) { function onSetShowHiddenAccounts(state, action) { if (action.type === ActionTypes.SET_SHOW_HIDDEN_ACCOUNTS) { + // persist settings + if (localStorage) { + localStorage.setItem('showHiddenAccounts', action.show); + } return state.set('showHiddenAccounts', action.show); } return state;