|
|
@ -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() { |
|
|
@ -103,32 +113,32 @@ class WalletsData extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
columns.push(...[ |
|
|
|
{ |
|
|
|
id: 'direction', |
|
|
|
Header: translate('INDEX.DIRECTION'), |
|
|
|
Footer: translate('INDEX.DIRECTION'), |
|
|
|
accessor: (tx) => TxTypeRender.call(this, tx.category || tx.type) |
|
|
|
}, |
|
|
|
{ |
|
|
|
Header: translate('INDEX.CONFIRMATIONS'), |
|
|
|
Footer: translate('INDEX.CONFIRMATIONS'), |
|
|
|
headerClassName: 'hidden-xs hidden-sm', |
|
|
|
footerClassName: 'hidden-xs hidden-sm', |
|
|
|
className: 'hidden-xs hidden-sm', |
|
|
|
accessor: 'confirmations' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'amount', |
|
|
|
Header: translate('INDEX.AMOUNT'), |
|
|
|
Footer: translate('INDEX.AMOUNT'), |
|
|
|
accessor: (tx) => TxAmountRender.call(this, tx) |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'timestamp', |
|
|
|
Header: translate('INDEX.TIME'), |
|
|
|
Footer: translate('INDEX.TIME'), |
|
|
|
accessor: (tx) => secondsToString(tx.blocktime || tx.timestamp || tx.time) |
|
|
|
} |
|
|
|
{ |
|
|
|
id: 'direction', |
|
|
|
Header: translate('INDEX.DIRECTION'), |
|
|
|
Footer: translate('INDEX.DIRECTION'), |
|
|
|
accessor: (tx) => TxTypeRender.call(this, tx.category || tx.type) |
|
|
|
}, |
|
|
|
{ |
|
|
|
Header: translate('INDEX.CONFIRMATIONS'), |
|
|
|
Footer: translate('INDEX.CONFIRMATIONS'), |
|
|
|
headerClassName: 'hidden-xs hidden-sm', |
|
|
|
footerClassName: 'hidden-xs hidden-sm', |
|
|
|
className: 'hidden-xs hidden-sm', |
|
|
|
accessor: 'confirmations' |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'amount', |
|
|
|
Header: translate('INDEX.AMOUNT'), |
|
|
|
Footer: translate('INDEX.AMOUNT'), |
|
|
|
accessor: (tx) => TxAmountRender.call(this, tx) |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'timestamp', |
|
|
|
Header: translate('INDEX.TIME'), |
|
|
|
Footer: translate('INDEX.TIME'), |
|
|
|
accessor: (tx) => secondsToString(tx.blocktime || tx.timestamp || tx.time) |
|
|
|
} |
|
|
|
]); |
|
|
|
|
|
|
|
if (this.isFullMode()) { |
|
|
@ -195,28 +205,36 @@ class WalletsData extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
updateSocketsData(data) { |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
|
data.message.shepherd.iguanaAPI && |
|
|
|
data.message.shepherd.iguanaAPI.totalStackLength) { |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
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, { |
|
|
|
currentStackLength: data.message.shepherd.iguanaAPI.currentStackLength, |
|
|
|
})); |
|
|
|
} |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
|
data.message.shepherd.method && |
|
|
|
data.message.shepherd.method === 'cache-one' && |
|
|
|
data.message.shepherd.status === 'done') { |
|
|
|
Store.dispatch(basiliskRefresh(false)); |
|
|
|
let stateObj = {}; |
|
|
|
|
|
|
|
if (this.props.ActiveCoin.mode === 'basilisk') { |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
|
data.message.shepherd.iguanaAPI && |
|
|
|
data.message.shepherd.iguanaAPI.totalStackLength) { |
|
|
|
stateObj = Object.assign(stateObj, { |
|
|
|
totalStackLength: data.message.shepherd.iguanaAPI.totalStackLength, |
|
|
|
}); |
|
|
|
} |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
|
data.message.shepherd.iguanaAPI && |
|
|
|
data.message.shepherd.iguanaAPI.currentStackLength) { |
|
|
|
stateObj = Object.assign(stateObj, { |
|
|
|
currentStackLength: data.message.shepherd.iguanaAPI.currentStackLength, |
|
|
|
}); |
|
|
|
} |
|
|
|
if (data && |
|
|
|
data.message && |
|
|
|
data.message.shepherd.method && |
|
|
|
data.message.shepherd.method === 'cache-one' && |
|
|
|
data.message.shepherd.status === 'done') { |
|
|
|
Store.dispatch(basiliskRefresh(false)); |
|
|
|
} |
|
|
|
|
|
|
|
if (Object.keys(stateObj).length) { |
|
|
|
this.setState(Object.assign({}, this.state, stateObj)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -305,9 +323,19 @@ 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) { |
|
|
|
this.props.ActiveCoin.activeAddress) { |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
currentAddress: this.props.ActiveCoin.activeAddress, |
|
|
|
})); |
|
|
@ -322,18 +350,18 @@ class WalletsData extends React.Component { |
|
|
|
(props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) { |
|
|
|
const sortedItemsList = sortByDate(this.props.ActiveCoin.txhistory); |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
itemsList: sortedItemsList, |
|
|
|
filteredItemsList: this.filterTransactions(sortedItemsList, this.state.searchTerm), |
|
|
|
showPagination: this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory.length >= this.state.pageSize |
|
|
|
})); |
|
|
|
itemsList: sortedItemsList, |
|
|
|
filteredItemsList: this.filterTransactions(sortedItemsList, this.state.searchTerm), |
|
|
|
showPagination: this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory.length >= this.state.pageSize |
|
|
|
})); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.props.ActiveCoin.txhistory && |
|
|
|
this.props.ActiveCoin.txhistory === 'no data') { |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
itemsList: 'no data', |
|
|
|
})); |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
itemsList: 'no data', |
|
|
|
})); |
|
|
|
} else if (this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory === 'loading') { |
|
|
|
this.setState(Object.assign({}, this.state, { |
|
|
|
itemsList: 'loading', |
|
|
@ -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'; |
|
|
|
} |
|
|
|
|
|
|
|
_amount = formatValue('round', _amount, -6); |
|
|
|
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'; |
|
|
|
|
|
|
|
_amount = formatValue('round', _amount, -6); |
|
|
|
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.send && |
|
|
|
!this.props.ActiveCoin.receive) { |
|
|
|
( |
|
|
|
this.props.ActiveCoin.mode !== 'native' && |
|
|
|
!this.props.ActiveCoin.send && |
|
|
|
!this.props.ActiveCoin.receive |
|
|
|
) || ( |
|
|
|
this.props.ActiveCoin.mode === 'native' && |
|
|
|
this.props.ActiveCoin.nativeActiveSection === 'default' |
|
|
|
)) { |
|
|
|
return WalletsDataRender.call(this); |
|
|
|
} else { |
|
|
|
return null; |
|
|
|