Browse Source

remove gui http state logger

all-modes
pbca26 8 years ago
parent
commit
66b547a4cc
  1. 15
      assets/mainWindow/css/loading.css
  2. 8
      assets/mainWindow/js/loading.js
  3. 5
      react/src/actions/actionCreators.js
  4. 30
      react/src/actions/actions/addCoin.js
  5. 113
      react/src/actions/actions/addressBalance.js
  6. 30
      react/src/actions/actions/atomic.js
  7. 4
      react/src/actions/actions/basiliskCache.js
  8. 56
      react/src/actions/actions/basiliskProcessAddress.js
  9. 4
      react/src/actions/actions/basiliskTxHistory.js
  10. 4
      react/src/actions/actions/cli.js
  11. 4
      react/src/actions/actions/coinList.js
  12. 30
      react/src/actions/actions/createWallet.js
  13. 30
      react/src/actions/actions/dexCoins.js
  14. 49
      react/src/actions/actions/edexBalance.js
  15. 30
      react/src/actions/actions/edexGetTx.js
  16. 30
      react/src/actions/actions/fullTxHistory.js
  17. 30
      react/src/actions/actions/getAddrByAccount.js
  18. 30
      react/src/actions/actions/iguanaHelpers.js
  19. 4
      react/src/actions/actions/iguanaInstance.js
  20. 4
      react/src/actions/actions/interest.js
  21. 4
      react/src/actions/actions/jumblr.js
  22. 61
      react/src/actions/actions/log.js
  23. 30
      react/src/actions/actions/logout.js
  24. 30
      react/src/actions/actions/nativeBalance.js
  25. 30
      react/src/actions/actions/nativeNewAddress.js
  26. 57
      react/src/actions/actions/nativeSend.js
  27. 55
      react/src/actions/actions/nativeSyncInfo.js
  28. 30
      react/src/actions/actions/nativeTxHistory.js
  29. 55
      react/src/actions/actions/notary.js
  30. 4
      react/src/actions/actions/openAlias.js
  31. 110
      react/src/actions/actions/sendFullBasilisk.js
  32. 82
      react/src/actions/actions/settings.js
  33. 30
      react/src/actions/actions/syncInfo.js
  34. 4
      react/src/actions/actions/syncOnly.js
  35. 4
      react/src/actions/actions/sysInfo.js
  36. 4
      react/src/actions/actions/update.js
  37. 108
      react/src/actions/actions/walletAuth.js
  38. 1
      react/src/actions/storeType.js
  39. 122
      react/src/components/dashboard/notifications/notifications.js
  40. 116
      react/src/components/dashboard/notifications/notifications.render.js
  41. 2
      react/src/components/main/walletMain.js
  42. 169
      react/src/components/overrides.scss
  43. 31
      react/src/reducers/dashboard.js
  44. 26
      react/src/reducers/errors.js
  45. 2
      react/src/reducers/index.js

15
assets/mainWindow/css/loading.css

@ -41,7 +41,7 @@ body.agama-default-window-height {
}
body.agama-app-settings-window {
height: 770px;
height: 820px;
}
.agama-logo {
@ -162,6 +162,11 @@ body.agama-app-settings-window {
margin-top: 20px;
}
.pull-left {
float: left;
margin-left: 50px;
}
.btn-close {
border-bottom-left-radius: 50%;
background: #fff;
@ -210,6 +215,8 @@ body.agama-app-settings-window {
.settings-buttons-block {
margin-top: 50px;
margin-right: 50px;
text-align: right;
}
.settings-table {
@ -382,4 +389,10 @@ button.toast-close-button {
margin-left: 10px;
-ms-word-wrap: break-word;
word-wrap: break-word;
}
.test-bins {
text-align: left;
margin-top: 10px;
margin-left: 30px;
}

8
assets/mainWindow/js/loading.js

@ -102,6 +102,14 @@ function setDefaultAppSettings() {
showToast('success', 'App settings are reset to default');
}
function testBins(binName) {
const remote = require('electron').remote;
remote.getCurrentWindow().testBins(binName).
then(function(res) {
$('#debugOut').html(JSON.stringify(res, null, '\t'));
});
}
function handleSaveSettings() {
if (_configCopy.dataDir &&
_configCopy.dataDir.length) {

5
react/src/actions/actionCreators.js

@ -31,11 +31,6 @@ import {
START_INTERVAL,
STOP_INTERVAL
} from './storeType';
import {
logGuiHttp,
getAgamaLog,
guiLogState
} from './actions/log';
export * from './actions/nativeSyncInfo';
export * from './actions/basiliskCache';

30
react/src/actions/actions/addCoin.js

@ -7,10 +7,6 @@ import {
startIguanaInstance,
iguanaWalletPassphraseState,
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import {
startCurrencyAssetChain,
startAssetChain,
@ -96,31 +92,12 @@ export function addCoin(coin, mode, syncOnly, port, startupParams) {
export function iguanaAddCoin(coin, mode, acData, port) {
function _iguanaAddCoin(dispatch) {
const _timestamp = Date.now();
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',
body: JSON.stringify(acData),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
translate('TOASTR.FAILED_TO_ADDCOIN'),
@ -131,13 +108,6 @@ export function iguanaAddCoin(coin, mode, acData, port) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(
addCoinResult(
coin,

113
react/src/actions/actions/addressBalance.js

@ -5,10 +5,6 @@ import {
getPassthruAgent,
iguanaHashHex
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
function getKMDAddressesNativeState(json) {
@ -105,18 +101,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
};
}
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
@ -139,13 +123,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative',
@ -156,13 +133,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
resolve(Config.cli.default && mode === 'native' ? json.result : json);
})
}
@ -307,16 +277,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
hex: hashHexJson,
};
}
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',
@ -349,13 +309,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+ZBalance',
@ -369,13 +322,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (json &&
json.error) {
resolve(0);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: json,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+ZBalance',
@ -394,13 +340,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
amount: json,
type: 'private',
};
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
}
});
});
@ -448,31 +387,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (json[coin][currentAddress].refresh) {
calcBalance(result, json[coin][currentAddress].refresh.data, dispatch, mode);
} else {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+Balance',
@ -483,13 +403,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
.then(response => response.json())
.then(function(json) {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
updatedCache.basilisk[coin][currentAddress].refresh = {
data: json,
status: 'done',
@ -506,18 +419,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
}
})
} else {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
@ -547,13 +448,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+Balance',
@ -568,13 +462,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
mode === 'native') {
json = json.result;
}
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
calcBalance(
result,
json,

30
react/src/actions/actions/atomic.js

@ -1,38 +1,15 @@
import { ATOMIC } from '../storeType';
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function atomic(payload) {
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
payload.method,
@ -43,13 +20,6 @@ export function atomic(payload) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(atomicState(json));
});
}

4
react/src/actions/actions/basiliskCache.js

@ -1,9 +1,5 @@
import { DASHBOARD_ACTIVE_COIN_GET_CACHE } from '../storeType';
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
// TODO: rewrite cache API to use POST

56
react/src/actions/actions/basiliskProcessAddress.js

@ -1,9 +1,5 @@
import { translate } from '../../translate/translate';
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function checkAddressBasilisk(coin, address) {
@ -16,31 +12,12 @@ export function checkAddressBasilisk(coin, address) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'checkAddressBasilisk',
@ -51,13 +28,6 @@ export function checkAddressBasilisk(coin, address) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(checkAddressBasiliskHandle(json));
})
}
@ -102,31 +72,12 @@ export function validateAddressBasilisk(coin, address) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'validateAddressBasilisk',
@ -137,13 +88,6 @@ export function validateAddressBasilisk(coin, address) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(validateAddressBasiliskHandle(json));
})
}

4
react/src/actions/actions/basiliskTxHistory.js

@ -2,10 +2,6 @@ import {
triggerToaster,
getNativeTxHistoryState
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function getBasiliskTransactionsList(coin, address) {

4
react/src/actions/actions/cli.js

@ -1,9 +1,5 @@
import { triggerToaster } from '../actionCreators';
import { CLI } from '../storeType';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function shepherdCliPromise(mode, chain, cmd) {

4
react/src/actions/actions/coinList.js

@ -1,8 +1,4 @@
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function shepherdGetCoinList() {

30
react/src/actions/actions/createWallet.js

@ -1,9 +1,5 @@
import { translate } from '../../translate/translate';
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
function createNewWalletState(json) {
@ -41,31 +37,12 @@ export function createNewWallet(_passphrase) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'createNewWallet',
@ -76,13 +53,6 @@ export function createNewWallet(_passphrase) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(createNewWalletState(json));
})
}

30
react/src/actions/actions/dexCoins.js

@ -2,10 +2,6 @@ import {
triggerToaster,
dashboardCoinsState
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
// TODO: find out why it errors on slow systems
@ -17,18 +13,6 @@ export function getDexCoins() {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(_payload),
@ -49,13 +33,6 @@ export function getDexCoins() {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'Error getDexCoins',
@ -66,13 +43,6 @@ export function getDexCoins() {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(dashboardCoinsState(json));
});
}

49
react/src/actions/actions/edexBalance.js

@ -1,9 +1,5 @@
import { DASHBOARD_ACTIVE_COIN_BALANCE } from '../storeType';
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function iguanaEdexBalance(coin) {
@ -16,31 +12,12 @@ export function iguanaEdexBalance(coin) {
return dispatch => {
if (coin) {
const _timestamp = Date.now();
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',
body: JSON.stringify(_payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'Error iguanaEdexBalance',
@ -73,31 +50,12 @@ export function getDexBalance(coin, mode, addr) {
};
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getDexBalance',
@ -109,13 +67,6 @@ export function getDexBalance(coin, mode, addr) {
.then(response => response.json())
.then(json => {
console.log(json);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
})
resolve(index);

30
react/src/actions/actions/edexGetTx.js

@ -1,8 +1,4 @@
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function edexGetTransaction(data, dispatch) {
@ -16,31 +12,12 @@ export function edexGetTransaction(data, dispatch) {
};
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'edexGetTransaction',
@ -51,13 +28,6 @@ export function edexGetTransaction(data, dispatch) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
resolve(json);
})
});

30
react/src/actions/actions/fullTxHistory.js

@ -2,10 +2,6 @@ import {
triggerToaster,
getNativeTxHistoryState
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function getFullTransactionsList(coin) {
@ -21,31 +17,12 @@ export function getFullTransactionsList(coin) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getFullTransactionsList',
@ -56,13 +33,6 @@ export function getFullTransactionsList(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(getNativeTxHistoryState(json));
})
}

30
react/src/actions/actions/getAddrByAccount.js

@ -1,8 +1,4 @@
import { ACTIVE_COIN_GET_ADDRESSES } from '../storeType';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function getAddressesByAccountState(json, coin, mode) {
@ -36,31 +32,12 @@ export function getAddressesByAccount(coin, mode) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(updateErrosStack('activeHandle'));
dispatch(
triggerToaster(
@ -72,13 +49,6 @@ export function getAddressesByAccount(coin, mode) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(
getAddressesByAccountState(
json,

30
react/src/actions/actions/iguanaHelpers.js

@ -1,7 +1,3 @@
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
import { checkAC } from '../../components/addcoin/payload';
@ -29,31 +25,12 @@ export function iguanaHashHex(data, dispatch) {
if (Config.cli.default) {
resolve(true);
} else {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'iguanaHashHex',
@ -64,13 +41,6 @@ export function iguanaHashHex(data, dispatch) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
resolve(json.hex);
})
}

4
react/src/actions/actions/iguanaInstance.js

@ -1,8 +1,4 @@
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function restartIguanaInstance(pmid) {

4
react/src/actions/actions/interest.js

@ -1,10 +1,6 @@
import {
triggerToaster
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function getListUnspent(coin) {

4
react/src/actions/actions/jumblr.js

@ -2,10 +2,6 @@ import {
triggerToaster,
getNewKMDAddresses
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
function getNewAddress(coin) { // TODO: remove(?)

61
react/src/actions/actions/log.js

@ -1,61 +0,0 @@
import { LOG_GUI_HTTP } from '../storeType';
import { triggerToaster } from '../actionCreators';
import Config from '../../config';
export function logGuiHttp(payload) {
return dispatch => {
dispatch(guiLogState(payload));
// disabled for now
/*return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/guilog`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster('logGuiHttp', 'Error', 'error'));
})
.then(response => response.json())*/
}
}
export function getAgamaLog(type) {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getlog?type=${type}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.catch(function(error) {
console.log(error);
dispatch(
triggerToaster(
'getAgamaLog',
'Error',
'error'
)
);
})
.then(response => response.json())
}
}
export function guiLogState(logData) {
return {
type: LOG_GUI_HTTP,
timestamp: logData.timestamp,
log: {
timestamp: logData.timestamp,
function: logData.function,
httpMethod: logData.type,
url: logData.url,
payload: logData.payload,
status: logData.status,
response: logData.response,
}
}
}

30
react/src/actions/actions/logout.js

@ -4,10 +4,6 @@ import {
} from '../storeType';
import { triggerToaster } from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
function logoutState(json) {
sessionStorage.removeItem('IguanaActiveAccount');
@ -38,31 +34,12 @@ function walletLock() {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'walletLock',
@ -73,13 +50,6 @@ function walletLock() {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(logoutState(json));
dispatch(logoutResetAppState());
})

30
react/src/actions/actions/nativeBalance.js

@ -4,10 +4,6 @@ import {
getPassthruAgent
} from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
export function getKMDBalanceTotal(coin) {
let payload;
@ -41,18 +37,6 @@ export function getKMDBalanceTotal(coin) {
}
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
@ -74,13 +58,6 @@ export function getKMDBalanceTotal(coin) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getKMDBalanceTotal',
@ -91,13 +68,6 @@ export function getKMDBalanceTotal(coin) {
})
.then(response => response.json())
.then(function(json) { // TODO: figure out why komodod spits out "parse error"
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
if (json &&
!json.error) {
dispatch(getNativeBalancesState(json));

30
react/src/actions/actions/nativeNewAddress.js

@ -5,10 +5,6 @@ import {
getKMDAddressesNative
} from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
export function getNewKMDAddresses(coin, pubpriv, mode) {
let payload;
@ -34,18 +30,6 @@ export function getNewKMDAddresses(coin, pubpriv, mode) {
}
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
@ -73,13 +57,6 @@ export function getNewKMDAddresses(coin, pubpriv, mode) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getNewKMDAddresses',
@ -93,13 +70,6 @@ export function getNewKMDAddresses(coin, pubpriv, mode) {
if (Config.cli.default) {
json = json.result;
}
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(
triggerToaster(
json.result ? json.result : json,

57
react/src/actions/actions/nativeSend.js

@ -5,10 +5,6 @@ import {
getPassthruAgent,
iguanaHashHex
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function sendNativeTx(coin, _payload) {
@ -47,18 +43,6 @@ export function sendNativeTx(coin, _payload) {
};
}
const _timestamp = Date.now();
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),
@ -110,13 +94,6 @@ export function sendNativeTx(coin, _payload) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'sendNativeTx',
@ -130,14 +107,6 @@ export function sendNativeTx(coin, _payload) {
return _response;
})
.then(function(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`,
@ -230,18 +199,6 @@ export function getKMDOPID(opid, coin) {
};
}
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
@ -269,13 +226,6 @@ export function getKMDOPID(opid, coin) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getKMDOPID',
@ -289,13 +239,6 @@ export function getKMDOPID(opid, coin) {
if (Config.cli.default) {
json = json.result;
}
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(getKMDOPIDState(json));
})
})

55
react/src/actions/actions/nativeSyncInfo.js

@ -5,41 +5,18 @@ import {
getDebugLog,
toggleCoindDownModal
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
import Config from '../../config';
export function getSyncInfoNativeKMD(skipDebug, json) {
const coin = 'KMD';
// https://www.kmd.host/
return dispatch => {
const _timestamp = Date.now();
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}`, {
method: 'GET',
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
/*dispatch(
triggerToaster(
'getSyncInfoNativeKMD',
@ -52,13 +29,6 @@ export function getSyncInfoNativeKMD(skipDebug, json) {
})
.then(response => response.json())
.then(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() {
@ -111,17 +81,6 @@ export function getSyncInfoNative(coin, skipDebug) {
}
return dispatch => {
const _timestamp = Date.now();
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),
@ -143,13 +102,6 @@ export function getSyncInfoNative(coin, skipDebug) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getSyncInfo',
@ -206,13 +158,6 @@ export function getSyncInfoNative(coin, skipDebug) {
}
}
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(
getSyncInfoNativeState(
json,

30
react/src/actions/actions/nativeTxHistory.js

@ -4,10 +4,6 @@ import {
getNativeTxHistoryState
} from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
export function getNativeTxHistory(coin) {
let payload;
@ -32,18 +28,6 @@ export function getNativeTxHistory(coin) {
}
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
@ -71,13 +55,6 @@ export function getNativeTxHistory(coin) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getNativeTxHistory',
@ -88,13 +65,6 @@ export function getNativeTxHistory(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(getNativeTxHistoryState(json));
})
}

55
react/src/actions/actions/notary.js

@ -5,10 +5,6 @@ import {
import { translate } from '../../translate/translate';
import { triggerToaster } from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
function initNotaryNodesConSequence(nodes) {
return dispatch => {
@ -22,30 +18,11 @@ function initNotaryNodesConSequence(nodes) {
};
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
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);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
`getInfoDexNode+${node}`,
@ -56,13 +33,6 @@ function initNotaryNodesConSequence(nodes) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(
updateNotaryNodeConState(
json,
@ -176,30 +146,12 @@ export function getDexNotaries(coin) {
};
return dispatch => {
const _timestamp = Date.now();
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);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getDexNotaries',
@ -210,13 +162,6 @@ export function getDexNotaries(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(getDexNotariesState(json));
})
}

4
react/src/actions/actions/openAlias.js

@ -1,8 +1,4 @@
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
export function resolveOpenAliasAddress(email) {
const url = email.replace('@', '.');

110
react/src/actions/actions/sendFullBasilisk.js

@ -5,10 +5,6 @@ import {
getDispatch
} from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
export function sendToAddress(coin, _payload) {
const payload = {
@ -24,31 +20,12 @@ export function sendToAddress(coin, _payload) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'sendToAddress',
@ -59,13 +36,6 @@ export function sendToAddress(coin, _payload) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(sendToAddressState(json, dispatch));
})
}
@ -86,31 +56,12 @@ export function sendFromAddress(coin, _payload) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'sendFromAddress',
@ -121,13 +72,6 @@ export function sendFromAddress(coin, _payload) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(sendToAddressState(json, dispatch));
})
}
@ -151,31 +95,12 @@ export function iguanaUTXORawTX(data, dispatch) {
};
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch => dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'iguanaUTXORawTX',
@ -186,13 +111,6 @@ export function iguanaUTXORawTX(data, dispatch) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
resolve(json);
})
});
@ -208,31 +126,12 @@ export function dexSendRawTX(data, dispatch) {
};
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
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, {
fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'dexSendRawTX',
@ -247,13 +146,6 @@ export function dexSendRawTX(data, dispatch) {
return _response;
})
.then(function(json) {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
resolve(json);
})
});

82
react/src/actions/actions/settings.js

@ -8,10 +8,6 @@ import {
import { translate } from '../../translate/translate';
import { triggerToaster } from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
function getAppInfoState(json) {
return {
@ -100,31 +96,12 @@ export function importPrivKey(wifKey) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'importPrivKey',
@ -135,13 +112,6 @@ export function importPrivKey(wifKey) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(
parseImportPrivKeyResponse(
json,
@ -209,31 +179,12 @@ export function getPeersList(coin) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getPeersList',
@ -244,13 +195,6 @@ export function getPeersList(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(getPeersListState(json, dispatch));
})
}
@ -331,31 +275,12 @@ export function addPeerNode(coin, ip) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'addPeerNode',
@ -366,13 +291,6 @@ export function addPeerNode(coin, ip) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(addPeerNodeState(json, dispatch));
})
}

30
react/src/actions/actions/syncInfo.js

@ -1,10 +1,6 @@
import { SYNCING_FULL_MODE } from '../storeType';
import { triggerToaster } from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
// TODO: add custom json parser
function getSyncInfoState(json) {
@ -30,31 +26,12 @@ export function getSyncInfo(coin) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'getSyncInfo',
@ -69,13 +46,6 @@ export function getSyncInfo(coin) {
return _response;
})
.then(function(json) {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
if (json.indexOf('coin is busy processing') === -1) {
dispatch(getSyncInfoState(json, dispatch));
}

4
react/src/actions/actions/syncOnly.js

@ -5,10 +5,6 @@ import {
import { translate } from '../../translate/translate';
import Config from '../../config';
import { triggerToaster } from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
export function toggleSyncOnlyModal(display) {
return {

4
react/src/actions/actions/sysInfo.js

@ -1,9 +1,5 @@
import { triggerToaster } from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
export function shepherdGetSysInfo() {
return dispatch => {

4
react/src/actions/actions/update.js

@ -1,9 +1,5 @@
import { triggerToaster } from '../actionCreators';
import Config from '../../config';
import {
logGuiHttp,
guiLogState
} from './log';
export function checkForUpdateUIPromise() {
return new Promise((resolve, reject) => {

108
react/src/actions/actions/walletAuth.js

@ -9,10 +9,6 @@ import {
getMainAddressState,
updateErrosStack
} from '../actionCreators';
import {
logGuiHttp,
guiLogState
} from './log';
export function encryptWallet(_passphrase, cb, coin) {
const payload = {
@ -23,31 +19,12 @@ export function encryptWallet(_passphrase, cb, coin) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'encryptWallet',
@ -59,13 +36,6 @@ export function encryptWallet(_passphrase, cb, coin) {
.then(dispatch(walletPassphrase(_passphrase)))
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(
cb.call(
this,
@ -87,31 +57,12 @@ export function walletPassphrase(_passphrase) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'walletPassphrase',
@ -121,13 +72,6 @@ export function walletPassphrase(_passphrase) {
);
})
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
})
}
}
@ -143,31 +87,12 @@ export function iguanaWalletPassphrase(_passphrase) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(_payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(
triggerToaster(
'Error iguanaWalletPassphrase',
@ -178,13 +103,6 @@ export function iguanaWalletPassphrase(_passphrase) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
dispatch(iguanaWalletPassphraseState(json, dispatch));
});
}
@ -198,18 +116,6 @@ export function iguanaActiveHandle(getMainAddress) {
};
return dispatch => {
const _timestamp = Date.now();
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',
body: JSON.stringify(_payload),
@ -230,13 +136,6 @@ export function iguanaActiveHandle(getMainAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'error',
response: error,
}));
}
dispatch(updateErrosStack('activeHandle'));
dispatch(
triggerToaster(
@ -248,13 +147,6 @@ export function iguanaActiveHandle(getMainAddress) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
timestamp: _timestamp,
status: 'success',
response: json,
}));
}
if (!Config.iguanaLessMode &&
sessionStorage.getItem('IguanaActiveAccount') &&
JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey === json.pubkey &&

1
react/src/actions/storeType.js

@ -41,7 +41,6 @@ export const SAVE_APP_CONFIG = 'SAVE_APP_CONFIG';
export const SERVICE_ERROR = 'SERVICE_ERROR';
export const DASHBOARD_ACTIVE_ADDRESS = 'DASHBOARD_ACTIVE_ADDRESS';
export const LOAD_APP_INFO = 'LOAD_APP_INFO';
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';

122
react/src/components/dashboard/notifications/notifications.js

@ -1,122 +0,0 @@
import React from 'react';
import { connect } from 'react-redux';
import { sortByDate } from '../../../util/sort';
import Config from '../../../config';
import {
NotificationsByTypeRender,
NotificationsModalRender,
NotificationsRender
} from './notifications.render';
class Notifications extends React.Component {
constructor() {
super();
this.state = {
displayModal: false,
calls: {
total: 0,
error: 0,
success: 0,
pending: 0,
},
activeTab: 2,
guiLog: null,
debug: Config.debug,
};
this.toggleNotificationsModal = this.toggleNotificationsModal.bind(this);
}
openTab(tab) {
this.setState(Object.assign({}, this.state, {
activeTab: tab,
}));
}
componentWillReceiveProps(props) {
// get total number of calls per type
if (this.props.Dashboard &&
this.props.Dashboard.guiLog) {
const _guiLog = this.props.Dashboard.guiLog;
let _callsLength = {
total: Object.keys(_guiLog).length,
error: 0,
success: 0,
pending: 0,
}
let guiLogToArray = [];
for (let timestamp in _guiLog) {
guiLogToArray.push(_guiLog[timestamp]);
_callsLength[_guiLog[timestamp].status]++;
}
this.setState(Object.assign({}, this.state, {
calls: {
total: _callsLength.total,
error: _callsLength.error,
success: _callsLength.success,
pending: _callsLength.pending,
},
guiLog: guiLogToArray,
}));
}
}
renderNotificationsByType(type) {
// get total number of calls per type
if (this.state.guiLog &&
this.state.guiLog.length) {
let _guiLog = this.state.guiLog;
let items = [];
_guiLog = sortByDate(_guiLog);
for (let i = 0; i < _guiLog.length; i++) {
if (_guiLog[i].status === type) {
const _logItem = _guiLog[i];
items.push(
NotificationsByTypeRender.call(
this,
_logItem,
type,
i
)
);
}
}
return items;
}
}
renderNotificationsModal() {
if (this.state.displayModal) {
return NotificationsModalRender.call(this);
}
return null;
}
toggleNotificationsModal() {
this.setState(Object.assign({}, this.state, {
displayModal: !this.state.displayModal,
}));
}
render() {
return NotificationsRender.call(this);
}
}
const mapStateToProps = (state) => {
return {
Dashboard: {
guiLog: state.Dashboard.guiLog,
activeHandle: state.Dashboard.activeHandle,
}
};
};
export default connect(mapStateToProps)(Notifications);

116
react/src/components/dashboard/notifications/notifications.render.js

@ -1,116 +0,0 @@
import React from 'react';
import {
secondsToString
} from '../../../util/time';
import { translate } from '../../../translate/translate';
export const NotificationsByTypeRender = function(logItem, type, index) {
return (
<div key={ logItem.timestamp }>
<div>{ index + 1 }.</div>
<div>
<strong>Time:</strong> { secondsToString(logItem.timestamp, true, true) }
</div>
<div>
<strong>GUI Function:</strong> { logItem.function }
</div>
<div>
<strong>HTTP:</strong> { logItem.httpMethod.toUpperCase() }
</div>
<div>
<strong>URL:</strong> { logItem.url }
</div>
<div>
<strong>Payload:</strong> { JSON.stringify(logItem.payload, null, '\t') }
</div>
<div className={ type !== 'pending' ? '' : 'hide' }>
<strong>Response:</strong> { JSON.stringify(logItem.response, null, '\t') }
</div>
<hr />
</div>
);
}
export const NotificationsModalRender = function() {
return (
<div onKeyDown={ (event) => this.handleKeydown(event) }>
<div className="modal show notifications-modal">
<div className="modal-dialog modal-center modal-lg">
<div className="modal-content">
<div className="modal-body modal-body-container">
<div className="panel nav-tabs-horizontal">
<ul className="nav nav-tabs nav-tabs-line">
<li className={ this.state.activeTab === 0 ? 'active' : 'pointer' }>
<a onClick={ () => this.openTab(0) }>
<i className="icon fa fa-thumbs-o-up"></i> Success ({ this.state.calls.success })
</a>
</li>
<li className={ this.state.activeTab === 1 ? 'active' : 'pointer' }>
<a onClick={ () => this.openTab(1) }>
<i className="icon fa fa-exclamation-triangle"></i> Error ({ this.state.calls.error })
</a>
</li>
<li className={ this.state.activeTab === 2 ? 'active' : 'pointer' }>
<a onClick={ () => this.openTab(2) }>
<i className="icon fa fa-clock-o"></i> Pending ({ this.state.calls.pending })
</a>
</li>
</ul>
<div className="panel-body panel-body-container">
<div className="tab-content">
<div className={ 'tab-pane' + (this.state.activeTab === 0 ? ' active' : '') }>
{ this.renderNotificationsByType('success') }
</div>
<div className={ 'tab-pane' + (this.state.activeTab === 1 ? ' active' : '') }>
{ this.renderNotificationsByType('error') }
</div>
<div className={ 'tab-pane' + (this.state.activeTab === 2 ? ' active' : '') }>
{ this.renderNotificationsByType('pending') }
</div>
</div>
</div>
</div>
</div>
<div className="modal-footer">
<button
type="button"
className="btn btn-default"
onClick={ this.toggleNotificationsModal }>
{ translate('INDEX.CLOSE') }
</button>
</div>
</div>
</div>
</div>
<div className="modal-backdrop show in"></div>
</div>
);
};
export const NotificationsRender = function() {
return (
<div>
<div
className={ 'notifications-badge' + (this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle.status === 'unlocked' ? ' stick-to-top' : '') }
onClick={ this.state.debug ? this.toggleNotificationsModal : null }>
<span className={ this.state.debug ? 'badge success' : 'hide' }>
{ this.state.calls.success }
</span>
<span className={ this.state.debug ? 'badge error' : 'hide' }>
{ this.state.calls.error }
</span>
<span className={ this.state.debug ? 'badge pending' : 'hide' }>
{ this.state.calls.pending }
</span>
<div className={ 'spinner' + (this.state.calls.pending === 0 ? ' spinner-hide' : '') }>
<div className="rect1"></div>
<div className="rect2"></div>
<div className="rect3"></div>
<div className="rect4"></div>
<div className="rect5"></div>
</div>
</div>
{ this.renderNotificationsModal() }
</div>
);
};

2
react/src/components/main/walletMain.js

@ -5,7 +5,6 @@ import AddCoin from '../addcoin/addcoin';
import Login from '../login/login';
import Dashboard from '../dashboard/main/dashboard';
import SyncOnly from '../dashboard/syncOnly/syncOnly';
import Notifications from '../dashboard/notifications/notifications';
class WalletMain extends React.Component {
render() {
@ -17,7 +16,6 @@ class WalletMain extends React.Component {
<AddCoin />
<Login />
<Toaster {...this.props.toaster} />
<Notifications />
</div>
);
}

169
react/src/components/overrides.scss

@ -239,141 +239,6 @@ input:checked + .slider:before {
display: none;
}
.notifications-modal {
color: #757575;
}
.notifications {
.notice {
position: relative;
margin: 1em;
background: #F9F9F9;
padding: 1em 1em 1em 2em;
border-left: 4px solid #DDD;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125);
&:before {
position: absolute;
top: 50%;
margin-top: -17px;
left: -17px;
background-color: #DDD;
color: #FFF;
width: 30px;
height: 30px;
border-radius: 100%;
text-align: center;
line-height: 30px;
font-weight: bold;
font-family: Georgia;
text-shadow: 1px 1px rgba(0, 0, 0, 0.5);
}
}
.info {
border-color: #0074D9;
&:before {
content: 'i';
background-color: #0074D9;
}
}
.success {
border-color: #2ECC40;
&:before {
content: '';
background-color: #2ECC40;
}
}
.warning {
border-color: #FFDC00;
&:before {
content: '!';
background-color: #FFDC00;
}
}
.error {
border-color: #FF4136;
&:before {
content: 'X';
background-color: #FF4136;
}
}
}
.notifications-badge {
position: fixed;
bottom: 10px;
left: 5px;
cursor: pointer;
height: 20px;
z-index: 20;
.badge {
margin-left: 2px;
font-weight: bold;
&.success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
&.pending {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
&.error {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
}
.spinner-hide {
>div {
display: none;
}
}
.spinner {
position: absolute;
left: 60px;
bottom: -12px;
>div {
background-color: #fff;
margin-right: 1px;
width: 3px;
}
}
&.stick-to-top {
top: -3px;
left: 400px;
z-index: 1500;
.spinner {
display: inline-block;
position: relative;
left: -4px;
bottom: -16px;
>div {
background-color: #00bcd4;
margin-right: 1px;
width: 3px;
}
}
}
}
#js-copytextarea {
opacity: 0;
height: 10px;
@ -533,21 +398,6 @@ select{
}
}
.coin-logo-wide {
padding: 8px 30px 0;
position: relative;
top: 0;
.header-easydex-section {
img {
width: inherit;
max-width: inherit;
position: relative;
top: -5px;
}
}
}
.native-coin-logo {
float: left;
position: absolute;
@ -562,11 +412,26 @@ select{
}
.coin-logo-wide {
padding: 8px 30px 0;
position: relative;
top: 0;
.header-easydex-section {
img {
width: inherit;
max-width: inherit;
position: relative;
top: -5px;
}
}
&.native-coin-logo {
top: -93px;
.header-easydex-section img {
width: inherit;
.header-easydex-section {
img {
width: inherit;
}
}
}
}

31
react/src/reducers/dashboard.js

@ -7,24 +7,11 @@ import {
BASILISK_CONNECTION,
DASHBOARD_CONNECT_NOTARIES,
VIEW_CACHE_DATA,
LOG_GUI_HTTP,
TOGGLE_NOTIFICATIONS_MODAL,
DISPLAY_COIND_DOWN_MODAL,
DISPLAY_CLAIM_INTEREST_MODAL
} from '../actions/storeType';
const HTTP_STACK_MAX_ENTRIES = 150; // limit stack mem length to N records per type
const trimHTTPLogs = (logObject) => {
const logObjectArray = Object.keys(logObject);
if (logObjectArray.length - HTTP_STACK_MAX_ENTRIES === 1) {
delete logObject[logObjectArray.shift()];
}
return logObject;
};
export function Dashboard(state = {
activeSection: 'wallets',
activeHandle: null,
@ -83,24 +70,6 @@ export function Dashboard(state = {
return Object.assign({}, state, {
displayViewCacheModal: action.display,
});
case LOG_GUI_HTTP:
const logState = state.guiLog;
const actionTS = action.timestamp;
let newLogState = {};
if (logState[actionTS]) {
const logItem = { [actionTS]: logState[actionTS] };
logItem[actionTS].status = action.log.status;
logItem[actionTS].response = action.log.response;
newLogState = trimHTTPLogs(Object.assign({}, logState, logItem));
} else {
const logItem = { [actionTS]: action.log };
newLogState = trimHTTPLogs(Object.assign({}, logState, logItem));
}
return Object.assign({}, state, {
guiLog: newLogState,
});
case DISPLAY_COIND_DOWN_MODAL:
return Object.assign({}, state, {
displayCoindDownModal: action.displayCoindDownModal,

26
react/src/reducers/errors.js

@ -1,26 +0,0 @@
import {
SERVICE_ERROR
} from '../actions/storeType';
export function Errors(state = {
errors: {},
}, action) {
switch (action.type) {
case SERVICE_ERROR:
let _errors = Object.assign({}, state);
if (_errors[action.apiMethod]) {
_errors[action.apiMethod]++;
} else {
_errors[action.apiMethod] = 1;
}
return Object.assign({}, state, {
errors: _errors,
});
default:
return state;
}
}
export default Errors;

2
react/src/reducers/index.js

@ -10,7 +10,6 @@ import { Atomic } from './atomic';
import { Settings } from './settings';
import { Interval } from './interval';
import { SyncOnly } from './syncOnly';
import { Errors } from './errors';
const appReducer = combineReducers({
AddCoin,
@ -22,7 +21,6 @@ const appReducer = combineReducers({
Settings,
Interval,
SyncOnly,
Errors,
routing: routerReducer,
});

Loading…
Cancel
Save