Browse Source

Merge branch 'redux' into jsx-separate-component-logic

# Conflicts:
#	react/src/components/addcoin/addcoin.js
#	react/src/components/dashboard/walletsHeader.js
all-modes
petitPapillon 8 years ago
parent
commit
122b19a66e
  1. 3
      react/package.json
  2. 139
      react/src/actions/actionCreators.js
  3. 33
      react/src/actions/actions/addCoin.js
  4. 86
      react/src/actions/actions/addressBalance.js
  5. 10
      react/src/actions/actions/atomic.js
  6. 44
      react/src/actions/actions/basiliskCache.js
  7. 17
      react/src/actions/actions/basiliskProcessAddress.js
  8. 5
      react/src/actions/actions/basiliskTxHistory.js
  9. 7
      react/src/actions/actions/coinList.js
  10. 10
      react/src/actions/actions/copyAddress.js
  11. 11
      react/src/actions/actions/createWallet.js
  12. 9
      react/src/actions/actions/dexCoins.js
  13. 18
      react/src/actions/actions/edexBalance.js
  14. 11
      react/src/actions/actions/edexGetTx.js
  15. 9
      react/src/actions/actions/fullTxHistory.js
  16. 12
      react/src/actions/actions/getAddrByAccount.js
  17. 11
      react/src/actions/actions/iguanaHelpers.js
  18. 9
      react/src/actions/actions/iguanaInstance.js
  19. 10
      react/src/actions/actions/log.js
  20. 12
      react/src/actions/actions/logout.js
  21. 14
      react/src/actions/actions/nativeBalance.js
  22. 21
      react/src/actions/actions/nativeNewAddress.js
  23. 63
      react/src/actions/actions/nativeSend.js
  24. 16
      react/src/actions/actions/nativeSyncInfo.js
  25. 11
      react/src/actions/actions/nativeTxHistory.js
  26. 37
      react/src/actions/actions/notary.js
  27. 6
      react/src/actions/actions/openAlias.js
  28. 46
      react/src/actions/actions/sendFullBasilisk.js
  29. 50
      react/src/actions/actions/settings.js
  30. 12
      react/src/actions/actions/syncInfo.js
  31. 17
      react/src/actions/actions/syncOnly.js
  32. 5
      react/src/actions/actions/sysInfo.js
  33. 37
      react/src/actions/actions/walletAuth.js
  34. 10
      react/src/components/addcoin/addcoin.js
  35. 22
      react/src/components/addcoin/payload.js
  36. 2
      react/src/components/dashboard/atomic.js
  37. 315
      react/src/components/dashboard/coinTile.js
  38. 35
      react/src/components/dashboard/coinTileItem.js
  39. 34
      react/src/components/dashboard/navbar.js
  40. 66
      react/src/components/dashboard/notifications.js
  41. 11
      react/src/components/dashboard/sendCoin.js
  42. 123
      react/src/components/dashboard/settings.js
  43. 108
      react/src/components/dashboard/syncOnly.js
  44. 4
      react/src/components/dashboard/walletsBasiliskConnection.js
  45. 10
      react/src/components/dashboard/walletsData.js
  46. 4
      react/src/components/dashboard/walletsHeader.js
  47. 4
      react/src/components/dashboard/walletsNative.js
  48. 56
      react/src/components/dashboard/walletsNativeSend.js
  49. 2
      react/src/components/dashboard/walletsNativeSyncProgress.js
  50. 2
      react/src/components/dashboard/walletsNativeTxHistory.js
  51. 31
      react/src/components/login/login.js
  52. 4
      react/src/components/main/main.js
  53. 552
      react/src/components/overrides.scss
  54. 12
      react/src/components/toaster/toaster-item.js
  55. 40
      react/src/components/toaster/toaster.js
  56. 31
      react/src/reducers/dashboard.js
  57. 490
      react/src/styles/index.scss
  58. 1
      react/src/translate/en.js
  59. 316
      react/src/util/coinHelper.js
  60. 8
      react/webpack.config.js

3
react/package.json

@ -5,8 +5,7 @@
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"start": "webpack-dashboard -t 'EDEX-ReactJS' -- webpack-dev-server --colors --no-info", "start": "webpack-dashboard -t 'EDEX-ReactJS' -- webpack-dev-server --colors --no-info",
"build": "rm -rf ./build && NODE_ENV=\"production\" webpack", "build": "rm -rf ./build && mkdir build && mkdir build/assets && cp -R src/assets build/ && NODE_ENV=\"production\" webpack",
"build_dist": " webpack -p --config ./webpack.config.js",
"lint-break-on-errors": "eslint ./src ./webpack.config.js -f table --ext .js --ext .jsx", "lint-break-on-errors": "eslint ./src ./webpack.config.js -f table --ext .js --ext .jsx",
"lint": "eslint ./src ./webpack.config.js -f table --ext .js --ext .jsx || true", "lint": "eslint ./src ./webpack.config.js -f table --ext .js --ext .jsx || true",
"preview": "NODE_ENV=\"production\" ./node_modules/webpack-dashboard/bin/webpack-dashboard.js -t 'Preview Mode - EDEX' -- ./node_modules/webpack-dev-server/bin/webpack-dev-server.js", "preview": "NODE_ENV=\"production\" ./node_modules/webpack-dashboard/bin/webpack-dashboard.js -t 'Preview Mode - EDEX' -- ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",

139
react/src/actions/actionCreators.js

@ -3,43 +3,68 @@ import 'bluebird';
import _config from '../config'; import _config from '../config';
import { translate } from '../translate/translate'; import { translate } from '../translate/translate';
import * as storeType from './storeType'; import {
GET_ACTIVE_COINS,
DASHBOARD_ACTIVE_ADDRESS,
VIEW_CACHE_DATA,
DASHBOARD_DISPLAY_NOTARIES_MODAL,
DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR,
DASHBOARD_ACTIVE_SECTION,
DASHBOARD_ACTIVE_TXINFO_MODAL,
BASILISK_CONNECTION,
BASILISK_REFRESH,
SYNCING_FULL_MODE,
SYNCING_NATIVE_MODE,
DASHBOARD_ACTIVE_COIN_SEND_FORM,
DASHBOARD_ACTIVE_COIN_RECEIVE_FORM,
DASHBOARD_ACTIVE_COIN_RESET_FORMS,
ADD_TOASTER_MESSAGE,
REMOVE_TOASTER_MESSAGE,
DISPLAY_ADDCOIN_MODAL,
GET_MAIN_ADDRESS,
DASHBOARD_SECTION_CHANGE,
DASHBOARD_ACTIVE_COIN_CHANGE,
ACTIVE_COIN_GET_ADDRESSES,
DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY,
START_INTERVAL,
STOP_INTERVAL
} from './storeType';
import { import {
logGuiHttp, logGuiHttp,
getAgamaLog, getAgamaLog,
guiLogState guiLogState
} from './log'; } from './actions/log';
export * from './nativeSyncInfo'; export * from './actions/nativeSyncInfo';
export * from './basiliskCache'; export * from './actions/basiliskCache';
export * from './nativeSend'; export * from './actions/nativeSend';
export * from './coinList'; export * from './actions/coinList';
export * from './createWallet'; export * from './actions/createWallet';
export * from './nativeTxHistory'; export * from './actions/nativeTxHistory';
export * from './nativeBalance'; export * from './actions/nativeBalance';
export * from './nativeNewAddress'; export * from './actions/nativeNewAddress';
export * from './logout'; export * from './actions/logout';
export * from './basiliskProcessAddress'; export * from './actions/basiliskProcessAddress';
export * from './edexGetTx'; export * from './actions/edexGetTx';
export * from './sendFullBasilisk'; export * from './actions/sendFullBasilisk';
export * from './settings'; export * from './actions/settings';
export * from './syncOnly'; export * from './actions/syncOnly';
export * from './iguanaInstance'; export * from './actions/iguanaInstance';
export * from './notary'; export * from './actions/notary';
export * from './edexBalance'; export * from './actions/edexBalance';
export * from './addCoin'; export * from './actions/addCoin';
export * from './addressBalance'; export * from './actions/addressBalance';
export * from './syncInfo'; export * from './actions/syncInfo';
export * from './getAddrByAccount'; export * from './actions/getAddrByAccount';
export * from './atomic'; export * from './actions/atomic';
export * from './walletAuth'; export * from './actions/walletAuth';
export * from './openAlias'; export * from './actions/openAlias';
export * from './copyAddress'; export * from './actions/copyAddress';
export * from './sysInfo'; export * from './actions/sysInfo';
export * from './dexCoins'; export * from './actions/dexCoins';
export * from './fullTxHistory'; export * from './actions/fullTxHistory';
export * from './basiliskTxHistory'; export * from './actions/basiliskTxHistory';
export * from './iguanaHelpers'; export * from './actions/iguanaHelpers';
export let Config; export let Config;
@ -51,7 +76,7 @@ try {
export function changeActiveAddress(address) { export function changeActiveAddress(address) {
return { return {
type: storeType.DASHBOARD_ACTIVE_ADDRESS, type: DASHBOARD_ACTIVE_ADDRESS,
address, address,
} }
} }
@ -64,35 +89,35 @@ export function updateErrosStack(method) {
export function toggleViewCacheModal(display) { export function toggleViewCacheModal(display) {
return { return {
type: storeType.VIEW_CACHE_DATA, type: VIEW_CACHE_DATA,
display, display,
} }
} }
export function displayNotariesModal(display) { export function displayNotariesModal(display) {
return { return {
type: storeType.DASHBOARD_DISPLAY_NOTARIES_MODAL, type: DASHBOARD_DISPLAY_NOTARIES_MODAL,
display, display,
} }
} }
export function changeMainBasiliskAddress(address) { export function changeMainBasiliskAddress(address) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR, type: DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR,
address, address,
} }
} }
export function toggleDashboardActiveSection(name) { export function toggleDashboardActiveSection(name) {
return { return {
type: storeType.DASHBOARD_ACTIVE_SECTION, type: DASHBOARD_ACTIVE_SECTION,
section: name, section: name,
} }
} }
export function toggleDashboardTxInfoModal(display, txIndex) { export function toggleDashboardTxInfoModal(display, txIndex) {
return { return {
type: storeType.DASHBOARD_ACTIVE_TXINFO_MODAL, type: DASHBOARD_ACTIVE_TXINFO_MODAL,
showTransactionInfo: display, showTransactionInfo: display,
showTransactionInfoTxIndex: txIndex, showTransactionInfoTxIndex: txIndex,
} }
@ -100,7 +125,7 @@ export function toggleDashboardTxInfoModal(display, txIndex) {
export function basiliskConnectionState(display, json) { export function basiliskConnectionState(display, json) {
return { return {
type: storeType.BASILISK_CONNECTION, type: BASILISK_CONNECTION,
basiliskConnection: display, basiliskConnection: display,
progress: json, progress: json,
} }
@ -108,7 +133,7 @@ export function basiliskConnectionState(display, json) {
export function basiliskRefreshState(display, json) { export function basiliskRefreshState(display, json) {
return { return {
type: storeType.BASILISK_REFRESH, type: BASILISK_REFRESH,
basiliskRefresh: display, basiliskRefresh: display,
progress: json, progress: json,
} }
@ -128,7 +153,7 @@ export function basiliskConnection(display) {
export function syncingNativeModeState(display, json) { export function syncingNativeModeState(display, json) {
return { return {
type: storeType.SYNCING_FULL_MODE, type: SYNCING_FULL_MODE,
syncingNativeMode: display, syncingNativeMode: display,
progress: json, progress: json,
} }
@ -136,7 +161,7 @@ export function syncingNativeModeState(display, json) {
export function syncingFullModeState(display, json) { export function syncingFullModeState(display, json) {
return { return {
type: storeType.SYNCING_NATIVE_MODE, type: SYNCING_NATIVE_MODE,
syncingFullMode: display, syncingFullMode: display,
progress: json, progress: json,
} }
@ -144,21 +169,21 @@ export function syncingFullModeState(display, json) {
export function toggleSendCoinFormState(display) { export function toggleSendCoinFormState(display) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_SEND_FORM, type: DASHBOARD_ACTIVE_COIN_SEND_FORM,
send: display, send: display,
} }
} }
export function toggleReceiveCoinFormState(display) { export function toggleReceiveCoinFormState(display) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_RECEIVE_FORM, type: DASHBOARD_ACTIVE_COIN_RECEIVE_FORM,
receive: display, receive: display,
} }
} }
export function toggleSendReceiveCoinFormsState() { export function toggleSendReceiveCoinFormsState() {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_RESET_FORMS, type: DASHBOARD_ACTIVE_COIN_RESET_FORMS,
send: false, send: false,
receive: false, receive: false,
} }
@ -166,7 +191,7 @@ export function toggleSendReceiveCoinFormsState() {
export function triggerToaster(display, message, title, _type) { export function triggerToaster(display, message, title, _type) {
return { return {
type: storeType.ADD_TOASTER_MESSAGE, type: ADD_TOASTER_MESSAGE,
display, display,
message, message,
title, title,
@ -177,14 +202,14 @@ export function triggerToaster(display, message, title, _type) {
// triggers removing of the toast with the provided toastId // triggers removing of the toast with the provided toastId
export function dismissToaster(toastId) { export function dismissToaster(toastId) {
return { return {
type: storeType.REMOVE_TOASTER_MESSAGE, type: REMOVE_TOASTER_MESSAGE,
toastId: toastId toastId: toastId
} }
} }
export function toggleAddcoinModalState(display, isLogin) { export function toggleAddcoinModalState(display, isLogin) {
return { return {
type: storeType.DISPLAY_ADDCOIN_MODAL, type: DISPLAY_ADDCOIN_MODAL,
display: display, display: display,
isLogin: isLogin, isLogin: isLogin,
} }
@ -192,7 +217,7 @@ export function toggleAddcoinModalState(display, isLogin) {
export function dashboardCoinsState(json) { export function dashboardCoinsState(json) {
return { return {
type: storeType.GET_ACTIVE_COINS, type: GET_ACTIVE_COINS,
coins: json, coins: json,
activeCoins: Object.keys(json.native).length || Object.keys(json.basilisk).length || Object.keys(json.full).length ? true : false activeCoins: Object.keys(json.native).length || Object.keys(json.basilisk).length || Object.keys(json.full).length ? true : false
} }
@ -200,7 +225,7 @@ export function dashboardCoinsState(json) {
export function getMainAddressState(json) { export function getMainAddressState(json) {
return { return {
type: storeType.GET_MAIN_ADDRESS, type: GET_MAIN_ADDRESS,
activeHandle: json, activeHandle: json,
} }
} }
@ -225,7 +250,7 @@ export function toggleSendReceiveCoinForms() {
export function dashboardChangeSectionState(sectionName) { export function dashboardChangeSectionState(sectionName) {
return { return {
type: storeType.DASHBOARD_SECTION_CHANGE, type: DASHBOARD_SECTION_CHANGE,
activeSection: sectionName, activeSection: sectionName,
} }
} }
@ -238,7 +263,7 @@ export function dashboardChangeSection(sectionName) {
export function dashboardChangeActiveCoinState(coin, mode) { export function dashboardChangeActiveCoinState(coin, mode) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_CHANGE, type: DASHBOARD_ACTIVE_COIN_CHANGE,
coin: coin, coin: coin,
mode: mode, mode: mode,
} }
@ -292,7 +317,7 @@ export function setBasiliskMainAddress(json, coin, mode) {
} }
return { return {
type: storeType.ACTIVE_COIN_GET_ADDRESSES, type: ACTIVE_COIN_GET_ADDRESSES,
addresses: { 'public': [] }, addresses: { 'public': [] },
} }
} }
@ -308,14 +333,14 @@ export function getNativeTxHistoryState(json) {
} }
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY, type: DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY,
txhistory: json, txhistory: json,
} }
} }
export function startInterval(name, handle) { export function startInterval(name, handle) {
return { return {
type: storeType.START_INTERVAL, type: START_INTERVAL,
name, name,
handle, handle,
} }
@ -325,7 +350,7 @@ export function stopInterval(name, intervals) {
clearInterval(intervals[name]); clearInterval(intervals[name]);
return { return {
type: storeType.STOP_INTERVAL, type: STOP_INTERVAL,
name, name,
} }
} }

33
react/src/actions/addCoin.js → react/src/actions/actions/addCoin.js

@ -1,11 +1,11 @@
import * as storeType from './storeType'; import { translate } from '../../translate/translate';
import { translate } from '../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config, Config,
toggleAddcoinModal, toggleAddcoinModal,
getDexCoins getDexCoins,
} from './actionCreators'; startIguanaInstance
} from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -16,7 +16,7 @@ import {
startCrypto, startCrypto,
checkCoinType, checkCoinType,
checkAC checkAC
} from '../components/addcoin/payload'; } from '../../components/addcoin/payload';
export function addCoin(coin, mode, syncOnly, port) { export function addCoin(coin, mode, syncOnly, port) {
if (mode === '-1') { if (mode === '-1') {
@ -49,10 +49,10 @@ export function addCoin(coin, mode, syncOnly, port) {
}; };
return dispatch => { return dispatch => {
startIguanaInstance(modeToValue[mode] + '/sync', coin) startIguanaInstance(`${modeToValue[mode]}/sync`, coin)
.then(function(json) { .then(function(json) {
setTimeout(function() { setTimeout(function() {
console.log('started ' + coin + ' / ' + modeToValue[mode] + ' fork', json); console.log(`started ${coin} / ${modeToValue[mode]} fork`, json);
dispatch(iguanaAddCoin(coin, mode, _acData, json.result)); dispatch(iguanaAddCoin(coin, mode, _acData, json.result));
}, 2000); }, 2000);
}); });
@ -79,12 +79,12 @@ export function iguanaAddCoin(coin, mode, acData, port) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaAddCoin', 'function': 'iguanaAddCoin',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (port ? port : Config.iguanaCorePort), 'url': `http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`,
'payload': acData, 'payload': acData,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + (port ? port : Config.iguanaCorePort), { return fetch(`http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(acData), body: JSON.stringify(acData),
}) })
@ -126,7 +126,7 @@ export function shepherdHerd(coin, mode, path) {
'ac_options': [ 'ac_options': [
'-daemon=0', '-daemon=0',
'-server', '-server',
'-ac_name=' + coin, `-ac_name=${coin}`,
'-addnode=78.47.196.146' '-addnode=78.47.196.146'
] ]
}; };
@ -160,12 +160,11 @@ export function shepherdHerd(coin, mode, path) {
if (checkCoinType(coin) === 'ac') { if (checkCoinType(coin) === 'ac') {
acData = startAssetChain(path.result, coin, mode); acData = startAssetChain(path.result, coin, mode);
const supply = startAssetChain(path.result, coin, mode, true); const supply = startAssetChain(path.result, coin, mode, true);
herdData.ac_options.push('-ac_supply=' + supply); herdData.ac_options.push(`-ac_supply=${supply}`);
} }
console.log('herdData', herdData);
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/herd', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/herd`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -192,7 +191,7 @@ export function addCoinResult(coin, mode) {
}; };
return dispatch => { return dispatch => {
dispatch(triggerToaster(true, coin + ' ' + translate('TOASTR.STARTED_IN') + ' ' + modeToValue[mode] + ' ' + translate('TOASTR.MODE'), translate('TOASTR.COIN_NOTIFICATION'), 'success')); dispatch(triggerToaster(true, `${coin} ${translate('TOASTR.STARTED_IN')} ${modeToValue[mode]} ${translate('TOASTR.MODE')}`, translate('TOASTR.COIN_NOTIFICATION'), 'success'));
dispatch(toggleAddcoinModal(false, false)); dispatch(toggleAddcoinModal(false, false));
dispatch(getDexCoins()); dispatch(getDexCoins());
} }
@ -200,7 +199,7 @@ export function addCoinResult(coin, mode) {
export function _shepherdGetConfig(coin, mode) { export function _shepherdGetConfig(coin, mode) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getconf`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -220,7 +219,7 @@ export function shepherdGetConfig(coin, mode) {
if (coin === 'KMD' && if (coin === 'KMD' &&
mode === '-1') { mode === '-1') {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getconf`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -236,7 +235,7 @@ export function shepherdGetConfig(coin, mode) {
} }
} else { } else {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getconf`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

86
react/src/actions/addressBalance.js → react/src/actions/actions/addressBalance.js

@ -1,10 +1,12 @@
import * as storeType from './storeType'; import {
ACTIVE_COIN_GET_ADDRESSES
} from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config, Config,
shepherdGroomPost, shepherdGroomPost,
getPassthruAgent getPassthruAgent
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -12,13 +14,16 @@ import {
function getKMDAddressesNativeState(json) { function getKMDAddressesNativeState(json) {
return { return {
type: storeType.ACTIVE_COIN_GET_ADDRESSES, type: ACTIVE_COIN_GET_ADDRESSES,
addresses: json, addresses: json,
} }
} }
export function getKMDAddressesNative(coin, mode, currentAddress) { export function getKMDAddressesNative(coin, mode, currentAddress) {
const type = ['public', 'private']; const type = [
'public',
'private'
];
if (mode !== 'native') { if (mode !== 'native') {
type.pop(); type.pop();
@ -28,43 +33,43 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
Promise.all(type.map((_type, index) => { Promise.all(type.map((_type, index) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let payload, let payload,
ajax_data_to_hex = '', ajaxFunctionInput = '',
ajax_function_input = '', tmplistaddrHexInput = '',
tmplistaddr_hex_input = '', passthruAgent = getPassthruAgent(coin),
passthru_agent = getPassthruAgent(coin), tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
if (_type === 'public') { if (_type === 'public') {
ajax_function_input = 'getaddressesbyaccount'; ajaxFunctionInput = 'getaddressesbyaccount';
tmplistaddr_hex_input = '222200'; tmplistaddrHexInput = '222200';
} }
if (_type === 'private') { if (_type === 'private') {
ajax_function_input = 'z_listaddresses'; ajaxFunctionInput = 'z_listaddresses';
tmplistaddr_hex_input = ''; tmplistaddrHexInput = '';
} }
if (passthru_agent === 'iguana') { if (passthruAgent === 'iguana') {
payload = { payload = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
'function': ajax_function_input, 'function': ajaxFunctionInput,
'hex': tmplistaddr_hex_input, 'hex': tmplistaddrHexInput,
}; };
} else { } else {
payload = { payload = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'function': ajax_function_input, 'function': ajaxFunctionInput,
'hex': tmplistaddr_hex_input, 'hex': tmplistaddrHexInput,
}; };
} }
if (mode === 'full' || mode === 'basilisk') { if (mode === 'full' ||
mode === 'basilisk') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'getaddressesbyaccount', 'method': 'getaddressesbyaccount',
@ -75,7 +80,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (mode === 'basilisk') { if (mode === 'basilisk') {
const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/cache?pubkey=' + pubkey, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -99,12 +104,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDAddressesNative', 'function': 'getKMDAddressesNative',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -131,14 +136,14 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})) }))
.then(result => { .then(result => {
// TODO: split into 2 functions // TODO: split into 2 functions
const passthru_agent = getPassthruAgent(coin), const passthruAgent = getPassthruAgent(coin),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
let payload; let payload;
if (passthru_agent === 'iguana') { if (passthruAgent === 'iguana') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
'function': 'listunspent', 'function': 'listunspent',
@ -146,8 +151,8 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
}; };
} else { } else {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'function': 'listunspent', 'function': 'listunspent',
'hex': '', 'hex': '',
@ -156,7 +161,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (mode === 'full') { if (mode === 'full') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'listunspent', 'method': 'listunspent',
'params': [ 'params': [
@ -169,7 +174,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
// if api cache option is off // if api cache option is off
if (mode === 'basilisk') { if (mode === 'basilisk') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'listunspent', 'method': 'listunspent',
'address': currentAddress, 'address': currentAddress,
@ -217,7 +222,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
newAddressArray[a] = []; newAddressArray[a] = [];
for (let b = 0; b < result[a].length; b++) { for (let b = 0; b < result[a].length; b++) {
var filteredArray; let filteredArray;
if (mode === 'basilisk') { if (mode === 'basilisk') {
filteredArray = json.map(res => res.amount); filteredArray = json.map(res => res.amount);
@ -226,7 +231,6 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
} }
let sum = 0; let sum = 0;
for (let i = 0; i < filteredArray.length; i++) { for (let i = 0; i < filteredArray.length; i++) {
sum += filteredArray[i]; sum += filteredArray[i];
} }
@ -247,7 +251,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (mode === 'basilisk') { if (mode === 'basilisk') {
const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/cache?pubkey=' + pubkey, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -271,12 +275,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDAddressesNative+Balance', 'function': 'getKMDAddressesNative+Balance',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -312,12 +316,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDAddressesNative+Balance', 'function': 'getKMDAddressesNative+Balance',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

10
react/src/actions/atomic.js → react/src/actions/actions/atomic.js

@ -1,8 +1,8 @@
import * as storeType from './storeType'; import { ATOMIC } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -15,12 +15,12 @@ export function atomic(payload) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'atomic', 'function': 'atomic',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -47,7 +47,7 @@ export function atomic(payload) {
function atomicState(json) { function atomicState(json) {
return { return {
type: storeType.ATOMIC, type: ATOMIC,
response: json, response: json,
} }
} }

44
react/src/actions/basiliskCache.js → react/src/actions/actions/basiliskCache.js

@ -1,8 +1,8 @@
import * as storeType from './storeType'; import { DASHBOARD_ACTIVE_COIN_GET_CACHE } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -10,7 +10,7 @@ import {
export function deleteCacheFile(_payload) { export function deleteCacheFile(_payload) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/groom?', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom`, {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -30,7 +30,7 @@ export function getCacheFile(pubkey) {
const _pubkey = pubkey || JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; const _pubkey = pubkey || JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/groom?filename=' + _pubkey, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom?filename=${_pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -46,16 +46,16 @@ export function getCacheFile(pubkey) {
} }
export function fetchNewCacheData(_payload) { export function fetchNewCacheData(_payload) {
const _userpass = '?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), const _userpass = `?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
_pubkey = '&pubkey=' + _payload.pubkey, _pubkey = `&pubkey=${_payload.pubkey}`,
_route = _payload.allcoins ? 'cache-all' : 'cache-one', _route = _payload.allcoins ? 'cache-all' : 'cache-one',
_coin = '&coin=' + _payload.coin, _coin = `&coin=${_payload.coin}`,
_calls = '&calls=' + _payload.calls, _calls = `&calls=${_payload.calls}`,
_address = _payload.address ? ('&address=' + _payload.address) : '', _address = _payload.address ? (`&address=${_payload.address}`) : '',
_iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + (Config.iguanaCorePort + 1) : ''; _iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : '';
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls + _address + _iguanaInstancePort, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_iguanaInstancePort}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -72,7 +72,7 @@ export function fetchNewCacheData(_payload) {
export function getShepherdCache(pubkey, coin) { export function getShepherdCache(pubkey, coin) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/cache?pubkey=' + pubkey, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -101,23 +101,23 @@ function getShepherdCacheState(json, pubkey, coin) {
} }
} else { } else {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_GET_CACHE, type: DASHBOARD_ACTIVE_COIN_GET_CACHE,
cache: json && json.result && json.result.basilisk ? json.result.basilisk : null, cache: json && json.result && json.result.basilisk ? json.result.basilisk : null,
} }
} }
} }
export function fetchUtxoCache(_payload) { export function fetchUtxoCache(_payload) {
const _userpass = '?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), const _userpass = `?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
_pubkey = '&pubkey=' + _payload.pubkey, _pubkey = `&pubkey=${_payload.pubkey}`,
_route = _payload.allcoins ? 'cache-all' : 'cache-one', _route = _payload.allcoins ? 'cache-all' : 'cache-one',
_coin = '&coin=' + _payload.coin, _coin = `&coin=${_payload.coin}`,
_calls = '&calls=' + _payload.calls, _calls = `&calls=${_payload.calls}`,
_address = _payload.address ? ('&address=' + _payload.address) : '', _address = _payload.address ? (`&address=${_payload.address}`) : '',
_iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + (Config.iguanaCorePort + 1) : ''; _iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : '';
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls + _address + _iguanaInstancePort, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_iguanaInstancePort}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -134,7 +134,7 @@ export function fetchUtxoCache(_payload) {
export function shepherdGroomPost(_filename, _payload) { export function shepherdGroomPost(_filename, _payload) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/groom/', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom/`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -155,7 +155,7 @@ export function shepherdGroomPost(_filename, _payload) {
export function shepherdGroomPostPromise(_filename, _payload) { export function shepherdGroomPostPromise(_filename, _payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/groom/', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom/`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

17
react/src/actions/basiliskProcessAddress.js → react/src/actions/actions/basiliskProcessAddress.js

@ -1,9 +1,8 @@
import * as storeType from './storeType'; import { translate } from '../../translate/translate';
import { translate } from '../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -11,7 +10,7 @@ import {
export function checkAddressBasilisk(coin, address) { export function checkAddressBasilisk(coin, address) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'checkaddress', 'method': 'checkaddress',
'address': address, 'address': address,
@ -24,12 +23,12 @@ export function checkAddressBasilisk(coin, address) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'checkAddressBasilisk', 'function': 'checkAddressBasilisk',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -73,7 +72,7 @@ function checkAddressBasiliskHandle(json) {
export function validateAddressBasilisk(coin, address) { export function validateAddressBasilisk(coin, address) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'validateaddress', 'method': 'validateaddress',
'address': address, 'address': address,
@ -86,12 +85,12 @@ export function validateAddressBasilisk(coin, address) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'validateAddressBasilisk', 'function': 'validateAddressBasilisk',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

5
react/src/actions/basiliskTxHistory.js → react/src/actions/actions/basiliskTxHistory.js

@ -1,9 +1,8 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getNativeTxHistoryState getNativeTxHistoryState
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -13,7 +12,7 @@ export function getBasiliskTransactionsList(coin, address) {
const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/cache?pubkey=' + pubkey, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

7
react/src/actions/coinList.js → react/src/actions/actions/coinList.js

@ -1,8 +1,7 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -10,7 +9,7 @@ import {
export function shepherdGetCoinList() { export function shepherdGetCoinList() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/coinslist', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coinslist`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -27,7 +26,7 @@ export function shepherdGetCoinList() {
export function shepherdPostCoinList(data) { export function shepherdPostCoinList(data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/coinslist', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coinslist`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

10
react/src/actions/copyAddress.js → react/src/actions/actions/copyAddress.js

@ -1,10 +1,6 @@
import { copyToClipboard } from '../util/copyToClipboard'; import { copyToClipboard } from '../../util/copyToClipboard';
import { translate } from '../translate/translate'; import { translate } from '../../translate/translate';
import * as storeType from './storeType'; import { triggerToaster } from '../actionCreators';
import {
triggerToaster,
Config
} from './actionCreators';
export function copyCoinAddress(address) { export function copyCoinAddress(address) {
const _result = copyToClipboard(address); const _result = copyToClipboard(address);

11
react/src/actions/createWallet.js → react/src/actions/actions/createWallet.js

@ -1,9 +1,8 @@
import * as storeType from './storeType'; import { translate } from '../../translate/translate';
import { translate } from '../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -25,7 +24,7 @@ function createNewWalletState(json) {
export function createNewWallet(_passphrase) { export function createNewWallet(_passphrase) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'encryptwallet', 'method': 'encryptwallet',
'passphrase': _passphrase, 'passphrase': _passphrase,
@ -37,12 +36,12 @@ export function createNewWallet(_passphrase) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'createNewWallet', 'function': 'createNewWallet',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

9
react/src/actions/dexCoins.js → react/src/actions/actions/dexCoins.js

@ -1,9 +1,8 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config, Config,
dashboardCoinsState dashboardCoinsState
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -11,7 +10,7 @@ import {
export function getDexCoins() { export function getDexCoins() {
const _payload = { const _payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'InstantDEX', 'agent': 'InstantDEX',
'method': 'allcoins', 'method': 'allcoins',
}; };
@ -22,12 +21,12 @@ export function getDexCoins() {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getDexCoins', 'function': 'getDexCoins',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload) body: JSON.stringify(_payload)
}) })

18
react/src/actions/edexBalance.js → react/src/actions/actions/edexBalance.js

@ -1,8 +1,8 @@
import * as storeType from './storeType'; import { DASHBOARD_ACTIVE_COIN_BALANCE } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -10,7 +10,7 @@ import {
export function iguanaEdexBalance(coin) { export function iguanaEdexBalance(coin) {
const _payload = { const _payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'getbalance', 'method': 'getbalance',
'coin': coin, 'coin': coin,
@ -23,12 +23,12 @@ export function iguanaEdexBalance(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaEdexBalance', 'function': 'iguanaEdexBalance',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload), body: JSON.stringify(_payload),
}) })
@ -49,7 +49,7 @@ export function iguanaEdexBalance(coin) {
function iguanaEdexBalanceState(json) { function iguanaEdexBalanceState(json) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_BALANCE, type: DASHBOARD_ACTIVE_COIN_BALANCE,
balance: json && json.result ? json.result : 0, balance: json && json.result ? json.result : 0,
} }
} }
@ -57,7 +57,7 @@ function iguanaEdexBalanceState(json) {
export function getDexBalance(coin, mode, addr) { export function getDexBalance(coin, mode, addr) {
Promise.all(addr.map((_addr, index) => { Promise.all(addr.map((_addr, index) => {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'listunspent', 'method': 'listunspent',
'address': _addr, 'address': _addr,
@ -70,12 +70,12 @@ export function getDexBalance(coin, mode, addr) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getDexBalance', 'function': 'getDexBalance',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

11
react/src/actions/edexGetTx.js → react/src/actions/actions/edexGetTx.js

@ -1,16 +1,15 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
} from './log'; } from './log';
export function edexGetTransaction(data) { export function edexGetTransaction(data, dispatch) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'symbol': data.coin, 'symbol': data.coin,
'agent': 'dex', 'agent': 'dex',
'method': 'gettransaction', 'method': 'gettransaction',
@ -24,12 +23,12 @@ export function edexGetTransaction(data) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'edexGetTransaction', 'function': 'edexGetTransaction',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

9
react/src/actions/fullTxHistory.js → react/src/actions/actions/fullTxHistory.js

@ -1,9 +1,8 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getNativeTxHistoryState getNativeTxHistoryState
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -11,7 +10,7 @@ import {
export function getFullTransactionsList(coin) { export function getFullTransactionsList(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'listtransactions', 'method': 'listtransactions',
'params': [ 'params': [
@ -27,12 +26,12 @@ export function getFullTransactionsList(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getFullTransactionsList', 'function': 'getFullTransactionsList',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

12
react/src/actions/getAddrByAccount.js → react/src/actions/actions/getAddrByAccount.js

@ -1,8 +1,8 @@
import * as storeType from './storeType'; import { ACTIVE_COIN_GET_ADDRESSES } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -24,14 +24,14 @@ export function getAddressesByAccountState(json, coin, mode) {
} }
return { return {
type: storeType.ACTIVE_COIN_GET_ADDRESSES, type: ACTIVE_COIN_GET_ADDRESSES,
addresses: { 'public': json.result }, addresses: { 'public': json.result },
} }
} }
export function getAddressesByAccount(coin, mode) { export function getAddressesByAccount(coin, mode) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'getaddressesbyaccount', 'method': 'getaddressesbyaccount',
@ -44,12 +44,12 @@ export function getAddressesByAccount(coin, mode) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getAddressesByAccount', 'function': 'getAddressesByAccount',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

11
react/src/actions/iguanaHelpers.js → react/src/actions/actions/iguanaHelpers.js

@ -1,13 +1,12 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
} from './log'; } from './log';
import { checkAC } from '../components/addcoin/payload'; import { checkAC } from '../../components/addcoin/payload';
export function getPassthruAgent(coin) { export function getPassthruAgent(coin) {
let passthruAgent; let passthruAgent;
@ -22,7 +21,7 @@ export function getPassthruAgent(coin) {
export function iguanaHashHex(data, dispatch) { export function iguanaHashHex(data, dispatch) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'hash', 'agent': 'hash',
'method': 'hex', 'method': 'hex',
'message': data, 'message': data,
@ -34,12 +33,12 @@ export function iguanaHashHex(data, dispatch) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaHashHex', 'function': 'iguanaHashHex',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

9
react/src/actions/iguanaInstance.js → react/src/actions/actions/iguanaInstance.js

@ -1,8 +1,7 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -10,7 +9,7 @@ import {
export function restartIguanaInstance(pmid) { export function restartIguanaInstance(pmid) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks/restart?pmid=' + pmid, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/restart?pmid=${pmid}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -43,7 +42,7 @@ export function restartBasiliskInstance() {
export function startIguanaInstance(mode, coin) { export function startIguanaInstance(mode, coin) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -64,7 +63,7 @@ export function startIguanaInstance(mode, coin) {
export function getIguanaInstancesList() { export function getIguanaInstancesList() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

10
react/src/actions/log.js → react/src/actions/actions/log.js

@ -1,15 +1,15 @@
import * as storeType from './storeType'; import { LOG_GUI_HTTP } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
export function logGuiHttp(payload) { export function logGuiHttp(payload) {
return dispatch => { return dispatch => {
dispatch(guiLogState(payload)); dispatch(guiLogState(payload));
// disabled for now // disabled for now
/*return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/guilog', { /*return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/guilog`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -26,7 +26,7 @@ export function logGuiHttp(payload) {
export function getAgamaLog(type) { export function getAgamaLog(type) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getlog?type=' + type, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getlog?type=${type}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -43,7 +43,7 @@ export function getAgamaLog(type) {
export function guiLogState(logData) { export function guiLogState(logData) {
return { return {
type: storeType.LOG_GUI_HTTP, type: LOG_GUI_HTTP,
timestamp: logData.timestamp, timestamp: logData.timestamp,
log: { log: {
timestamp: logData.timestamp, timestamp: logData.timestamp,

12
react/src/actions/logout.js → react/src/actions/actions/logout.js

@ -1,8 +1,8 @@
import * as storeType from './storeType'; import { LOGIN } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -12,7 +12,7 @@ function logoutState(json, dispatch) {
sessionStorage.removeItem('IguanaActiveAccount'); sessionStorage.removeItem('IguanaActiveAccount');
return { return {
type: storeType.LOGIN, type: LOGIN,
isLoggedIn: false, isLoggedIn: false,
} }
} }
@ -25,7 +25,7 @@ export function logout() {
function walletLock() { function walletLock() {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'walletlock', 'method': 'walletlock',
}; };
@ -36,12 +36,12 @@ function walletLock() {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'walletLock', 'function': 'walletLock',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

14
react/src/actions/nativeBalance.js → react/src/actions/actions/nativeBalance.js

@ -1,9 +1,9 @@
import * as storeType from './storeType'; import { DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getPassthruAgent getPassthruAgent
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -15,7 +15,7 @@ export function getKMDBalanceTotal(coin) {
if (coin !== 'KMD' && if (coin !== 'KMD' &&
coin !== 'ZEC') { coin !== 'ZEC') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'iguana', 'agent': 'iguana',
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
@ -24,7 +24,7 @@ export function getKMDBalanceTotal(coin) {
}; };
} else { } else {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'function': 'z_gettotalbalance', 'function': 'z_gettotalbalance',
@ -38,12 +38,12 @@ export function getKMDBalanceTotal(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDBalanceTotal', 'function': 'getKMDBalanceTotal',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -73,7 +73,7 @@ export function getKMDBalanceTotal(coin) {
export function getNativeBalancesState(json) { export function getNativeBalancesState(json) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE, type: DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE,
balance: json && !json.error ? json : 0, balance: json && !json.error ? json : 0,
} }
} }

21
react/src/actions/nativeNewAddress.js → react/src/actions/actions/nativeNewAddress.js

@ -1,10 +1,9 @@
import * as storeType from './storeType'; import { translate } from '../../translate/translate';
import { translate } from '../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getPassthruAgent getPassthruAgent
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -19,22 +18,22 @@ function handleGetNewKMDAddresses(pubpriv, coin, dispatch) {
export function getNewKMDAddresses(coin, pubpriv) { export function getNewKMDAddresses(coin, pubpriv) {
let payload, let payload,
ajax_function_input = ''; ajaxFunctionInput = '';
if (pubpriv === 'public') { if (pubpriv === 'public') {
ajax_function_input = 'getnewaddress'; ajaxFunctionInput = 'getnewaddress';
} }
if (pubpriv === 'private') { if (pubpriv === 'private') {
ajax_function_input = 'z_getnewaddress'; ajaxFunctionInput = 'z_getnewaddress';
} }
if (getPassthruAgent(coin) === 'iguana') { if (getPassthruAgent(coin) === 'iguana') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
'function': ajax_function_input, 'function': ajaxFunctionInput,
'hex': '', 'hex': '',
}; };
} else { } else {
@ -42,7 +41,7 @@ export function getNewKMDAddresses(coin, pubpriv) {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
'agent': coin, 'agent': coin,
'method': 'passthru', 'method': 'passthru',
'function': ajax_function_input, 'function': ajaxFunctionInput,
'hex': '', 'hex': '',
}; };
} }
@ -53,12 +52,12 @@ export function getNewKMDAddresses(coin, pubpriv) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getNewKMDAddresses', 'function': 'getNewKMDAddresses',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

63
react/src/actions/nativeSend.js → react/src/actions/actions/nativeSend.js

@ -1,34 +1,34 @@
import * as storeType from './storeType'; import { DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS } from '../storeType';
import { translate } from '../translate/translate'; import { translate } from '../../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getPassthruAgent, getPassthruAgent,
iguanaHashHex iguanaHashHex
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
} from './log'; } from './log';
export function sendNativeTx(coin, _payload) { export function sendNativeTx(coin, _payload) {
let ajax_data_to_hex; let ajaxDataToHex;
let payload; let payload;
let _apiMethod; let _apiMethod;
if (_payload.addressType === 'public') { if (_payload.addressType === 'public') {
_apiMethod = 'sendtoaddress'; _apiMethod = 'sendtoaddress';
ajax_data_to_hex = '["' + _payload.sendTo + '", ' + (Number(_payload.amount) - Number(_payload.fee)) + ']'; ajaxDataToHex = `["${_payload.sendTo}", ${Number(_payload.amount) - Number(_payload.fee)}]`;
} else { } else {
_apiMethod = 'z_sendmany'; _apiMethod = 'z_sendmany';
ajax_data_to_hex = '["' + _payload.sendFrom + '",[{"address":"' + _payload.sendTo + '","amount":' + (Number(_payload.amount) - Number(_payload.fee)) + '}]]'; ajaxDataToHex = `["${_payload.sendFrom}", [{"address": "${_payload.sendTo}", "amount": ${Number(_payload.amount) - Number(_payload.fee)}}]]`;
} }
return dispatch => { return dispatch => {
return iguanaHashHex(ajax_data_to_hex, dispatch).then((hashHexJson) => { return iguanaHashHex(ajaxDataToHex, dispatch).then((hashHexJson) => {
if (getPassthruAgent(coin) === 'iguana') { if (getPassthruAgent(coin) === 'iguana') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
@ -37,7 +37,7 @@ export function sendNativeTx(coin, _payload) {
}; };
} else { } else {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'function': _apiMethod, 'function': _apiMethod,
@ -50,12 +50,12 @@ export function sendNativeTx(coin, _payload) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'sendNativeTx', 'function': 'sendNativeTx',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -68,7 +68,16 @@ export function sendNativeTx(coin, _payload) {
})); }));
dispatch(triggerToaster(true, 'sendNativeTx', 'Error', 'error')); dispatch(triggerToaster(true, 'sendNativeTx', 'Error', 'error'));
}) })
.then(response => response.json()) .then(function(response) {
if (_apiMethod === 'sendtoaddress') {
const _response = response.text().then(function(text) { return text; });
console.log('native sendtoaddress', _response);
return _response;
} else {
return response.json();
}
})
.then(function(json) { .then(function(json) {
dispatch(logGuiHttp({ dispatch(logGuiHttp({
'timestamp': _timestamp, 'timestamp': _timestamp,
@ -83,45 +92,41 @@ export function sendNativeTx(coin, _payload) {
dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success')); dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
} }
}) })
.catch(function(ex) {
dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
console.log('parsing failed', ex);
})
}); });
} }
} }
export function getKMDOPIDState(json) { export function getKMDOPIDState(json) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS, type: DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS,
opids: json, opids: json,
} }
} }
export function getKMDOPID(opid, coin) { export function getKMDOPID(opid, coin) {
let tmpopid_output = '', let tmpopidOutput = '',
ajax_data_to_hex; ajaxDataToHex;
if (opid === undefined) { if (opid === undefined) {
ajax_data_to_hex = null; ajaxDataToHex = null;
} else { } else {
ajax_data_to_hex = '["' + opid + '"]'; ajaxDataToHex = `["${opid}"]`;
} }
return dispatch => { return dispatch => {
return iguanaHashHex(ajax_data_to_hex, dispatch).then((hashHexJson) => { return iguanaHashHex(ajaxDataToHex, dispatch).then((hashHexJson) => {
if (hashHexJson === '5b226e756c6c225d00') { if (hashHexJson === '5b226e756c6c225d00') {
hashHexJson = ''; hashHexJson = '';
} }
let payload, let payload,
passthru_agent = getPassthruAgent(coin), passthruAgent = getPassthruAgent(coin),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
if (passthru_agent == 'iguana') { if (passthruAgent == 'iguana') {
payload = { payload = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
'function': 'z_getoperationstatus', 'function': 'z_getoperationstatus',
@ -130,7 +135,7 @@ export function getKMDOPID(opid, coin) {
} else { } else {
payload = { payload = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'function': 'z_getoperationstatus', 'function': 'z_getoperationstatus',
'hex': hashHexJson, 'hex': hashHexJson,
@ -142,12 +147,12 @@ export function getKMDOPID(opid, coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDOPID', 'function': 'getKMDOPID',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

16
react/src/actions/nativeSyncInfo.js → react/src/actions/actions/nativeSyncInfo.js

@ -1,10 +1,10 @@
import * as storeType from './storeType'; import { SYNCING_NATIVE_MODE } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getPassthruAgent, getPassthruAgent,
getDebugLog getDebugLog
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -19,12 +19,12 @@ export function getSyncInfoNativeKMD(skipDebug) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getSyncInfoNativeKMD', 'function': 'getSyncInfoNativeKMD',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort + '/api/dex/getinfo?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth') + '&symbol=' + coin, 'url': `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`,
'payload': '', 'payload': '',
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort + '/api/dex/getinfo?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth') + '&symbol=' + coin, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, {
method: 'GET', method: 'GET',
}) })
.catch(function(error) { .catch(function(error) {
@ -60,7 +60,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) {
return getSyncInfoNativeKMD(skipDebug); return getSyncInfoNativeKMD(skipDebug);
} else { } else {
return { return {
type: storeType.SYNCING_NATIVE_MODE, type: SYNCING_NATIVE_MODE,
progress: json, progress: json,
} }
} }
@ -68,7 +68,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) {
export function getSyncInfoNative(coin, skipDebug) { export function getSyncInfoNative(coin, skipDebug) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
@ -82,12 +82,12 @@ export function getSyncInfoNative(coin, skipDebug) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getSyncInfo', 'function': 'getSyncInfo',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

11
react/src/actions/nativeTxHistory.js → react/src/actions/actions/nativeTxHistory.js

@ -1,10 +1,9 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getPassthruAgent, getPassthruAgent,
getNativeTxHistoryState getNativeTxHistoryState
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -15,7 +14,7 @@ export function getNativeTxHistory(coin) {
if (getPassthruAgent(coin) === 'iguana') { if (getPassthruAgent(coin) === 'iguana') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'iguana', 'agent': 'iguana',
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
@ -24,7 +23,7 @@ export function getNativeTxHistory(coin) {
}; };
} else { } else {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'function': 'listtransactions', 'function': 'listtransactions',
@ -38,12 +37,12 @@ export function getNativeTxHistory(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getNativeTxHistory', 'function': 'getNativeTxHistory',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

37
react/src/actions/notary.js → react/src/actions/actions/notary.js

@ -1,9 +1,12 @@
import * as storeType from './storeType'; import {
import { translate } from '../translate/translate'; DASHBOARD_CONNECT_NOTARIES,
DASHBOARD_GET_NOTARIES_LIST
} from '../storeType';
import { translate } from '../../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -13,7 +16,7 @@ function initNotaryNodesConSequence(nodes) {
return dispatch => { return dispatch => {
Promise.all(nodes.map((node, index) => { Promise.all(nodes.map((node, index) => {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'getinfo', 'method': 'getinfo',
'symbol': node, 'symbol': node,
@ -24,14 +27,14 @@ function initNotaryNodesConSequence(nodes) {
const _timestamp = Date.now(); const _timestamp = Date.now();
dispatch(logGuiHttp({ dispatch(logGuiHttp({
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'initNotaryNodesConSequence+' + node, 'function': `initNotaryNodesConSequence+${node}`,
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', '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, { 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', method: 'GET',
}) })
.catch(function(error) { .catch(function(error) {
@ -41,7 +44,7 @@ function initNotaryNodesConSequence(nodes) {
'status': 'error', 'status': 'error',
'response': error, 'response': error,
})); }));
dispatch(triggerToaster(true, 'getInfoDexNode+' + node, 'Error', 'error')); dispatch(triggerToaster(true, `getInfoDexNode+${node}`, 'Error', 'error'));
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
@ -66,7 +69,7 @@ function updateNotaryNodeConState(json, totalNodes, currentNodeIndex, currentNod
if (json && if (json &&
json.error === 'less than required responses') { json.error === 'less than required responses') {
return { return {
type: storeType.DASHBOARD_CONNECT_NOTARIES, type: DASHBOARD_CONNECT_NOTARIES,
total: totalNodes - 1, total: totalNodes - 1,
current: currentNodeIndex, current: currentNodeIndex,
name: currentNodeName, name: currentNodeName,
@ -74,7 +77,7 @@ function updateNotaryNodeConState(json, totalNodes, currentNodeIndex, currentNod
} }
} else { } else {
return { return {
type: storeType.DASHBOARD_CONNECT_NOTARIES, type: DASHBOARD_CONNECT_NOTARIES,
total: totalNodes - 1, total: totalNodes - 1,
current: currentNodeIndex, current: currentNodeIndex,
name: currentNodeName, name: currentNodeName,
@ -89,7 +92,7 @@ function connectAllNotaryNodes(json, dispatch) {
dispatch(initNotaryNodesConSequence(json)); dispatch(initNotaryNodesConSequence(json));
return { return {
type: storeType.DASHBOARD_CONNECT_NOTARIES, type: DASHBOARD_CONNECT_NOTARIES,
total: json.length - 1, total: json.length - 1,
current: 0, current: 0,
name: json[0], name: json[0],
@ -99,13 +102,13 @@ function connectAllNotaryNodes(json, dispatch) {
export function connectNotaries() { export function connectNotaries() {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dpow', 'agent': 'dpow',
'method': 'notarychains', 'method': 'notarychains',
}; };
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -125,7 +128,7 @@ function getDexNotariesState(json) {
} }
} else { } else {
return { return {
type: storeType.DASHBOARD_GET_NOTARIES_LIST, type: DASHBOARD_GET_NOTARIES_LIST,
notaries: json, notaries: json,
} }
} }
@ -133,7 +136,7 @@ function getDexNotariesState(json) {
export function getDexNotaries(coin) { export function getDexNotaries(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'getnotaries', 'method': 'getnotaries',
'symbol': coin, 'symbol': coin,
@ -145,11 +148,11 @@ export function getDexNotaries(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getDexNotaries', 'function': 'getDexNotaries',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

6
react/src/actions/openAlias.js → react/src/actions/actions/openAlias.js

@ -1,8 +1,4 @@
import * as storeType from './storeType'; import { triggerToaster } from '../actionCreators';
import {
triggerToaster,
Config
} from './actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState

46
react/src/actions/sendFullBasilisk.js → react/src/actions/actions/sendFullBasilisk.js

@ -1,9 +1,10 @@
import * as storeType from './storeType'; import { DASHBOARD_ACTIVE_COIN_SENDTO } from '../storeType';
import { translate } from '../translate/translate'; import { translate } from '../../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config Config,
} from './actionCreators'; getDispatch
} from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -11,7 +12,7 @@ import {
export function sendToAddress(coin, _payload) { export function sendToAddress(coin, _payload) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'sendtoaddress', 'method': 'sendtoaddress',
'params': [ 'params': [
@ -28,12 +29,12 @@ export function sendToAddress(coin, _payload) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'sendToAddress', 'function': 'sendToAddress',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -60,7 +61,7 @@ export function sendToAddress(coin, _payload) {
export function sendFromAddress(coin, _payload) { export function sendFromAddress(coin, _payload) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'sendfrom', 'method': 'sendfrom',
'params': [ 'params': [
@ -78,12 +79,12 @@ export function sendFromAddress(coin, _payload) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'sendFromAddress', 'function': 'sendFromAddress',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -108,9 +109,9 @@ export function sendFromAddress(coin, _payload) {
} }
} }
export function iguanaUTXORawTX(data) { export function iguanaUTXORawTX(data, dispatch) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'symbol': data.coin, 'symbol': data.coin,
'agent': 'basilisk', 'agent': 'basilisk',
'method': 'utxorawtx', 'method': 'utxorawtx',
@ -124,7 +125,6 @@ export function iguanaUTXORawTX(data) {
}, },
'utxos': data.utxos, 'utxos': data.utxos,
}; };
console.log('iguanaUTXORawTXExport', payload);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const _timestamp = Date.now(); const _timestamp = Date.now();
@ -132,18 +132,18 @@ export function iguanaUTXORawTX(data) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaUTXORawTX', 'function': 'iguanaUTXORawTX',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
.catch(function(error) { .catch(function(error) {
console.log(error); console.log(error);
dispatch(logGuiHttp({ dispatch => dispatch(logGuiHttp({
'timestamp': _timestamp, 'timestamp': _timestamp,
'status': 'error', 'status': 'error',
'response': error, 'response': error,
@ -162,9 +162,9 @@ export function iguanaUTXORawTX(data) {
}); });
} }
export function dexSendRawTX(data) { export function dexSendRawTX(data, dispatch) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'sendrawtransaction', 'method': 'sendrawtransaction',
'signedtx': data.signedtx, 'signedtx': data.signedtx,
@ -177,7 +177,7 @@ export function dexSendRawTX(data) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'dexSendRawTX', 'function': 'dexSendRawTX',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
@ -217,14 +217,14 @@ function sendToAddressState(json, dispatch) {
dispatch(triggerToaster(true, json.error, 'Error', 'error')); dispatch(triggerToaster(true, json.error, 'Error', 'error'));
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, type: DASHBOARD_ACTIVE_COIN_SENDTO,
lastSendToResponse: json, lastSendToResponse: json,
} }
} else if (json && json.result && json.complete) { } else if (json && json.result && json.complete) {
dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success')); dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, type: DASHBOARD_ACTIVE_COIN_SENDTO,
lastSendToResponse: json, lastSendToResponse: json,
} }
} }
@ -232,14 +232,14 @@ function sendToAddressState(json, dispatch) {
export function sendToAddressStateAlt(json) { export function sendToAddressStateAlt(json) {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, type: DASHBOARD_ACTIVE_COIN_SENDTO,
lastSendToResponse: json, lastSendToResponse: json,
} }
} }
export function clearLastSendToResponseState() { export function clearLastSendToResponseState() {
return { return {
type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, type: DASHBOARD_ACTIVE_COIN_SENDTO,
lastSendToResponse: null, lastSendToResponse: null,
} }
} }

50
react/src/actions/settings.js → react/src/actions/actions/settings.js

@ -1,9 +1,15 @@
import * as storeType from './storeType'; import {
import { translate } from '../translate/translate'; LOAD_APP_INFO,
GET_WIF_KEY,
GET_DEBUG_LOG,
GET_PEERS_LIST,
LOAD_APP_CONFIG
} from '../storeType';
import { translate } from '../../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -11,14 +17,14 @@ import {
function getAppInfoState(json) { function getAppInfoState(json) {
return { return {
type: storeType.LOAD_APP_INFO, type: LOAD_APP_INFO,
info: json, info: json,
} }
} }
export function getAppInfo() { export function getAppInfo() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/appinfo', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appinfo`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -35,8 +41,8 @@ export function getAppInfo() {
export function settingsWifkeyState(json, coin) { export function settingsWifkeyState(json, coin) {
return { return {
type: storeType.GET_WIF_KEY, type: GET_WIF_KEY,
wifkey: json[coin + 'wif'], wifkey: json[`{$coin}wif`],
address: json[coin], address: json[coin],
} }
} }
@ -63,7 +69,7 @@ function parseImportPrivKeyResponse(json, dispatch) {
export function importPrivKey(wifKey) { export function importPrivKey(wifKey) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'method': 'importprivkey', 'method': 'importprivkey',
'params': [ 'params': [
wifKey, wifKey,
@ -77,12 +83,12 @@ export function importPrivKey(wifKey) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'importPrivKey', 'function': 'importPrivKey',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -117,7 +123,7 @@ function getDebugLogState(json) {
const _data = json.result.replace('\n', '\r\n'); const _data = json.result.replace('\n', '\r\n');
return { return {
type: storeType.GET_DEBUG_LOG, type: GET_DEBUG_LOG,
data: _data, data: _data,
} }
} }
@ -129,7 +135,7 @@ export function getDebugLog(target, linesCount) {
}; };
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/debuglog', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/debuglog`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -147,7 +153,7 @@ export function getDebugLog(target, linesCount) {
export function getPeersList(coin) { export function getPeersList(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'SuperNET', 'agent': 'SuperNET',
'method': 'getpeers', 'method': 'getpeers',
'activecoin': coin, 'activecoin': coin,
@ -159,12 +165,12 @@ export function getPeersList(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getPeersList', 'function': 'getPeersList',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -201,7 +207,7 @@ export function getPeersListState(json) {
} }
return { return {
type: storeType.GET_PEERS_LIST, type: GET_PEERS_LIST,
supernetPeers: json && json.supernet[0] ? json.supernet : null, supernetPeers: json && json.supernet[0] ? json.supernet : null,
rawPeers: peersList, rawPeers: peersList,
} }
@ -232,7 +238,7 @@ function addPeerNodeState(json, dispatch) {
export function addPeerNode(coin, ip) { export function addPeerNode(coin, ip) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'iguana', 'agent': 'iguana',
'method': 'addnode', 'method': 'addnode',
'activecoin': coin, 'activecoin': coin,
@ -245,12 +251,12 @@ export function addPeerNode(coin, ip) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'addPeerNode', 'function': 'addPeerNode',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -277,7 +283,7 @@ export function addPeerNode(coin, ip) {
export function saveAppConfig(_payload) { export function saveAppConfig(_payload) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/appconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appconf`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -295,14 +301,14 @@ export function saveAppConfig(_payload) {
function getAppConfigState(json) { function getAppConfigState(json) {
return { return {
type: storeType.LOAD_APP_CONFIG, type: LOAD_APP_CONFIG,
config: json, config: json,
} }
} }
export function getAppConfig() { export function getAppConfig() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/appconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appconf`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

12
react/src/actions/syncInfo.js → react/src/actions/actions/syncInfo.js

@ -1,8 +1,8 @@
import * as storeType from './storeType'; import { SYNCING_FULL_MODE } from '../storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -18,14 +18,14 @@ function getSyncInfoState(json) {
} }
return { return {
type: storeType.SYNCING_FULL_MODE, type: SYNCING_FULL_MODE,
progress: json, progress: json,
} }
} }
export function getSyncInfo(coin) { export function getSyncInfo(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'getinfo', 'method': 'getinfo',
@ -37,12 +37,12 @@ export function getSyncInfo(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getSyncInfo', 'function': 'getSyncInfo',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

17
react/src/actions/syncOnly.js → react/src/actions/actions/syncOnly.js

@ -1,9 +1,12 @@
import * as storeType from './storeType'; import {
import { translate } from '../translate/translate'; SYNC_ONLY_MODAL_TOGGLE,
SYNC_ONLY_DATA
} from '../storeType';
import { translate } from '../../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -11,21 +14,21 @@ import {
export function toggleSyncOnlyModal(display) { export function toggleSyncOnlyModal(display) {
return { return {
type: storeType.SYNC_ONLY_MODAL_TOGGLE, type: SYNC_ONLY_MODAL_TOGGLE,
display, display,
} }
} }
function getSyncOnlyForksState(json) { function getSyncOnlyForksState(json) {
return { return {
type: storeType.SYNC_ONLY_DATA, type: SYNC_ONLY_DATA,
forks: JSON.parse(json.result), forks: JSON.parse(json.result),
} }
} }
export function getSyncOnlyForks() { export function getSyncOnlyForks() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks/info/show', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/info/show`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -42,7 +45,7 @@ export function getSyncOnlyForks() {
export function stopIguanaFork(pmid) { export function stopIguanaFork(pmid) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks/stop?pmid=' + pmid, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/stop?pmid=${pmid}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

5
react/src/actions/sysInfo.js → react/src/actions/actions/sysInfo.js

@ -1,8 +1,7 @@
import * as storeType from './storeType';
import { import {
triggerToaster, triggerToaster,
Config Config
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -10,7 +9,7 @@ import {
export function shepherdGetSysInfo() { export function shepherdGetSysInfo() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/sysinfo', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/sysinfo`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

37
react/src/actions/walletAuth.js → react/src/actions/actions/walletAuth.js

@ -1,11 +1,14 @@
import * as storeType from './storeType'; import {
import { translate } from '../translate/translate'; LOGIN,
ACTIVE_HANDLE
} from '../storeType';
import { translate } from '../../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config, Config,
getMainAddressState, getMainAddressState,
updateErrosStack updateErrosStack
} from './actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
guiLogState guiLogState
@ -13,7 +16,7 @@ import {
export function encryptWallet(_passphrase, cb, coin) { export function encryptWallet(_passphrase, cb, coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'encryptwallet', 'method': 'encryptwallet',
'passphrase': _passphrase, 'passphrase': _passphrase,
@ -25,12 +28,12 @@ export function encryptWallet(_passphrase, cb, coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'encryptWallet', 'function': 'encryptWallet',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -58,7 +61,7 @@ export function encryptWallet(_passphrase, cb, coin) {
export function walletPassphrase(_passphrase) { export function walletPassphrase(_passphrase) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'walletpassphrase', 'method': 'walletpassphrase',
'password': _passphrase, 'password': _passphrase,
@ -71,12 +74,12 @@ export function walletPassphrase(_passphrase) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'walletpassphrase', 'function': 'walletpassphrase',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -101,7 +104,7 @@ export function walletPassphrase(_passphrase) {
export function iguanaWalletPassphrase(_passphrase) { export function iguanaWalletPassphrase(_passphrase) {
const _payload = { const _payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'handle': '', 'handle': '',
'password': _passphrase, 'password': _passphrase,
'timeout': '2592000', 'timeout': '2592000',
@ -115,12 +118,12 @@ export function iguanaWalletPassphrase(_passphrase) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaWalletPassphrase', 'function': 'iguanaWalletPassphrase',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload), body: JSON.stringify(_payload),
}) })
@ -147,7 +150,7 @@ export function iguanaWalletPassphrase(_passphrase) {
export function iguanaActiveHandle(getMainAddress) { export function iguanaActiveHandle(getMainAddress) {
const _payload = { const _payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'SuperNET', 'agent': 'SuperNET',
'method': 'activehandle', 'method': 'activehandle',
}; };
@ -158,12 +161,12 @@ export function iguanaActiveHandle(getMainAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaActiveHandle', 'function': 'iguanaActiveHandle',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload), body: JSON.stringify(_payload),
}) })
@ -196,14 +199,14 @@ function iguanaWalletPassphraseState(json, dispatch) {
dispatch(iguanaActiveHandleState(json)); dispatch(iguanaActiveHandleState(json));
return { return {
type: storeType.LOGIN, type: LOGIN,
isLoggedIn: json && json.pubkey ? true : false, isLoggedIn: json && json.pubkey ? true : false,
} }
} }
function iguanaActiveHandleState(json) { function iguanaActiveHandleState(json) {
return { return {
type: storeType.ACTIVE_HANDLE, type: ACTIVE_HANDLE,
isLoggedIn: sessionStorage.getItem('IguanaActiveAccount') && JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey === json.pubkey && json.status === 'unlocked' ? true : false, isLoggedIn: sessionStorage.getItem('IguanaActiveAccount') && JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey === json.pubkey && json.status === 'unlocked' ? true : false,
handle: json, handle: json,
} }

10
react/src/components/addcoin/addcoin.js

@ -97,12 +97,12 @@ class AddCoin extends React.Component {
modalClassName: props.display ? 'show fade' : 'show fade', modalClassName: props.display ? 'show fade' : 'show fade',
})); }));
setTimeout(function() { setTimeout(() => {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
display: props.display, display: props.display,
modalClassName: props.display ? 'show in' : 'hide', modalClassName: props.display ? 'show in' : 'hide',
})); }));
}.bind(this), 100); }, 100);
} }
} }
@ -220,7 +220,7 @@ class AddCoin extends React.Component {
for (let i = 1; i < this.state.coins.length; i++) { for (let i = 1; i < this.state.coins.length; i++) {
const _item = this.state.coins[i]; const _item = this.state.coins[i];
setTimeout(function() { setTimeout(() => {
Store.dispatch(addCoin( Store.dispatch(addCoin(
_item.selectedCoin.split('|')[0], _item.selectedCoin.split('|')[0],
_item.mode, _item.mode,
@ -237,7 +237,7 @@ class AddCoin extends React.Component {
Store.dispatch(toggleAddcoinModal(false, false)); Store.dispatch(toggleAddcoinModal(false, false));
} }
}.bind(this), 2000 * i); }, 2000 * i);
} }
} }
@ -249,7 +249,7 @@ class AddCoin extends React.Component {
const _coin = _item.selectedCoin || ''; const _coin = _item.selectedCoin || '';
items.push( items.push(
<div className={ this.hasMoreThanOneCoin() ? 'multi' : 'single' } key={ 'add-coin-' + i }> <div className={ this.hasMoreThanOneCoin() ? 'multi' : 'single' } key={ `add-coin-${i}` }>
<div className="col-sm-8"> <div className="col-sm-8">
<div className="form-group"> <div className="form-group">
<select <select

22
react/src/components/addcoin/payload.js

@ -133,9 +133,11 @@ export function startCrypto(confpath, coin, mode) {
var tmpinternval = 0, var tmpinternval = 0,
AddCoinData = {}, AddCoinData = {},
tmpPendValue = 1, // TODO: hook up to shepherd sysinfo tmpPendValue = 1, // TODO: hook up to shepherd sysinfo
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
if (coin !== 'BTC' && coin !== 'LTC' && coin !== 'DOGE') { if (coin !== 'BTC' &&
coin !== 'LTC' &&
coin !== 'DOGE') {
tmpPendValue = parseInt(tmpPendValue) * 4; tmpPendValue = parseInt(tmpPendValue) * 4;
} }
@ -168,16 +170,17 @@ export function startCrypto(confpath, coin, mode) {
} }
} }
console.log('AddCoinData', AddCoinData[coin]);
return AddCoinData[coin]; return AddCoinData[coin];
} }
export function startCurrencyAssetChain(confpath, coin, mode) { export function startCurrencyAssetChain(confpath, coin, mode) {
var AddCoinDataPayload = {}, var AddCoinDataPayload = {},
tmpPendValue = 1, tmpPendValue = 1,
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
if (coin !== 'BTC' && coin !== 'LTC' && coin !== 'DOGE') { if (coin !== 'BTC' &&
coin !== 'LTC' &&
coin !== 'DOGE') {
tmpPendValue = parseInt(tmpPendValue) * 4; tmpPendValue = parseInt(tmpPendValue) * 4;
} }
@ -631,15 +634,17 @@ export function startCurrencyAssetChain(confpath, coin, mode) {
}; };
AddCoinDataPayload.CZKVar = Object.assign({}, _payloadVar, CZKDiff); AddCoinDataPayload.CZKVar = Object.assign({}, _payloadVar, CZKDiff);
return AddCoinDataPayload[coin + 'Var']; return AddCoinDataPayload[`${coin}Var`];
} }
} }
export function startAssetChain(confpath, coin, mode, getSuppyOnly) { export function startAssetChain(confpath, coin, mode, getSuppyOnly) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); var tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
var tmpPendValue; var tmpPendValue;
if (coin !== 'BTC' && coin !== 'LTC' && coin !== 'DOGE') { if (coin !== 'BTC' &&
coin !== 'LTC' &&
coin !== 'DOGE') {
tmpPendValue = parseInt(tmpPendValue) * 4; tmpPendValue = parseInt(tmpPendValue) * 4;
} }
@ -667,6 +672,7 @@ export function startAssetChain(confpath, coin, mode, getSuppyOnly) {
'debug': 0, 'debug': 0,
'seedipaddr': '78.47.196.146' 'seedipaddr': '78.47.196.146'
}; };
const acConfig = { const acConfig = {
'SUPERNET': { 'SUPERNET': {
'name': 'SUPERNET', 'name': 'SUPERNET',

2
react/src/components/dashboard/atomic.js

@ -44,7 +44,7 @@ class Atomic extends React.Component {
} }
getAtomicData() { getAtomicData() {
const tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); const tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
let ExplorerInputData; let ExplorerInputData;
switch (this.state.api) { switch (this.state.api) {

315
react/src/components/dashboard/coinTile.js

@ -1,5 +1,9 @@
import React from 'react'; import React from 'react';
import { translate } from '../../translate/translate'; import { translate } from '../../translate/translate';
import {
getCoinTitle,
getModeInfo
} from '../../util/coinHelper';
import CoinTileItem from './coinTileItem'; import CoinTileItem from './coinTileItem';
class CoinTile extends React.Component { class CoinTile extends React.Component {
@ -17,311 +21,20 @@ class CoinTile extends React.Component {
'full' 'full'
]; ];
const allCoins = this.props.Main.coins; const allCoins = this.props.Main.coins;
var items = []; let items = [];
if (this.props.Main && this.props.Main.coins) { if (this.props.Main &&
allCoins) {
modes.map(function(mode) { modes.map(function(mode) {
allCoins[mode].map(function(coin) { allCoins[mode].map(function(coin) {
var coinlogo = '', const _coinMode = getModeInfo(mode),
coinname = '', modecode = _coinMode.code,
modecode = '', modetip = _coinMode.tip,
modetip = '', modecolor = _coinMode.color;
modecolor = '';
switch (mode) { const _coinTitle = getCoinTitle(coin),
case 'native': coinlogo = _coinTitle.logo,
modecode = 'Native'; coinname = _coinTitle.name;
modetip = 'Native';
modecolor = 'primary';
break;
case 'basilisk':
modecode = 'Basilisk';
modetip = 'Basilisk';
modecolor = 'info';
break;
case 'full':
modecode = 'Full';
modetip = 'Full';
modecolor = 'success';
break;
case 'virtual':
modecode = 'Virtual';
modetip = 'Virtual';
modecolor = 'danger';
break;
case 'notarychains':
modecode = 'Notarychains';
modetip = 'Notarychains';
modecolor = 'dark';
break;
}
switch (coin) {
case 'BTC':
coinlogo = 'bitcoin';
coinname = 'Bitcoin';
break;
case 'BTCD':
coinlogo = 'bitcoindark';
coinname = 'BitcoinDark';
break;
case 'LTC':
coinlogo = 'litecoin';
coinname = 'Litecoin';
break;
case 'VPN':
coinlogo = 'vpncoin';
coinname = 'VPNcoin';
break;
case 'SYS':
coinlogo = 'syscoin';
coinname = 'Syscoin';
break;
case 'ZEC':
coinlogo = 'zcash';
coinname = 'Zcash';
break;
case 'NMC':
coinlogo = 'namecoin';
coinname = 'Namecoin';
break;
case 'DEX':
coinlogo = 'dex';
coinname = 'InstantDEX';
break;
case 'DOGE':
coinlogo = 'dogecoin';
coinname = 'Dogecoin';
break;
case 'DGB':
coinlogo = 'digibyte';
coinname = 'Digibyte';
break;
case 'MZC':
coinlogo = 'mazacoin';
coinname = 'Mazacoin';
break;
case 'UNO':
coinlogo = 'unobtanium';
coinname = 'Unobtanium';
break;
case 'ZET':
coinlogo = 'zetacoin';
coinname = 'Zetacoin';
break;
case 'KMD':
coinlogo = 'komodo';
coinname = 'Komodo';
break;
case 'BTM':
coinlogo = 'bitmark';
coinname = 'Bitmark';
break;
case 'CARB':
coinlogo = 'carboncoin';
coinname = 'Carboncoin';
break;
case 'ANC':
coinlogo = 'anoncoin';
coinname = 'AnonCoin';
break;
case 'FRK':
coinlogo = 'franko';
coinname = 'Franko';
break;
case 'GAME':
coinlogo = 'GAME';
coinname = 'GameCredits';
break;
case 'SUPERNET':
coinlogo = 'SUPERNET';
coinname = 'SUPERNET';
break;
case 'REVS':
coinlogo = 'REVS';
coinname = 'REVS';
break;
case 'WLC':
coinlogo = 'WLC';
coinname = 'WIRELESS';
break;
case 'PANGEA':
coinlogo = 'PANGEA';
coinname = 'PANGEA';
break;
case 'JUMBLR':
coinlogo = 'JUMBLR';
coinname = 'JUMBLR';
break;
case 'BET':
coinlogo = 'BET';
coinname = 'BET';
break;
case 'CRYPTO':
coinlogo = 'CRYPTO';
coinname = 'CRYPTO';
break;
case 'HODL':
coinlogo = 'HODL';
coinname = 'HODL';
break;
case 'SHARK':
coinlogo = 'SHARK';
coinname = 'SHARK';
break;
case 'BOTS':
coinlogo = 'BOTS';
coinname = 'BOTS';
break;
case 'MGW':
coinlogo = 'MGW';
coinname = 'MultiGateway';
break;
case 'MVP':
coinlogo = 'MVP';
coinname = 'MVP Lineup';
break;
case 'KV':
coinlogo = 'KV';
coinname = 'KV';
break;
case 'CEAL':
coinlogo = 'CEAL';
coinname = 'CEAL NET';
break;
case 'MESH':
coinlogo = 'MESH';
coinname = 'SpaceMesh';
break;
case 'USD':
coinlogo = 'usd';
coinname = 'US Dollar';
break;
case 'RON':
coinlogo = 'RON';
coinname = 'Romanian Leu';
break;
case 'EUR':
coinlogo = 'EUR';
coinname = 'Euro';
break;
case 'JPY':
coinlogo = 'JPY';
coinname = 'Japanese Yen';
break;
case 'GBP':
coinlogo = 'GBP';
coinname = 'British Pound';
break;
case 'AUD':
coinlogo = 'AUD';
coinname = 'Australian Dollar';
break;
case 'CAD':
coinlogo = 'CAD';
coinname = 'Canadian Dollar';
break;
case 'CHF':
coinlogo = 'CHF';
coinname = 'Swiss Franc';
break;
case 'NZD':
coinlogo = 'NZD';
coinname = 'New Zealand Dollar';
break;
case 'CNY':
coinlogo = 'CNY';
coinname = 'Chinese Yuan';
break;
case 'RUB':
coinlogo = 'RUB';
coinname = 'Russian Ruble';
break;
case 'MXN':
coinlogo = 'MXN';
coinname = 'Mexican peso';
break;
case 'BRL':
coinlogo = 'BRL';
coinname = 'Brazilian Real';
break;
case 'INR':
coinlogo = 'INR';
coinname = 'Indian Rupee';
break;
case 'HKD':
coinlogo = 'HKD';
coinname = 'Hong Kong Dollar';
break;
case 'TRY':
coinlogo = 'TRY';
coinname = 'Turkish Lira';
break;
case 'ZAR':
coinlogo = 'ZAR';
coinname = 'South African Rand';
break;
case 'PLN':
coinlogo = 'PLN';
coinname = 'Polish Zloty';
break;
case 'NOK':
coinlogo = 'NOK';
coinname = 'Norwegian Krone';
break;
case 'SEK':
coinlogo = 'SEK';
coinname = 'Swedish Krona';
break;
case 'DKK':
coinlogo = 'DKK';
coinname = 'Danish Krone';
break;
case 'CZK':
coinlogo = 'CZK';
coinname = 'Czech Koruna';
break;
case 'HUF':
coinlogo = 'HUF';
coinname = 'Hungarian Forint';
break;
case 'ILS':
coinlogo = 'ILS';
coinname = 'Israeli Shekel';
break;
case 'KRW':
coinlogo = 'KRW';
coinname = 'Korean Won';
break;
case 'MYR':
coinlogo = 'MYR';
coinname = 'Malaysian Ringgit';
break;
case 'PHP':
coinlogo = 'PHP';
coinname = 'Philippine Peso';
break;
case 'SGD':
coinlogo = 'SGD';
coinname = 'Singapore Dollar';
break;
case 'THB':
coinlogo = 'THB';
coinname = 'Thai Baht';
break;
case 'BGN':
coinlogo = 'BGN';
coinname = 'Bulgarian Lev';
break;
case 'IDR':
coinlogo = 'IDR';
coinname = 'Indonesian Rupiah';
break;
case 'HRK':
coinlogo = 'HRK';
coinname = 'Croatian Kuna';
break;
}
items.push({ items.push({
coinlogo, coinlogo,

35
react/src/components/dashboard/coinTileItem.js

@ -21,6 +21,11 @@ import {
} from '../../actions/actionCreators'; } from '../../actions/actionCreators';
import Store from '../../store'; import Store from '../../store';
const BASILISK_CACHE_UPDATE_TIMEOUT = 240000;
const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000;
const IGUNA_ACTIVE_HANDLE_TIMEOUT_KMD_NATIVE = 15000;
const NATIVE_MIN_SYNC_PERCENTAGE_THRESHOLD = 90;
class CoinTileItem extends React.Component { class CoinTileItem extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -39,10 +44,13 @@ class CoinTileItem extends React.Component {
dispatchCoinActions(coin, mode) { dispatchCoinActions(coin, mode) {
if (mode === 'native') { if (mode === 'native') {
Store.dispatch(iguanaActiveHandle(true)); Store.dispatch(iguanaActiveHandle(true));
const syncPercentage = this.props.Dashboard && this.props.Dashboard.progress && (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100 / parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2)).replace('NaN', 0);
if (this.props.Dashboard.progress && if (this.props.Dashboard.progress &&
this.props.Dashboard.progress.blocks && this.props.Dashboard.progress.blocks &&
this.props.Dashboard.progress.longestchain && this.props.Dashboard.progress.longestchain &&
this.props.Dashboard.progress.blocks === this.props.Dashboard.progress.longestchain) { syncPercentage &&
syncPercentage >= NATIVE_MIN_SYNC_PERCENTAGE_THRESHOLD) {
Store.dispatch(getSyncInfoNative(coin, true)); Store.dispatch(getSyncInfoNative(coin, true));
Store.dispatch(getKMDBalanceTotal(coin)); Store.dispatch(getKMDBalanceTotal(coin));
Store.dispatch(getNativeTxHistory(coin)); Store.dispatch(getNativeTxHistory(coin));
@ -61,6 +69,7 @@ class CoinTileItem extends React.Component {
} }
if (mode === 'basilisk') { if (mode === 'basilisk') {
const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin]; const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin];
Store.dispatch(iguanaActiveHandle(true)); Store.dispatch(iguanaActiveHandle(true));
Store.dispatch(getKMDAddressesNative(coin, mode, useAddress)); Store.dispatch(getKMDAddressesNative(coin, mode, useAddress));
Store.dispatch(getShepherdCache(JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey, coin)); Store.dispatch(getShepherdCache(JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey, coin));
@ -72,8 +81,8 @@ class CoinTileItem extends React.Component {
if (!this.props.ActiveCoin.addresses) { if (!this.props.ActiveCoin.addresses) {
Store.dispatch(getAddressesByAccount(coin, mode)); Store.dispatch(getAddressesByAccount(coin, mode));
} }
Store.dispatch(getBasiliskTransactionsList(coin, useAddress)); Store.dispatch(getBasiliskTransactionsList(coin, useAddress));
//Store.dispatch(iguanaEdexBalance(coin, mode));
} }
} }
} }
@ -87,16 +96,15 @@ class CoinTileItem extends React.Component {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
if (mode === 'full') { if (mode === 'full') {
var _iguanaActiveHandle = setInterval(function() { const _iguanaActiveHandle = setInterval(() => {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
}.bind(this), 3000); }, IGUNA_ACTIVE_HANDLE_TIMEOUT);
Store.dispatch(startInterval('sync', _iguanaActiveHandle)); Store.dispatch(startInterval('sync', _iguanaActiveHandle));
} }
if (mode === 'native') { if (mode === 'native') {
// TODO: add conditions to skip txhistory, balances, addresses while "activating best chain" const _iguanaActiveHandle = setInterval(() => {
var _iguanaActiveHandle = setInterval(function() {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
}.bind(this), coin === 'KMD' ? 15000 : 3000); }, coin === 'KMD' ? IGUNA_ACTIVE_HANDLE_TIMEOUT_KMD_NATIVE : IGUNA_ACTIVE_HANDLE_TIMEOUT);
Store.dispatch(startInterval('sync', _iguanaActiveHandle)); Store.dispatch(startInterval('sync', _iguanaActiveHandle));
} }
if (mode === 'basilisk') { if (mode === 'basilisk') {
@ -112,11 +120,11 @@ class CoinTileItem extends React.Component {
'address': _basiliskMainAddress, 'address': _basiliskMainAddress,
})); }));
var _iguanaActiveHandle = setInterval(function() { const _iguanaActiveHandle = setInterval(() => {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
}.bind(this), 3000); }, IGUNA_ACTIVE_HANDLE_TIMEOUT);
var _basiliskCache = setInterval(function() { const _basiliskCache = setInterval(() => {
Store.dispatch(fetchNewCacheData({ Store.dispatch(fetchNewCacheData({
'pubkey': this.props.Dashboard.activeHandle.pubkey, 'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false, 'allcoins': false,
@ -124,10 +132,9 @@ class CoinTileItem extends React.Component {
'calls': 'listtransactions:getbalance', 'calls': 'listtransactions:getbalance',
'address': _basiliskMainAddress, 'address': _basiliskMainAddress,
})); }));
}.bind(this), 240000); }, BASILISK_CACHE_UPDATE_TIMEOUT);
Store.dispatch(startInterval('sync', _iguanaActiveHandle)); Store.dispatch(startInterval('sync', _iguanaActiveHandle));
Store.dispatch(startInterval('basilisk', _basiliskCache)); Store.dispatch(startInterval('basilisk', _basiliskCache));
// basilisk
} }
} }
} }
@ -145,9 +152,9 @@ class CoinTileItem extends React.Component {
<a className="avatar margin-bottom-5" id="edexcoin-logo"> <a className="avatar margin-bottom-5" id="edexcoin-logo">
<img <img
className="img-responsive" className="img-responsive"
src={ 'assets/images/cryptologo/' + item.coinlogo + '.png' } src={ `assets/images/cryptologo/${item.coinlogo}.png` }
alt={ item.coinname }/> alt={ item.coinname }/>
<span className={ 'badge up badge-' + item.modecolor } id="basfull">{ item.modecode }</span> <span className={ `badge up badge-${item.modecolor}` } id="basfull">{ item.modecode }</span>
</a> </a>
<div className="coin-name">{ item.coinname } ({ item.coinlogo.toUpperCase() })</div> <div className="coin-name">{ item.coinname } ({ item.coinlogo.toUpperCase() })</div>
</div> </div>

34
react/src/components/dashboard/navbar.js

@ -19,6 +19,27 @@ class Navbar extends React.Component {
}; };
this.openDropMenu = this.openDropMenu.bind(this); this.openDropMenu = this.openDropMenu.bind(this);
this.logout = this.logout.bind(this); this.logout = this.logout.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
}
componentWillMount() {
document.addEventListener('click', this.handleClickOutside, false);
}
componentWillUnmount() {
document.removeEventListener('click', this.handleClickOutside, false);
}
handleClickOutside(e) {
if (e.srcElement.className !== 'dropdown-menu' &&
e.srcElement.alt !== 'iguana profile pic' &&
(e.srcElement.offsetParent && e.srcElement.offsetParent.className !== 'avatar avatar-online') &&
e.srcElement.className.indexOf('navbar-avatar') === -1 &&
(e.path && e.path[4] && e.path[4].className.indexOf('dropdown-menu') === -1)) {
this.setState({
openDropMenu: false,
});
}
} }
openDropMenu() { openDropMenu() {
@ -114,11 +135,6 @@ class Navbar extends React.Component {
<i className="site-menu-icon" aria-hidden="true"></i> Atomic Explorer <i className="site-menu-icon" aria-hidden="true"></i> Atomic Explorer
</a> </a>
</li> </li>
<li className="nav-top-menu">
<a id="nav-iguana-atomic-explorer" onClick={ () => this.openSyncOnlyModal() }>
<i className="site-menu-icon" aria-hidden="true"></i> { translate('ADD_COIN.SYNC_ONLY') }
</a>
</li>
</ul> </ul>
<ul className="nav navbar-toolbar navbar-right navbar-toolbar-right"> <ul className="nav navbar-toolbar navbar-right navbar-toolbar-right">
<li role="presentation"> <li role="presentation">
@ -150,6 +166,14 @@ class Navbar extends React.Component {
<i className="icon md-settings" aria-hidden="true"></i> { translate('INDEX.SETTINGS') } <i className="icon md-settings" aria-hidden="true"></i> { translate('INDEX.SETTINGS') }
</a> </a>
</li> </li>
<li role="presentation">
<a
role="menuitem"
id="nav-iguana-sync-only"
onClick={ () => this.openSyncOnlyModal() }>
<i className="icon fa-cubes" aria-hidden="true"></i> { translate('ADD_COIN.SYNC_ONLY') }
</a>
</li>
<li role="presentation"> <li role="presentation">
<a <a
role="menuitem" role="menuitem"

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

@ -12,10 +12,12 @@ class Notifications extends React.Component {
super(props); super(props);
this.state = { this.state = {
displayModal: false, displayModal: false,
totalCalls: 0, calls: {
totalErrorCalls: 0, total: 0,
totalSuccessCalls: 0, error: 0,
totalPendingCalls: 0, success: 0,
pending: 0,
},
activeTab: 2, activeTab: 2,
guiLog: null, guiLog: null,
}; };
@ -33,31 +35,27 @@ class Notifications extends React.Component {
if (this.props.Dashboard && if (this.props.Dashboard &&
this.props.Dashboard.guiLog) { this.props.Dashboard.guiLog) {
const _guiLog = this.props.Dashboard.guiLog; const _guiLog = this.props.Dashboard.guiLog;
let totalCalls = Object.keys(_guiLog).length; let _callsLength = {
let totalErrorCalls = 0; total: Object.keys(_guiLog).length,
let totalSuccessCalls = 0; error: 0,
let totalPendingCalls = 0; success: 0,
pending: 0,
}
let guiLogToArray = []; let guiLogToArray = [];
for (let timestamp in _guiLog) { for (let timestamp in _guiLog) {
guiLogToArray.push(_guiLog[timestamp]); guiLogToArray.push(_guiLog[timestamp]);
_callsLength[_guiLog[timestamp].status]++;
if (_guiLog[timestamp].status === 'error') {
totalErrorCalls++;
}
if (_guiLog[timestamp].status === 'success') {
totalSuccessCalls++;
}
if (_guiLog[timestamp].status === 'pending') {
totalPendingCalls++;
}
} }
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
totalCalls, calls: {
totalErrorCalls, total: _callsLength.total,
totalSuccessCalls, error: _callsLength.error,
totalPendingCalls, success: _callsLength.success,
pending: _callsLength.pending,
},
guiLog: guiLogToArray, guiLog: guiLogToArray,
})); }));
} }
@ -70,7 +68,6 @@ class Notifications extends React.Component {
let _guiLog = this.state.guiLog; let _guiLog = this.state.guiLog;
_guiLog = sortByDate(_guiLog); _guiLog = sortByDate(_guiLog);
let items = []; let items = [];
let index = 0;
for (let i = 0; i < _guiLog.length; i++) { for (let i = 0; i < _guiLog.length; i++) {
if (_guiLog[i].status === type) { if (_guiLog[i].status === type) {
@ -78,7 +75,7 @@ class Notifications extends React.Component {
items.push( items.push(
<div key={ _logItem.timestamp }> <div key={ _logItem.timestamp }>
<div>{ index + 1 }.</div> <div>{ i + 1 }.</div>
<div> <div>
<strong>Time:</strong> { secondsToString(_logItem.timestamp, true, true) } <strong>Time:</strong> { secondsToString(_logItem.timestamp, true, true) }
</div> </div>
@ -101,8 +98,6 @@ class Notifications extends React.Component {
</div> </div>
); );
} }
index++;
} }
return items; return items;
@ -123,21 +118,21 @@ class Notifications extends React.Component {
<a <a
role="tab" role="tab"
onClick={ () => this.openTab(0) }> onClick={ () => this.openTab(0) }>
<i className="icon fa fa-thumbs-o-up" aria-hidden="true"></i> Success ({ this.state.totalSuccessCalls }) <i className="icon fa fa-thumbs-o-up" aria-hidden="true"></i> Success ({ this.state.calls.success })
</a> </a>
</li> </li>
<li className={ this.state.activeTab === 1 ? 'active' : 'pointer' } role="presentation"> <li className={ this.state.activeTab === 1 ? 'active' : 'pointer' } role="presentation">
<a <a
role="tab" role="tab"
onClick={ () => this.openTab(1) }> onClick={ () => this.openTab(1) }>
<i className="icon fa fa-exclamation-triangle" aria-hidden="true"></i> Error ({ this.state.totalErrorCalls }) <i className="icon fa fa-exclamation-triangle" aria-hidden="true"></i> Error ({ this.state.calls.error })
</a> </a>
</li> </li>
<li className={ this.state.activeTab === 2 ? 'active' : 'pointer' } role="presentation"> <li className={ this.state.activeTab === 2 ? 'active' : 'pointer' } role="presentation">
<a <a
role="tab" role="tab"
onClick={ () => this.openTab(2) }> onClick={ () => this.openTab(2) }>
<i className="icon fa fa-clock-o" aria-hidden="true"></i> Pending ({ this.state.totalPendingCalls }) <i className="icon fa fa-clock-o" aria-hidden="true"></i> Pending ({ this.state.calls.pending })
</a> </a>
</li> </li>
</ul> </ul>
@ -192,9 +187,16 @@ class Notifications extends React.Component {
<div <div
className={ this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle.status === 'unlocked' ? 'notifications-badge stick-to-top' : 'notifications-badge' } className={ this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle.status === 'unlocked' ? 'notifications-badge stick-to-top' : 'notifications-badge' }
onClick={ this.toggleNotificationsModal }> onClick={ this.toggleNotificationsModal }>
<span className="badge success">{ this.state.totalSuccessCalls }</span> <span className="badge success">{ this.state.calls.success }</span>
<span className="badge error">{ this.state.totalErrorCalls }</span> <span className="badge error">{ this.state.calls.error }</span>
<span className="badge pending">{ this.state.totalPendingCalls }</span> <span className="badge pending">{ this.state.calls.pending }</span>
<div className={ this.state.calls.pending === 0 ? 'spinner spinner-hide' : 'spinner' }>
<div className="rect1"></div>
<div className="rect2"></div>
<div className="rect3"></div>
<div className="rect4"></div>
<div className="rect5"></div>
</div>
</div> </div>
{ this.renderNotificationsModal() } { this.renderNotificationsModal() }
</div> </div>

11
react/src/components/dashboard/sendCoin.js

@ -291,7 +291,7 @@ class SendCoin extends React.Component {
renderAddressList() { renderAddressList() {
return ( return (
<div id="showkmdwalletaddrs" className={ 'btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ' + (this.state.addressSelectorOpen ? 'open' : '') }> <div id="showkmdwalletaddrs" className={ `btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ${(this.state.addressSelectorOpen ? 'open' : '')}` }>
<button <button
type="button" type="button"
className="btn dropdown-toggle btn-info" className="btn dropdown-toggle btn-info"
@ -357,7 +357,8 @@ class SendCoin extends React.Component {
}); });
} }
if (step === 1 || step === 2) { if (step === 1 ||
step === 2) {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
currentStep: step, currentStep: step,
utxoMethodInProgress: !this.state.sendApiType && this.props.ActiveCoin.mode === 'basilisk' ? true : false, utxoMethodInProgress: !this.state.sendApiType && this.props.ActiveCoin.mode === 'basilisk' ? true : false,
@ -411,7 +412,7 @@ class SendCoin extends React.Component {
'utxos': utxoSet 'utxos': utxoSet
}; };
iguanaUTXORawTX(sendData) iguanaUTXORawTX(sendData, Store.dispatch)
.then(function(json) { .then(function(json) {
console.log('sendData', sendData); console.log('sendData', sendData);
console.log('iguanaUTXORawTXJSON', json); console.log('iguanaUTXORawTXJSON', json);
@ -424,7 +425,7 @@ class SendCoin extends React.Component {
'signedtx': json.signedtx, 'signedtx': json.signedtx,
'coin': sendData.coin 'coin': sendData.coin
}; };
dexSendRawTX(dexrawtxData) dexSendRawTX(dexrawtxData, Store.dispatch)
.then(function(dexRawTxJSON) { .then(function(dexRawTxJSON) {
console.log('dexRawTxJSON', dexRawTxJSON); console.log('dexRawTxJSON', dexRawTxJSON);
if (dexRawTxJSON.indexOf('"error":{"code"') > -1) { if (dexRawTxJSON.indexOf('"error":{"code"') > -1) {
@ -445,7 +446,7 @@ class SendCoin extends React.Component {
edexGetTransaction({ edexGetTransaction({
'coin': sendData.coin, 'coin': sendData.coin,
'txid': dexRawTxJSON.txid ? dexRawTxJSON.txid : dexRawTxJSON 'txid': dexRawTxJSON.txid ? dexRawTxJSON.txid : dexRawTxJSON
}) }, Store.dispatch)
.then(function(json) { .then(function(json) {
console.log('gettx', json); console.log('gettx', json);
resolve(json); resolve(json);

123
react/src/components/dashboard/settings.js

@ -23,6 +23,7 @@ import AddCoinOptionsACFiat from '../addcoin/addcoinOptionsACFiat';
2) add fiat section 2) add fiat section
3) kickstart section 3) kickstart section
4) batch export/import wallet addresses 4) batch export/import wallet addresses
5) export keys, add coin selector
*/ */
class Settings extends React.Component { class Settings extends React.Component {
constructor(props) { constructor(props) {
@ -31,8 +32,9 @@ class Settings extends React.Component {
activeTab: 0, activeTab: 0,
debugLinesCount: 10, debugLinesCount: 10,
debugTarget: 'iguana', debugTarget: 'iguana',
activeTabHeight: '10px', activeTabHeight: '0',
appSettings: {}, appSettings: {},
tabElId: null,
}; };
this.exportWifKeys = this.exportWifKeys.bind(this); this.exportWifKeys = this.exportWifKeys.bind(this);
this.updateInput = this.updateInput.bind(this); this.updateInput = this.updateInput.bind(this);
@ -52,13 +54,28 @@ class Settings extends React.Component {
Store.dispatch(getAppInfo()); Store.dispatch(getAppInfo());
} }
componentWillReceiveProps(props) {
if (this.state.tabElId) {
const _height = document.querySelector(`#${this.state.tabElId} .panel-collapse .panel-body`).offsetHeight;
this.setState(Object.assign({}, this.state, {
activeTab: this.state.activeTab,
activeTabHeight: _height,
tabElId: this.state.tabElId,
}));
}
}
openTab(elemId, tab) { openTab(elemId, tab) {
const _height = document.querySelector('#' + elemId + ' .panel-collapse .panel-body').offsetHeight; setTimeout(() => {
const _height = document.querySelector(`#${elemId} .panel-collapse .panel-body`).offsetHeight;
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
activeTab: tab, activeTab: tab,
activeTabHeight: _height, activeTabHeight: _height,
tabElId: elemId,
})); }));
}, 100);
} }
exportWifKeys() { exportWifKeys() {
@ -108,15 +125,15 @@ class Settings extends React.Component {
if (releaseInfo) { if (releaseInfo) {
return ( return (
<div className="panel" id="AppInfo"> <div className="panel" id="AppInfo" onClick={ () => this.openTab('AppInfo', 8) }>
<div className="panel-heading" role="tab" onClick={ () => this.openTab('AppInfo', 8) }> <div className="panel-heading" role="tab">
<a className={this.state.activeTab === 8 ? 'panel-title' : 'panel-title collapsed'}> <a className={this.state.activeTab === 8 ? 'panel-title' : 'panel-title collapsed'}>
<i className="icon md-info" aria-hidden="true"></i>{ translate('SETTINGS.APP_INFO') } <i className="icon md-info" aria-hidden="true"></i>{ translate('SETTINGS.APP_INFO') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 8 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 8 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 8 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 8 ? this.state.activeTabHeight + 'px' : '0' }}
aria-labelledby="DebugLog" aria-labelledby="DebugLog"
role="tabpanel"> role="tabpanel">
<div className="panel-body"> <div className="panel-body">
@ -217,8 +234,6 @@ class Settings extends React.Component {
this.setState({ this.setState({
appSettings: _appSettings, appSettings: _appSettings,
}); });
console.log(this.state.appSettings);
} }
_saveAppConfig() { _saveAppConfig() {
@ -295,6 +310,27 @@ class Settings extends React.Component {
}); });
} }
renderDebugLogData() {
if (this.props.Settings.debugLog) {
const _debugLogDataRows = this.props.Settings.debugLog.split('\n');
if (_debugLogDataRows &&
_debugLogDataRows.length) {
return _debugLogDataRows.map((_row) =>
<div
key={ `settings-debuglog-${Math.random(0, 9) * 10}` }
className="padding-bottom-5">{ _row }</div>
);
} else {
return (
<span>{ translate('INDEX.EMPTY_DEBUG_LOG') }</span>
);
}
} else {
return null;
}
}
renderLB(_translationID) { renderLB(_translationID) {
const _translationComponents = translate(_translationID).split('<br>'); const _translationComponents = translate(_translationID).split('<br>');
@ -316,15 +352,18 @@ class Settings extends React.Component {
<div className="col-xlg-12 col-md-12"> <div className="col-xlg-12 col-md-12">
<h4 className="font-size-14 text-uppercase">{ translate('INDEX.WALLET_SETTINGS') }</h4> <h4 className="font-size-14 text-uppercase">{ translate('INDEX.WALLET_SETTINGS') }</h4>
<div className="panel-group" id="SettingsAccordion" aria-multiselectable="true" role="tablist"> <div className="panel-group" id="SettingsAccordion" aria-multiselectable="true" role="tablist">
<div className="panel" id="WalletInfo"> <div
<div className="panel-heading" role="tab" onClick={ () => this.openTab('WalletInfo', 0) }> className="panel"
id="WalletInfo"
onClick={ () => this.openTab('WalletInfo', 0) }>
<div className="panel-heading" role="tab">
<a className={ this.state.activeTab === 0 ? 'panel-title' : 'panel-title collapsed' }> <a className={ this.state.activeTab === 0 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon md-balance-wallet" aria-hidden="true"></i>{ translate('INDEX.WALLET_INFO') } <i className="icon md-balance-wallet" aria-hidden="true"></i>{ translate('INDEX.WALLET_INFO') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 0 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 0 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 0 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 0 ? this.state.activeTabHeight + 'px' : '0' }}
id="WalletInfoTab" id="WalletInfoTab"
aria-labelledby="WalletInfo" aria-labelledby="WalletInfo"
role="tabpanel"> role="tabpanel">
@ -379,15 +418,18 @@ class Settings extends React.Component {
</div> </div>
</div> </div>
<div className="panel" id="AddNodeforCoin"> <div
<div className="panel-heading" role="tab" onClick={ () => this.openTab('AddNodeforCoin', 1) }> className="panel"
id="AddNodeforCoin"
onClick={ () => this.openTab('AddNodeforCoin', 1) }>
<div className="panel-heading" role="tab">
<a className={ this.state.activeTab === 1 ? 'panel-title' : 'panel-title collapsed' }> <a className={ this.state.activeTab === 1 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon md-plus-square" aria-hidden="true"></i>{ translate('INDEX.ADD_NODE') } <i className="icon md-plus-square" aria-hidden="true"></i>{ translate('INDEX.ADD_NODE') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 1 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 1 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 1 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 1 ? this.state.activeTabHeight + 'px' : '0' }}
id="AddNodeforCoinTab" id="AddNodeforCoinTab"
aria-labelledby="AddNodeforCoin" aria-labelledby="AddNodeforCoin"
role="tabpanel"> role="tabpanel">
@ -470,15 +512,18 @@ class Settings extends React.Component {
</div> </div>
</div> </div>
<div className="panel" id="DumpWallet"> <div
<div className="panel-heading" role="tab" onClick={ () => this.openTab('DumpWallet', 2) }> className="panel"
id="DumpWallet"
onClick={ () => this.openTab('DumpWallet', 2) }>
<div className="panel-heading" role="tab">
<a className={this.state.activeTab === 2 ? 'panel-title' : 'panel-title collapsed'}> <a className={this.state.activeTab === 2 ? 'panel-title' : 'panel-title collapsed'}>
<i className="icon wb-briefcase" aria-hidden="true"></i>{ translate('INDEX.WALLET_BACKUP') } <i className="icon wb-briefcase" aria-hidden="true"></i>{ translate('INDEX.WALLET_BACKUP') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 2 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 2 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 2 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 2 ? this.state.activeTabHeight + 'px' : '0' }}
id="DumpWalletTab" id="DumpWalletTab"
aria-labelledby="DumpWallet" aria-labelledby="DumpWallet"
role="tabpanel"> role="tabpanel">
@ -486,18 +531,18 @@ class Settings extends React.Component {
</div> </div>
</div> </div>
<div className="panel" id="FiatCurrencySettings">
<div <div
className="panel-heading" className="panel"
role="tab" id="FiatCurrencySettings"
onClick={ () => this.openTab('FiatCurrencySettings', 3) }> onClick={ () => this.openTab('FiatCurrencySettings', 3) }>
<div className="panel-heading" role="tab">
<a className={ this.state.activeTab === 3 ? 'panel-title' : 'panel-title collapsed' }> <a className={ this.state.activeTab === 3 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon fa-money" aria-hidden="true"></i>{ translate('INDEX.FIAT_CURRENCY') } <i className="icon fa-money" aria-hidden="true"></i>{ translate('INDEX.FIAT_CURRENCY') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 3 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 3 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 3 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 3 ? this.state.activeTabHeight + 'px' : '0' }}
id="FiatCurrencySettingsTab" id="FiatCurrencySettingsTab"
aria-labelledby="FiatCurrencySettings" aria-labelledby="FiatCurrencySettings"
role="tabpanel"> role="tabpanel">
@ -505,15 +550,18 @@ class Settings extends React.Component {
</div> </div>
</div> </div>
<div className="panel" id="ExportKeys"> <div
<div className="panel-heading" role="tab" onClick={ () => this.openTab('ExportKeys', 4) }> className="panel"
id="ExportKeys"
onClick={ () => this.openTab('ExportKeys', 4) }>
<div className="panel-heading" role="tab">
<a className={ this.state.activeTab === 4 ? 'panel-title' : 'panel-title collapsed' }> <a className={ this.state.activeTab === 4 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon md-key" aria-hidden="true"></i>{ translate('INDEX.EXPORT_KEYS') } <i className="icon md-key" aria-hidden="true"></i>{ translate('INDEX.EXPORT_KEYS') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 4 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 4 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 4 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 4 ? this.state.activeTabHeight + 'px' : '0' }}
id="ExportKeysTab" id="ExportKeysTab"
aria-labelledby="ExportKeys" aria-labelledby="ExportKeys"
role="tabpanel"> role="tabpanel">
@ -566,15 +614,18 @@ class Settings extends React.Component {
</div> </div>
</div> </div>
<div className="panel" id="ImportKeys"> <div
<div className="panel-heading" role="tab" onClick={ () => this.openTab('ImportKeys', 5) }> className="panel"
id="ImportKeys"
onClick={ () => this.openTab('ImportKeys', 5) }>
<div className="panel-heading" role="tab">
<a className={ this.state.activeTab === 5 ? 'panel-title' : 'panel-title collapsed' }> <a className={ this.state.activeTab === 5 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon md-key" aria-hidden="true"></i>{ translate('INDEX.IMPORT_KEYS') } <i className="icon md-key" aria-hidden="true"></i>{ translate('INDEX.IMPORT_KEYS') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 5 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 5 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 5 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 5 ? this.state.activeTabHeight + 'px' : '0' }}
id="ImportKeysTab" id="ImportKeysTab"
aria-labelledby="ImportKeys" aria-labelledby="ImportKeys"
role="tabpanel"> role="tabpanel">
@ -612,15 +663,18 @@ class Settings extends React.Component {
</div> </div>
</div> </div>
<div className="panel" id="DebugLog"> <div
<div className="panel-heading" role="tab" onClick={ () => this.openTab('DebugLog', 6) }> className="panel"
id="DebugLog"
onClick={ () => this.openTab('DebugLog', 6) }>
<div className="panel-heading" role="tab">
<a className={ this.state.activeTab === 6 ? 'panel-title' : 'panel-title collapsed' }> <a className={ this.state.activeTab === 6 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon fa-bug" aria-hidden="true"></i>{ translate('INDEX.DEBUG_LOG') } <i className="icon fa-bug" aria-hidden="true"></i>{ translate('INDEX.DEBUG_LOG') }
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 6 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 6 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 6 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 6 ? this.state.activeTabHeight + 'px' : '0' }}
id="DebugLogTab" aria-labelledby="DebugLog" role="tabpanel"> id="DebugLogTab" aria-labelledby="DebugLog" role="tabpanel">
<div className="panel-body"> <div className="panel-body">
<p>{ translate('INDEX.DEBUG_LOG_DESC') }</p> <p>{ translate('INDEX.DEBUG_LOG_DESC') }</p>
@ -663,22 +717,25 @@ class Settings extends React.Component {
onClick={ this.readDebugLog }>{ translate('INDEX.LOAD_DEBUG_LOG') }</button> onClick={ this.readDebugLog }>{ translate('INDEX.LOAD_DEBUG_LOG') }</button>
</div> </div>
<div className="col-sm-12 col-xs-12 text-align-left"> <div className="col-sm-12 col-xs-12 text-align-left">
<div className="padding-top-40 padding-bottom-20 horizontal-padding-0">{ this.props.Settings.debugLog }</div> <div className="padding-top-40 padding-bottom-20 horizontal-padding-0">{ this.renderDebugLogData() }</div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
<div className="panel" id="AppSettings"> <div
<div className="panel-heading" role="tab" onClick={ () => this.openTab('AppSettings', 7) }> className="panel"
id="AppSettings"
onClick={ () => this.openTab('AppSettings', 7) }>
<div className="panel-heading" role="tab">
<a className={ this.state.activeTab === 7 ? 'panel-title' : 'panel-title collapsed' }> <a className={ this.state.activeTab === 7 ? 'panel-title' : 'panel-title collapsed' }>
<i className="icon fa-wrench" aria-hidden="true"></i>{ translate('SETTINGS.APP_CONFIG') } (config.json) <i className="icon fa-wrench" aria-hidden="true"></i>{ translate('SETTINGS.APP_CONFIG') } (config.json)
</a> </a>
</div> </div>
<div <div
className={ this.state.activeTab === 7 ? 'panel-collapse collapse in' : 'panel-collapse collapse' } className={ this.state.activeTab === 7 ? 'panel-collapse collapse in' : 'panel-collapse collapse' }
style={{ height: this.state.activeTab === 7 ? this.state.activeTabHeight + 'px' : '10px' }} style={{ height: this.state.activeTab === 7 ? this.state.activeTabHeight + 'px' : '0' }}
id="DebugLogTab" aria-labelledby="DebugLog" role="tabpanel"> id="DebugLogTab" aria-labelledby="DebugLog" role="tabpanel">
<div className="panel-body"> <div className="panel-body">
<p> <p>

108
react/src/components/dashboard/syncOnly.js

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { translate } from '../../translate/translate'; import { translate } from '../../translate/translate';
import { getCoinTitle } from '../../util/coinHelper';
import { import {
stopInterval, stopInterval,
addCoin, addCoin,
@ -19,7 +20,8 @@ class SyncOnly extends React.Component {
} }
isFullySynced(fork) { isFullySynced(fork) {
if (fork.balances && ((Number(fork.balances) + if (fork.balances &&
((Number(fork.balances) +
Number(fork.validated) + Number(fork.validated) +
Number(fork.bundles) + Number(fork.bundles) +
Number(fork.utxo)) / 4 === 100)) { Number(fork.utxo)) / 4 === 100)) {
@ -30,96 +32,15 @@ class SyncOnly extends React.Component {
} }
renderCoinName(coin) { renderCoinName(coin) {
let coinlogo; const _coinTitle = getCoinTitle(coin);
let coinname;
switch (coin) {
case 'BTC':
coinlogo = 'bitcoin';
coinname = 'Bitcoin';
break;
case 'BTCD':
coinlogo = 'bitcoindark';
coinname = 'BitcoinDark';
break;
case 'LTC':
coinlogo = 'litecoin';
coinname = 'Litecoin';
break;
case 'VPN':
coinlogo = 'vpncoin';
coinname = 'VPNcoin';
break;
case 'SYS':
coinlogo = 'syscoin';
coinname = 'Syscoin';
break;
case 'ZEC':
coinlogo = 'zcash';
coinname = 'Zcash';
break;
case 'NMC':
coinlogo = 'namecoin';
coinname = 'Namecoin';
break;
case 'DEX':
coinlogo = 'dex';
coinname = 'InstantDEX';
break;
case 'DOGE':
coinlogo = 'dogecoin';
coinname = 'Dogecoin';
break;
case 'DGB':
coinlogo = 'digibyte';
coinname = 'Digibyte';
break;
case 'MZC':
coinlogo = 'mazacoin';
coinname = 'Mazacoin';
break;
case 'UNO':
coinlogo = 'unobtanium';
coinname = 'Unobtanium';
break;
case 'ZET':
coinlogo = 'zetacoin';
coinname = 'Zetacoin';
break;
case 'KMD':
coinlogo = 'komodo';
coinname = 'Komodo';
break;
case 'BTM':
coinlogo = 'bitmark';
coinname = 'Bitmark';
break;
case 'CARB':
coinlogo = 'carboncoin';
coinname = 'Carboncoin';
break;
case 'ANC':
coinlogo = 'anoncoin';
coinname = 'AnonCoin';
break;
case 'FRK':
coinlogo = 'franko';
coinname = 'Franko';
break;
case 'GAME':
coinlogo = 'GAME';
coinname = 'GameCredits';
break;
}
return { return {
'logo': coinlogo, 'logo': _coinTitle.logo,
'name': coinname 'name': _coinTitle.name
}; };
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
// console.log('SyncOnly', props);
if (props.SyncOnly) { if (props.SyncOnly) {
for (let port in this.props.SyncOnly.forks) { for (let port in this.props.SyncOnly.forks) {
const forkInfo = this.props.SyncOnly.forks[port]; const forkInfo = this.props.SyncOnly.forks[port];
@ -130,7 +51,6 @@ class SyncOnly extends React.Component {
forkInfo.getinfo && forkInfo.getinfo &&
forkInfo.getinfo.error && forkInfo.getinfo.error &&
forkInfo.getinfo.error === 'bitcoinrpc needs coin that is active') { forkInfo.getinfo.error === 'bitcoinrpc needs coin that is active') {
console.log('fork add coin required');
let _autoRestartedForks = Object.assign({}, this.state.autoRestartedForks); let _autoRestartedForks = Object.assign({}, this.state.autoRestartedForks);
_autoRestartedForks[port] = true; _autoRestartedForks[port] = true;
@ -138,14 +58,15 @@ class SyncOnly extends React.Component {
autoRestartedForks: _autoRestartedForks, autoRestartedForks: _autoRestartedForks,
}); });
Store.dispatch(addCoin(forkInfo.registry.coin, '1', null, port)); Store.dispatch(addCoin(forkInfo.registry.coin, '1', null, port));
setTimeout(function() {
setTimeout(() => {
let _autoRestartedForks = Object.assign({}, this.state.autoRestartedForks); let _autoRestartedForks = Object.assign({}, this.state.autoRestartedForks);
_autoRestartedForks[port] = false; _autoRestartedForks[port] = false;
this.setState({ this.setState({
autoRestartedForks: _autoRestartedForks, autoRestartedForks: _autoRestartedForks,
}); });
}.bind(this), 10000); }, 10000);
} }
} }
} }
@ -237,12 +158,14 @@ class SyncOnly extends React.Component {
<div className="avatar"> <div className="avatar">
<img <img
className="img-responsive margin-bottom-5" className="img-responsive margin-bottom-5"
src={ 'assets/images/cryptologo/' + this.renderCoinName(forkInfo.registry.coin).logo + '.png' } src={ `assets/images/cryptologo/${this.renderCoinName(forkInfo.registry.coin).logo}.png` }
alt={ forkInfo.registry.coin }/> alt={ forkInfo.registry.coin }/>
<span className="badge up badge-success margin-bottom-5">Full</span> <span className="badge up badge-success margin-bottom-5">Full</span>
<div className="coin-name">{ this.renderCoinName(forkInfo.registry.coin).name } ({ forkInfo.registry.coin.toUpperCase() })</div> <div className="coin-name">{ this.renderCoinName(forkInfo.registry.coin).name } ({ forkInfo.registry.coin.toUpperCase() })</div>
<div className="margin-top-10"> <div className="margin-top-10">
<span className="btn btn-primary" onClick={ () => this._stopIguanaFork(forkInfo.registry.pmid) }> <span
className="btn btn-primary"
onClick={ () => this._stopIguanaFork(forkInfo.registry.pmid) }>
<span className="fa fa-stop"></span> { translate('INDEX.STOP') } <span className="fa fa-stop"></span> { translate('INDEX.STOP') }
</span> </span>
<span <span
@ -281,7 +204,10 @@ class SyncOnly extends React.Component {
{ this.renderForksList() } { this.renderForksList() }
</div> </div>
<div className="modal-footer"> <div className="modal-footer">
<button type="button" className="btn btn-default" onClick={ this.closeSyncOnlyModal }>{ translate('INDEX.CLOSE') }</button> <button
type="button"
className="btn btn-default"
onClick={ this.closeSyncOnlyModal }>{ translate('INDEX.CLOSE') }</button>
</div> </div>
</div> </div>
</div> </div>

4
react/src/components/dashboard/walletsBasiliskConnection.js

@ -80,13 +80,13 @@ class WalletsBasiliskConnection extends React.Component {
</div> </div>
</div> </div>
<h5 className="text-left"> <h5 className="text-left">
{ translate('IAPI.CON_STATUS') + '... ' + this.props.Dashboard.connectedNotaries.current + '/' + this.props.Dashboard.connectedNotaries.total + ': ' + this.props.Dashboard.connectedNotaries.currentNodeName} <span className="pull-right" id="basilisk-connections-refresh-percent">{ Math.floor(this.props.Dashboard.connectedNotaries.current * 100 / this.props.Dashboard.connectedNotaries.total) }%</span> { `${translate('IAPI.CON_STATUS')}... ${this.props.Dashboard.connectedNotaries.current}/${this.props.Dashboard.connectedNotaries.total}:${this.props.Dashboard.connectedNotaries.currentNodeName}` } <span className="pull-right" id="basilisk-connections-refresh-percent">{ Math.floor(this.props.Dashboard.connectedNotaries.current * 100 / this.props.Dashboard.connectedNotaries.total) }%</span>
</h5> </h5>
<div className="progress progress-sm"> <div className="progress progress-sm">
<div className="progress-bar progress-bar-info progress-bar-striped active font-size-80-percent" style={{ width: Math.floor(this.props.Dashboard.connectedNotaries.current * 100 / this.props.Dashboard.connectedNotaries.total) + '%' }} role="progressbar" id="basilisk-connections-refresh-progress-bar"></div> <div className="progress-bar progress-bar-info progress-bar-striped active font-size-80-percent" style={{ width: Math.floor(this.props.Dashboard.connectedNotaries.current * 100 / this.props.Dashboard.connectedNotaries.total) + '%' }} role="progressbar" id="basilisk-connections-refresh-progress-bar"></div>
</div> </div>
<pre id="basilisk-connections-refresh-status-output no-padding"> <pre id="basilisk-connections-refresh-status-output no-padding">
{ this.props.Dashboard.connectedNotaries.failedToConnectNodes ? 'Failed: ' + this.props.Dashboard.connectedNotaries.failedToConnectNodes : null } { this.props.Dashboard.connectedNotaries.failedToConnectNodes ? `Failed: ${this.props.Dashboard.connectedNotaries.failedToConnectNodes}` : null }
</pre> </pre>
</div> </div>
</div> </div>

10
react/src/components/dashboard/walletsData.js

@ -82,6 +82,7 @@ class WalletsData extends React.Component {
} }
} }
// deprecated
toggleCacheApi() { toggleCacheApi() {
const _useCache = !this.state.useCache; const _useCache = !this.state.useCache;
@ -463,6 +464,7 @@ class WalletsData extends React.Component {
} }
}*/ }*/
// deprecated
renderUseCacheToggle() { renderUseCacheToggle() {
if (this.props.ActiveCoin.mode === 'basilisk') { if (this.props.ActiveCoin.mode === 'basilisk') {
return ( return (
@ -552,11 +554,11 @@ class WalletsData extends React.Component {
this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] && this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] &&
this.props.ActiveCoin.mode === 'basilisk') { this.props.ActiveCoin.mode === 'basilisk') {
return ( return (
<div className={ 'btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ' + (this.state.addressSelectorOpen ? 'open' : '') }> <div className={ `btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ${(this.state.addressSelectorOpen ? 'open' : '')}` }>
<button <button
type="button" type="button"
className="btn dropdown-toggle btn-info" className="btn dropdown-toggle btn-info"
title={ '-' + translate('KMD_NATIVE.SELECT_ADDRESS') + '-' } title={ `-${translate('KMD_NATIVE.SELECT_ADDRESS')}-` }
aria-expanded="true" aria-expanded="true"
onClick={ this.openDropMenu }> onClick={ this.openDropMenu }>
<span className="filter-option pull-left">{ this.renderSelectorCurrentLabel() } </span>&nbsp; <span className="filter-option pull-left">{ this.renderSelectorCurrentLabel() } </span>&nbsp;
@ -609,7 +611,9 @@ class WalletsData extends React.Component {
{ translate('SEND.PROCESSING_REQ') }: { this.state.currentStackLength } / { this.state.totalStackLength } { translate('SEND.PROCESSING_REQ') }: { this.state.currentStackLength } / { this.state.totalStackLength }
</div> </div>
</div> </div>
<div className={ this.state.basiliskActionsMenu ? 'dropdown open' : 'dropdown' } onClick={ this.toggleBasiliskActionsMenu }> <div
className={ this.state.basiliskActionsMenu ? 'dropdown open' : 'dropdown' }
onClick={ this.toggleBasiliskActionsMenu }>
<a <a
className="dropdown-toggle btn-xs btn-default" className="dropdown-toggle btn-xs btn-default"
id="btn_edexcoin_basilisk" id="btn_edexcoin_basilisk"

4
react/src/components/dashboard/walletsHeader.js

@ -1,7 +1,5 @@
import React from 'react'; import React from 'react';
import { translate } from '../../translate/translate'; import { translate } from '../../translate/translate';
// import { dashboardChangeSection, toggleAddcoinModal } from '../../actions/actionCreators';
// import Store from '../../store';
class WalletsHeader extends React.Component { class WalletsHeader extends React.Component {
hasActiveSection() { hasActiveSection() {
@ -19,7 +17,7 @@ class WalletsHeader extends React.Component {
<div <div
className="page-header page-header-bordered header-easydex margin-bottom-0" className="page-header page-header-bordered header-easydex margin-bottom-0"
id="easydex-header-div" id="easydex-header-div"
style={{ backgroundImage: 'url("assets/images/bg/' + this.props.activeSection + '_transparent_header_bg.png")', backgroundRepeat: 'no-repeat', backgroundPosition: '0%' }}> style={{ backgroundImage: `url("assets/images/bg/${this.props.activeSection}_transparent_header_bg.png")`, backgroundRepeat: 'no-repeat', backgroundPosition: '0%' }}>
<h1 className={ this.isActiveSectionJumblr() ? 'hide' : 'page-title' }>EasyDEX</h1> <h1 className={ this.isActiveSectionJumblr() ? 'hide' : 'page-title' }>EasyDEX</h1>
<ol className="breadcrumb"> <ol className="breadcrumb">
<li className={ this.isActiveSectionJumblr() ? 'hide' : 'header-easydex-section' }>{ translate('INDEX.DASHBOARD') }</li> <li className={ this.isActiveSectionJumblr() ? 'hide' : 'header-easydex-section' }>{ translate('INDEX.DASHBOARD') }</li>

4
react/src/components/dashboard/walletsNative.js

@ -33,10 +33,10 @@ class WalletsNative extends React.Component {
return ( return (
<div className="page margin-left-0"> <div className="page margin-left-0">
<div id="section-extcoin" className="padding-top-0"> <div id="section-extcoin" className="padding-top-0">
<div id="easydex-header-div" className="background-color-white" style={{ 'backgroundImage': 'url("assets/images/bg/' + this.defaultBG() + '_transparent_header_bg.png")' }}> <div id="easydex-header-div" className="background-color-white" style={{ 'backgroundImage': `url("assets/images/bg/${this.defaultBG()}_transparent_header_bg.png")` }}>
<ol className="breadcrumb"> <ol className="breadcrumb">
<li className="header-easydex-section"> <li className="header-easydex-section">
<img src={ 'assets/images/native/' + this.defaultBG() + '_header_title_logo.png' } /> <span className={'easydex-section-image ' + (this.props.ActiveCoin.coin === 'KMD' ? 'hide' : '') }>{ this.props.ActiveCoin.coin }</span> <img src={ `assets/images/native/${this.defaultBG()}_header_title_logo.png` } /> <span className={ `easydex-section-image ${(this.props.ActiveCoin.coin === 'KMD' ? 'hide' : '')}` }>{ this.props.ActiveCoin.coin }</span>
</li> </li>
</ol> </ol>
</div> </div>

56
react/src/components/dashboard/walletsNativeSend.js

@ -80,7 +80,7 @@ class WalletsNativeSend extends React.Component {
renderAddressList() { renderAddressList() {
return ( return (
<div className={ 'btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ' + (this.state.addressSelectorOpen ? 'open' : '') }> <div className={ `btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ${(this.state.addressSelectorOpen ? 'open' : '')}` }>
<button <button
type="button" type="button"
className="btn dropdown-toggle btn-info" className="btn dropdown-toggle btn-info"
@ -106,31 +106,29 @@ class WalletsNativeSend extends React.Component {
} }
renderOPIDLabel(opid) { renderOPIDLabel(opid) {
if (opid.status === 'queued') { const _satatusDef = {
return ( queued: {
<span className="label label-warning"> icon: 'warning',
<i className="icon fa-eye"></i> <span>{ translate('KMD_NATIVE.QUEUED') }</span> label: 'QUEUED'
</span> },
); executing: {
} icon: 'info',
if (opid.status === 'executing') { label: 'EXECUTING'
return ( },
<span className="label label-info"> failed: {
<i className="icon fa-eye"></i> <span>{ translate('KMD_NATIVE.EXECUTING') }</span> icon: 'danger',
</span> label: 'FAILED'
); },
success: {
icon: 'success',
label: 'SUCCESS'
} }
if (opid.status === 'failed') { };
return (
<span className="label label-danger"> if (opid.status === 'queued') {
<i className="icon fa-eye"></i> <span>{ translate('KMD_NATIVE.FAILED') }</span>
</span>
);
}
if (opid.status === 'success') {
return ( return (
<span className="label label-success"> <span className={`label label-${_satatusDef[opid.status].icon}`}>
<i className="icon fa-eye"></i> <span>{ translate('KMD_NATIVE.SUCCESS') }</span> <i className="icon fa-eye"></i> <span>{ translate(`KMD_NATIVE.${_satatusDef[opid.status].label}`) }</span>
</span> </span>
); );
} }
@ -217,14 +215,14 @@ class WalletsNativeSend extends React.Component {
handleSubmit() { handleSubmit() {
Store.dispatch(sendNativeTx(this.props.ActiveCoin.coin, this.state)); Store.dispatch(sendNativeTx(this.props.ActiveCoin.coin, this.state));
setTimeout(function() { setTimeout(() => {
Store.dispatch(getKMDOPID(null, this.props.ActiveCoin.coin)); Store.dispatch(getKMDOPID(null, this.props.ActiveCoin.coin));
}.bind(this), 1000); }, 1000);
} }
getOAdress() { getOAdress() {
resolveOpenAliasAddress(this.state.sendToOA) resolveOpenAliasAddress(this.state.sendToOA)
.then(function(json) { .then((json) => {
const reply = json.Answer; const reply = json.Answer;
if (reply && if (reply &&
@ -247,7 +245,7 @@ class WalletsNativeSend extends React.Component {
} else { } else {
Store.dispatch(triggerToaster(true, 'Couldn\'t find any addresses', 'OpenAlias', 'error')); Store.dispatch(triggerToaster(true, 'Couldn\'t find any addresses', 'OpenAlias', 'error'));
} }
}.bind(this)); });
} }
renderOASendUI() { renderOASendUI() {
@ -293,7 +291,7 @@ class WalletsNativeSend extends React.Component {
<div className="col-xlg-12 col-md-12 col-sm-12 col-xs-12"> <div className="col-xlg-12 col-md-12 col-sm-12 col-xs-12">
<div className="panel" id="projects"> <div className="panel" id="projects">
<div className="panel-heading"> <div className="panel-heading">
<h3 data-extcoin="COIN" className="panel-title"> <h3 className="panel-title">
{ translate('INDEX.SEND') } { this.props.ActiveCoin.coin } { translate('INDEX.SEND') } { this.props.ActiveCoin.coin }
</h3> </h3>
</div> </div>

2
react/src/components/dashboard/walletsNativeSyncProgress.js

@ -57,7 +57,7 @@ class WalletsNativeSyncProgress extends React.Component {
} }
} }
return(': ' + Math.floor(currentBestChain * 100 / this.props.Dashboard.progress.remoteKMDNode.blocks) + '% (blocks ' + currentBestChain + ' / ' + this.props.Dashboard.progress.remoteKMDNode.blocks + ')'); return(`: ${Math.floor(currentBestChain * 100 / this.props.Dashboard.progress.remoteKMDNode.blocks)}% (blocks ${currentBestChain} / ${this.props.Dashboard.progress.remoteKMDNode.blocks})`);
} else { } else {
return ( return (
<span id="activating-komodod-tridot">...</span> <span id="activating-komodod-tridot">...</span>

2
react/src/components/dashboard/walletsNativeTxHistory.js

@ -126,7 +126,7 @@ class WalletsNativeTxHistory extends React.Component {
<li className={ this.state.activePage === i + 1 ? 'paginate_button active' : 'paginate_button' }> <li className={ this.state.activePage === i + 1 ? 'paginate_button active' : 'paginate_button' }>
<a <a
aria-controls="kmd-tx-history-tbl" aria-controls="kmd-tx-history-tbl"
tabIndex="0" key={i + '-pagination'} tabIndex="0" key={ `${i}-pagination` }
onClick={ this.state.activePage !== (i + 1) ? () => this.updateCurrentPage(i + 1) : null }>{ i + 1 }</a> onClick={ this.state.activePage !== (i + 1) ? () => this.updateCurrentPage(i + 1) : null }>{ i + 1 }</a>
</li> </li>
); );

31
react/src/components/login/login.js

@ -14,6 +14,9 @@ import {
import Store from '../../store'; import Store from '../../store';
import { PassPhraseGenerator } from '../../util/crypto/passphrasegenerator'; import { PassPhraseGenerator } from '../../util/crypto/passphrasegenerator';
const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000;
const IGUNA_ACTIVE_COINS_TIMEOUT = 10000;
class Login extends React.Component { class Login extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -41,9 +44,9 @@ class Login extends React.Component {
openSyncOnlyModal() { openSyncOnlyModal() {
Store.dispatch(getSyncOnlyForks()); Store.dispatch(getSyncOnlyForks());
const _iguanaActiveHandle = setInterval(function() { const _iguanaActiveHandle = setInterval(() => {
Store.dispatch(getSyncOnlyForks()); Store.dispatch(getSyncOnlyForks());
}.bind(this), 3000); }, IGUNA_ACTIVE_HANDLE_TIMEOUT);
Store.dispatch(startInterval('syncOnly', _iguanaActiveHandle)); Store.dispatch(startInterval('syncOnly', _iguanaActiveHandle));
Store.dispatch(toggleSyncOnlyModal(true)); Store.dispatch(toggleSyncOnlyModal(true));
@ -67,21 +70,25 @@ class Login extends React.Component {
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
if (props && props.Main && props.Main.isLoggedIn) { if (props &&
props.Main &&
props.Main.isLoggedIn) {
this.setState({ this.setState({
display: false, display: false,
}); });
} }
if (props && props.Main && !props.Main.isLoggedIn) { if (props &&
props.Main &&
!props.Main.isLoggedIn) {
this.setState({ this.setState({
display: true, display: true,
}); });
if (!this.props.Interval.interval.activeCoins) { if (!this.props.Interval.interval.activeCoins) {
const _iguanaActiveCoins = setInterval(function() { const _iguanaActiveCoins = setInterval(() => {
Store.dispatch(getDexCoins()); Store.dispatch(getDexCoins());
}.bind(this), 10000); }, IGUNA_ACTIVE_COINS_TIMEOUT);
Store.dispatch(startInterval('activeCoins', _iguanaActiveCoins)); Store.dispatch(startInterval('activeCoins', _iguanaActiveCoins));
} }
@ -89,7 +96,9 @@ class Login extends React.Component {
} }
if (this.state.activeLoginSection !== 'signup') { if (this.state.activeLoginSection !== 'signup') {
if (props && props.Main && props.Main.activeCoins) { if (props &&
props.Main &&
props.Main.activeCoins) {
this.setState({ this.setState({
activeLoginSection: 'login', activeLoginSection: 'login',
}); });
@ -164,8 +173,12 @@ class Login extends React.Component {
<h2>{ translate('LOGIN.SAVED_WALLET_SEED') }</h2> <h2>{ translate('LOGIN.SAVED_WALLET_SEED') }</h2>
<div className="swal2-content display-block">{ translate('LOGIN.SEED_MAKE_SURE_BACKUP') }</div> <div className="swal2-content display-block">{ translate('LOGIN.SEED_MAKE_SURE_BACKUP') }</div>
<hr className="swal2-spacer display-block" /> <hr className="swal2-spacer display-block" />
<button className="swal2-confirm styled swal2-confirm-container" onClick={ this.execWalletCreate }>{ translate('LOGIN.YES_I_BACKUP') }</button> <button
<button className="swal2-cancel styled swal2-cancel-container" onClick={ this.toggleSeedBackupModal }>{ translate('LOGIN.CANCEL') }</button> className="swal2-confirm styled swal2-confirm-container"
onClick={ this.execWalletCreate }>{ translate('LOGIN.YES_I_BACKUP') }</button>
<button
className="swal2-cancel styled swal2-cancel-container"
onClick={ this.toggleSeedBackupModal }>{ translate('LOGIN.CANCEL') }</button>
</div> </div>
</div> </div>
); );

4
react/src/components/main/main.js

@ -8,6 +8,8 @@ import {
iguanaActiveHandle iguanaActiveHandle
} from '../../actions/actionCreators'; } from '../../actions/actionCreators';
const IGUANA_ACTIVE_HANDLE_TIMEOUT = 30000;
class Main extends React.Component { class Main extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -24,7 +26,7 @@ class Main extends React.Component {
Store.dispatch(iguanaActiveHandle()); Store.dispatch(iguanaActiveHandle());
const _iguanaActiveHandle = setInterval(function() { const _iguanaActiveHandle = setInterval(function() {
Store.dispatch(iguanaActiveHandle()); Store.dispatch(iguanaActiveHandle());
}, 30000); }, IGUANA_ACTIVE_HANDLE_TIMEOUT);
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
activeHandleInterval: _iguanaActiveHandle, activeHandleInterval: _iguanaActiveHandle,

552
react/src/components/overrides.scss

@ -0,0 +1,552 @@
/* TODO: nesting, separate */
#app > div {
height: 100%;
}
.page-main {
background: #f3f4f5;
}
#kmd_header_button button {
margin-right: 5px;
}
.widget.active .bg-white {
box-shadow: inset 1px 1px 10px #ccc;
}
body {
padding-top: 44px;
}
.login-form,
.register-form {
width: 540px;
margin: 30px 0;
}
#section-iguana-wallet-settings .panel-title {
cursor: pointer;
cursor: hand;
}
#section-iguana-wallet-settings .panel-title:before {
content: '\F273';
}
#section-iguana-wallet-settings .panel-title.collapsed:before {
content: '\F278';
}
#section-dashboard {
height: 100%;
}
#section-iguana-wallet-settings {
background: #f3f4f5;
}
#edexcoin_dashboardinfo a,
.nav-top-menu,
#kmd_txid_info_mdl .nav-tabs li,
.pagination a,
.action {
cursor: pointer;
cursor: hand;
}
#easydex-header-div {
background-repeat: no-repeat;
background-size: 100%;
}
.unselectable {
user-select: none;
}
.seed-toggle {
position: absolute;
right: 0;
top: 0px;
cursor: pointer;
cursor: hand;
}
.radio-custom input {
cursor: pointer;
cursor: hand;
}
.collapse {
overflow: hidden;
display: block;
}
.collapse-active {
transition: height 0.3s ease-out;
}
.rc-tree {
height: 450px;
overflow-y: scroll;
margin-top: 20px;
a {
pointer-events: none;
}
li span.rc-tree-iconEle {
display: none;
}
}
.rc-tree-node-content-wrapper-close + ul {
height: 0;
}
.rc-tree-node-content-wrapper {
user-select: none;
}
.rc-tree-node-content-wrapper-normal {
color: inherit;
pointer-events: all;
user-select: all;
}
#RefreshBasiliskConnectionsMdl .btn-close {
position: absolute;
top: 15px;
right: 15px;
}
.page-aside {
position: fixed;
}
.page-aside-inner .wallet-widgets-list {
overflow-y: auto;
height: 100%;
}
.display-sync-only-coins-toggle {
cursor: pointer;
}
.display-sync-only-coins-toggle:hover {
color: #ffa726;
}
.btn-add-coin-item,
.btn-add-coin-item-options,
.btn-save-coin-selection,
.btn-load-coin-selection {
position: absolute;
right: 32px;
z-index: 50;
}
.btn-add-coin-item {
right: 60px;
}
.btn-add-coin-item-options {
padding: 6px;
}
.btn-save-coin-selection {
top: 60px;
}
.btn-load-coin-selection {
top: 95px;
}
.btn-outline-primary {
color: #FF6600;
background-color: #fff;
border-color: #FF6600;
}
.add-coin-modal {
.modal-body {
max-height: 590px;
overflow-y: auto;
}
.multi {
.col-sm-8 {
width: 30%;
}
.col-sm-12 {
&.text-center {
width: 60%;
padding: 0;
.col-lg-4 {
width: 25%;
margin-right: 8%;
padding: 0;
.input.to-labelauty+label {
max-width: 136px;
}
}
.col-lg-4:last-child {
margin-right: 0;
}
.col-sm-1 {
width: 44px;
padding: 0;
}
}
}
}
}
.sync-only-forks {
color: #757575;
.modal-body {
overflow-y: auto;
}
.badge{
&.up {
position: absolute;
top: 40px;
left: 65px;
margin: 0 5px;
}
}
.avatar {
width: 20%;
display: inline-block;
text-align: center;
vertical-align: top;
img {
width: 55px;
display: inherit;
}
}
.progress-bars {
padding-left: 40px;
display: inline-block;
width: 80%;
margin: 0 auto;
}
.padding-bottom-60:last-child {
padding-bottom: 0 !important;
}
}
#SettingsAccordion {
.panel {
.panel-collapse {
transition: all .3s;
&.collapse {
height: 0;
}
}
}
}
.center {
text-align: center;
}
.navbar {
&.navbar-fixed-top {
.dropdown {
&.open {
.dropdown-menu {
right: 0;
}
}
.dropdown-menu {
display: block;
right: -165px;
}
}
}
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 40px;
height: 24px;
}
/* Hide default HTML checkbox */
.switch input {
display: none;
}
/* The slider */
.slider {
border-radius: 20px;
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
border-radius: 50%;
position: absolute;
content: "";
height: 20px;
width: 20px;
left: 2px;
bottom: 2px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
.toggle-label {
color: #757575;
display: inline-block;
position: relative;
top: -12px;
left: 8px;
}
input:checked + .slider {
background-color: rgb(57, 73, 171);
}
input:focus + .slider {
box-shadow: 0 0 1px rgb(57, 73, 171);
}
input:checked + .slider:before {
-webkit-transform: translateX(16px);
-ms-transform: translateX(16px);
transform: translateX(16px);
}
.dropdown-menu li {
cursor: pointer;
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
.pointer {
cursor: pointer;
}
.text-center {
text-align: center;
}
.breadcrumb > li + li: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);
}
.notice: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;
}
.info:before {
content: 'i';
background-color: #0074D9;
}
.success {
border-color: #2ECC40;
}
.success:before {
content: '';
background-color: #2ECC40;
}
.warning {
border-color: #FFDC00;
}
.warning:before {
content: '!';
background-color: #FFDC00;
}
.error {
border-color: #FF4136;
}
.error: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;
}
.badge.success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.badge.pending {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.badge.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: 470px;
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;
width: 200px;
}
#app {
height: 100%;
}
.spinner {
width: 50px;
height: 40px;
text-align: center;
font-size: 10px;
}
.spinner > div {
background-color: #333;
height: 100%;
width: 6px;
display: inline-block;
-webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
animation: sk-stretchdelay 1.2s infinite ease-in-out;
}
.spinner .rect2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
.spinner .rect3 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
}
.spinner .rect4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
.spinner .rect5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
@-webkit-keyframes sk-stretchdelay {
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
20% { -webkit-transform: scaleY(1.0) }
}
@keyframes sk-stretchdelay {
0%, 40%, 100% {
transform: scaleY(0.4);
-webkit-transform: scaleY(0.4);
} 20% {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
}
.bootstrap-select > .dropdown-toggle {
z-index: 0;
}

12
react/src/components/toaster/toaster-item.js

@ -1,6 +1,6 @@
import React from "react"; import React from 'react';
import {dismissToasterMessage} from "../../actions/actionCreators"; import { dismissToasterMessage } from '../../actions/actionCreators';
import Store from "../../store"; import Store from '../../store';
// each toast will be displayed for 5 seconds // each toast will be displayed for 5 seconds
const DISPLAY_LENGTH_MILLIS = 5000; const DISPLAY_LENGTH_MILLIS = 5000;
@ -10,7 +10,6 @@ const DISPLAY_LENGTH_MILLIS = 5000;
* each messages has a type, title and a content message * each messages has a type, title and a content message
*/ */
class ToasterItem extends React.Component { class ToasterItem extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -60,8 +59,9 @@ class ToasterItem extends React.Component {
} }
return ( return (
<div className={ 'toast toast-' + this.state.type }> <div className={ `toast toast-${this.state.type}` }>
<button className="toast-close-button" role="button" <button
className="toast-close-button" role="button"
onClick={ () => this.dismissToast(this.state.toastId) }>× onClick={ () => this.dismissToast(this.state.toastId) }>×
</button> </button>
<div className="toast-title">{ this.state.title }</div> <div className="toast-title">{ this.state.title }</div>

40
react/src/components/toaster/toaster.js

@ -1,11 +1,8 @@
import React from "react"; import React from 'react';
import {dismissToasterMessage} from "../../actions/actionCreators"; import { dismissToasterMessage } from '../../actions/actionCreators';
import Store from "../../store"; import Store from '../../store';
import ToasterItem from "./toaster-item"; import ToasterItem from './toaster-item';
/**
* Container component used for creating multiple toasts
*/
class Toaster extends React.Component { class Toaster extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -34,15 +31,10 @@ class Toaster extends React.Component {
Store.dispatch(dismissToasterMessage(toastId)); Store.dispatch(dismissToasterMessage(toastId));
} }
// render all current toasts renderToasts() {
render() { if (this.state.toasts &&
return ( this.state.toasts.length) {
<div id="toast-container" return this.state.toasts.map((toast) => {
className="single-toast toast-bottom-right"
aria-live="polite"
role="alert">
{this.state.toasts
.map((toast) => {
// sets the toastId for all new toasts // sets the toastId for all new toasts
if (!toast.toastId) { if (!toast.toastId) {
toast.toastId = this.toastId++; toast.toastId = this.toastId++;
@ -51,7 +43,21 @@ class Toaster extends React.Component {
return ( return (
<ToasterItem key={ toast.toastId } {...toast} /> <ToasterItem key={ toast.toastId } {...toast} />
); );
})} });
} else {
return null;
}
}
// render all current toasts
render() {
return (
<div
id="toast-container"
className="single-toast toast-bottom-right"
aria-live="polite"
role="alert">
{ this.renderToasts() }
</div> </div>
); );
} }

31
react/src/reducers/dashboard.js

@ -11,6 +11,8 @@ import {
TOGGLE_NOTIFICATIONS_MODAL TOGGLE_NOTIFICATIONS_MODAL
} from '../actions/storeType'; } from '../actions/storeType';
const HTTP_STACK_MAX_ENTRIES = 150; // limit stack mem length to N records per type
export function Dashboard(state = { export function Dashboard(state = {
activeSection: 'wallets', activeSection: 'wallets',
activeHandle: null, activeHandle: null,
@ -69,6 +71,11 @@ export function Dashboard(state = {
}); });
case LOG_GUI_HTTP: case LOG_GUI_HTTP:
let _guiLogState = state.guiLog; let _guiLogState = state.guiLog;
let _guiLogStateTrim = {
error: [],
success: [],
pending: []
};
if (_guiLogState[action.timestamp]) { if (_guiLogState[action.timestamp]) {
_guiLogState[action.timestamp].status = action.log.status; _guiLogState[action.timestamp].status = action.log.status;
@ -77,8 +84,30 @@ export function Dashboard(state = {
_guiLogState[action.timestamp] = action.log; _guiLogState[action.timestamp] = action.log;
} }
for (let timestamp in _guiLogState) {
if (_guiLogState[timestamp].status === 'error') {
_guiLogStateTrim.error.push(_guiLogState[timestamp]);
}
if (_guiLogState[timestamp].status === 'success') {
_guiLogStateTrim.success.push(_guiLogState[timestamp]);
}
if (_guiLogState[timestamp].status === 'pending') {
_guiLogStateTrim.pending.push(_guiLogState[timestamp]);
}
}
let _guiLogStateNew = {};
for (let _key in _guiLogStateTrim) {
if (_guiLogStateTrim[_key].length > HTTP_STACK_MAX_ENTRIES) {
_guiLogStateTrim[_key].shift();
}
for (let i = 0; i < _guiLogStateTrim[_key].length; i++) {
_guiLogStateNew[_guiLogStateTrim[_key][i].timestamp] = _guiLogStateTrim[_key][i];
}
}
return Object.assign({}, state, { return Object.assign({}, state, {
guiLog: _guiLogState, guiLog: _guiLogStateNew,
}); });
default: default:
return state; return state;

490
react/src/styles/index.scss

@ -1,7 +1,3 @@
@import '../components/addcoin/addcoin.scss';
@import '../components/dashboard/dashboard.scss';
@import '../components/login/login.scss';
@import '../assets/global/css/bootstrap.min.css'; @import '../assets/global/css/bootstrap.min.css';
@import '../assets/global/css/bootstrap-extend.min.css'; @import '../assets/global/css/bootstrap-extend.min.css';
@import '../assets/global/css/alertify.css'; @import '../assets/global/css/alertify.css';
@ -34,485 +30,7 @@
@import '../assets/global/fonts/brand-icons/brand-icons.min.css'; @import '../assets/global/fonts/brand-icons/brand-icons.min.css';
@import '../assets/skins/orange.min.css'; @import '../assets/skins/orange.min.css';
@import '../../node_modules/rc-tree/assets/index.css'; @import '../../node_modules/rc-tree/assets/index.css';
@import '../components/addcoin/addcoin.scss';
#app > div { @import '../components/dashboard/dashboard.scss';
height: 100%; @import '../components/login/login.scss';
} @import '../components/overrides.scss';
.page-main {
background: #f3f4f5;
}
#kmd_header_button button {
margin-right: 5px;
}
.widget.active .bg-white {
box-shadow: inset 1px 1px 10px #ccc;
}
body {
padding-top: 44px;
}
.login-form,
.register-form {
width: 540px;
margin: 30px 0;
}
#section-iguana-wallet-settings .panel-title {
cursor: pointer;
cursor: hand;
}
#section-iguana-wallet-settings .panel-title:before {
content: '\F273';
}
#section-iguana-wallet-settings .panel-title.collapsed:before {
content: '\F278';
}
#section-dashboard {
height: 100%;
}
#section-iguana-wallet-settings {
background: #f3f4f5;
}
#edexcoin_dashboardinfo a,
.nav-top-menu,
#kmd_txid_info_mdl .nav-tabs li,
.pagination a,
.action {
cursor: pointer;
cursor: hand;
}
#easydex-header-div {
background-repeat: no-repeat;
background-size: 100%;
}
.unselectable {
user-select: none;
}
.seed-toggle {
position: absolute;
right: 0;
top: 0px;
cursor: pointer;
cursor: hand;
}
.radio-custom input {
cursor: pointer;
cursor: hand;
}
.collapse {
overflow: hidden;
display: block;
}
.collapse-active {
transition: height 0.3s ease-out;
}
.rc-tree {
height: 450px;
overflow-y: scroll;
margin-top: 20px;
a {
pointer-events: none;
}
li span.rc-tree-iconEle {
display: none;
}
}
.rc-tree-node-content-wrapper-close + ul {
height: 0;
}
.rc-tree-node-content-wrapper {
user-select: none;
}
.rc-tree-node-content-wrapper-normal {
color: inherit;
pointer-events: all;
user-select: all;
}
#RefreshBasiliskConnectionsMdl .btn-close {
position: absolute;
top: 15px;
right: 15px;
}
.page-aside {
position: fixed;
}
.page-aside-inner .wallet-widgets-list {
overflow-y: auto;
height: 100%;
}
.display-sync-only-coins-toggle {
cursor: pointer;
}
.display-sync-only-coins-toggle:hover {
color: #ffa726;
}
.btn-add-coin-item,
.btn-add-coin-item-options,
.btn-save-coin-selection,
.btn-load-coin-selection {
position: absolute;
right: 32px;
z-index: 50;
}
.btn-add-coin-item {
right: 60px;
}
.btn-add-coin-item-options {
padding: 6px;
}
.btn-save-coin-selection {
top: 60px;
}
.btn-load-coin-selection {
top: 95px;
}
.btn-outline-primary {
color: #FF6600;
background-color: #fff;
border-color: #FF6600;
}
.add-coin-modal {
.modal-body {
max-height: 590px;
overflow-y: auto;
}
.multi {
.col-sm-8 {
width: 30%;
}
.col-sm-12 {
&.text-center {
width: 60%;
padding: 0;
.col-lg-4 {
width: 25%;
margin-right: 8%;
padding: 0;
.input.to-labelauty+label {
max-width: 136px;
}
}
.col-lg-4:last-child {
margin-right: 0;
}
.col-sm-1 {
width: 44px;
padding: 0;
}
}
}
}
}
.sync-only-forks {
color: #757575;
.modal-body {
overflow-y: auto;
}
.badge{
&.up {
position: absolute;
top: 40px;
left: 65px;
margin: 0 5px;
}
}
.avatar {
width: 20%;
display: inline-block;
text-align: center;
vertical-align: top;
img {
width: 55px;
display: inherit;
}
}
.progress-bars {
padding-left: 40px;
display: inline-block;
width: 80%;
margin: 0 auto;
}
.padding-bottom-60:last-child {
padding-bottom: 0 !important;
}
}
#SettingsAccordion {
.panel {
.panel-collapse {
transition: all .3s;
&.collapse {
height: 10px;
}
}
}
}
.center {
text-align: center;
}
.navbar {
&.navbar-fixed-top {
.dropdown {
&.open {
.dropdown-menu {
right: 0;
}
}
.dropdown-menu {
display: block;
right: -165px;
}
}
}
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 40px;
height: 24px;
}
/* Hide default HTML checkbox */
.switch input {
display: none;
}
/* The slider */
.slider {
border-radius: 20px;
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
border-radius: 50%;
position: absolute;
content: "";
height: 20px;
width: 20px;
left: 2px;
bottom: 2px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
.toggle-label {
color: #757575;
display: inline-block;
position: relative;
top: -12px;
left: 8px;
}
input:checked + .slider {
background-color: rgb(57, 73, 171);
}
input:focus + .slider {
box-shadow: 0 0 1px rgb(57, 73, 171);
}
input:checked + .slider:before {
-webkit-transform: translateX(16px);
-ms-transform: translateX(16px);
transform: translateX(16px);
}
.dropdown-menu li {
cursor: pointer;
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
.pointer {
cursor: pointer;
}
.text-center {
text-align: center;
}
#section-dashboard .navbar-brand {
padding: 10px 20px;
}
.breadcrumb > li + li: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);
}
.notice: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;
}
.info:before {
content: 'i';
background-color: #0074D9;
}
.success {
border-color: #2ECC40;
}
.success:before {
content: '';
background-color: #2ECC40;
}
.warning {
border-color: #FFDC00;
}
.warning:before {
content: '!';
background-color: #FFDC00;
}
.error {
border-color: #FF4136;
}
.error:before {
content: 'X';
background-color: #FF4136;
}
}
.notifications-badge.stick-to-top {
top: 38px;
left: 30px;
z-index: 1500;
}
.notifications-badge {
position: fixed;
bottom: 10px;
left: 5px;
cursor: pointer;
height: 20px;
z-index: 20;
.badge {
margin-left: 2px;
font-weight: bold;
}
.badge.success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.badge.pending {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.badge.error {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
}
#js-copytextarea {
opacity: 0;
height: 10px;
width: 200px;
}
#app {
height: 100%;
}
/*.toaster .single-toast:nth-child(0) {
bottom: 12px;
}
.toaster .single-toast:nth-child(1) {
bottom: 102px;
}
.toaster .single-toast:nth-child(2) {
bottom: 192px;
}
.toaster .single-toast:nth-child(3) {
bottom: 282px;
}*/

1
react/src/translate/en.js

@ -1,6 +1,7 @@
export const _lang = { export const _lang = {
'EN': { 'EN': {
'INDEX': { 'INDEX': {
'EMPTY_DEBUG_LOG': 'Debug.log is empty',
'RESTART': 'Restart', 'RESTART': 'Restart',
'WALLET_INFO': 'Wallet Info', 'WALLET_INFO': 'Wallet Info',
'ADD_COIN': 'Add Coin', 'ADD_COIN': 'Add Coin',

316
react/src/util/coinHelper.js

@ -0,0 +1,316 @@
export function getCoinTitle(coin) {
let coinlogo,
coinname;
switch (coin) {
case 'BTC':
coinlogo = 'bitcoin';
coinname = 'Bitcoin';
break;
case 'BTCD':
coinlogo = 'bitcoindark';
coinname = 'BitcoinDark';
break;
case 'LTC':
coinlogo = 'litecoin';
coinname = 'Litecoin';
break;
case 'VPN':
coinlogo = 'vpncoin';
coinname = 'VPNcoin';
break;
case 'SYS':
coinlogo = 'syscoin';
coinname = 'Syscoin';
break;
case 'ZEC':
coinlogo = 'zcash';
coinname = 'Zcash';
break;
case 'NMC':
coinlogo = 'namecoin';
coinname = 'Namecoin';
break;
case 'DEX':
coinlogo = 'dex';
coinname = 'InstantDEX';
break;
case 'DOGE':
coinlogo = 'dogecoin';
coinname = 'Dogecoin';
break;
case 'DGB':
coinlogo = 'digibyte';
coinname = 'Digibyte';
break;
case 'MZC':
coinlogo = 'mazacoin';
coinname = 'Mazacoin';
break;
case 'UNO':
coinlogo = 'unobtanium';
coinname = 'Unobtanium';
break;
case 'ZET':
coinlogo = 'zetacoin';
coinname = 'Zetacoin';
break;
case 'KMD':
coinlogo = 'komodo';
coinname = 'Komodo';
break;
case 'BTM':
coinlogo = 'bitmark';
coinname = 'Bitmark';
break;
case 'CARB':
coinlogo = 'carboncoin';
coinname = 'Carboncoin';
break;
case 'ANC':
coinlogo = 'anoncoin';
coinname = 'AnonCoin';
break;
case 'FRK':
coinlogo = 'franko';
coinname = 'Franko';
break;
case 'GAME':
coinlogo = 'GAME';
coinname = 'GameCredits';
break;
case 'SUPERNET':
coinlogo = 'SUPERNET';
coinname = 'SUPERNET';
break;
case 'REVS':
coinlogo = 'REVS';
coinname = 'REVS';
break;
case 'WLC':
coinlogo = 'WLC';
coinname = 'WIRELESS';
break;
case 'PANGEA':
coinlogo = 'PANGEA';
coinname = 'PANGEA';
break;
case 'JUMBLR':
coinlogo = 'JUMBLR';
coinname = 'JUMBLR';
break;
case 'BET':
coinlogo = 'BET';
coinname = 'BET';
break;
case 'CRYPTO':
coinlogo = 'CRYPTO';
coinname = 'CRYPTO';
break;
case 'HODL':
coinlogo = 'HODL';
coinname = 'HODL';
break;
case 'SHARK':
coinlogo = 'SHARK';
coinname = 'SHARK';
break;
case 'BOTS':
coinlogo = 'BOTS';
coinname = 'BOTS';
break;
case 'MGW':
coinlogo = 'MGW';
coinname = 'MultiGateway';
break;
case 'MVP':
coinlogo = 'MVP';
coinname = 'MVP Lineup';
break;
case 'KV':
coinlogo = 'KV';
coinname = 'KV';
break;
case 'CEAL':
coinlogo = 'CEAL';
coinname = 'CEAL NET';
break;
case 'MESH':
coinlogo = 'MESH';
coinname = 'SpaceMesh';
break;
case 'USD':
coinlogo = 'usd';
coinname = 'US Dollar';
break;
case 'RON':
coinlogo = 'RON';
coinname = 'Romanian Leu';
break;
case 'EUR':
coinlogo = 'EUR';
coinname = 'Euro';
break;
case 'JPY':
coinlogo = 'JPY';
coinname = 'Japanese Yen';
break;
case 'GBP':
coinlogo = 'GBP';
coinname = 'British Pound';
break;
case 'AUD':
coinlogo = 'AUD';
coinname = 'Australian Dollar';
break;
case 'CAD':
coinlogo = 'CAD';
coinname = 'Canadian Dollar';
break;
case 'CHF':
coinlogo = 'CHF';
coinname = 'Swiss Franc';
break;
case 'NZD':
coinlogo = 'NZD';
coinname = 'New Zealand Dollar';
break;
case 'CNY':
coinlogo = 'CNY';
coinname = 'Chinese Yuan';
break;
case 'RUB':
coinlogo = 'RUB';
coinname = 'Russian Ruble';
break;
case 'MXN':
coinlogo = 'MXN';
coinname = 'Mexican peso';
break;
case 'BRL':
coinlogo = 'BRL';
coinname = 'Brazilian Real';
break;
case 'INR':
coinlogo = 'INR';
coinname = 'Indian Rupee';
break;
case 'HKD':
coinlogo = 'HKD';
coinname = 'Hong Kong Dollar';
break;
case 'TRY':
coinlogo = 'TRY';
coinname = 'Turkish Lira';
break;
case 'ZAR':
coinlogo = 'ZAR';
coinname = 'South African Rand';
break;
case 'PLN':
coinlogo = 'PLN';
coinname = 'Polish Zloty';
break;
case 'NOK':
coinlogo = 'NOK';
coinname = 'Norwegian Krone';
break;
case 'SEK':
coinlogo = 'SEK';
coinname = 'Swedish Krona';
break;
case 'DKK':
coinlogo = 'DKK';
coinname = 'Danish Krone';
break;
case 'CZK':
coinlogo = 'CZK';
coinname = 'Czech Koruna';
break;
case 'HUF':
coinlogo = 'HUF';
coinname = 'Hungarian Forint';
break;
case 'ILS':
coinlogo = 'ILS';
coinname = 'Israeli Shekel';
break;
case 'KRW':
coinlogo = 'KRW';
coinname = 'Korean Won';
break;
case 'MYR':
coinlogo = 'MYR';
coinname = 'Malaysian Ringgit';
break;
case 'PHP':
coinlogo = 'PHP';
coinname = 'Philippine Peso';
break;
case 'SGD':
coinlogo = 'SGD';
coinname = 'Singapore Dollar';
break;
case 'THB':
coinlogo = 'THB';
coinname = 'Thai Baht';
break;
case 'BGN':
coinlogo = 'BGN';
coinname = 'Bulgarian Lev';
break;
case 'IDR':
coinlogo = 'IDR';
coinname = 'Indonesian Rupiah';
break;
case 'HRK':
coinlogo = 'HRK';
coinname = 'Croatian Kuna';
break;
}
return {
'logo': coinlogo,
'name': coinname
};
}
export function getModeInfo(mode) {
let modecode,
modetip,
modecolor;
switch (mode) {
case 'native':
modecode = 'Native';
modetip = 'Native';
modecolor = 'primary';
break;
case 'basilisk':
modecode = 'Basilisk';
modetip = 'Basilisk';
modecolor = 'info';
break;
case 'full':
modecode = 'Full';
modetip = 'Full';
modecolor = 'success';
break;
case 'virtual':
modecode = 'Virtual';
modetip = 'Virtual';
modecolor = 'danger';
break;
case 'notarychains':
modecode = 'Notarychains';
modetip = 'Notarychains';
modecolor = 'dark';
break;
}
return {
'code': modecode,
'tip': modetip,
'color': modecolor
};
}

8
react/webpack.config.js

@ -122,7 +122,13 @@ if (isProduction) {
test: /\.scss$/, test: /\.scss$/,
loader: ExtractTextPlugin.extract({ loader: ExtractTextPlugin.extract({
fallback: 'style-loader', fallback: 'style-loader',
use: 'css-loader!postcss-loader!sass-loader!file-loader!url-loader', use: [
'css-loader',
'postcss-loader',
'sass-loader'
//'file-loader',
//'url-loader'
]
}), }),
} }
); );

Loading…
Cancel
Save