diff --git a/react/src/actions/actions/nativeDashboardUpdate.js b/react/src/actions/actions/nativeDashboardUpdate.js index af3cd75..9c9fa28 100644 --- a/react/src/actions/actions/nativeDashboardUpdate.js +++ b/react/src/actions/actions/nativeDashboardUpdate.js @@ -45,10 +45,10 @@ export function getDashboardUpdate(coin, activeCoinProps) { export function getDashboardUpdateState(json, coin, fakeResponse) { // rescan or similar resource heavy process if (fakeResponse || - ((json.result['getinfo'].error && json.result['getinfo'].error === 'daemon is busy') && - (json.result['z_getoperationstatus'].error && json.result['z_getoperationstatus'].error === 'daemon is busy') && - (json.result['listtransactions'].error && json.result['listtransactions'].error === 'daemon is busy') && - (json.result['listtransactions'].error && json.result['listtransactions'].error === 'daemon is busy'))) { + ((json.result.getinfo.error && json.result.getinfo.error === 'daemon is busy') && + (json.result.z_getoperationstatus.error && json.result.z_getoperationstatus.error === 'daemon is busy') && + (json.result.listtransactions.error && json.result.listtransactions.error === 'daemon is busy') && + (json.result.listtransactions.error && json.result.listtransactions.error === 'daemon is busy'))) { return { type: DASHBOARD_UPDATE, progress: null, @@ -60,7 +60,7 @@ export function getDashboardUpdateState(json, coin, fakeResponse) { rescanInProgress: true, }; } else { - let _listtransactions = json.result['listtransactions']; + let _listtransactions = json.result.listtransactions; if (_listtransactions && _listtransactions.error) { @@ -74,22 +74,41 @@ export function getDashboardUpdateState(json, coin, fakeResponse) { if (coin === 'CHIPS') { return { type: DASHBOARD_UPDATE, - progress: json.result['getinfo'].result, + progress: json.result.getinfo.result, opids: null, txhistory: _listtransactions, - balance: { transparent: json.result['getbalance'].result, total: json.result['getbalance'].result }, - addresses: json.result['addresses'], + balance: { + transparent: json.result.getbalance.result, + total: json.result.getbalance.result + }, + addresses: json.result.addresses, coin: coin, rescanInProgress: false, }; } else { + // calc transparent balance properly + let _tbalance = 0; + + if (json.result.addresses && + json.result.addresses.public && + json.result.addresses.public.length) { + for (let i = 0; i < json.result.addresses.public.length; i++) { + _tbalance += json.result.addresses.public[i].spendable; + } + } + + console.warn(_tbalance); + + json.result.z_gettotalbalance.result.transparent = _tbalance.toFixed(8); + json.result.z_gettotalbalance.result.total = json.result.z_gettotalbalance.result.transparent + Number(json.result.z_gettotalbalance.result.interest) + Number(json.result.z_gettotalbalance.result.private); + return { type: DASHBOARD_UPDATE, - progress: json.result['getinfo'].result, - opids: json.result['z_getoperationstatus'].result, + progress: json.result.getinfo.result, + opids: json.result.z_getoperationstatus.result, txhistory: _listtransactions, - balance: json.result['z_gettotalbalance'].result, - addresses: json.result['addresses'], + balance: json.result.z_gettotalbalance.result, + addresses: json.result.addresses, coin: coin, rescanInProgress: false, }; diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js index ec7a597..8c05df2 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js +++ b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js @@ -40,20 +40,24 @@ export const AddressActionsNonBasiliskModeRender = function(address, type) { }; export const AddressItemRender = function(address, type) { - const _isBarterDexAddress = address.address[0] === 'b' ? true : false; - //fa-ban return (