|
|
@ -56,6 +56,8 @@ class WalletsData extends React.Component { |
|
|
|
pageSize: 20, |
|
|
|
showPagination: false, |
|
|
|
searchTerm: null |
|
|
|
coin: null, |
|
|
|
txhistory: null, |
|
|
|
}; |
|
|
|
|
|
|
|
this.toggleBasiliskActionsMenu = this.toggleBasiliskActionsMenu.bind(this); |
|
|
@ -71,7 +73,6 @@ class WalletsData extends React.Component { |
|
|
|
this.basiliskRefreshActionOne = this.basiliskRefreshActionOne.bind(this); |
|
|
|
this.handleClickOutside = this.handleClickOutside.bind(this); |
|
|
|
this.refreshTxHistory = this.refreshTxHistory.bind(this); |
|
|
|
socket.on('messages', msg => this.updateSocketsData(msg)); |
|
|
|
} |
|
|
|
|
|
|
|
componentWillMount() { |
|
|
@ -80,6 +81,14 @@ class WalletsData extends React.Component { |
|
|
|
this.handleClickOutside, |
|
|
|
false |
|
|
|
); |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
if (this.props.ActiveCoin.mode === 'basilisk' || (Object.keys(this.props.Main.coins.basilisk).length && (Object.keys(this.props.Main.coins.native).length || Object.keys(this.props.Main.coins.full).length)) || Object.keys(this.props.Main.coins.basilisk).length) { |
|
|
|
socket.on('messages', msg => this.updateSocketsData(msg)); |
|
|
|
} else { |
|
|
|
socket.removeAllListeners('messages'); |
|
|
|
} |
|
|
|
}, 100); |
|
|
|
} |
|
|
|
|
|
|
|
componentWillUnmount() { |
|
|
@ -88,7 +97,8 @@ class WalletsData extends React.Component { |
|
|
|
this.handleClickOutside, |
|
|
|
false |
|
|
|
); |
|
|
|
socket.off('messages'); |
|
|
|
|
|
|
|
socket.removeAllListeners('messages'); |
|
|
|
} |
|
|
|
|
|
|
|
generateItemsListColumns() { |
|
|
@ -195,21 +205,24 @@ class WalletsData extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
updateSocketsData(data) { |
|
|
|
let stateObj = {}; |
|
|
|
|
|
|
|
if (this.props.ActiveCoin.mode === 'basilisk') { |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
|
data.message.shepherd.iguanaAPI && |
|
|
|
data.message.shepherd.iguanaAPI.totalStackLength) { |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
stateObj = Object.assign(stateObj, { |
|
|
|
totalStackLength: data.message.shepherd.iguanaAPI.totalStackLength, |
|
|
|
})); |
|
|
|
}); |
|
|
|
} |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
|
data.message.shepherd.iguanaAPI && |
|
|
|
data.message.shepherd.iguanaAPI.currentStackLength) { |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
stateObj = Object.assign(stateObj, { |
|
|
|
currentStackLength: data.message.shepherd.iguanaAPI.currentStackLength, |
|
|
|
})); |
|
|
|
}); |
|
|
|
} |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
@ -218,6 +231,11 @@ class WalletsData extends React.Component { |
|
|
|
data.message.shepherd.status === 'done') { |
|
|
|
Store.dispatch(basiliskRefresh(false)); |
|
|
|
} |
|
|
|
|
|
|
|
if (Object.keys(stateObj).length) { |
|
|
|
this.setState(Object.assign({}, this.state, stateObj)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
refreshTxHistory() { |
|
|
@ -305,6 +323,16 @@ class WalletsData extends React.Component { |
|
|
|
Store.dispatch(toggleDashboardTxInfoModal(display, txIndex)); |
|
|
|
} |
|
|
|
|
|
|
|
indexTxHistory(txhistoryArr) { |
|
|
|
if (txhistoryArr.length > 1) { |
|
|
|
for (let i = 0; i < txhistoryArr.length; i++) { |
|
|
|
this.props.ActiveCoin.txhistory[i]['index'] = i + 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return this.props.ActiveCoin.txhistory; |
|
|
|
} |
|
|
|
|
|
|
|
componentWillReceiveProps(props) { |
|
|
|
if (!this.state.currentAddress && |
|
|
|
this.props.ActiveCoin.activeAddress) { |
|
|
@ -362,15 +390,15 @@ class WalletsData extends React.Component { |
|
|
|
if (this.state.itemsList === 'loading') { |
|
|
|
if (!this.isNativeMode() || this.isFullySynced()) { |
|
|
|
return ( |
|
|
|
<tr> |
|
|
|
<td colSpan="6">{ translate('INDEX.LOADING_HISTORY') }...</td> |
|
|
|
<tr className="hover--none"> |
|
|
|
<td colSpan="7">{ translate('INDEX.LOADING_HISTORY') }...</td> |
|
|
|
</tr> |
|
|
|
); |
|
|
|
} |
|
|
|
} else if (this.state.itemsList === 'no data' || this.state.itemsList.length == 0) { |
|
|
|
return ( |
|
|
|
<tr> |
|
|
|
<td colSpan="6">{ translate('INDEX.NO_DATA') }</td> |
|
|
|
<tr className="hover--none"> |
|
|
|
<td colSpan="7">{ translate('INDEX.NO_DATA') }</td> |
|
|
|
</tr> |
|
|
|
); |
|
|
|
} else if (this.state.itemsList) { |
|
|
@ -437,10 +465,12 @@ class WalletsData extends React.Component { |
|
|
|
let _amount = address.amount; |
|
|
|
|
|
|
|
if (this.props.ActiveCoin.mode === 'basilisk') { |
|
|
|
_amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A'; |
|
|
|
_amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A'; |
|
|
|
} |
|
|
|
|
|
|
|
if (_amount !== 'N/A') { |
|
|
|
_amount = formatValue('round', _amount, -6); |
|
|
|
} |
|
|
|
|
|
|
|
items.push( |
|
|
|
AddressItemRender.call(this, address, type, _amount, _coin) |
|
|
@ -472,12 +502,20 @@ class WalletsData extends React.Component { |
|
|
|
if (_addresses.public[i].address === this.state.currentAddress) { |
|
|
|
if (_addresses.public[i].amount && |
|
|
|
_addresses.public[i].amount !== 'N/A') { |
|
|
|
return _addresses.public[i].amount; |
|
|
|
let _amount = _addresses.public[i].amount; |
|
|
|
|
|
|
|
if (_amount !== 'N/A') { |
|
|
|
_amount = formatValue('round', _amount, -6); |
|
|
|
} |
|
|
|
|
|
|
|
return _amount; |
|
|
|
} else { |
|
|
|
const address = _addresses.public[i].address; |
|
|
|
let _amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A'; |
|
|
|
|
|
|
|
if (_amount !== 'N/A') { |
|
|
|
_amount = formatValue('round', _amount, -6); |
|
|
|
} |
|
|
|
|
|
|
|
return _amount; |
|
|
|
} |
|
|
@ -567,8 +605,14 @@ class WalletsData extends React.Component { |
|
|
|
if (this.props && |
|
|
|
this.props.ActiveCoin && |
|
|
|
this.props.ActiveCoin.coin && |
|
|
|
( |
|
|
|
this.props.ActiveCoin.mode !== 'native' && |
|
|
|
!this.props.ActiveCoin.send && |
|
|
|
!this.props.ActiveCoin.receive) { |
|
|
|
!this.props.ActiveCoin.receive |
|
|
|
) || ( |
|
|
|
this.props.ActiveCoin.mode === 'native' && |
|
|
|
this.props.ActiveCoin.nativeActiveSection === 'default' |
|
|
|
)) { |
|
|
|
return WalletsDataRender.call(this); |
|
|
|
} else { |
|
|
|
return null; |
|
|
|