diff --git a/react/change.log b/react/change.log index c376a6b..65eee02 100644 --- a/react/change.log +++ b/react/change.log @@ -13,6 +13,9 @@ UI: - reset app setting to default - manual balance / transactions list refresh - quick access dropdown on login to open settings / about / sync only modals +- qr code generator / scan +- basilisk send form reset fix +- added native wallet info button v0.2.0.21a-beta -------------- diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index f070101..69d451c 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -325,9 +325,9 @@ export function getNativeTxHistoryState(json) { if (json && json.error) { json = null; - } else if (json && json.result) { + } else if (json && json.result && json.result.length) { json = json.result; - } else if (!json.length) { + } else if (!json || !json.result.length) { json = 'no data'; } diff --git a/react/src/actions/actions/addCoin.js b/react/src/actions/actions/addCoin.js index bd11ef1..c34443b 100644 --- a/react/src/actions/actions/addCoin.js +++ b/react/src/actions/actions/addCoin.js @@ -97,14 +97,16 @@ export function addCoin(coin, mode, syncOnly, port, startupParams) { export function iguanaAddCoin(coin, mode, acData, port) { function _iguanaAddCoin(dispatch) { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'iguanaAddCoin', - 'type': 'post', - 'url': `http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, - 'payload': acData, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'iguanaAddCoin', + 'type': 'post', + 'url': `http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, + 'payload': acData, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, { method: 'POST', @@ -112,11 +114,13 @@ export function iguanaAddCoin(coin, mode, acData, port) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( translate('TOASTR.FAILED_TO_ADDCOIN'), @@ -127,11 +131,13 @@ export function iguanaAddCoin(coin, mode, acData, port) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch( addCoinResult( coin, diff --git a/react/src/actions/actions/addressBalance.js b/react/src/actions/actions/addressBalance.js index 5f16784..a420575 100644 --- a/react/src/actions/actions/addressBalance.js +++ b/react/src/actions/actions/addressBalance.js @@ -106,14 +106,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { } const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getKMDAddressesNative', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getKMDAddressesNative', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -137,11 +139,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getKMDAddressesNative', @@ -152,11 +156,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } resolve(Config.cli.default && mode === 'native' ? json.result : json); }) } @@ -249,25 +255,27 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { for (let a = 0; a < result.length; a++) { newAddressArray[a] = []; - for (let b = 0; b < result[a].length; b++) { - let filteredArray; + if (result[a]) { + for (let b = 0; b < result[a].length; b++) { + let filteredArray; - if (mode === 'basilisk') { - filteredArray = json.map(res => res.amount); - } else { - filteredArray = json.filter(res => res.address === result[a][b]).map(res => res.amount); - } + if (mode === 'basilisk') { + filteredArray = json.map(res => res.amount); + } else { + filteredArray = json.filter(res => res.address === result[a][b]).map(res => res.amount); + } - let sum = 0; - for (let i = 0; i < filteredArray.length; i++) { - sum += filteredArray[i]; - } + let sum = 0; + for (let i = 0; i < filteredArray.length; i++) { + sum += filteredArray[i]; + } - newAddressArray[a][b] = { - address: result[a][b], - amount: currentAddress === result[a][b] || mode === 'native' ? sum : 'N/A', - type: a === 0 ? 'public': 'private', - }; + newAddressArray[a][b] = { + address: result[a][b], + amount: currentAddress === result[a][b] || mode === 'native' ? sum : 'N/A', + type: a === 0 ? 'public': 'private', + }; + } } } @@ -277,7 +285,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { Promise.all(result[1].map((_address, index) => { return new Promise((resolve, reject) => { const _timestamp = Date.now(); - let ajaxDataToHex = `[\"${_address}\"]`; + let ajaxDataToHex = '["' + _address + '"]'; iguanaHashHex(ajaxDataToHex, dispatch) .then((hashHexJson) => { @@ -299,14 +307,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { 'hex': hashHexJson, }; } - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getKMDAddressesNative+ZBalance', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getKMDAddressesNative+ZBalance', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -339,11 +349,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getKMDAddressesNative+ZBalance', @@ -357,11 +369,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { if (json && json.error) { resolve(0); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': json, + })); + } dispatch( triggerToaster( 'getKMDAddressesNative+ZBalance', @@ -380,11 +394,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { amount: json, type: 'private', }; - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } } }); }); @@ -433,14 +449,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { calcBalance(result, json[coin][currentAddress].refresh.data, dispatch, mode); } else { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getKMDAddressesNative+Balance', - 'type': 'post', - 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getKMDAddressesNative+Balance', + 'type': 'post', + 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, + 'payload': payload, + 'status': 'pending', + })); + } fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, { method: 'POST', @@ -448,11 +466,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getKMDAddressesNative+Balance', @@ -463,11 +483,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { }) .then(response => response.json()) .then(function(json) { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } updatedCache.basilisk[coin][currentAddress].refresh = { 'data': json, 'status': 'done', @@ -485,14 +507,16 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { }) } else { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getKMDAddressesNative+Balance', - 'type': 'post', - 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getKMDAddressesNative+Balance', + 'type': 'post', + 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -523,11 +547,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getKMDAddressesNative+Balance', @@ -542,11 +568,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { mode === 'native') { json = json.result; } - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } calcBalance( result, json, diff --git a/react/src/actions/actions/atomic.js b/react/src/actions/actions/atomic.js index 8008e73..a6d5b73 100644 --- a/react/src/actions/actions/atomic.js +++ b/react/src/actions/actions/atomic.js @@ -9,14 +9,16 @@ import Config from '../../config'; export function atomic(payload) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'atomic', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'atomic', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -24,11 +26,13 @@ export function atomic(payload) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( payload.method, @@ -39,11 +43,13 @@ export function atomic(payload) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(atomicState(json)); }); } diff --git a/react/src/actions/actions/basiliskProcessAddress.js b/react/src/actions/actions/basiliskProcessAddress.js index 1a4445b..ec85708 100644 --- a/react/src/actions/actions/basiliskProcessAddress.js +++ b/react/src/actions/actions/basiliskProcessAddress.js @@ -17,14 +17,16 @@ export function checkAddressBasilisk(coin, address) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'checkAddressBasilisk', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'checkAddressBasilisk', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, { method: 'POST', @@ -32,11 +34,13 @@ export function checkAddressBasilisk(coin, address) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'checkAddressBasilisk', @@ -47,11 +51,13 @@ export function checkAddressBasilisk(coin, address) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(checkAddressBasiliskHandle(json)); }) } @@ -97,14 +103,16 @@ export function validateAddressBasilisk(coin, address) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'validateAddressBasilisk', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'validateAddressBasilisk', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, { method: 'POST', @@ -112,11 +120,13 @@ export function validateAddressBasilisk(coin, address) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'validateAddressBasilisk', @@ -127,11 +137,13 @@ export function validateAddressBasilisk(coin, address) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(validateAddressBasiliskHandle(json)); }) } diff --git a/react/src/actions/actions/createWallet.js b/react/src/actions/actions/createWallet.js index cde4df6..88fc4e2 100644 --- a/react/src/actions/actions/createWallet.js +++ b/react/src/actions/actions/createWallet.js @@ -42,14 +42,16 @@ export function createNewWallet(_passphrase) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'createNewWallet', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'createNewWallet', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -57,11 +59,13 @@ export function createNewWallet(_passphrase) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'createNewWallet', @@ -72,11 +76,13 @@ export function createNewWallet(_passphrase) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(createNewWalletState(json)); }) } diff --git a/react/src/actions/actions/dexCoins.js b/react/src/actions/actions/dexCoins.js index 8df3a0a..817ba99 100644 --- a/react/src/actions/actions/dexCoins.js +++ b/react/src/actions/actions/dexCoins.js @@ -17,14 +17,16 @@ export function getDexCoins() { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getDexCoins', - 'type': 'post', - 'url': Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/InstantDEX/allcoins` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': _payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getDexCoins', + 'type': 'post', + 'url': Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/InstantDEX/allcoins` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': _payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -46,11 +48,13 @@ export function getDexCoins() { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'Error getDexCoins', @@ -61,11 +65,13 @@ export function getDexCoins() { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(dashboardCoinsState(json)); }); } diff --git a/react/src/actions/actions/edexBalance.js b/react/src/actions/actions/edexBalance.js index f54c622..fcdeb55 100644 --- a/react/src/actions/actions/edexBalance.js +++ b/react/src/actions/actions/edexBalance.js @@ -17,14 +17,16 @@ export function iguanaEdexBalance(coin) { return dispatch => { if (coin) { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'iguanaEdexBalance', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': _payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'iguanaEdexBalance', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': _payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -32,11 +34,13 @@ export function iguanaEdexBalance(coin) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'Error iguanaEdexBalance', @@ -70,14 +74,16 @@ export function getDexBalance(coin, mode, addr) { return new Promise((resolve, reject) => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getDexBalance', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getDexBalance', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, { method: 'POST', @@ -85,11 +91,13 @@ export function getDexBalance(coin, mode, addr) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getDexBalance', @@ -101,11 +109,13 @@ export function getDexBalance(coin, mode, addr) { .then(response => response.json()) .then(json => { console.log(json); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } }) resolve(index); diff --git a/react/src/actions/actions/edexGetTx.js b/react/src/actions/actions/edexGetTx.js index aa5b987..c9561cb 100644 --- a/react/src/actions/actions/edexGetTx.js +++ b/react/src/actions/actions/edexGetTx.js @@ -17,14 +17,16 @@ export function edexGetTransaction(data, dispatch) { return new Promise((resolve, reject) => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'edexGetTransaction', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'edexGetTransaction', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -32,11 +34,13 @@ export function edexGetTransaction(data, dispatch) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'edexGetTransaction', @@ -47,11 +51,13 @@ export function edexGetTransaction(data, dispatch) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } resolve(json); }) }); diff --git a/react/src/actions/actions/fullTxHistory.js b/react/src/actions/actions/fullTxHistory.js index 124696a..64a8523 100644 --- a/react/src/actions/actions/fullTxHistory.js +++ b/react/src/actions/actions/fullTxHistory.js @@ -22,14 +22,16 @@ export function getFullTransactionsList(coin) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getFullTransactionsList', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getFullTransactionsList', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -37,11 +39,13 @@ export function getFullTransactionsList(coin) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getFullTransactionsList', @@ -52,11 +56,13 @@ export function getFullTransactionsList(coin) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(getNativeTxHistoryState(json)); }) } diff --git a/react/src/actions/actions/getAddrByAccount.js b/react/src/actions/actions/getAddrByAccount.js index 0ef1f52..2759224 100644 --- a/react/src/actions/actions/getAddrByAccount.js +++ b/react/src/actions/actions/getAddrByAccount.js @@ -37,14 +37,16 @@ export function getAddressesByAccount(coin, mode) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getAddressesByAccount', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getAddressesByAccount', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -52,11 +54,13 @@ export function getAddressesByAccount(coin, mode) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch(updateErrosStack('activeHandle')); dispatch( triggerToaster( @@ -68,11 +72,13 @@ export function getAddressesByAccount(coin, mode) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch( getAddressesByAccountState( json, diff --git a/react/src/actions/actions/iguanaHelpers.js b/react/src/actions/actions/iguanaHelpers.js index a0eb8a9..bcae9eb 100644 --- a/react/src/actions/actions/iguanaHelpers.js +++ b/react/src/actions/actions/iguanaHelpers.js @@ -30,14 +30,16 @@ export function iguanaHashHex(data, dispatch) { resolve(true); } else { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'iguanaHashHex', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'iguanaHashHex', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -45,11 +47,13 @@ export function iguanaHashHex(data, dispatch) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'iguanaHashHex', @@ -60,11 +64,13 @@ export function iguanaHashHex(data, dispatch) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } resolve(json.hex); }) } diff --git a/react/src/actions/actions/logout.js b/react/src/actions/actions/logout.js index 63f4783..fe68c3f 100644 --- a/react/src/actions/actions/logout.js +++ b/react/src/actions/actions/logout.js @@ -39,14 +39,16 @@ function walletLock() { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'walletLock', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'walletLock', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -54,11 +56,13 @@ function walletLock() { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'walletLock', @@ -69,11 +73,13 @@ function walletLock() { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(logoutState(json)); dispatch(logoutResetAppState()); }) diff --git a/react/src/actions/actions/nativeBalance.js b/react/src/actions/actions/nativeBalance.js index 22ebef9..960e00f 100644 --- a/react/src/actions/actions/nativeBalance.js +++ b/react/src/actions/actions/nativeBalance.js @@ -42,14 +42,16 @@ export function getKMDBalanceTotal(coin) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getKMDBalanceTotal', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getKMDBalanceTotal', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -72,11 +74,13 @@ export function getKMDBalanceTotal(coin) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getKMDBalanceTotal', @@ -87,11 +91,13 @@ export function getKMDBalanceTotal(coin) { }) .then(response => response.json()) .then(function(json) { // TODO: figure out why komodod spits out "parse error" - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } if (json && !json.error) { dispatch(getNativeBalancesState(json)); diff --git a/react/src/actions/actions/nativeNewAddress.js b/react/src/actions/actions/nativeNewAddress.js index d41d213..4bd4088 100644 --- a/react/src/actions/actions/nativeNewAddress.js +++ b/react/src/actions/actions/nativeNewAddress.js @@ -49,14 +49,16 @@ export function getNewKMDAddresses(coin, pubpriv) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getNewKMDAddresses', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getNewKMDAddresses', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -85,11 +87,13 @@ export function getNewKMDAddresses(coin, pubpriv) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getNewKMDAddresses', @@ -103,11 +107,13 @@ export function getNewKMDAddresses(coin, pubpriv) { if (Config.cli.default) { json = json.result; } - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch( handleGetNewKMDAddresses( pubpriv, diff --git a/react/src/actions/actions/nativeSend.js b/react/src/actions/actions/nativeSend.js index 8fea38e..0f788c8 100644 --- a/react/src/actions/actions/nativeSend.js +++ b/react/src/actions/actions/nativeSend.js @@ -16,8 +16,9 @@ export function sendNativeTx(coin, _payload) { let payload; let _apiMethod; - if (_payload.addressType === 'public' && // transparent - _payload.sendTo.length !== 95) { + // iguana core + if ((_payload.addressType === 'public' && // transparent + _payload.sendTo.length !== 95) || !_payload.sendFrom) { _apiMethod = 'sendtoaddress'; ajaxDataToHex = `["${_payload.sendTo}", ${Number(_payload.amount) - Number(_payload.fee)}]`; } else { // private @@ -47,27 +48,29 @@ export function sendNativeTx(coin, _payload) { } const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'sendNativeTx', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'sendNativeTx', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', body: JSON.stringify(payload), }; - if (Config.cli.default) { + if (Config.cli.default) { // rpc payload = { mode: null, chain: coin, cmd: payload.function, params: - _payload.addressType === 'public' && _payload.sendTo.length !== 95 ? + (_payload.addressType === 'public' && _payload.sendTo.length !== 95) || !_payload.sendFrom ? [ _payload.sendTo, _payload.amount @@ -97,11 +100,13 @@ export function sendNativeTx(coin, _payload) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'sendNativeTx', @@ -115,15 +120,17 @@ export function sendNativeTx(coin, _payload) { return _response; }) .then(function(json) { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } if (json.indexOf('"code":') > -1) { const _message = json.substring( - `${json.indexOf('"message":"')}11`, + `${json.indexOf('"message":"')}11`, json.indexOf('"},"id":"jl777"') ); @@ -208,14 +215,16 @@ export function getKMDOPID(opid, coin) { } const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getKMDOPID', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getKMDOPID', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -244,11 +253,13 @@ export function getKMDOPID(opid, coin) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getKMDOPID', @@ -262,11 +273,13 @@ export function getKMDOPID(opid, coin) { if (Config.cli.default) { json = json.result; } - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(getKMDOPIDState(json)); }) }) diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js index ed7c6cb..8260128 100644 --- a/react/src/actions/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -16,14 +16,16 @@ export function getSyncInfoNativeKMD(skipDebug) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getSyncInfoNativeKMD', - 'type': 'post', - 'url': Config.iguanaLessMode ? 'http://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, - 'payload': '', - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getSyncInfoNativeKMD', + 'type': 'post', + 'url': Config.iguanaLessMode ? 'http://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, + 'payload': '', + 'status': 'pending', + })); + } return fetch( Config.iguanaLessMode ? 'http://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, { @@ -31,11 +33,13 @@ export function getSyncInfoNativeKMD(skipDebug) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getSyncInfoNativeKMD', @@ -46,11 +50,13 @@ export function getSyncInfoNativeKMD(skipDebug) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': Config.iguanaLessMode ? json.info : json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': Config.iguanaLessMode ? json.info : json, + })); + } dispatch(getSyncInfoNativeState({ 'remoteKMDNode': Config.iguanaLessMode ? json.info : json })); }) .then(function() { @@ -104,14 +110,16 @@ export function getSyncInfoNative(coin, skipDebug) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getSyncInfo', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getSyncInfo', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', body: JSON.stringify(payload), @@ -133,11 +141,13 @@ export function getSyncInfoNative(coin, skipDebug) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getSyncInfo', @@ -172,11 +182,13 @@ export function getSyncInfoNative(coin, skipDebug) { dispatch(getDebugLog('komodo', 1)); } - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch( getSyncInfoNativeState( json, diff --git a/react/src/actions/actions/nativeTxHistory.js b/react/src/actions/actions/nativeTxHistory.js index 2bb72de..6724003 100644 --- a/react/src/actions/actions/nativeTxHistory.js +++ b/react/src/actions/actions/nativeTxHistory.js @@ -33,14 +33,16 @@ export function getNativeTxHistory(coin) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getNativeTxHistory', - 'type': 'post', - 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getNativeTxHistory', + 'type': 'post', + 'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -69,11 +71,13 @@ export function getNativeTxHistory(coin) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getNativeTxHistory', @@ -84,11 +88,13 @@ export function getNativeTxHistory(coin) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(getNativeTxHistoryState(json)); }) } diff --git a/react/src/actions/actions/notary.js b/react/src/actions/actions/notary.js index d51d0ec..10f1c8a 100644 --- a/react/src/actions/actions/notary.js +++ b/react/src/actions/actions/notary.js @@ -23,25 +23,29 @@ function initNotaryNodesConSequence(nodes) { return new Promise((resolve, reject) => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': `initNotaryNodesConSequence+${node}`, - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': `initNotaryNodesConSequence+${node}`, + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } fetch(`http://127.0.0.1:${(Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}/api/dex/getinfo?userpass=${('tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'))}&symbol=${node}`, { method: 'GET', }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( `getInfoDexNode+${node}`, @@ -52,11 +56,13 @@ function initNotaryNodesConSequence(nodes) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch( updateNotaryNodeConState( json, @@ -171,25 +177,29 @@ export function getDexNotaries(coin) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getDexNotaries', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getDexNotaries', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getDexNotaries', @@ -200,11 +210,13 @@ export function getDexNotaries(coin) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(getDexNotariesState(json)); }) } diff --git a/react/src/actions/actions/sendFullBasilisk.js b/react/src/actions/actions/sendFullBasilisk.js index ee058fd..0abda10 100644 --- a/react/src/actions/actions/sendFullBasilisk.js +++ b/react/src/actions/actions/sendFullBasilisk.js @@ -25,14 +25,16 @@ export function sendToAddress(coin, _payload) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'sendToAddress', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'sendToAddress', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -40,11 +42,13 @@ export function sendToAddress(coin, _payload) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'sendToAddress', @@ -55,11 +59,13 @@ export function sendToAddress(coin, _payload) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(sendToAddressState(json, dispatch)); }) } @@ -81,14 +87,16 @@ export function sendFromAddress(coin, _payload) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'sendFromAddress', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'sendFromAddress', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -96,11 +104,13 @@ export function sendFromAddress(coin, _payload) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'sendFromAddress', @@ -111,11 +121,13 @@ export function sendFromAddress(coin, _payload) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(sendToAddressState(json, dispatch)); }) } @@ -140,14 +152,16 @@ export function iguanaUTXORawTX(data, dispatch) { return new Promise((resolve, reject) => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'iguanaUTXORawTX', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'iguanaUTXORawTX', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -155,11 +169,13 @@ export function iguanaUTXORawTX(data, dispatch) { }) .catch(function(error) { console.log(error); - dispatch => dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch => dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'iguanaUTXORawTX', @@ -170,11 +186,13 @@ export function iguanaUTXORawTX(data, dispatch) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } resolve(json); }) }); @@ -191,14 +209,16 @@ export function dexSendRawTX(data, dispatch) { return new Promise((resolve, reject) => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'dexSendRawTX', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'dexSendRawTX', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } fetch('http://127.0.0.1:' + Config.iguanaCorePort, { method: 'POST', @@ -206,11 +226,13 @@ export function dexSendRawTX(data, dispatch) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'dexSendRawTX', @@ -225,11 +247,13 @@ export function dexSendRawTX(data, dispatch) { return _response; }) .then(function(json) { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } resolve(json); }) }); diff --git a/react/src/actions/actions/settings.js b/react/src/actions/actions/settings.js index 126f10b..f38adfa 100644 --- a/react/src/actions/actions/settings.js +++ b/react/src/actions/actions/settings.js @@ -101,14 +101,16 @@ export function importPrivKey(wifKey) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'importPrivKey', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'importPrivKey', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -116,11 +118,13 @@ export function importPrivKey(wifKey) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'importPrivKey', @@ -131,11 +135,13 @@ export function importPrivKey(wifKey) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch( parseImportPrivKeyResponse( json, @@ -200,14 +206,16 @@ export function getPeersList(coin) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getPeersList', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getPeersList', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -215,11 +223,13 @@ export function getPeersList(coin) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getPeersList', @@ -230,11 +240,13 @@ export function getPeersList(coin) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(getPeersListState(json, dispatch)); }) } @@ -316,14 +328,16 @@ export function addPeerNode(coin, ip) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'addPeerNode', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'addPeerNode', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -331,11 +345,13 @@ export function addPeerNode(coin, ip) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'addPeerNode', @@ -346,11 +362,13 @@ export function addPeerNode(coin, ip) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(addPeerNodeState(json, dispatch)); }) } diff --git a/react/src/actions/actions/syncInfo.js b/react/src/actions/actions/syncInfo.js index b24b944..53c87cf 100644 --- a/react/src/actions/actions/syncInfo.js +++ b/react/src/actions/actions/syncInfo.js @@ -31,14 +31,16 @@ export function getSyncInfo(coin) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'getSyncInfo', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'getSyncInfo', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -46,11 +48,13 @@ export function getSyncInfo(coin) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'getSyncInfo', @@ -65,11 +69,13 @@ export function getSyncInfo(coin) { return _response; }) .then(function(json) { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } if (json.indexOf('coin is busy processing') === -1) { dispatch(getSyncInfoState(json, dispatch)); } diff --git a/react/src/actions/actions/walletAuth.js b/react/src/actions/actions/walletAuth.js index aa5d767..31f2332 100644 --- a/react/src/actions/actions/walletAuth.js +++ b/react/src/actions/actions/walletAuth.js @@ -24,14 +24,16 @@ export function encryptWallet(_passphrase, cb, coin) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'encryptWallet', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'encryptWallet', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -39,11 +41,13 @@ export function encryptWallet(_passphrase, cb, coin) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'encryptWallet', @@ -55,11 +59,13 @@ export function encryptWallet(_passphrase, cb, coin) { .then(dispatch(walletPassphrase(_passphrase))) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch( cb.call( this, @@ -82,14 +88,16 @@ export function walletPassphrase(_passphrase) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'walletpassphrase', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'walletpassphrase', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -97,11 +105,13 @@ export function walletPassphrase(_passphrase) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'walletPassphrase', @@ -111,11 +121,13 @@ export function walletPassphrase(_passphrase) { ); }) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } }) } } @@ -132,14 +144,16 @@ export function iguanaWalletPassphrase(_passphrase) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'iguanaWalletPassphrase', - 'type': 'post', - 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': _payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'iguanaWalletPassphrase', + 'type': 'post', + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': _payload, + 'status': 'pending', + })); + } return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', @@ -147,11 +161,13 @@ export function iguanaWalletPassphrase(_passphrase) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch( triggerToaster( 'Error iguanaWalletPassphrase', @@ -162,11 +178,13 @@ export function iguanaWalletPassphrase(_passphrase) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(iguanaWalletPassphraseState(json, dispatch)); }); } @@ -181,14 +199,16 @@ export function iguanaActiveHandle(getMainAddress) { return dispatch => { const _timestamp = Date.now(); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'function': 'iguanaActiveHandle', - 'type': 'post', - 'url': Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/SuperNET/activehandle` : `http://127.0.0.1:${Config.iguanaCorePort}`, - 'payload': _payload, - 'status': 'pending', - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'function': 'iguanaActiveHandle', + 'type': 'post', + 'url': Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/SuperNET/activehandle` : `http://127.0.0.1:${Config.iguanaCorePort}`, + 'payload': _payload, + 'status': 'pending', + })); + } let _fetchConfig = { method: 'POST', @@ -210,11 +230,13 @@ export function iguanaActiveHandle(getMainAddress) { ) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } dispatch(updateErrosStack('activeHandle')); dispatch( triggerToaster( @@ -226,11 +248,13 @@ export function iguanaActiveHandle(getMainAddress) { }) .then(response => response.json()) .then(json => { - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } dispatch(getMainAddress ? getMainAddressState(json) : iguanaActiveHandleState(json)); }); } diff --git a/react/src/components/dashboard/coinTile/coinTileItem.js b/react/src/components/dashboard/coinTile/coinTileItem.js index 3e41952..e270774 100644 --- a/react/src/components/dashboard/coinTile/coinTileItem.js +++ b/react/src/components/dashboard/coinTile/coinTileItem.js @@ -76,7 +76,7 @@ class CoinTileItem extends React.Component { const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin]; Store.dispatch(iguanaActiveHandle(true)); - + Store.dispatch( getKMDAddressesNative( coin, @@ -107,6 +107,11 @@ class CoinTileItem extends React.Component { dashboardChangeActiveCoin(coin, mode) { if (coin !== this.props.ActiveCoin.coin) { + Store.dispatch(dashboardChangeActiveCoin(coin, mode)); + setTimeout(() => { + this.dispatchCoinActions(coin, mode); + }, 100); + Store.dispatch( stopInterval( 'sync', @@ -121,10 +126,6 @@ class CoinTileItem extends React.Component { ) ); - Store.dispatch(dashboardChangeActiveCoin(coin, mode)); - - this.dispatchCoinActions(coin, mode); - if (mode === 'full') { const _iguanaActiveHandle = setInterval(() => { this.dispatchCoinActions(coin, mode); @@ -147,6 +148,7 @@ class CoinTileItem extends React.Component { if (mode === 'basilisk') { const _activeHandle = this.props.Dashboard.activeHandle; const _basiliskMainAddress = _activeHandle[coin] || JSON.parse(sessionStorage.getItem('IguanaActiveAccount'))[coin]; + Store.dispatch(changeActiveAddress(_basiliskMainAddress)); if (_basiliskMainAddress) { @@ -178,7 +180,7 @@ class CoinTileItem extends React.Component { _iguanaActiveHandle ) ); - + Store.dispatch( startInterval( 'basilisk', diff --git a/react/src/components/dashboard/main/dashboard.render.js b/react/src/components/dashboard/main/dashboard.render.js index 580f60e..59b5b98 100644 --- a/react/src/components/dashboard/main/dashboard.render.js +++ b/react/src/components/dashboard/main/dashboard.render.js @@ -36,21 +36,21 @@ const DashboardRender = function() { -
+ { this.isSectionActive('edex') && -
-
+ } + { this.isSectionActive('atomic') && -
-
+ } + { this.isSectionActive('jumblr') && -
-
+ } + { this.isSectionActive('settings') && -
-
+ } + { this.isSectionActive('about') && -
+ } ); diff --git a/react/src/components/dashboard/qrModal/qrModal.js b/react/src/components/dashboard/qrModal/qrModal.js index 0866cc9..7012919 100755 --- a/react/src/components/dashboard/qrModal/qrModal.js +++ b/react/src/components/dashboard/qrModal/qrModal.js @@ -19,22 +19,28 @@ class QRModal extends React.Component { this.closeModal = this.closeModal.bind(this); this.handleScan = this.handleScan.bind(this); this.handleError = this.handleError.bind(this); - document.body.addEventListener('click', this.closeModal); } handleScan(data) { if (data !== null) { if (this.props.mode === 'scan') { - this.props.setRecieverFromScan(data) + this.props.setRecieverFromScan(data); } + this.closeModal(); } } handleError(err) { - this.setState({ - error: err, - }); + if (err.name === 'NoVideoInputDevicesError') { + this.setState({ + error: 'Error: No video input devices found!', + }); + } else { + this.setState({ + error: 'Error: unknown error!', + }); + } } openModal() { @@ -60,10 +66,6 @@ class QRModal extends React.Component { this.setState({ modalIsOpen: false, }); - - if (this.props.mode === 'scan') { - ReactDOM.unmountComponentAtNode(document.getElementById('webcam')); - } } render() { diff --git a/react/src/components/dashboard/qrModal/qrModal.render.js b/react/src/components/dashboard/qrModal/qrModal.render.js index 0524407..db7d0eb 100644 --- a/react/src/components/dashboard/qrModal/qrModal.render.js +++ b/react/src/components/dashboard/qrModal/qrModal.render.js @@ -66,7 +66,13 @@ export const QRModalReaderRender = function () {
-
+
{ this.state.error }
diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.js b/react/src/components/dashboard/receiveCoin/receiveCoin.js index 34303a6..1c13748 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.js +++ b/react/src/components/dashboard/receiveCoin/receiveCoin.js @@ -167,15 +167,17 @@ class ReceiveCoin extends React.Component { if (this.isBasiliskMode() && this.hasNoAmount(address)) { - address.amount = _cache && _cache[_coin][address.address] - && _cache[_coin][address.address].getbalance.data - && _cache[_coin][address.address].getbalance.data.balance ? _cache[_coin][address.address].getbalance.data.balance : 'N/A'; + address.amount = _cache && _cache[_coin][address.address] && + _cache[_coin][address.address].getbalance && + _cache[_coin][address.address].getbalance.data && + _cache[_coin][address.address].getbalance.data.balance ? _cache[_coin][address.address].getbalance.data.balance : 'N/A'; } if (this.isBasiliskMode() && this.hasNoInterest(address)) { - address.interest = _cache && _cache[_coin][address.address] - && _cache[_coin][address.address].getbalance.data - && _cache[_coin][address.address].getbalance.data.interest ? _cache[_coin][address.address].getbalance.data.interest : 'N/A'; + address.interest = _cache && _cache[_coin][address.address] && + _cache[_coin][address.address].getbalance && + _cache[_coin][address.address].getbalance.data && + _cache[_coin][address.address].getbalance.data.interest ? _cache[_coin][address.address].getbalance.data.interest : 'N/A'; } if (this.state.hideZeroAddresses) { diff --git a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js index de187d2..788988c 100644 --- a/react/src/components/dashboard/receiveCoin/receiveCoin.render.js +++ b/react/src/components/dashboard/receiveCoin/receiveCoin.render.js @@ -26,9 +26,7 @@ export const AddressActionsBasiliskModeRender = function(address) { onClick={ () => this._validateAddressBasilisk(address) }> - + ); }; @@ -45,9 +43,7 @@ export const AddressActionsNonBasiliskModeRender = function(address, type) { onClick={ () => this._copyCoinAddress(address) }> { translate('INDEX.COPY') } - + ); }; diff --git a/react/src/components/dashboard/sendCoin/sendCoin.js b/react/src/components/dashboard/sendCoin/sendCoin.js index 39566aa..e80716e 100644 --- a/react/src/components/dashboard/sendCoin/sendCoin.js +++ b/react/src/components/dashboard/sendCoin/sendCoin.js @@ -1,9 +1,7 @@ import React from 'react'; import Config from '../../../config'; import { translate } from '../../../translate/translate'; -import { - checkTimestamp -} from '../../../util/time'; +import { checkTimestamp } from '../../../util/time'; import { edexGetTxIDList, edexRemoveTXID @@ -55,7 +53,6 @@ class SendCoin extends React.Component { currentStackLength: 0, totalStackLength: 0, utxoMethodInProgress: false, - isCameraFeatureDetected: false, }; this.updateInput = this.updateInput.bind(this); this.handleBasiliskSend = this.handleBasiliskSend.bind(this); @@ -66,27 +63,9 @@ class SendCoin extends React.Component { this._fetchNewUTXOData = this._fetchNewUTXOData.bind(this); this.handleClickOutside = this.handleClickOutside.bind(this); this.setRecieverFromScan = this.setRecieverFromScan.bind(this); - this.detectCamera = this.detectCamera.bind(this); socket.on('messages', msg => this.updateSocketsData(msg)); } - // test device camera capabilities - detectCamera() { - const _getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia; - - _getUserMedia( - { 'video': true }, - function() { - this.setState({ - isCameraFeatureDetected: true, - }); - }, - function() { - console.warn('this device doesn\'t have camera!'); - } - ); - } - setRecieverFromScan(receiver) { this.setState({ sendTo: receiver @@ -101,8 +80,6 @@ class SendCoin extends React.Component { this.handleClickOutside, false ); - - this.detectCamera(); } componentWillUnmount() { @@ -323,7 +300,7 @@ class SendCoin extends React.Component { ); } else { return ( - - { translate('SEND.SELECT_T_OR_Z_ADDR') } - + { translate('SEND.SELECT_T_OR_Z_ADDR') } ); } } @@ -347,7 +324,7 @@ class SendCoin extends React.Component {
  • - - { translate('SEND.SELECT_T_OR_Z_ADDR') } - + { translate('SEND.SELECT_T_OR_Z_ADDR') }
  • @@ -395,7 +372,7 @@ class SendCoin extends React.Component { amount: 0, fee: 0.0001, sendSig: false, - sendApiType: false, + sendApiType: true, addressSelectorOpen: false, currentStackLength: 0, totalStackLength: 0, @@ -697,6 +674,8 @@ class SendCoin extends React.Component { ); } } else if (key === 'sendrawtransaction') { + const _lastSendToResponse = this.props.ActiveCoin.lastSendToResponse; + if (_lastSendToResponse[key] === 'success') { return ( true @@ -707,6 +686,8 @@ class SendCoin extends React.Component { ); } } else if (key === 'txid' || key === 'sent') { + const _lastSendToResponse = this.props.ActiveCoin.lastSendToResponse; + return ( { _lastSendToResponse[key] } ); @@ -775,6 +756,7 @@ class SendCoin extends React.Component { return null; } + render() { if (this.props.ActiveCoin && this.props.ActiveCoin.send && diff --git a/react/src/components/dashboard/sendCoin/sendCoin.render.js b/react/src/components/dashboard/sendCoin/sendCoin.render.js index 5a30302..43672d8 100644 --- a/react/src/components/dashboard/sendCoin/sendCoin.render.js +++ b/react/src/components/dashboard/sendCoin/sendCoin.render.js @@ -8,6 +8,8 @@ import { import QRModal from '../qrModal/qrModal'; export const UTXOCacheInfoRender = function(refreshCacheData, isReadyToUpdate, waitUntilCallIsFinished, timestamp) { + const _progress = 100 - this.state.currentStackLength * 100 / this.state.totalStackLength; + return (

    @@ -25,7 +27,7 @@ export const UTXOCacheInfoRender = function(refreshCacheData, isReadyToUpdate, w
    + style={{ width: `${_progress}%` }}> { translate('SEND.PROCESSING_REQ') }: { this.state.currentStackLength } / { this.state.totalStackLength }
    @@ -40,7 +42,7 @@ export const UTXOCacheInfoRender = function(refreshCacheData, isReadyToUpdate, w ); }; -export const SendCoinResponseRender = function () { +export const SendCoinResponseRender = function() { if (this.props.ActiveCoin.lastSendToResponse) { let items = []; const _response = this.props.ActiveCoin.lastSendToResponse; @@ -59,55 +61,59 @@ export const SendCoinResponseRender = function () { return items; } else { return ( -
    -
    - { translate('SEND.PROCESSING_TRANSACTION') }...
    - { translate('SEND.NOTE_IT_WILL_TAKE') }. -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    + + +
    +
    + { translate('SEND.PROCESSING_TRANSACTION') }...
    + { translate('SEND.NOTE_IT_WILL_TAKE') }.
    -
    -
    -
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    -
    -
    + + ); } } -export const OASendUIRender = function () { +export const OASendUIRender = function() { return (
    @@ -136,7 +142,7 @@ export const OASendUIRender = function () { ); }; -export const SendApiTypeSelectorRender = function () { +export const SendApiTypeSelectorRender = function() { return (
    @@ -144,7 +150,8 @@ export const SendApiTypeSelectorRender = function () {
    - { this.stateisCameraFeatureDetected && -
    - -
    - } +
    + +
    ); }; -export const SendCoinRender = function () { +export const SendCoinRender = function() { return (
    @@ -247,9 +252,8 @@ export const SendCoinRender = function () { className="form-control" id="edexcoinAmount" name="amount" - placeholder="0.000" + placeholder="0.001" autoComplete="off" - defaultValue={ this.state.amount } value={ this.state.amount } onChange={ this.updateInput } />
    @@ -264,16 +268,15 @@ export const SendCoinRender = function () { className="form-control" id="edexcoinFee" name="fee" - defaultValue={ this.state.fee } value={ this.state.fee } - placeholder="0.000" + placeholder="0.001" autoComplete="off" onChange={ this.updateInput } />
    { translate('INDEX.TOTAL') }  - ({ translate('INDEX.AMOUNT_SM') } - txfee): + ({ translate('INDEX.AMOUNT_SM') } - fee):   { Number(this.state.amount) - Number(this.state.fee) } { this.props.ActiveCoin.coin }
    @@ -282,7 +285,8 @@ export const SendCoinRender = function () {
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { this.isNativeMode() && - - - - - } - - { this.isNativeMode() && + { this.state.activeTab === 0 && +
+
{ translate('TX_INFO.ADDRESS') } - { txInfo.address } -
{ translate('TX_INFO.AMOUNT') } - { Config.roundValues ? formatValue('round', txInfo.amount, -10) : txInfo.amount } -
{ translate('TX_INFO.CATEGORY') } - { txInfo.category || txInfo.type } -
{ translate('TX_INFO.CONFIRMATIONS') } - { txInfo.confirmations } -
blockhash - { txInfo.blockhash } -
blocktime - { secondsToString(txInfo.blocktime || txInfo.timestamp) } -
txid - { txInfo.txid } -
walletconflicts - { txInfo.walletconflicts ? txInfo.walletconflicts.length : null } -
+ + + + + + + + + + + + + + + + + + { txInfo.blockhash && + + + + + } + { (txInfo.blocktime || txInfo.timestamp) && + + + + + } + + + + + { this.isNativeMode() && + + + + + } + { this.isNativeMode() && + + + + + } + { this.isNativeMode() && + + + + + } + +
{ translate('TX_INFO.ADDRESS') } + { this.props.ActiveCoin.mode === 'basilisk' ? this.props.ActiveCoin.activeAddress : txInfo.address } +
{ translate('TX_INFO.AMOUNT') } + { Config.roundValues ? formatValue('round', txInfo.amount, -10) : txInfo.amount } +
{ translate('TX_INFO.CATEGORY') } + { txInfo.category || txInfo.type } +
{ translate('TX_INFO.CONFIRMATIONS') } + { txInfo.confirmations } +
blockhash + { txInfo.blockhash } +
blocktime + { secondsToString(txInfo.blocktime || txInfo.timestamp) } +
txid + { txInfo.txid } +
walletconflicts + { txInfo.walletconflicts.length } +
time + { secondsToString(txInfo.time) } +
timereceived + { secondsToString(txInfo.timereceived) } +
+
+ } + { this.state.activeTab === 1 && +
+ + - + - } - - { this.isNativeMode() && - + - } - -
timevjoinsplit - { secondsToString(txInfo.time) } + { txInfo.vjoinsplit }
timereceiveddetails - { secondsToString(txInfo.timereceived) } + { txInfo.details }
-
- -
- - - - - - - - - - - -
vjoinsplit - { txInfo.vjoinsplit } -
details - { txInfo.details } -
-
-
- -
- -
- -
+ + +
+ } + { this.state.activeTab === 2 && +
+ +
+ } + { this.state.activeTab === 3 && +
+ +
+ }
diff --git a/react/src/components/login/login.js b/react/src/components/login/login.js index a2b475b..4f6dc64 100644 --- a/react/src/components/login/login.js +++ b/react/src/components/login/login.js @@ -21,6 +21,8 @@ import { translate } from '../../translate/translate'; const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000; const IGUNA_ACTIVE_COINS_TIMEOUT = 10000; +// TODO: remove duplicate activehandle and activecoins calls + class Login extends React.Component { constructor(props) { super(props); @@ -62,7 +64,7 @@ class Login extends React.Component { toggleLoginSettingsDropdownSection(sectionName) { Store.dispatch(toggleLoginSettingsModal(true)); - + this.setState({ displayLoginSettingsDropdown: false, displayLoginSettingsDropdownSection: sectionName, @@ -193,14 +195,14 @@ class Login extends React.Component { if (this.state.seedInputVisibility) { document.querySelector('#loginPassphrase').style.height = '1px'; document.querySelector('#loginPassphrase').style.height = `${(15 + document.querySelector('#loginPassphrase').scrollHeight)}px`; - } + } }, 100); } updateLoginPassPhraseInput(e) { // remove any empty chars from the start/end of the string const newValue = e.target.value; - + clearTimeout(this.state.trimPassphraseTimer); const _trimPassphraseTimer = setTimeout(() => { @@ -211,7 +213,7 @@ class Login extends React.Component { }, 2000); this.resizeLoginTextarea(); - + this.setState({ trimPassphraseTimer: _trimPassphraseTimer, [e.target.name]: newValue, @@ -350,7 +352,7 @@ class Login extends React.Component { copyPassPhraseToClipboard() { const passPhrase = this.state.randomSeed; const textField = document.createElement('textarea'); - + textField.innerText = passPhrase; document.body.appendChild(textField); textField.select(); diff --git a/react/src/components/main/main.js b/react/src/components/main/main.js index 9f18b85..88f66c3 100644 --- a/react/src/components/main/main.js +++ b/react/src/components/main/main.js @@ -23,6 +23,16 @@ class Main extends React.Component { } componentDidMount() { + let appVersion; + + try { + appVersion = window.require('electron').remote.getCurrentWindow().appBasicInfo; + } catch (e) {} + + if (appVersion) { + document.title = `${appVersion.name} (v${appVersion.version.replace('version=', '')}-beta)`; + } + Store.dispatch(iguanaActiveHandle()); const _iguanaActiveHandle = setInterval(function() { Store.dispatch(iguanaActiveHandle()); diff --git a/react/src/components/main/walletMain.js b/react/src/components/main/walletMain.js index 6c291ca..65e0e5c 100644 --- a/react/src/components/main/walletMain.js +++ b/react/src/components/main/walletMain.js @@ -10,6 +10,7 @@ class WalletMain extends React.Component { render() { return (
+ diff --git a/react/src/components/overrides.scss b/react/src/components/overrides.scss index 5bee66c..a3cb152 100644 --- a/react/src/components/overrides.scss +++ b/react/src/components/overrides.scss @@ -648,4 +648,40 @@ select{ position: absolute; right: 4px; top: 3px; +} + +.table-striped { + > tbody { + > tr.hover--none { + background-color: inherit; + } + } +} + +.qr-modal-send-block { + position: absolute; + top: 15px; + right: 30px; +} + +@media only screen and (min-width : 1201px) { + .wallet-widgets { + .flex { + display: flex; + flex-wrap: wrap; + } + > div { + display: flex; + + .widget, + .widget-content { + height: 100%; + + > div, + .clearfix { + height: 100%; + } + } + } + } } \ No newline at end of file diff --git a/react/src/translate/en.js b/react/src/translate/en.js index 783c235..9779a73 100644 --- a/react/src/translate/en.js +++ b/react/src/translate/en.js @@ -17,6 +17,7 @@ export const _lang = { 'NO_ACTIVE_COIN': 'No active coin', }, 'INDEX': { + 'RESCANNING_LAST_BLOCKS': 'Rescanning last blocks...', 'NO_DATA_AVAILABLE': 'No data available', 'LOADING': 'Loading', 'ACTIVATING_SM': 'activating', @@ -193,7 +194,8 @@ export const _lang = { '- Your External Wallet/daemon is setup, but is not setup with config settings like
', 'ACTIVATING_CHAIN': 'Activating best chain', 'KMD_STARTED': 'Komodo daemon has been started and is processing.
' + - 'Please wait while the best chain is being activated.', + 'Please wait while the best chain is being activated.
' + + 'Tip: in case sync is stuck restart the wallet.', 'CONNECTIONS': 'Connections', 'TRANSPARENT_BALANCE': 'Transparent Balance', 'Z_BALANCE': 'Private (Z) Balance', diff --git a/react/src/translate/translate.js b/react/src/translate/translate.js index 060f05d..631141b 100644 --- a/react/src/translate/translate.js +++ b/react/src/translate/translate.js @@ -13,13 +13,13 @@ export function translate(langID) { _lang[defaultLang][langIDComponents[0]][langIDComponents[1]]) { return _lang[defaultLang][langIDComponents[0]][langIDComponents[1]]; } else { - console.warn('Missing translation in js/' + defaultLang.toLowerCase() + '.js ' + langID); - return '--> ' + langID + ' <--'; + console.warn(`Missing translation ${langID} in js/${defaultLang.toLowerCase()}.js`); + return `--> ${langID} <--`; } } else { if (langID.length) { - console.warn('Missing translation in js/' + defaultLang.toLowerCase() + '.js ' + langID); - return '--> ' + langID + ' <--'; + console.warn(`Missing translation ${langID} in js/${defaultLang.toLowerCase()}.js`); + return `--> ${langID} <--`; } } } \ No newline at end of file diff --git a/react/src/util/formatValue.js b/react/src/util/formatValue.js index f28b22e..c355e8f 100644 --- a/react/src/util/formatValue.js +++ b/react/src/util/formatValue.js @@ -1,5 +1,6 @@ // ref: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Math/round#Decimal_rounding export function formatValue(formatType, formatValue, formatExp) { + let _formatExp; /** * Decimal adjustment of a number. * @@ -31,19 +32,21 @@ export function formatValue(formatType, formatValue, formatExp) { return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)); } - if (formatValue >= 1) { - formatExp = -3; + if (Math.abs(Number(formatValue)) >= 1) { + _formatExp = -3; + } else { + _formatExp = formatExp; } switch (formatType) { case 'round': - return decimalAdjust('round', formatValue, formatExp); + return decimalAdjust('round', formatValue, _formatExp); break; case 'floor': - return decimalAdjust('floor', formatValue, formatExp); + return decimalAdjust('floor', formatValue, _formatExp); break; case 'ceil': - return decimalAdjust('ceil', formatValue, formatExp); + return decimalAdjust('ceil', formatValue, _formatExp); break; } } \ No newline at end of file diff --git a/react/src/util/sort.js b/react/src/util/sort.js index 3ae1063..6bf318f 100644 --- a/react/src/util/sort.js +++ b/react/src/util/sort.js @@ -1,10 +1,13 @@ -export function sortByDate(data) { +export function sortByDate(data, sortKey) { return data.sort(function(a, b) { - if (a.timestamp && - b.timestamp) { - return b.timestamp - a.timestamp; - } else { - return b.blocktime - a.blocktime; + if (a[sortKey] < b[sortKey]) { + return -1; } + + if (a[sortKey] > b[sortKey]) { + return 1; + } + + return 0; }); } \ No newline at end of file diff --git a/react/src/util/time.js b/react/src/util/time.js index 1e65f2b..faff9fc 100644 --- a/react/src/util/time.js +++ b/react/src/util/time.js @@ -18,7 +18,7 @@ export function secondsToString(seconds, skipMultiply, showSeconds) { month = months[a.getMonth()], date = a.getDate(), hour = a.getHours() < 10 ? `0${a.getHours()}` : a.getHours(), - min = a.getMinutes() < 10 ? `0 ${a.getMinutes()}` : a.getMinutes(), + min = a.getMinutes() < 10 ? `0${a.getMinutes()}` : a.getMinutes(), sec = a.getSeconds(), time = `${date} ${month} ${year} ${hour}:${min}${(showSeconds ? ':' + sec : '')}`; @@ -37,9 +37,9 @@ export function secondsElapsedToString(timestamp) { // in seconds const hours = Math.floor(timestamp / 3600); const minutes = Math.floor((timestamp - (hours * 3600)) / 60); const seconds = timestamp - (hours * 3600) - (minutes * 60); - const returnTimeVal = (hours > 0 ? hours + ' hour(s) ' : '') + - (minutes > 0 ? minutes + ' minute(s) ' : '') + - (seconds > 0 ? seconds + ' second(s) ' : ''); + const returnTimeVal = (hours > 0 ? `${hours} hour(s) ` : '') + + (minutes > 0 ? `${minutes} minute(s) ` : '') + + (seconds > 0 ? `${seconds} second(s) ` : ''); return returnTimeVal; } \ No newline at end of file diff --git a/react/www/index.html b/react/www/index.html index d8d2d3a..3b7aa4c 100644 --- a/react/www/index.html +++ b/react/www/index.html @@ -1,21 +1,20 @@ - - - - - - Agama (v0.2.0.21a-beta) - - - - - - + + + + + + Agama + + + + + + -