diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index e721fdb..14d83a3 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -268,7 +268,28 @@ function logoutState(json, dispatch) { export function logout() { return dispatch => { - dispatch(logoutState()); + dispatch(walletLock()); + } +} + +function walletLock() { + const payload = { + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'agent': 'bitcoinrpc', + 'method': 'walletlock', + }; + + return dispatch => { + return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + method: 'POST', + body: JSON.stringify(payload), + }) + .catch(function(error) { + console.log(error); + dispatch(triggerToaster(true, 'walletLock', 'Error', 'error')); + }) + .then(response => response.json()) + .then(json => dispatch(logoutState(json))) } } @@ -2501,14 +2522,14 @@ export function saveAppConfig(_payload) { headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify(_payload), + body: JSON.stringify({ 'payload': _payload }), }) .catch(function(error) { console.log(error); dispatch(triggerToaster(true, 'saveAppConfig', 'Error', 'error')); }) .then(response => response.json()) - .then(json => dispatch(getAppConfigState(json))) + .then(json => dispatch(getAppConfig())) } } diff --git a/react/src/components/addcoin/addcoin.js b/react/src/components/addcoin/addcoin.js index 1761764..4f55e92 100644 --- a/react/src/components/addcoin/addcoin.js +++ b/react/src/components/addcoin/addcoin.js @@ -4,7 +4,8 @@ import { addCoin, toggleAddcoinModal, shepherdGetCoinList, - shepherdPostCoinList + shepherdPostCoinList, + triggerToaster } from '../../actions/actionCreators'; import Store from '../../store'; import AddCoinOptionsCrypto from './addcoinOptionsCrypto'; @@ -55,10 +56,14 @@ class AddCoin extends React.Component { loadCoinSelection() { shepherdGetCoinList() .then(function(json) { - this.setState(Object.assign({}, this.state, { - coins: json.result, - actionsMenu: false, - })); + if (json.msg !== 'error') { + this.setState(Object.assign({}, this.state, { + coins: json.result, + actionsMenu: false, + })); + } else { + Store.dispatch(triggerToaster(true, 'Local coin list is not found', 'Coin Selection', 'info')); + } }.bind(this)); } @@ -121,7 +126,7 @@ class AddCoin extends React.Component { } this.setState(Object.assign({}, this.state, { - coins: _coins + coins: _coins, })); } @@ -159,6 +164,11 @@ class AddCoin extends React.Component { this.state.coins[0].mode, this.state.coins[0].syncOnly )); + + this.removeCoin(); + this.addNewItem(); + + Store.dispatch(toggleAddcoinModal(false, false)); } dismiss() { @@ -199,7 +209,18 @@ class AddCoin extends React.Component { _item.mode, _item.syncOnly )); - }, 2000 * i); + + if (i === this.state.coins.length - 1) { + let _coins = []; + _coins.push(this.state.defaultCoinState); + + this.setState(Object.assign({}, this.state, { + coins: _coins, + })); + + Store.dispatch(toggleAddcoinModal(false, false)); + } + }.bind(this), 2000 * i); } } diff --git a/react/src/components/addcoin/payload.js b/react/src/components/addcoin/payload.js index 5268cc1..51f41d2 100644 --- a/react/src/components/addcoin/payload.js +++ b/react/src/components/addcoin/payload.js @@ -132,7 +132,7 @@ export function checkCoinType(coin) { export function startCrypto(confpath, coin, mode) { var tmpinternval = 0, AddCoinData = {}, - tmpPendValue = 4, // TODO: hook up to shepherd sysinfo + tmpPendValue = 1, // TODO: hook up to shepherd sysinfo tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); if (coin !== 'BTC' && coin !== 'LTC' && coin !== 'DOGE') { @@ -174,7 +174,7 @@ export function startCrypto(confpath, coin, mode) { export function startCurrencyAssetChain(confpath, coin, mode) { var AddCoinDataPayload = {}, - tmpPendValue, + tmpPendValue = 1, tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); if (coin !== 'BTC' && coin !== 'LTC' && coin !== 'DOGE') { diff --git a/react/src/components/dashboard/atomic.js b/react/src/components/dashboard/atomic.js index a532f7e..5036aad 100644 --- a/react/src/components/dashboard/atomic.js +++ b/react/src/components/dashboard/atomic.js @@ -6,6 +6,10 @@ import AddCoinOptionsCrypto from '../addcoin/addcoinOptionsCrypto'; import AddCoinOptionsAC from '../addcoin/addcoinOptionsAC'; import AddCoinOptionsACFiat from '../addcoin/addcoinOptionsACFiat'; +/* + TODO: + pre-select active coin +*/ class Atomic extends React.Component { constructor(props) { super(props); @@ -41,7 +45,7 @@ class Atomic extends React.Component { getAtomicData() { const tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); - var ExplorerInputData; + let ExplorerInputData; switch (this.state.api) { case 'history': diff --git a/react/src/components/dashboard/jumblr.js b/react/src/components/dashboard/jumblr.js index 460ec59..e2e20db 100644 --- a/react/src/components/dashboard/jumblr.js +++ b/react/src/components/dashboard/jumblr.js @@ -17,6 +17,17 @@ class Jumblr extends React.Component { })); } + renderLB(_translationID) { + const _translationComponents = translate(_translationID).split('
'); + + return _translationComponents.map((_translation) => + + {_translation} +
+
+ ); + } + render() { return (
@@ -121,7 +132,7 @@ class Jumblr extends React.Component {
  • {translate('JUMBLR.IMPORTANT_FUNDS')}
  • {translate('JUMBLR.LARGE_LOT')}
  • -

    {translate('JUMBLR.EG')}

    +

    {this.renderLB('JUMBLR.EG')}

    {translate('JUMBLR.93_KMD')}

    {translate('JUMBLR.TO_CLEAR_THEM')}

    {translate('JUMBLR.WHEN_IT_TOTALS')}

    diff --git a/react/src/components/dashboard/navbar.js b/react/src/components/dashboard/navbar.js index 42e7dea..9ef399f 100644 --- a/react/src/components/dashboard/navbar.js +++ b/react/src/components/dashboard/navbar.js @@ -1,6 +1,11 @@ import React from 'react'; import { translate } from '../../translate/translate'; -import { dashboardChangeSection, toggleAddcoinModal, logout } from '../../actions/actionCreators'; +import { + dashboardChangeSection, + toggleAddcoinModal, + logout, + stopInterval +} from '../../actions/actionCreators'; import Store from '../../store'; class Navbar extends React.Component { @@ -28,6 +33,8 @@ class Navbar extends React.Component { } logout() { + Store.dispatch(stopInterval('sync', this.props.Interval.interval)); + Store.dispatch(stopInterval('basilisk', this.props.Interval.interval)); Store.dispatch(logout()); } @@ -82,14 +89,14 @@ class Navbar extends React.Component {
  • - this.dashboardChangeSection('atomic')}> + this.dashboardChangeSection('atomic')}> Atomic Explorer