diff --git a/react/src/actions/actions/basiliskCache.js b/react/src/actions/actions/basiliskCache.js index 07a5713..00d4087 100644 --- a/react/src/actions/actions/basiliskCache.js +++ b/react/src/actions/actions/basiliskCache.js @@ -67,10 +67,11 @@ export function fetchNewCacheData(_payload) { _coin = `&coin=${_payload.coin}`, _calls = `&calls=${_payload.calls}`, _address = _payload.address ? (`&address=${_payload.address}`) : '', + _skip = _payload.skip ? (`&skip=${_payload.skip}`) : '', _iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : ''; return dispatch => { - return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_iguanaInstancePort}`, { + return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_skip}${_iguanaInstancePort}`, { method: 'GET', headers: { 'Content-Type': 'application/json', diff --git a/react/src/components/dashboard/walletsBalance/walletsBalance.js b/react/src/components/dashboard/walletsBalance/walletsBalance.js index 1dab912..a3b7a31 100755 --- a/react/src/components/dashboard/walletsBalance/walletsBalance.js +++ b/react/src/components/dashboard/walletsBalance/walletsBalance.js @@ -1,12 +1,27 @@ import React from 'react'; import { translate } from '../../../translate/translate'; +import { fetchNewCacheData } from '../../../actions/actionCreators'; +import Store from '../../../store'; import WalletsBalanceRender from './walletsBalance.render'; class WalletsBalance extends React.Component { constructor(props) { super(props); + this.state = { + currentAddress: null, + }; this.isFullySynced = this.isFullySynced.bind(this); + this.refreshBalance = this.refreshBalance.bind(this); + } + + componentWillReceiveProps(props) { + if (!this.state.currentAddress && + this.props.ActiveCoin.activeAddress) { + this.setState(Object.assign({}, this.state, { + currentAddress: this.props.ActiveCoin.activeAddress, + })); + } } isFullySynced() { @@ -21,6 +36,19 @@ class WalletsBalance extends React.Component { } } + refreshBalance() { + if (this.props.ActiveCoin.mode === 'basilisk') { + Store.dispatch(fetchNewCacheData({ + 'pubkey': this.props.Dashboard.activeHandle.pubkey, + 'allcoins': false, + 'coin': this.props.ActiveCoin.coin, + 'calls': 'getbalance', + 'skip': true, + 'address': this.state.currentAddress, + })); + } + } + renderBalance(type) { let _balance = '0'; const _mode = this.props.ActiveCoin.mode; diff --git a/react/src/components/dashboard/walletsBalance/walletsBalance.render.js b/react/src/components/dashboard/walletsBalance/walletsBalance.render.js index 5a97998..4664e40 100644 --- a/react/src/components/dashboard/walletsBalance/walletsBalance.render.js +++ b/react/src/components/dashboard/walletsBalance/walletsBalance.render.js @@ -26,6 +26,9 @@ const WalletsBalanceRender = function() {