diff --git a/react/change.log b/react/change.log index c376a6b..5ee34f5 100644 --- a/react/change.log +++ b/react/change.log @@ -13,6 +13,13 @@ 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 +- added coqui assetchain +- jumblr +- zcashparams folder check +- claim interest modal v0.2.0.21a-beta -------------- diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index f070101..5919f83 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -27,6 +27,7 @@ import { DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY, DISPLAY_LOGIN_SETTINGS_MODAL, DISPLAY_COIND_DOWN_MODAL, + DISPLAY_CLAIM_INTEREST_MODAL, START_INTERVAL, STOP_INTERVAL } from './storeType'; @@ -68,6 +69,8 @@ export * from './actions/basiliskTxHistory'; export * from './actions/iguanaHelpers'; export * from './actions/cli'; export * from './actions/update'; +export * from './actions/jumblr'; +export * from './actions/interest'; export function changeActiveAddress(address) { return { @@ -325,9 +328,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'; } @@ -366,4 +369,11 @@ export function toggleLoginSettingsModal(display) { type: DISPLAY_LOGIN_SETTINGS_MODAL, displayLoginSettingsModal: display, } +} + +export function toggleClaimInterestModal(display) { + return { + type: DISPLAY_CLAIM_INTEREST_MODAL, + displayClaimInterestModal: display, + } } \ No newline at end of file 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/copyAddress.js b/react/src/actions/actions/copyAddress.js index 9bf15fe..9accd3b 100644 --- a/react/src/actions/actions/copyAddress.js +++ b/react/src/actions/actions/copyAddress.js @@ -14,4 +14,18 @@ export function copyCoinAddress(address) { ) ); } +} + +export function copyString(string, message) { + const _result = copyToClipboard(string); + + return dispatch => { + dispatch( + triggerToaster( + message, + translate('TOASTR.COIN_NOTIFICATION'), + _result ? 'success' : 'error' + ) + ); + } } \ No newline at end of file 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/interest.js b/react/src/actions/actions/interest.js new file mode 100644 index 0000000..1dd95c6 --- /dev/null +++ b/react/src/actions/actions/interest.js @@ -0,0 +1,86 @@ +import { + triggerToaster +} from '../actionCreators'; +import { + logGuiHttp, + guiLogState +} from './log'; +import Config from '../../config'; + +export function getListUnspent(coin) { + return new Promise((resolve, reject) => { + const payload = { + mode: null, + chain: coin, + cmd: 'listunspent', + }; + + const _fetchConfig = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ 'payload': payload }), + }; + + fetch( + `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, + _fetchConfig + ) + .catch(function(error) { + console.log(error); + dispatch( + triggerToaster( + 'getListUnspent', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => { + resolve(json.result ? json.result : json); + }) + }); +} + +export function getRawTransaction(coin, txid) { + return new Promise((resolve, reject) => { + const payload = { + mode: null, + chain: coin, + cmd: 'getrawtransaction', + params: [ + txid, + 1 + ], + }; + + const _fetchConfig = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ 'payload': payload }), + }; + + fetch( + `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, + _fetchConfig + ) + .catch(function(error) { + console.log(error); + dispatch( + triggerToaster( + 'getTransaction', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => { + resolve(json.result ? json.result : json); + }) + }); +} \ No newline at end of file diff --git a/react/src/actions/actions/jumblr.js b/react/src/actions/actions/jumblr.js new file mode 100644 index 0000000..c734c07 --- /dev/null +++ b/react/src/actions/actions/jumblr.js @@ -0,0 +1,164 @@ +import { + triggerToaster, + getNewKMDAddresses +} from '../actionCreators'; +import { + logGuiHttp, + guiLogState +} from './log'; +import Config from '../../config'; + +function getNewAddress(coin) { // TODO: remove(?) + return new Promise((resolve, reject) => { + const payload = { + mode: null, + chain: coin, + cmd: 'getnewaddress' + }; + + const _fetchConfig = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ 'payload': payload }), + }; + + fetch( + `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, + _fetchConfig + ) + .catch(function(error) { + console.log(error); + dispatch( + triggerToaster( + 'genJumblrAddress + getKMDAddressesNative', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => { + resolve(json.result ? json.result : json); + }) + }); +} + +export function setJumblrAddress(coin, type, address) { + return new Promise((resolve, reject) => { + const payload = { + mode: null, + chain: coin, + cmd: type === 'deposit' ? 'jumblr_deposit' : 'jumblr_secret', + params: [address], + }; + + const _fetchConfig = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ 'payload': payload }), + }; + + fetch( + `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, + _fetchConfig + ) + .catch(function(error) { + console.log(error); + dispatch( + triggerToaster( + 'setJumblrAddress', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => { + resolve(json); + }); + }); +} + +function dumpPrivkey(coin, key) { + return new Promise((resolve, reject) => { + const payload = { + mode: null, + chain: coin, + cmd: 'dumpprivkey', + params: [key], + }; + + const _fetchConfig = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ 'payload': payload }), + }; + + fetch( + `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, + _fetchConfig + ) + .catch(function(error) { + console.log(error); + dispatch( + triggerToaster( + 'dumpPrivkey ', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => { + resolve(json.result ? json.result : json); + }) + }); +} + +export function importPrivkey(coin, key) { + return new Promise((resolve, reject) => { + const payload = { + mode: null, + chain: coin, + cmd: 'importprivkey', + params: [ + key, + '', + false + ], + }; + + const _fetchConfig = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ 'payload': payload }), + }; + + fetch( + `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, + _fetchConfig + ) + .catch(function(error) { + console.log(error); + dispatch( + triggerToaster( + 'importPrivkey ', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => { + resolve(json.result ? json.result : json); + }) + }); +} \ No newline at end of file diff --git a/react/src/actions/actions/log.js b/react/src/actions/actions/log.js index ca42d5b..c53f402 100644 --- a/react/src/actions/actions/log.js +++ b/react/src/actions/actions/log.js @@ -41,7 +41,6 @@ export function getAgamaLog(type) { ); }) .then(response => response.json()) - .then() } } 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..e3f9821 100644 --- a/react/src/actions/actions/nativeNewAddress.js +++ b/react/src/actions/actions/nativeNewAddress.js @@ -10,21 +10,7 @@ import { guiLogState } from './log'; -function handleGetNewKMDAddresses(pubpriv, coin, dispatch, json) { - dispatch( - triggerToaster( - json.result ? json.result : json, - translate('KMD_NATIVE.NEW_ADDR_GENERATED'), - 'info', - false - ) - ); - dispatch(getKMDAddressesNative(coin)); - - return {}; -} - -export function getNewKMDAddresses(coin, pubpriv) { +export function getNewKMDAddresses(coin, pubpriv, mode) { let payload; let ajaxFunctionInput = pubpriv === 'public' ? 'getnewaddress' : 'z_getnewaddress'; @@ -49,14 +35,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 +73,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,28 +93,33 @@ 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, - coin, - dispatch, - json + triggerToaster( + json.result ? json.result : json, + translate('KMD_NATIVE.NEW_ADDR_GENERATED'), + 'info', + false ) ); + dispatch(getKMDAddressesNative(coin, mode)); }) .catch(function(ex) { dispatch( - handleGetNewKMDAddresses( - pubpriv, - coin, - dispatch + triggerToaster( + json.result ? json.result : json, + translate('KMD_NATIVE.NEW_ADDR_GENERATED'), + 'info', + false ) ); + dispatch(getKMDAddressesNative(coin, mode)); }); } } \ No newline at end of file diff --git a/react/src/actions/actions/nativeSend.js b/react/src/actions/actions/nativeSend.js index 8fea38e..fc3e3e2 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"') ); @@ -188,7 +195,7 @@ export function getKMDOPID(opid, coin) { passthruAgent = getPassthruAgent(coin), tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; - if (passthruAgent == 'iguana') { + if (passthruAgent === 'iguana') { payload = { 'userpass': tmpIguanaRPCAuth, 'agent': passthruAgent, @@ -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,13 +273,59 @@ 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)); }) }) } +} + +export function sendToAddressPromise(coin, address, amount) { + return new Promise((resolve, reject) => { + const payload = { + mode: null, + chain: coin, + cmd: 'sendtoaddress', + params: [ + address, + amount, + 'KMD interest claim request', + 'KMD interest claim request', + true + ] + }; + + const _fetchConfig = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ 'payload': payload }), + }; + + fetch( + `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, + _fetchConfig + ) + .catch(function(error) { + console.log(error); + dispatch( + triggerToaster( + 'sendToAddress', + 'Error', + 'error' + ) + ); + }) + .then(response => response.json()) + .then(json => { + resolve(json); + }) + }); } \ No newline at end of file diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js index ed7c6cb..009c190 100644 --- a/react/src/actions/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -11,19 +11,21 @@ import { } from './log'; import Config from '../../config'; -export function getSyncInfoNativeKMD(skipDebug) { +export function getSyncInfoNativeKMD(skipDebug, json) { const coin = 'KMD'; - + // https://www.kmd.host/ 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,26 +33,32 @@ export function getSyncInfoNativeKMD(skipDebug) { }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'error', - 'response': error, - })); - dispatch( + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'error', + 'response': error, + })); + } + /*dispatch( triggerToaster( 'getSyncInfoNativeKMD', 'Error', 'error' ) - ); + );*/ + console.warn('remote kmd node fetch failed', true); + dispatch(getSyncInfoNativeState({ 'remoteKMDNode': null })); }) .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() { @@ -66,7 +74,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) { json && json.error && json.error.message.indexOf('Activating best') === -1) { - return getSyncInfoNativeKMD(skipDebug); + return getSyncInfoNativeKMD(skipDebug, json); } else { if (json && json.error && @@ -104,14 +112,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 +143,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', @@ -151,39 +163,60 @@ export function getSyncInfoNative(coin, skipDebug) { return _response; }) .then(json => { - if (!json && - Config.cli.default) { + if (json === 'Work queue depth exceeded') { dispatch( - triggerToaster( - 'Komodod is down', - 'Critical Error', - 'error', - true + getSyncInfoNativeState( + { result: 'daemon is busy', error: null, id: null }, + coin, + skipDebug ) ); - dispatch(getDebugLog('komodo', 50)); - dispatch(toggleCoindDownModal(true)); } else { - json = JSON.parse(json); - } + if (!json && + Config.cli.default) { + dispatch( + triggerToaster( + 'Komodod is down', + 'Critical Error', + 'error', + true + ) + ); - if (json.error && - json.error.message.indexOf('Activating best') === -1) { - dispatch(getDebugLog('komodo', 1)); - } + if (coin === 'KMD') { + dispatch(getDebugLog('komodo', 50)); + } else { + dispatch(getDebugLog('komodo', 50, coin)); + } + dispatch(toggleCoindDownModal(true)); + } else { + json = JSON.parse(json); + } - dispatch(logGuiHttp({ - 'timestamp': _timestamp, - 'status': 'success', - 'response': json, - })); - dispatch( - getSyncInfoNativeState( - json, - coin, - skipDebug - ) - ); + if (json.error && + json.error.message.indexOf('Activating best') === -1) { + if (coin === 'KMD') { + dispatch(getDebugLog('komodo', 1)); + } else { + dispatch(getDebugLog('komodo', 1, coin)); + } + } + + if (Config.debug) { + dispatch(logGuiHttp({ + 'timestamp': _timestamp, + 'status': 'success', + 'response': json, + })); + } + dispatch( + getSyncInfoNativeState( + json, + coin, + skipDebug + ) + ); + } }) } } \ No newline at end of file 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..2b53637 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, @@ -161,12 +167,16 @@ function getDebugLogState(json) { } } -export function getDebugLog(target, linesCount) { +export function getDebugLog(target, linesCount, acName) { const payload = { 'herdname': target, 'lastLines': linesCount }; + if (acName) { + payload['ac'] = acName; + } + return dispatch => { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/debuglog`, { method: 'POST', @@ -200,14 +210,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 +227,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 +244,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 +332,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 +349,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 +366,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/actions/storeType.js b/react/src/actions/storeType.js index 23deb33..1e4c8af 100644 --- a/react/src/actions/storeType.js +++ b/react/src/actions/storeType.js @@ -45,4 +45,5 @@ export const LOG_GUI_HTTP = 'LOG_GUI_HTTP'; export const CLI = 'CLI'; export const LOGOUT = 'LOGOUT'; export const DISPLAY_COIND_DOWN_MODAL = 'DISPLAY_COIND_DOWN_MODAL'; -export const DISPLAY_LOGIN_SETTINGS_MODAL = 'DISPLAY_LOGIN_SETTINGS_MODAL'; \ No newline at end of file +export const DISPLAY_LOGIN_SETTINGS_MODAL = 'DISPLAY_LOGIN_SETTINGS_MODAL'; +export const DISPLAY_CLAIM_INTEREST_MODAL = 'DISPLAY_CLAIM_INTEREST_MODAL'; \ No newline at end of file diff --git a/react/src/assets/images/cryptologo/AUD.png b/react/src/assets/images/cryptologo/aud.png similarity index 100% rename from react/src/assets/images/cryptologo/AUD.png rename to react/src/assets/images/cryptologo/aud.png diff --git a/react/src/assets/images/cryptologo/BET.png b/react/src/assets/images/cryptologo/bet.png similarity index 100% rename from react/src/assets/images/cryptologo/BET.png rename to react/src/assets/images/cryptologo/bet.png diff --git a/react/src/assets/images/cryptologo/BGN.png b/react/src/assets/images/cryptologo/bgn.png similarity index 100% rename from react/src/assets/images/cryptologo/BGN.png rename to react/src/assets/images/cryptologo/bgn.png diff --git a/react/src/assets/images/cryptologo/BOTS.png b/react/src/assets/images/cryptologo/bots.png similarity index 100% rename from react/src/assets/images/cryptologo/BOTS.png rename to react/src/assets/images/cryptologo/bots.png diff --git a/react/src/assets/images/cryptologo/BRL.png b/react/src/assets/images/cryptologo/brl.png similarity index 100% rename from react/src/assets/images/cryptologo/BRL.png rename to react/src/assets/images/cryptologo/brl.png diff --git a/react/src/assets/images/cryptologo/CAD.png b/react/src/assets/images/cryptologo/cad.png similarity index 100% rename from react/src/assets/images/cryptologo/CAD.png rename to react/src/assets/images/cryptologo/cad.png diff --git a/react/src/assets/images/cryptologo/CEAL.png b/react/src/assets/images/cryptologo/ceal.png similarity index 100% rename from react/src/assets/images/cryptologo/CEAL.png rename to react/src/assets/images/cryptologo/ceal.png diff --git a/react/src/assets/images/cryptologo/CHF.png b/react/src/assets/images/cryptologo/chf.png similarity index 100% rename from react/src/assets/images/cryptologo/CHF.png rename to react/src/assets/images/cryptologo/chf.png diff --git a/react/src/assets/images/cryptologo/CNY.png b/react/src/assets/images/cryptologo/cny.png similarity index 100% rename from react/src/assets/images/cryptologo/CNY.png rename to react/src/assets/images/cryptologo/cny.png diff --git a/react/src/assets/images/cryptologo/coqui.png b/react/src/assets/images/cryptologo/coqui.png new file mode 100644 index 0000000..59f61a8 Binary files /dev/null and b/react/src/assets/images/cryptologo/coqui.png differ diff --git a/react/src/assets/images/cryptologo/CRYPTO.png b/react/src/assets/images/cryptologo/crypto.png similarity index 100% rename from react/src/assets/images/cryptologo/CRYPTO.png rename to react/src/assets/images/cryptologo/crypto.png diff --git a/react/src/assets/images/cryptologo/CZK.png b/react/src/assets/images/cryptologo/czk.png similarity index 100% rename from react/src/assets/images/cryptologo/CZK.png rename to react/src/assets/images/cryptologo/czk.png diff --git a/react/src/assets/images/cryptologo/DKK.png b/react/src/assets/images/cryptologo/dkk.png similarity index 100% rename from react/src/assets/images/cryptologo/DKK.png rename to react/src/assets/images/cryptologo/dkk.png diff --git a/react/src/assets/images/cryptologo/EUR.png b/react/src/assets/images/cryptologo/eur.png similarity index 100% rename from react/src/assets/images/cryptologo/EUR.png rename to react/src/assets/images/cryptologo/eur.png diff --git a/react/src/assets/images/cryptologo/GAME.png b/react/src/assets/images/cryptologo/game.png similarity index 100% rename from react/src/assets/images/cryptologo/GAME.png rename to react/src/assets/images/cryptologo/game.png diff --git a/react/src/assets/images/cryptologo/GBP.png b/react/src/assets/images/cryptologo/gbp.png similarity index 100% rename from react/src/assets/images/cryptologo/GBP.png rename to react/src/assets/images/cryptologo/gbp.png diff --git a/react/src/assets/images/cryptologo/HKD.png b/react/src/assets/images/cryptologo/hkd.png similarity index 100% rename from react/src/assets/images/cryptologo/HKD.png rename to react/src/assets/images/cryptologo/hkd.png diff --git a/react/src/assets/images/cryptologo/HODL.png b/react/src/assets/images/cryptologo/hodl.png similarity index 100% rename from react/src/assets/images/cryptologo/HODL.png rename to react/src/assets/images/cryptologo/hodl.png diff --git a/react/src/assets/images/cryptologo/HRK.png b/react/src/assets/images/cryptologo/hrk.png similarity index 100% rename from react/src/assets/images/cryptologo/HRK.png rename to react/src/assets/images/cryptologo/hrk.png diff --git a/react/src/assets/images/cryptologo/HUF.png b/react/src/assets/images/cryptologo/huf.png similarity index 100% rename from react/src/assets/images/cryptologo/HUF.png rename to react/src/assets/images/cryptologo/huf.png diff --git a/react/src/assets/images/cryptologo/IDR.png b/react/src/assets/images/cryptologo/idr.png similarity index 100% rename from react/src/assets/images/cryptologo/IDR.png rename to react/src/assets/images/cryptologo/idr.png diff --git a/react/src/assets/images/cryptologo/ILS.png b/react/src/assets/images/cryptologo/ils.png similarity index 100% rename from react/src/assets/images/cryptologo/ILS.png rename to react/src/assets/images/cryptologo/ils.png diff --git a/react/src/assets/images/cryptologo/INR.png b/react/src/assets/images/cryptologo/inr.png similarity index 100% rename from react/src/assets/images/cryptologo/INR.png rename to react/src/assets/images/cryptologo/inr.png diff --git a/react/src/assets/images/cryptologo/JPY.png b/react/src/assets/images/cryptologo/jpy.png similarity index 100% rename from react/src/assets/images/cryptologo/JPY.png rename to react/src/assets/images/cryptologo/jpy.png diff --git a/react/src/assets/images/cryptologo/JUMBLR.png b/react/src/assets/images/cryptologo/jumblr.png similarity index 100% rename from react/src/assets/images/cryptologo/JUMBLR.png rename to react/src/assets/images/cryptologo/jumblr.png diff --git a/react/src/assets/images/cryptologo/komodo.png b/react/src/assets/images/cryptologo/kmd.png similarity index 100% rename from react/src/assets/images/cryptologo/komodo.png rename to react/src/assets/images/cryptologo/kmd.png diff --git a/react/src/assets/images/cryptologo/KRW.png b/react/src/assets/images/cryptologo/krw.png similarity index 100% rename from react/src/assets/images/cryptologo/KRW.png rename to react/src/assets/images/cryptologo/krw.png diff --git a/react/src/assets/images/cryptologo/KV.png b/react/src/assets/images/cryptologo/kv.png similarity index 100% rename from react/src/assets/images/cryptologo/KV.png rename to react/src/assets/images/cryptologo/kv.png diff --git a/react/src/assets/images/cryptologo/MESH.png b/react/src/assets/images/cryptologo/mesh.png similarity index 100% rename from react/src/assets/images/cryptologo/MESH.png rename to react/src/assets/images/cryptologo/mesh.png diff --git a/react/src/assets/images/cryptologo/MGW.png b/react/src/assets/images/cryptologo/mgw.png similarity index 100% rename from react/src/assets/images/cryptologo/MGW.png rename to react/src/assets/images/cryptologo/mgw.png diff --git a/react/src/assets/images/cryptologo/MVP.png b/react/src/assets/images/cryptologo/mvp.png similarity index 100% rename from react/src/assets/images/cryptologo/MVP.png rename to react/src/assets/images/cryptologo/mvp.png diff --git a/react/src/assets/images/cryptologo/MXN.png b/react/src/assets/images/cryptologo/mxn.png similarity index 100% rename from react/src/assets/images/cryptologo/MXN.png rename to react/src/assets/images/cryptologo/mxn.png diff --git a/react/src/assets/images/cryptologo/MYR.png b/react/src/assets/images/cryptologo/myr.png similarity index 100% rename from react/src/assets/images/cryptologo/MYR.png rename to react/src/assets/images/cryptologo/myr.png diff --git a/react/src/assets/images/cryptologo/NOK.png b/react/src/assets/images/cryptologo/nok.png similarity index 100% rename from react/src/assets/images/cryptologo/NOK.png rename to react/src/assets/images/cryptologo/nok.png diff --git a/react/src/assets/images/cryptologo/NZD.png b/react/src/assets/images/cryptologo/nzd.png similarity index 100% rename from react/src/assets/images/cryptologo/NZD.png rename to react/src/assets/images/cryptologo/nzd.png diff --git a/react/src/assets/images/cryptologo/PANGEA.png b/react/src/assets/images/cryptologo/pangea.png similarity index 100% rename from react/src/assets/images/cryptologo/PANGEA.png rename to react/src/assets/images/cryptologo/pangea.png diff --git a/react/src/assets/images/cryptologo/PHP.png b/react/src/assets/images/cryptologo/php.png similarity index 100% rename from react/src/assets/images/cryptologo/PHP.png rename to react/src/assets/images/cryptologo/php.png diff --git a/react/src/assets/images/cryptologo/PLN.png b/react/src/assets/images/cryptologo/pln.png similarity index 100% rename from react/src/assets/images/cryptologo/PLN.png rename to react/src/assets/images/cryptologo/pln.png diff --git a/react/src/assets/images/cryptologo/REVS.png b/react/src/assets/images/cryptologo/revs.png similarity index 100% rename from react/src/assets/images/cryptologo/REVS.png rename to react/src/assets/images/cryptologo/revs.png diff --git a/react/src/assets/images/cryptologo/RON.png b/react/src/assets/images/cryptologo/ron.png similarity index 100% rename from react/src/assets/images/cryptologo/RON.png rename to react/src/assets/images/cryptologo/ron.png diff --git a/react/src/assets/images/cryptologo/RUB.png b/react/src/assets/images/cryptologo/rub.png similarity index 100% rename from react/src/assets/images/cryptologo/RUB.png rename to react/src/assets/images/cryptologo/rub.png diff --git a/react/src/assets/images/cryptologo/SEK.png b/react/src/assets/images/cryptologo/sek.png similarity index 100% rename from react/src/assets/images/cryptologo/SEK.png rename to react/src/assets/images/cryptologo/sek.png diff --git a/react/src/assets/images/cryptologo/SGD.png b/react/src/assets/images/cryptologo/sgd.png similarity index 100% rename from react/src/assets/images/cryptologo/SGD.png rename to react/src/assets/images/cryptologo/sgd.png diff --git a/react/src/assets/images/cryptologo/SHARK.png b/react/src/assets/images/cryptologo/shark.png similarity index 100% rename from react/src/assets/images/cryptologo/SHARK.png rename to react/src/assets/images/cryptologo/shark.png diff --git a/react/src/assets/images/cryptologo/SUPERNET.png b/react/src/assets/images/cryptologo/supernet.png similarity index 100% rename from react/src/assets/images/cryptologo/SUPERNET.png rename to react/src/assets/images/cryptologo/supernet.png diff --git a/react/src/assets/images/cryptologo/THB.png b/react/src/assets/images/cryptologo/thb.png similarity index 100% rename from react/src/assets/images/cryptologo/THB.png rename to react/src/assets/images/cryptologo/thb.png diff --git a/react/src/assets/images/cryptologo/TRY.png b/react/src/assets/images/cryptologo/try.png similarity index 100% rename from react/src/assets/images/cryptologo/TRY.png rename to react/src/assets/images/cryptologo/try.png diff --git a/react/src/assets/images/cryptologo/WLC.png b/react/src/assets/images/cryptologo/wlc.png similarity index 100% rename from react/src/assets/images/cryptologo/WLC.png rename to react/src/assets/images/cryptologo/wlc.png diff --git a/react/src/assets/images/cryptologo/ZAR.png b/react/src/assets/images/cryptologo/zar.png similarity index 100% rename from react/src/assets/images/cryptologo/ZAR.png rename to react/src/assets/images/cryptologo/zar.png diff --git a/react/src/components/addcoin/addcoinOptionsAC.js b/react/src/components/addcoin/addcoinOptionsAC.js index f47202c..020a097 100644 --- a/react/src/components/addcoin/addcoinOptionsAC.js +++ b/react/src/components/addcoin/addcoinOptionsAC.js @@ -8,6 +8,7 @@ class AddCoinOptionsAC extends React.Component { + diff --git a/react/src/components/addcoin/payload.js b/react/src/components/addcoin/payload.js index 7ea2ef3..7e727f6 100644 --- a/react/src/components/addcoin/payload.js +++ b/react/src/components/addcoin/payload.js @@ -1,4 +1,5 @@ // TODO: merge check functions +// move to nodejs export function checkAC(coinVal) { if (coinVal === 'SUPERNET' || @@ -9,6 +10,7 @@ export function checkAC(coinVal) { coinVal === 'JUMBLR' || coinVal === 'BET' || coinVal === 'CRYPTO' || + coinVal === 'COQUI' || coinVal === 'HODL' || coinVal === 'SHARK' || coinVal === 'BOTS' || @@ -98,6 +100,7 @@ export function checkCoinType(coin) { coin === 'JUMBLR' || coin === 'BET' || coin === 'CRYPTO' || + coin === 'COQUI' || coin === 'HODL' || coin === 'SHARK' || coin === 'BOTS' || @@ -131,10 +134,10 @@ export function checkCoinType(coin) { } export function startCrypto(confpath, coin, mode) { - let tmpinternval = 0, - AddCoinData = {}, - tmpPendValue = 1, // TODO: hook up to shepherd sysinfo - tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; + let tmpinternval = 0; + let AddCoinData = {}; + let tmpPendValue = 1; // TODO: hook up to shepherd sysinfo + let tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; if (coin !== 'BTC' && coin !== 'LTC' && @@ -176,9 +179,9 @@ export function startCrypto(confpath, coin, mode) { } export function startCurrencyAssetChain(confpath, coin, mode) { - let AddCoinDataPayload = {}, - tmpPendValue = 1, - tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; + let AddCoinDataPayload = {}; + let tmpPendValue = 1; + let tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; if (coin !== 'BTC' && coin !== 'LTC' && @@ -702,7 +705,7 @@ export function startAssetChain(confpath, coin, mode, getSuppyOnly) { }, 'DEX': { 'name': 'DEX', - 'supply': 1300000, + 'supply': 999999, 'AddCoinData': confpath ? Object.assign({}, _acPayloadOrigin, {"coin":"DEX","conf":"DEX.conf","path":confpath,"RELAY":-1,"VALIDATE":1,"startpend":4,"endpend":4,"maxpeers":8,"newcoin":"DEX","name":"DEX","netmagic":"f2ae0516","p2p":9502,"rpc":9503}) : {}, 'AddCoinDataVar': Object.assign({}, _acPayloadOrigin, {'userpass':tmpIguanaRPCAuth,"RELAY":mode,"VALIDATE":mode,"startpend":tmpPendValue,"endpend":tmpPendValue,"maxpeers":8,"newcoin":"DEX","name":"DEX","netmagic":"f2ae0516","p2p":9502,"rpc":9503}) }, @@ -726,7 +729,7 @@ export function startAssetChain(confpath, coin, mode, getSuppyOnly) { }, 'HODL': { 'name': 'HODL', - 'supply': 999999, + 'supply': 9999999, 'AddCoinData': confpath ? Object.assign({}, _acPayloadOrigin, {"coin":"HODL","conf":"HODL.conf","path":confpath,"RELAY":-1,"VALIDATE":1,"startpend":4,"endpend":4,"maxpeers":8,"newcoin":"HODL","name":"HODL","netmagic":"9b13fb5f","p2p":8009,"rpc":8010}) : {}, 'AddCoinDataVar': Object.assign({}, _acPayloadOrigin, {'userpass':tmpIguanaRPCAuth,"RELAY":mode,"VALIDATE":mode,"startpend":tmpPendValue,"endpend":tmpPendValue,"maxpeers":8,"newcoin":"HODL","name":"HODL","netmagic":"9b13fb5f","p2p":8009,"rpc":8010}) }, @@ -756,7 +759,7 @@ export function startAssetChain(confpath, coin, mode, getSuppyOnly) { }, 'KV': { 'name': 'KV', - 'supply': 999999, + 'supply': 1000000, 'AddCoinData': confpath ? Object.assign({}, _acPayloadOrigin, {"coin":"KV","conf":"KV.conf","path":confpath,"RELAY":-1,"VALIDATE":1,"startpend":4,"endpend":4,"maxpeers":8,"newcoin":"KV","name":"KV","netmagic":"b09a2d65","p2p":9746,"rpc":9747}) : {}, 'AddCoinDataVar': Object.assign(_acPayloadOrigin, {'userpass':tmpIguanaRPCAuth,"RELAY":mode,"VALIDATE":mode,"startpend":tmpPendValue,"endpend":tmpPendValue,"maxpeers":8,"newcoin":"KV","name":"KV","netmagic":"b09a2d65","p2p":9746,"rpc":9747}) }, @@ -768,9 +771,15 @@ export function startAssetChain(confpath, coin, mode, getSuppyOnly) { }, 'MESH': { 'name': 'MESH', - 'supply': 1000000, + 'supply': 1000007, 'AddCoinData': confpath ? Object.assign({}, _acPayloadOrigin, {"coin":"MESH","conf":"MESH.conf","path":confpath,"RELAY":-1,"VALIDATE":1,"startpend":4,"endpend":4,"maxpeers":8,"newcoin":"MESH","name":"MESH","netmagic":"f0265c67","p2p":8399,"rpc":8400}) : {}, 'AddCoinDataVar': Object.assign({}, _acPayloadOrigin, {'userpass':tmpIguanaRPCAuth,"RELAY":mode,"VALIDATE":mode,"startpend":tmpPendValue,"endpend":tmpPendValue,"maxpeers":8,"newcoin":"MESH","name":"MESH","netmagic":"f0265c67","p2p":8399,"rpc":8400}) + }, + 'COQUI': { + 'name': 'COQUI', + 'supply': 72000000, + 'AddCoinData': confpath ? Object.assign({}, _acPayloadOrigin, {"coin":"COQUI","conf":"COQUI.conf","path":confpath,"RELAY":-1,"VALIDATE":1,"startpend":4,"endpend":4,"maxpeers":8,"newcoin":"COQUI","name":"COQUI","netmagic":"4cbd5ef4","p2p":14275,"rpc":14276}) : {}, + 'AddCoinDataVar': Object.assign({}, _acPayloadOrigin, {'userpass':tmpIguanaRPCAuth,"RELAY":mode,"VALIDATE":mode,"startpend":tmpPendValue,"endpend":tmpPendValue,"maxpeers":8,"newcoin":"COQUI","name":"COQUI","netmagic":"4cbd5ef4","p2p":14275,"rpc":14276}) } }; diff --git a/react/src/components/dashboard/claimInterestModal/claimInterestModal.js b/react/src/components/dashboard/claimInterestModal/claimInterestModal.js new file mode 100755 index 0000000..94e05f5 --- /dev/null +++ b/react/src/components/dashboard/claimInterestModal/claimInterestModal.js @@ -0,0 +1,136 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import Store from '../../../store'; +import { + toggleClaimInterestModal, + getListUnspent, + getRawTransaction, + copyString, + sendToAddressPromise, + triggerToaster +} from '../../../actions/actionCreators'; +import { translate } from '../../../translate/translate'; +import { + ClaimInterestModalRender, + _ClaimInterestTableRender +} from './claimInterestModal.render'; + +class ClaimInterestModal extends React.Component { + constructor(props) { + super(props); + this.state = { + open: false, + isLoading: true, + transactionsList: [], + showZeroInterest: true, + }; + this.claimInterestTableRender = this.claimInterestTableRender.bind(this); + this.toggleZeroInterest = this.toggleZeroInterest.bind(this); + this.loadListUnspent = this.loadListUnspent.bind(this); + this.checkTransactionsListLength = this.checkTransactionsListLength.bind(this); + } + + componentWillMount() { + this.loadListUnspent(); + } + + loadListUnspent() { + let _transactionsList = []; + + getListUnspent(this.props.ActiveCoin.coin) + .then((json) => { + if (json && + json.length) { + for (let i = 0; i < json.length; i++) { + getRawTransaction(this.props.ActiveCoin.coin, json[i].txid) + .then((_json) => { + _transactionsList.push({ + address: json[i].address, + locktime: _json.locktime, + amount: json[i].amount, + interest: json[i].interest, + txid: json[i].txid, + }); + + if (i === json.length - 1) { + this.setState({ + transactionsList: _transactionsList, + isLoading: false, + }); + } + }); + } + } + }); + } + + claimInterest(address, amount) { + sendToAddressPromise(this.props.ActiveCoin.coin, this.state.transactionsList[0].address, this.props.ActiveCoin.balance.transparent) + .then((json) => { + if (json.error && + json.error.code) { + Store.dispatch( + triggerToaster( + json.error.message, + 'Error', + 'error' + ) + ); + } else if (json.result && json.result.length && json.result.length === 64) { + Store.dispatch( + triggerToaster( + `Your full balance is sent to address ${this.state.transactionsList[0].address}. Check back your new balance in a few minutes.`, + translate('TOASTR.WALLET_NOTIFICATION'), + 'success', + false + ) + ); + } + }); + } + + checkTransactionsListLength() { + if (this.state.transactionsList && this.state.transactionsList.length) { + return true; + } else if (!this.state.transactionsList || !this.state.transactionsList.length) { + return false; + } + } + + toggleZeroInterest() { + this.setState({ + showZeroInterest: !this.state.showZeroInterest, + }); + } + + copyTxId(txid) { + Store.dispatch(copyString(txid, 'Transaction ID copied')); + } + + claimInterestTableRender() { + return _ClaimInterestTableRender.call(this); + } + + componentWillReceiveProps(props) { + if (props.Dashboard.displayClaimInterestModal !== this.state.open) { + this.setState({ + open: props.Dashboard.displayClaimInterestModal, + }); + } + + if (!this.state.open && + props.Dashboard.displayClaimInterestModal) { + this.loadListUnspent(); + } + } + + closeModal() { + Store.dispatch(toggleClaimInterestModal(false)); + } + + render() { + return ClaimInterestModalRender.call(this); + } +} + +export default ClaimInterestModal; \ No newline at end of file diff --git a/react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js b/react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js new file mode 100644 index 0000000..8754965 --- /dev/null +++ b/react/src/components/dashboard/claimInterestModal/claimInterestModal.render.js @@ -0,0 +1,132 @@ +import React from 'react'; +import { translate } from '../../../translate/translate'; + +const MIN_INTEREST_THRESHOLD = 0.001; + +export const _ClaimInterestTableRender = function() { + const _transactionsList = this.state.transactionsList; + let _items = []; + + for (let i = 0; i < _transactionsList.length; i++) { + if ((_transactionsList[i].interest === 0 && this.state.showZeroInterest) || (_transactionsList[i].amount > 0 && _transactionsList[i].interest > 0)) { + _items.push( +
+ | Address | +Amount | +Interest | +Locktime | +
---|---|---|---|---|
+ | Address | +Amount | +Interest | +Locktime | +
+ Jumblr functions all locally which means no middle man is required to jumble your funds. You take control over the whole process. +
++ Tip: to achive maximum anonimity setup Jumblr node on a dedicated piece of hardware (laptop or VPS), use a separate IP address for main Jumblr node. +
{ translate('JUMBLR.THIS_SCREEN_DOESNT_REFRESH') }
+{ translate('JUMBLR.ADDRESS_ACCESSIBLE_EASILY') }
-duck dog cat donkey
- jumblr duck dog cat donkey
- { translate('JUMBLR.TO_CLEAR_THEM') }
{ translate('JUMBLR.WHEN_IT_TOTALS') }
{ translate('JUMBLR.BTC_DEPOSIT') } | -- - | -
BTC Jumblr | -
+
+
+ { translate('JUMBLR.FEW_SECURITY_NOTES') }+
+
+ { this.state.jumblrDepositAddressPBased &&
+
+
+
+
+
-
- { translate('JUMBLR.HIDDEN') }
- + Please write down your Jumblr passphrase and keept it safe. + +This is your main recovery passphrase. +All Jumblr addresses can be regenrated based on it. +
+ Tip: do not use smart editors to store your passphrase as they tend to add extra characters. |
-
{ translate('JUMBLR.KMD_DEPOSIT') } | -- |
KMD Jumblr | -
+
+ }
+
+ { this.state.jumblrDepositAddress && this.state.jumblrDepositAddress.address &&
+
+ Your Jumblr deposit address:
+
+ }
+
+ + { this.state.jumblrDepositAddress.address } + + ++ { this.state.jumblrDepositAddress.wif } + + +
+
+ Jumblr secret addresses are used for the final z -> t transactions. +In order to allow larger accounts to obtain privacy, up to 777 secret addresses are supported. +Whenever a z -> t stage is activated, a random secret address from the list of the then active secret addresses is selected. +To add a new set of secret addresses enter address count below. The passphrase below is exactly the same you saw on the previous step. +Your Jumblr secret address recovery passphrase will have the following pattern
+
+
-
-
- { translate('JUMBLR.HIDDEN') }
-
- |
-
+ Address + | ++ Wif + | +
Use the form below to send funds to your jumblr deposit address.
+You can also send funds to deposit address from an external service or another wallet.
+Enter your Jumblr passphrase you got previously during Public node configuration to import secret address.
+Passphrase example: jumblr muffin smart educate tomato boss foil open dirt opinion pizza goddess skate action card garden cotton life write life note shine myself gloom summer
.
The form below will "regenerate" Jumblr secret address based on passphrase provided.
+After this final step expect to see funds processed and credited to your address after 2 days period.
-{ translate('JUMBLR.RESULT') } | -- - | -
{ translate('JUMBLR.DEPOSITED') } | -- |
{ translate('JUMBLR.PUB_TO_PRIV') } | -- |
{ translate('JUMBLR.PRIV_TO_PRIV') } | -- |
{ translate('JUMBLR.PRIV_TO_PUB') } | -- |
{ translate('JUMBLR.FINISHED') } | -- |
{ translate('JUMBLR.PENDING') } | -- |
+ Address + | ++ Wif + | +