Browse Source

fetch cache only for active address

all-modes
pbca26 8 years ago
parent
commit
59bc967caa
  1. 5
      react/src/actions/actionCreators.js
  2. 44
      react/src/components/dashboard/coinTileItem.js

5
react/src/actions/actionCreators.js

@ -1357,7 +1357,7 @@ export function fetchUtxoCache(_payload) {
_route = _payload.allcoins ? 'cache-all' : 'cache-one',
_coin = '&coin=' + _payload.coin,
_calls = '&calls=' + _payload.calls,
_address = '&address=' + _payload.address,
_address = _payload.address ? ('&address=' + _payload.address) : '',
_iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + Config.basiliskPort : '';
return dispatch => {
@ -2203,10 +2203,11 @@ export function fetchNewCacheData(_payload) {
_route = _payload.allcoins ? 'cache-all' : 'cache-one',
_coin = '&coin=' + _payload.coin,
_calls = '&calls=' + _payload.calls,
_address = _payload.address ? ('&address=' + _payload.address) : '',
_iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + Config.basiliskPort : '';
return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls + _iguanaInstancePort, {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls + _address + _iguanaInstancePort, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

44
react/src/components/dashboard/coinTileItem.js

@ -55,9 +55,9 @@ class CoinTileItem extends React.Component {
if (mode === 'basilisk') {
const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin];
Store.dispatch(iguanaActiveHandle(true));
Store.dispatch(getShepherdCache(JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey, coin));
if (this.props && this.props.Dashboard && this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle[coin]) {
Store.dispatch(getShepherdCache(this.props.Dashboard.activeHandle.pubkey, coin));
Store.dispatch(getBasiliskTransactionsList(coin, useAddress));
Store.dispatch(getKMDAddressesNative(coin, mode, useAddress));
//Store.dispatch(iguanaEdexBalance(coin, mode));
@ -88,31 +88,35 @@ class CoinTileItem extends React.Component {
}
if (mode === 'basilisk') {
const _basiliskMainAddress = this.props.Dashboard.activeHandle[coin];
Store.dispatch(changeActiveAddress(_basiliskMainAddress));
if (_basiliskMainAddress) {
Store.dispatch(changeActiveAddress(_basiliskMainAddress));
console.log('_basiliskMainAddress', _basiliskMainAddress);
Store.dispatch(fetchNewCacheData({
'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false,
'coin': coin,
'calls': 'listtransactions:getbalance',
'address': this.props.ActiveCoin.activeAddress,
}));
var _iguanaActiveHandle = setInterval(function() {
this.dispatchCoinActions(coin, mode);
}.bind(this), 3000);
var _basiliskCache = setInterval(function() {
Store.dispatch(fetchNewCacheData({
'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false,
'coin': this.props.ActiveCoin.coin,
'coin': coin,
'calls': 'listtransactions:getbalance',
'address': _basiliskMainAddress,
}));
}.bind(this), 240000);
Store.dispatch(startInterval('sync', _iguanaActiveHandle));
Store.dispatch(startInterval('basilisk', _basiliskCache));
// basilisk
var _iguanaActiveHandle = setInterval(function() {
this.dispatchCoinActions(coin, mode);
}.bind(this), 3000);
var _basiliskCache = setInterval(function() {
Store.dispatch(fetchNewCacheData({
'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false,
'coin': this.props.ActiveCoin.coin,
'calls': 'listtransactions:getbalance',
'address': _basiliskMainAddress,
}));
}.bind(this), 240000);
Store.dispatch(startInterval('sync', _iguanaActiveHandle));
Store.dispatch(startInterval('basilisk', _basiliskCache));
// basilisk
}
}
}
}

Loading…
Cancel
Save