Browse Source

fetch utxo manually

all-modes
Petr Balashov 8 years ago
parent
commit
76cc1e4368
  1. 25
      react/src/actions/actionCreators.js
  2. 2
      react/src/components/dashboard/dashboard.js
  3. 19
      react/src/components/dashboard/walletsData.js

25
react/src/actions/actionCreators.js

@ -1175,6 +1175,31 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
}
}
export function fetchUtxoCache(_payload) {
const _userpass = '?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
_pubkey = '&pubkey=' + _payload.pubkey,
_route = _payload.allcoins ? 'cache-all' : 'cache-one',
_coin = '&coin=' + _payload.coin,
_calls = '&calls=' + _payload.calls,
_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 + _address + _iguanaInstancePort, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'fetchNewCacheData', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getShepherdCache(_pubkey)))
}
}
function getShepherdCacheState(json) {
return {
type: DASHBOARD_ACTIVE_COIN_GET_CACHE,

2
react/src/components/dashboard/dashboard.js

@ -36,7 +36,7 @@ class Dashboard extends React.Component {
<CoinTile {...this.props} />
<WalletsNav {...this.props} />
<WalletsProgress {...this.props} />
<WalletsBalance {...this.props.ActiveCoin} />
<WalletsBalance {...this.props} />
<SendCoin {...this.props} />
<ReceiveCoin {...this.props.ActiveCoin} />
<WalletsData {...this.props} />

19
react/src/components/dashboard/walletsData.js

@ -13,7 +13,8 @@ import {
deleteCacheFile,
connectNotaries,
toggleViewCacheModal,
fetchNewCacheData
fetchNewCacheData,
fetchUtxoCache
} from '../../actions/actionCreators';
import Store from '../../store';
@ -51,6 +52,7 @@ class WalletsData extends React.Component {
this.removeAndFetchNewCache = this.removeAndFetchNewCache.bind(this);
this._toggleViewCacheModal = this._toggleViewCacheModal.bind(this);
this.toggleCacheApi = this.toggleCacheApi.bind(this);
this._fetchUtxoCache = this._fetchUtxoCache.bind(this);
socket.on('messages', msg => this.updateSocketsData(msg));
}
@ -100,6 +102,16 @@ class WalletsData extends React.Component {
}));
}
_fetchUtxoCache() {
Store.dispatch(fetchUtxoCache({
'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false,
'coin': this.props.ActiveCoin.coin,
'calls': 'refresh',
'address': this.state.currentAddress,
}));
}
toggleBasiliskActionsMenu() {
this.setState(Object.assign({}, this.state, {
basiliskActionsMenu: !this.state.basiliskActionsMenu,
@ -422,6 +434,11 @@ class WalletsData extends React.Component {
<i className="icon fa-history" aria-hidden="true"></i> {translate('INDEX.REFETCH_WALLET_DATA')}
</a>
</li>
<li data-edexcoin="COIN" role="presentation" className={!this.state.useCache ? 'hide' : ''}>
<a className="btn_edexcoin_dashboard_refetchdata" data-edexcoin="COIN" id="btn_edexcoin_dashboard_refetchdata" role="menuitem" onClick={this._fetchUtxoCache}>
<i className="icon fa-history" aria-hidden="true"></i> Update UTXO
</a>
</li>
<li data-edexcoin="COIN" role="presentation" className={!this.state.useCache ? 'hide' : ''}>
<a className="btn_edexcoin_dashboard_fetchdata" role="menuitem" onClick={this._toggleViewCacheModal}>
<i className="icon fa-list-alt" aria-hidden="true"></i> {translate('INDEX.VIEW_CACHE_DATA')}

Loading…
Cancel
Save