diff --git a/react/src/components/dashboard/sendCoin.js b/react/src/components/dashboard/sendCoin.js index 17af181..ec0afa6 100644 --- a/react/src/components/dashboard/sendCoin.js +++ b/react/src/components/dashboard/sendCoin.js @@ -30,6 +30,8 @@ import { SocketProvider } from 'socket.io-react'; import io from 'socket.io-client'; const socket = io.connect('http://127.0.0.1:' + Config.agamaPort); +// TODO: prevent any cache updates rather than utxo while on send coin form + class SendCoin extends React.Component { constructor(props) { super(props); @@ -159,7 +161,9 @@ class SendCoin extends React.Component { this.props.ActiveCoin.addresses['public'].length) { for (let i = 0; i < this.props.ActiveCoin.addresses['public'].length; i++) { if (this.props.ActiveCoin.addresses['public'][i].address === address) { - return this.props.ActiveCoin.addresses['public'][i].amount; + if (this.props.ActiveCoin.addresses['public'][i].amount !== 'N/A') { + return this.props.ActiveCoin.addresses['public'][i].amount; + } } } } else { @@ -181,11 +185,24 @@ class SendCoin extends React.Component { ); } else { - return this.props.ActiveCoin.addresses[type].map((address) => -
  • - this.updateAddressSelection(address.address, type, address.amount)}> [ {address.amount} {this.props.ActiveCoin.coin} ]  {address.address} -
  • - ); + let items = []; + + for (let i = 0; i < this.props.ActiveCoin.addresses[type].length; i++) { + const address = this.props.ActiveCoin.addresses[type][i]; + let _amount = address.amount; + + if (this.props.ActiveCoin.mode === 'basilisk') { + _amount = this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][address.address].getbalance.data && this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][address.address].getbalance.data.balance ? this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][address.address].getbalance.data.balance : 'N/A'; + } + + items.push( +
  • + this.updateAddressSelection(address.address, type, _amount)}> [ {_amount} {this.props.ActiveCoin.coin} ]  {address.address} +
  • + ); + } + + return items; } } else { return null; @@ -240,10 +257,16 @@ class SendCoin extends React.Component { } updateAddressSelection(address, type, amount) { + let _sendFromAmount = amount ? amount : this.props.ActiveCoin.addresses[type][address].amount; + + if (this.props.ActiveCoin.mode === 'basilisk') { + _sendFromAmount = this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][address].getbalance.data && this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][address].getbalance.data.balance ? this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][address].getbalance.data.balance : 'N/A'; + } + this.setState(Object.assign({}, this.state, { sendFrom: address, addressType: type, - sendFromAmount: amount ? amount : this.props.ActiveCoin.addresses[type][address].amount, + sendFromAmount: _sendFromAmount, addressSelectorOpen: !this.state.addressSelectorOpen, })); } @@ -701,7 +724,7 @@ class SendCoin extends React.Component { {this.renderUTXOCacheInfo()} -
    +
    diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js index 25653fd..c32d0c6 100644 --- a/react/src/components/dashboard/walletsData.js +++ b/react/src/components/dashboard/walletsData.js @@ -357,18 +357,20 @@ class WalletsData extends React.Component { activePage: 1, })); - setTimeout(function() { - Store.dispatch(changeMainBasiliskAddress(address)); - Store.dispatch(getBasiliskTransactionsList(this.props.ActiveCoin.coin, address)); - }.bind(this), 100); - - Store.dispatch(fetchNewCacheData({ - 'pubkey': this.props.Dashboard.activeHandle.pubkey, - 'allcoins': false, - 'coin': this.props.ActiveCoin.coin, - 'calls': 'listtransactions:getbalance', - 'address': address, - })); + if (this.props.ActiveCoin.mode === 'basilisk') { + setTimeout(function() { + Store.dispatch(changeMainBasiliskAddress(address)); + Store.dispatch(getBasiliskTransactionsList(this.props.ActiveCoin.coin, address)); + }.bind(this), 100); + + Store.dispatch(fetchNewCacheData({ + 'pubkey': this.props.Dashboard.activeHandle.pubkey, + 'allcoins': false, + 'coin': this.props.ActiveCoin.coin, + 'calls': 'listtransactions:getbalance', + 'address': address, + })); + } } openDropMenu() { diff --git a/react/src/components/dashboard/walletsNativeSyncProgress.js b/react/src/components/dashboard/walletsNativeSyncProgress.js index 3af289c..fb7b005 100644 --- a/react/src/components/dashboard/walletsNativeSyncProgress.js +++ b/react/src/components/dashboard/walletsNativeSyncProgress.js @@ -5,22 +5,22 @@ class WalletsNativeSyncProgress extends React.Component { renderSyncPercentagePlaceholder() { if (this.props.Dashboard.progress.blocks > 0 && this.props.Dashboard.progress.longestchain === 0) { return ( -
    - Unable to get current sync progress. Err: no longestchain param in response +
    + {translate('INDEX.SYNC_ERR_LONGESTCHAIN')}
    ); } else if (this.props.Dashboard.progress.blocks === 0) { return ( -
    - Unable to get current sync progress. Err: no blocks param in response +
    + {translate('INDEX.SYNC_ERR_BLOCKS')}
    ); } else { var syncPercentage = (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100 / parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2) + '%').replace('NaN', 0); return ( -
    - {syncPercentage} | {this.props.Dashboard.progress.blocks} / {this.props.Dashboard.progress.longestchain} | {translate('INDEX.CONNECTIONS')}: {this.props.Dashboard.progress.connections} +
    + {syncPercentage} | {this.props.Dashboard.progress.blocks} / {this.props.Dashboard.progress.longestchain} | {translate('INDEX.CONNECTIONS')}: {this.props.Dashboard.progress.connections}
    ); } @@ -29,10 +29,10 @@ class WalletsNativeSyncProgress extends React.Component { renderActivatingBestChainProgress() { if (this.props.Settings && this.props.Settings.debugLog && this.props.Dashboard.progress.remoteKMDNode) { if (this.props.Settings.debugLog.indexOf('UpdateTip') > -1) { - var temp = this.props.Settings.debugLog.split(' '); - var currentBestChain; + let temp = this.props.Settings.debugLog.split(' '); + let currentBestChain; - for (var i = 0; i < temp.length; i++) { + for (let i = 0; i < temp.length; i++) { if (temp[i].indexOf('height=') > -1) { currentBestChain = temp[i].replace('height=', ''); } @@ -48,7 +48,7 @@ class WalletsNativeSyncProgress extends React.Component { renderChainActivationNotification() { if ((this.props.Dashboard.progress.blocks < this.props.Dashboard.progress.longestchain) || this.props.Dashboard.progress.remoteKMDNode) { return ( -