diff --git a/react/package.json b/react/package.json index fab8aec..9dd3a2f 100644 --- a/react/package.json +++ b/react/package.json @@ -5,8 +5,7 @@ "main": "src/index.js", "scripts": { "start": "webpack-dashboard -t 'EDEX-ReactJS' -- webpack-dev-server --colors --no-info", - "build": "rm -rf ./build && NODE_ENV=\"production\" webpack", - "build_dist": " webpack -p --config ./webpack.config.js", + "build": "rm -rf ./build && mkdir build && mkdir build/assets && cp -R src/assets build/ && NODE_ENV=\"production\" webpack", "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", "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", diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index 94da256..c53a8be 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -3,43 +3,68 @@ import 'bluebird'; import _config from '../config'; 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 { logGuiHttp, getAgamaLog, guiLogState -} from './log'; - -export * from './nativeSyncInfo'; -export * from './basiliskCache'; -export * from './nativeSend'; -export * from './coinList'; -export * from './createWallet'; -export * from './nativeTxHistory'; -export * from './nativeBalance'; -export * from './nativeNewAddress'; -export * from './logout'; -export * from './basiliskProcessAddress'; -export * from './edexGetTx'; -export * from './sendFullBasilisk'; -export * from './settings'; -export * from './syncOnly'; -export * from './iguanaInstance'; -export * from './notary'; -export * from './edexBalance'; -export * from './addCoin'; -export * from './addressBalance'; -export * from './syncInfo'; -export * from './getAddrByAccount'; -export * from './atomic'; -export * from './walletAuth'; -export * from './openAlias'; -export * from './copyAddress'; -export * from './sysInfo'; -export * from './dexCoins'; -export * from './fullTxHistory'; -export * from './basiliskTxHistory'; -export * from './iguanaHelpers'; +} from './actions/log'; + +export * from './actions/nativeSyncInfo'; +export * from './actions/basiliskCache'; +export * from './actions/nativeSend'; +export * from './actions/coinList'; +export * from './actions/createWallet'; +export * from './actions/nativeTxHistory'; +export * from './actions/nativeBalance'; +export * from './actions/nativeNewAddress'; +export * from './actions/logout'; +export * from './actions/basiliskProcessAddress'; +export * from './actions/edexGetTx'; +export * from './actions/sendFullBasilisk'; +export * from './actions/settings'; +export * from './actions/syncOnly'; +export * from './actions/iguanaInstance'; +export * from './actions/notary'; +export * from './actions/edexBalance'; +export * from './actions/addCoin'; +export * from './actions/addressBalance'; +export * from './actions/syncInfo'; +export * from './actions/getAddrByAccount'; +export * from './actions/atomic'; +export * from './actions/walletAuth'; +export * from './actions/openAlias'; +export * from './actions/copyAddress'; +export * from './actions/sysInfo'; +export * from './actions/dexCoins'; +export * from './actions/fullTxHistory'; +export * from './actions/basiliskTxHistory'; +export * from './actions/iguanaHelpers'; export let Config; @@ -51,7 +76,7 @@ try { export function changeActiveAddress(address) { return { - type: storeType.DASHBOARD_ACTIVE_ADDRESS, + type: DASHBOARD_ACTIVE_ADDRESS, address, } } @@ -64,35 +89,35 @@ export function updateErrosStack(method) { export function toggleViewCacheModal(display) { return { - type: storeType.VIEW_CACHE_DATA, + type: VIEW_CACHE_DATA, display, } } export function displayNotariesModal(display) { return { - type: storeType.DASHBOARD_DISPLAY_NOTARIES_MODAL, + type: DASHBOARD_DISPLAY_NOTARIES_MODAL, display, } } export function changeMainBasiliskAddress(address) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR, + type: DASHBOARD_ACTIVE_COIN_MAIN_BASILISK_ADDR, address, } } export function toggleDashboardActiveSection(name) { return { - type: storeType.DASHBOARD_ACTIVE_SECTION, + type: DASHBOARD_ACTIVE_SECTION, section: name, } } export function toggleDashboardTxInfoModal(display, txIndex) { return { - type: storeType.DASHBOARD_ACTIVE_TXINFO_MODAL, + type: DASHBOARD_ACTIVE_TXINFO_MODAL, showTransactionInfo: display, showTransactionInfoTxIndex: txIndex, } @@ -100,7 +125,7 @@ export function toggleDashboardTxInfoModal(display, txIndex) { export function basiliskConnectionState(display, json) { return { - type: storeType.BASILISK_CONNECTION, + type: BASILISK_CONNECTION, basiliskConnection: display, progress: json, } @@ -108,7 +133,7 @@ export function basiliskConnectionState(display, json) { export function basiliskRefreshState(display, json) { return { - type: storeType.BASILISK_REFRESH, + type: BASILISK_REFRESH, basiliskRefresh: display, progress: json, } @@ -128,7 +153,7 @@ export function basiliskConnection(display) { export function syncingNativeModeState(display, json) { return { - type: storeType.SYNCING_FULL_MODE, + type: SYNCING_FULL_MODE, syncingNativeMode: display, progress: json, } @@ -136,7 +161,7 @@ export function syncingNativeModeState(display, json) { export function syncingFullModeState(display, json) { return { - type: storeType.SYNCING_NATIVE_MODE, + type: SYNCING_NATIVE_MODE, syncingFullMode: display, progress: json, } @@ -144,21 +169,21 @@ export function syncingFullModeState(display, json) { export function toggleSendCoinFormState(display) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_SEND_FORM, + type: DASHBOARD_ACTIVE_COIN_SEND_FORM, send: display, } } export function toggleReceiveCoinFormState(display) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_RECEIVE_FORM, + type: DASHBOARD_ACTIVE_COIN_RECEIVE_FORM, receive: display, } } export function toggleSendReceiveCoinFormsState() { return { - type: storeType.DASHBOARD_ACTIVE_COIN_RESET_FORMS, + type: DASHBOARD_ACTIVE_COIN_RESET_FORMS, send: false, receive: false, } @@ -166,7 +191,7 @@ export function toggleSendReceiveCoinFormsState() { export function triggerToaster(display, message, title, _type) { return { - type: storeType.ADD_TOASTER_MESSAGE, + type: ADD_TOASTER_MESSAGE, display, message, title, @@ -177,14 +202,14 @@ export function triggerToaster(display, message, title, _type) { // triggers removing of the toast with the provided toastId export function dismissToaster(toastId) { return { - type: storeType.REMOVE_TOASTER_MESSAGE, + type: REMOVE_TOASTER_MESSAGE, toastId: toastId } } export function toggleAddcoinModalState(display, isLogin) { return { - type: storeType.DISPLAY_ADDCOIN_MODAL, + type: DISPLAY_ADDCOIN_MODAL, display: display, isLogin: isLogin, } @@ -192,7 +217,7 @@ export function toggleAddcoinModalState(display, isLogin) { export function dashboardCoinsState(json) { return { - type: storeType.GET_ACTIVE_COINS, + type: GET_ACTIVE_COINS, coins: json, 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) { return { - type: storeType.GET_MAIN_ADDRESS, + type: GET_MAIN_ADDRESS, activeHandle: json, } } @@ -225,7 +250,7 @@ export function toggleSendReceiveCoinForms() { export function dashboardChangeSectionState(sectionName) { return { - type: storeType.DASHBOARD_SECTION_CHANGE, + type: DASHBOARD_SECTION_CHANGE, activeSection: sectionName, } } @@ -238,7 +263,7 @@ export function dashboardChangeSection(sectionName) { export function dashboardChangeActiveCoinState(coin, mode) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_CHANGE, + type: DASHBOARD_ACTIVE_COIN_CHANGE, coin: coin, mode: mode, } @@ -292,7 +317,7 @@ export function setBasiliskMainAddress(json, coin, mode) { } return { - type: storeType.ACTIVE_COIN_GET_ADDRESSES, + type: ACTIVE_COIN_GET_ADDRESSES, addresses: { 'public': [] }, } } @@ -308,14 +333,14 @@ export function getNativeTxHistoryState(json) { } return { - type: storeType.DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY, + type: DASHBOARD_ACTIVE_COIN_NATIVE_TXHISTORY, txhistory: json, } } export function startInterval(name, handle) { return { - type: storeType.START_INTERVAL, + type: START_INTERVAL, name, handle, } @@ -325,7 +350,7 @@ export function stopInterval(name, intervals) { clearInterval(intervals[name]); return { - type: storeType.STOP_INTERVAL, + type: STOP_INTERVAL, name, } } \ No newline at end of file diff --git a/react/src/actions/addCoin.js b/react/src/actions/actions/addCoin.js similarity index 83% rename from react/src/actions/addCoin.js rename to react/src/actions/actions/addCoin.js index dfa13a0..de68e0a 100644 --- a/react/src/actions/addCoin.js +++ b/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 { triggerToaster, Config, toggleAddcoinModal, - getDexCoins -} from './actionCreators'; + getDexCoins, + startIguanaInstance +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -16,7 +16,7 @@ import { startCrypto, checkCoinType, checkAC -} from '../components/addcoin/payload'; +} from '../../components/addcoin/payload'; export function addCoin(coin, mode, syncOnly, port) { if (mode === '-1') { @@ -49,10 +49,10 @@ export function addCoin(coin, mode, syncOnly, port) { }; return dispatch => { - startIguanaInstance(modeToValue[mode] + '/sync', coin) + startIguanaInstance(`${modeToValue[mode]}/sync`, coin) .then(function(json) { 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)); }, 2000); }); @@ -79,12 +79,12 @@ export function iguanaAddCoin(coin, mode, acData, port) { 'timestamp': _timestamp, 'function': 'iguanaAddCoin', 'type': 'post', - 'url': 'http://127.0.0.1:' + (port ? port : Config.iguanaCorePort), + 'url': `http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, 'payload': acData, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + (port ? port : Config.iguanaCorePort), { + return fetch(`http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, { method: 'POST', body: JSON.stringify(acData), }) @@ -126,7 +126,7 @@ export function shepherdHerd(coin, mode, path) { 'ac_options': [ '-daemon=0', '-server', - '-ac_name=' + coin, + `-ac_name=${coin}`, '-addnode=78.47.196.146' ] }; @@ -160,12 +160,11 @@ export function shepherdHerd(coin, mode, path) { if (checkCoinType(coin) === 'ac') { acData = startAssetChain(path.result, coin, mode); 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 fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/herd', { + return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/herd`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -192,7 +191,7 @@ export function addCoinResult(coin, mode) { }; 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(getDexCoins()); } @@ -200,7 +199,7 @@ export function addCoinResult(coin, mode) { export function _shepherdGetConfig(coin, mode) { 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', headers: { 'Content-Type': 'application/json', @@ -220,7 +219,7 @@ export function shepherdGetConfig(coin, mode) { if (coin === 'KMD' && mode === '-1') { 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', headers: { 'Content-Type': 'application/json', @@ -236,7 +235,7 @@ export function shepherdGetConfig(coin, mode) { } } else { 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/addressBalance.js b/react/src/actions/actions/addressBalance.js similarity index 77% rename from react/src/actions/addressBalance.js rename to react/src/actions/actions/addressBalance.js index 8bf3e5f..3713e34 100644 --- a/react/src/actions/addressBalance.js +++ b/react/src/actions/actions/addressBalance.js @@ -1,10 +1,12 @@ -import * as storeType from './storeType'; +import { + ACTIVE_COIN_GET_ADDRESSES +} from '../storeType'; import { triggerToaster, Config, shepherdGroomPost, getPassthruAgent -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -12,13 +14,16 @@ import { function getKMDAddressesNativeState(json) { return { - type: storeType.ACTIVE_COIN_GET_ADDRESSES, + type: ACTIVE_COIN_GET_ADDRESSES, addresses: json, } } export function getKMDAddressesNative(coin, mode, currentAddress) { - const type = ['public', 'private']; + const type = [ + 'public', + 'private' + ]; if (mode !== 'native') { type.pop(); @@ -28,43 +33,43 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { Promise.all(type.map((_type, index) => { return new Promise((resolve, reject) => { let payload, - ajax_data_to_hex = '', - ajax_function_input = '', - tmplistaddr_hex_input = '', - passthru_agent = getPassthruAgent(coin), - tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); + ajaxFunctionInput = '', + tmplistaddrHexInput = '', + passthruAgent = getPassthruAgent(coin), + tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; if (_type === 'public') { - ajax_function_input = 'getaddressesbyaccount'; - tmplistaddr_hex_input = '222200'; + ajaxFunctionInput = 'getaddressesbyaccount'; + tmplistaddrHexInput = '222200'; } if (_type === 'private') { - ajax_function_input = 'z_listaddresses'; - tmplistaddr_hex_input = ''; + ajaxFunctionInput = 'z_listaddresses'; + tmplistaddrHexInput = ''; } - if (passthru_agent === 'iguana') { + if (passthruAgent === 'iguana') { payload = { 'userpass': tmpIguanaRPCAuth, - 'agent': passthru_agent, + 'agent': passthruAgent, 'method': 'passthru', 'asset': coin, - 'function': ajax_function_input, - 'hex': tmplistaddr_hex_input, + 'function': ajaxFunctionInput, + 'hex': tmplistaddrHexInput, }; } else { payload = { 'userpass': tmpIguanaRPCAuth, - 'agent': passthru_agent, + 'agent': passthruAgent, 'method': 'passthru', - 'function': ajax_function_input, - 'hex': tmplistaddr_hex_input, + 'function': ajaxFunctionInput, + 'hex': tmplistaddrHexInput, }; } - if (mode === 'full' || mode === 'basilisk') { + if (mode === 'full' || + mode === 'basilisk') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'coin': coin, 'agent': 'bitcoinrpc', 'method': 'getaddressesbyaccount', @@ -75,7 +80,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { if (mode === 'basilisk') { 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', headers: { 'Content-Type': 'application/json', @@ -99,12 +104,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { 'timestamp': _timestamp, 'function': 'getKMDAddressesNative', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -131,14 +136,14 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { })) .then(result => { // TODO: split into 2 functions - const passthru_agent = getPassthruAgent(coin), - tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); + const passthruAgent = getPassthruAgent(coin), + tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; let payload; - if (passthru_agent === 'iguana') { + if (passthruAgent === 'iguana') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), - 'agent': passthru_agent, + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, + 'agent': passthruAgent, 'method': 'passthru', 'asset': coin, 'function': 'listunspent', @@ -146,8 +151,8 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { }; } else { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), - 'agent': passthru_agent, + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, + 'agent': passthruAgent, 'method': 'passthru', 'function': 'listunspent', 'hex': '', @@ -156,7 +161,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { if (mode === 'full') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'coin': coin, 'method': 'listunspent', 'params': [ @@ -169,7 +174,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { // if api cache option is off if (mode === 'basilisk') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dex', 'method': 'listunspent', 'address': currentAddress, @@ -217,7 +222,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { newAddressArray[a] = []; for (let b = 0; b < result[a].length; b++) { - var filteredArray; + let filteredArray; if (mode === 'basilisk') { filteredArray = json.map(res => res.amount); @@ -226,8 +231,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { } let sum = 0; - - for (let i=0; i < filteredArray.length; i++) { + for (let i = 0; i < filteredArray.length; i++) { sum += filteredArray[i]; } @@ -247,7 +251,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { if (mode === 'basilisk') { 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', headers: { 'Content-Type': 'application/json', @@ -271,12 +275,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { 'timestamp': _timestamp, 'function': 'getKMDAddressesNative+Balance', '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, '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', body: JSON.stringify(payload), }) @@ -312,12 +316,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) { 'timestamp': _timestamp, 'function': 'getKMDAddressesNative+Balance', '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, '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', body: JSON.stringify(payload), }) diff --git a/react/src/actions/atomic.js b/react/src/actions/actions/atomic.js similarity index 81% rename from react/src/actions/atomic.js rename to react/src/actions/actions/atomic.js index 7f10461..7330d1e 100644 --- a/react/src/actions/atomic.js +++ b/react/src/actions/actions/atomic.js @@ -1,8 +1,8 @@ -import * as storeType from './storeType'; +import { ATOMIC } from '../storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -15,12 +15,12 @@ export function atomic(payload) { 'timestamp': _timestamp, 'function': 'atomic', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -47,7 +47,7 @@ export function atomic(payload) { function atomicState(json) { return { - type: storeType.ATOMIC, + type: ATOMIC, response: json, } } \ No newline at end of file diff --git a/react/src/actions/basiliskCache.js b/react/src/actions/actions/basiliskCache.js similarity index 70% rename from react/src/actions/basiliskCache.js rename to react/src/actions/actions/basiliskCache.js index 588df6c..05834b2 100644 --- a/react/src/actions/basiliskCache.js +++ b/react/src/actions/actions/basiliskCache.js @@ -1,8 +1,8 @@ -import * as storeType from './storeType'; +import { DASHBOARD_ACTIVE_COIN_GET_CACHE } from '../storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -10,7 +10,7 @@ import { export function deleteCacheFile(_payload) { 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', headers: { 'Content-Type': 'application/json', @@ -30,7 +30,7 @@ export function getCacheFile(pubkey) { const _pubkey = pubkey || JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; 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', headers: { 'Content-Type': 'application/json', @@ -46,16 +46,16 @@ export function getCacheFile(pubkey) { } export function fetchNewCacheData(_payload) { - const _userpass = '?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), - _pubkey = '&pubkey=' + _payload.pubkey, + const _userpass = `?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, + _pubkey = `&pubkey=${_payload.pubkey}`, _route = _payload.allcoins ? 'cache-all' : 'cache-one', - _coin = '&coin=' + _payload.coin, - _calls = '&calls=' + _payload.calls, - _address = _payload.address ? ('&address=' + _payload.address) : '', - _iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + (Config.iguanaCorePort + 1) : ''; + _coin = `&coin=${_payload.coin}`, + _calls = `&calls=${_payload.calls}`, + _address = _payload.address ? (`&address=${_payload.address}`) : '', + _iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : ''; 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', headers: { 'Content-Type': 'application/json', @@ -72,7 +72,7 @@ export function fetchNewCacheData(_payload) { export function getShepherdCache(pubkey, coin) { 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', headers: { 'Content-Type': 'application/json', @@ -101,23 +101,23 @@ function getShepherdCacheState(json, pubkey, coin) { } } else { 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, } } } export function fetchUtxoCache(_payload) { - const _userpass = '?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), - _pubkey = '&pubkey=' + _payload.pubkey, + const _userpass = `?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, + _pubkey = `&pubkey=${_payload.pubkey}`, _route = _payload.allcoins ? 'cache-all' : 'cache-one', - _coin = '&coin=' + _payload.coin, - _calls = '&calls=' + _payload.calls, - _address = _payload.address ? ('&address=' + _payload.address) : '', - _iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + (Config.iguanaCorePort + 1) : ''; + _coin = `&coin=${_payload.coin}`, + _calls = `&calls=${_payload.calls}`, + _address = _payload.address ? (`&address=${_payload.address}`) : '', + _iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : ''; 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', headers: { 'Content-Type': 'application/json', @@ -134,7 +134,7 @@ export function fetchUtxoCache(_payload) { export function shepherdGroomPost(_filename, _payload) { 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', headers: { 'Content-Type': 'application/json', @@ -155,7 +155,7 @@ export function shepherdGroomPost(_filename, _payload) { export function shepherdGroomPostPromise(_filename, _payload) { 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/basiliskProcessAddress.js b/react/src/actions/actions/basiliskProcessAddress.js similarity index 82% rename from react/src/actions/basiliskProcessAddress.js rename to react/src/actions/actions/basiliskProcessAddress.js index fe1582f..320296f 100644 --- a/react/src/actions/basiliskProcessAddress.js +++ b/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 { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -11,7 +10,7 @@ import { export function checkAddressBasilisk(coin, address) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dex', 'method': 'checkaddress', 'address': address, @@ -24,12 +23,12 @@ export function checkAddressBasilisk(coin, address) { 'timestamp': _timestamp, 'function': 'checkAddressBasilisk', '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, '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', body: JSON.stringify(payload), }) @@ -73,7 +72,7 @@ function checkAddressBasiliskHandle(json) { export function validateAddressBasilisk(coin, address) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dex', 'method': 'validateaddress', 'address': address, @@ -86,12 +85,12 @@ export function validateAddressBasilisk(coin, address) { 'timestamp': _timestamp, 'function': 'validateAddressBasilisk', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { + return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/basiliskTxHistory.js b/react/src/actions/actions/basiliskTxHistory.js similarity index 85% rename from react/src/actions/basiliskTxHistory.js rename to react/src/actions/actions/basiliskTxHistory.js index 50d38f4..8edcbe1 100644 --- a/react/src/actions/basiliskTxHistory.js +++ b/react/src/actions/actions/basiliskTxHistory.js @@ -1,9 +1,8 @@ -import * as storeType from './storeType'; import { triggerToaster, Config, getNativeTxHistoryState -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -13,7 +12,7 @@ export function getBasiliskTransactionsList(coin, address) { const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/coinList.js b/react/src/actions/actions/coinList.js similarity index 81% rename from react/src/actions/coinList.js rename to react/src/actions/actions/coinList.js index 0e4f31b..c17a072 100644 --- a/react/src/actions/coinList.js +++ b/react/src/actions/actions/coinList.js @@ -1,8 +1,7 @@ -import * as storeType from './storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -10,7 +9,7 @@ import { export function shepherdGetCoinList() { 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', headers: { 'Content-Type': 'application/json', @@ -27,7 +26,7 @@ export function shepherdGetCoinList() { export function shepherdPostCoinList(data) { 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/copyAddress.js b/react/src/actions/actions/copyAddress.js similarity index 66% rename from react/src/actions/copyAddress.js rename to react/src/actions/actions/copyAddress.js index 3b4dd3d..7f3f9d3 100644 --- a/react/src/actions/copyAddress.js +++ b/react/src/actions/actions/copyAddress.js @@ -1,10 +1,6 @@ -import { copyToClipboard } from '../util/copyToClipboard'; -import { translate } from '../translate/translate'; -import * as storeType from './storeType'; -import { - triggerToaster, - Config -} from './actionCreators'; +import { copyToClipboard } from '../../util/copyToClipboard'; +import { translate } from '../../translate/translate'; +import { triggerToaster } from '../actionCreators'; export function copyCoinAddress(address) { const _result = copyToClipboard(address); diff --git a/react/src/actions/createWallet.js b/react/src/actions/actions/createWallet.js similarity index 82% rename from react/src/actions/createWallet.js rename to react/src/actions/actions/createWallet.js index 425a2b6..29b2796 100644 --- a/react/src/actions/createWallet.js +++ b/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 { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -25,7 +24,7 @@ function createNewWalletState(json) { export function createNewWallet(_passphrase) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'bitcoinrpc', 'method': 'encryptwallet', 'passphrase': _passphrase, @@ -37,12 +36,12 @@ export function createNewWallet(_passphrase) { 'timestamp': _timestamp, 'function': 'createNewWallet', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/dexCoins.js b/react/src/actions/actions/dexCoins.js similarity index 79% rename from react/src/actions/dexCoins.js rename to react/src/actions/actions/dexCoins.js index 7f10dd2..eaf13c8 100644 --- a/react/src/actions/dexCoins.js +++ b/react/src/actions/actions/dexCoins.js @@ -1,9 +1,8 @@ -import * as storeType from './storeType'; import { triggerToaster, Config, dashboardCoinsState -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -11,7 +10,7 @@ import { export function getDexCoins() { const _payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'InstantDEX', 'method': 'allcoins', }; @@ -22,12 +21,12 @@ export function getDexCoins() { 'timestamp': _timestamp, 'function': 'getDexCoins', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': _payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(_payload) }) diff --git a/react/src/actions/edexBalance.js b/react/src/actions/actions/edexBalance.js similarity index 77% rename from react/src/actions/edexBalance.js rename to react/src/actions/actions/edexBalance.js index b760791..87f7aaa 100644 --- a/react/src/actions/edexBalance.js +++ b/react/src/actions/actions/edexBalance.js @@ -1,8 +1,8 @@ -import * as storeType from './storeType'; +import { DASHBOARD_ACTIVE_COIN_BALANCE } from '../storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -10,7 +10,7 @@ import { export function iguanaEdexBalance(coin) { const _payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'bitcoinrpc', 'method': 'getbalance', 'coin': coin, @@ -23,12 +23,12 @@ export function iguanaEdexBalance(coin) { 'timestamp': _timestamp, 'function': 'iguanaEdexBalance', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': _payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(_payload), }) @@ -49,7 +49,7 @@ export function iguanaEdexBalance(coin) { function iguanaEdexBalanceState(json) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_BALANCE, + type: DASHBOARD_ACTIVE_COIN_BALANCE, balance: json && json.result ? json.result : 0, } } @@ -57,7 +57,7 @@ function iguanaEdexBalanceState(json) { export function getDexBalance(coin, mode, addr) { Promise.all(addr.map((_addr, index) => { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dex', 'method': 'listunspent', 'address': _addr, @@ -70,12 +70,12 @@ export function getDexBalance(coin, mode, addr) { 'timestamp': _timestamp, 'function': 'getDexBalance', '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, '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', body: JSON.stringify(payload), }) diff --git a/react/src/actions/edexGetTx.js b/react/src/actions/actions/edexGetTx.js similarity index 77% rename from react/src/actions/edexGetTx.js rename to react/src/actions/actions/edexGetTx.js index 8cd1139..21336cc 100644 --- a/react/src/actions/edexGetTx.js +++ b/react/src/actions/actions/edexGetTx.js @@ -1,16 +1,15 @@ -import * as storeType from './storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState } from './log'; -export function edexGetTransaction(data) { +export function edexGetTransaction(data, dispatch) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'symbol': data.coin, 'agent': 'dex', 'method': 'gettransaction', @@ -24,12 +23,12 @@ export function edexGetTransaction(data) { 'timestamp': _timestamp, 'function': 'edexGetTransaction', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/fullTxHistory.js b/react/src/actions/actions/fullTxHistory.js similarity index 80% rename from react/src/actions/fullTxHistory.js rename to react/src/actions/actions/fullTxHistory.js index f73492e..bfc266f 100644 --- a/react/src/actions/fullTxHistory.js +++ b/react/src/actions/actions/fullTxHistory.js @@ -1,9 +1,8 @@ -import * as storeType from './storeType'; import { triggerToaster, Config, getNativeTxHistoryState -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -11,7 +10,7 @@ import { export function getFullTransactionsList(coin) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'coin': coin, 'method': 'listtransactions', 'params': [ @@ -27,12 +26,12 @@ export function getFullTransactionsList(coin) { 'timestamp': _timestamp, 'function': 'getFullTransactionsList', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/getAddrByAccount.js b/react/src/actions/actions/getAddrByAccount.js similarity index 83% rename from react/src/actions/getAddrByAccount.js rename to react/src/actions/actions/getAddrByAccount.js index f1238d0..4e4cfb1 100644 --- a/react/src/actions/getAddrByAccount.js +++ b/react/src/actions/actions/getAddrByAccount.js @@ -1,8 +1,8 @@ -import * as storeType from './storeType'; +import { ACTIVE_COIN_GET_ADDRESSES } from '../storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -24,14 +24,14 @@ export function getAddressesByAccountState(json, coin, mode) { } return { - type: storeType.ACTIVE_COIN_GET_ADDRESSES, + type: ACTIVE_COIN_GET_ADDRESSES, addresses: { 'public': json.result }, } } export function getAddressesByAccount(coin, mode) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'coin': coin, 'agent': 'bitcoinrpc', 'method': 'getaddressesbyaccount', @@ -44,12 +44,12 @@ export function getAddressesByAccount(coin, mode) { 'timestamp': _timestamp, 'function': 'getAddressesByAccount', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/iguanaHelpers.js b/react/src/actions/actions/iguanaHelpers.js similarity index 80% rename from react/src/actions/iguanaHelpers.js rename to react/src/actions/actions/iguanaHelpers.js index 97b8371..3f36266 100644 --- a/react/src/actions/iguanaHelpers.js +++ b/react/src/actions/actions/iguanaHelpers.js @@ -1,13 +1,12 @@ -import * as storeType from './storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState } from './log'; -import { checkAC } from '../components/addcoin/payload'; +import { checkAC } from '../../components/addcoin/payload'; export function getPassthruAgent(coin) { let passthruAgent; @@ -22,7 +21,7 @@ export function getPassthruAgent(coin) { export function iguanaHashHex(data, dispatch) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'hash', 'method': 'hex', 'message': data, @@ -34,12 +33,12 @@ export function iguanaHashHex(data, dispatch) { 'timestamp': _timestamp, 'function': 'iguanaHashHex', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/iguanaInstance.js b/react/src/actions/actions/iguanaInstance.js similarity index 85% rename from react/src/actions/iguanaInstance.js rename to react/src/actions/actions/iguanaInstance.js index 4a6adfd..04c817b 100644 --- a/react/src/actions/iguanaInstance.js +++ b/react/src/actions/actions/iguanaInstance.js @@ -1,8 +1,7 @@ -import * as storeType from './storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -10,7 +9,7 @@ import { export function restartIguanaInstance(pmid) { 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', headers: { 'Content-Type': 'application/json', @@ -43,7 +42,7 @@ export function restartBasiliskInstance() { export function startIguanaInstance(mode, coin) { 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', headers: { 'Content-Type': 'application/json', @@ -64,7 +63,7 @@ export function startIguanaInstance(mode, coin) { export function getIguanaInstancesList() { 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/log.js b/react/src/actions/actions/log.js similarity index 80% rename from react/src/actions/log.js rename to react/src/actions/actions/log.js index 51e17ba..eda0db6 100644 --- a/react/src/actions/log.js +++ b/react/src/actions/actions/log.js @@ -1,15 +1,15 @@ -import * as storeType from './storeType'; +import { LOG_GUI_HTTP } from '../storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; export function logGuiHttp(payload) { return dispatch => { dispatch(guiLogState(payload)); // 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', headers: { 'Content-Type': 'application/json', @@ -26,7 +26,7 @@ export function logGuiHttp(payload) { export function getAgamaLog(type) { 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', headers: { 'Content-Type': 'application/json', @@ -43,7 +43,7 @@ export function getAgamaLog(type) { export function guiLogState(logData) { return { - type: storeType.LOG_GUI_HTTP, + type: LOG_GUI_HTTP, timestamp: logData.timestamp, log: { timestamp: logData.timestamp, diff --git a/react/src/actions/logout.js b/react/src/actions/actions/logout.js similarity index 80% rename from react/src/actions/logout.js rename to react/src/actions/actions/logout.js index bfeb1e2..d391b89 100644 --- a/react/src/actions/logout.js +++ b/react/src/actions/actions/logout.js @@ -1,8 +1,8 @@ -import * as storeType from './storeType'; +import { LOGIN } from '../storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -12,7 +12,7 @@ function logoutState(json, dispatch) { sessionStorage.removeItem('IguanaActiveAccount'); return { - type: storeType.LOGIN, + type: LOGIN, isLoggedIn: false, } } @@ -25,7 +25,7 @@ export function logout() { function walletLock() { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'bitcoinrpc', 'method': 'walletlock', }; @@ -36,12 +36,12 @@ function walletLock() { 'timestamp': _timestamp, 'function': 'walletLock', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/nativeBalance.js b/react/src/actions/actions/nativeBalance.js similarity index 78% rename from react/src/actions/nativeBalance.js rename to react/src/actions/actions/nativeBalance.js index f8931b2..2819d52 100644 --- a/react/src/actions/nativeBalance.js +++ b/react/src/actions/actions/nativeBalance.js @@ -1,9 +1,9 @@ -import * as storeType from './storeType'; +import { DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE } from '../storeType'; import { triggerToaster, Config, getPassthruAgent -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -15,7 +15,7 @@ export function getKMDBalanceTotal(coin) { if (coin !== 'KMD' && coin !== 'ZEC') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'iguana', 'method': 'passthru', 'asset': coin, @@ -24,7 +24,7 @@ export function getKMDBalanceTotal(coin) { }; } else { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': getPassthruAgent(coin), 'method': 'passthru', 'function': 'z_gettotalbalance', @@ -38,12 +38,12 @@ export function getKMDBalanceTotal(coin) { 'timestamp': _timestamp, 'function': 'getKMDBalanceTotal', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -73,7 +73,7 @@ export function getKMDBalanceTotal(coin) { export function getNativeBalancesState(json) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE, + type: DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE, balance: json && !json.error ? json : 0, } } \ No newline at end of file diff --git a/react/src/actions/nativeNewAddress.js b/react/src/actions/actions/nativeNewAddress.js similarity index 77% rename from react/src/actions/nativeNewAddress.js rename to react/src/actions/actions/nativeNewAddress.js index 93f3425..965fb9a 100644 --- a/react/src/actions/nativeNewAddress.js +++ b/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 { triggerToaster, Config, getPassthruAgent -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -19,22 +18,22 @@ function handleGetNewKMDAddresses(pubpriv, coin, dispatch) { export function getNewKMDAddresses(coin, pubpriv) { let payload, - ajax_function_input = ''; + ajaxFunctionInput = ''; if (pubpriv === 'public') { - ajax_function_input = 'getnewaddress'; + ajaxFunctionInput = 'getnewaddress'; } if (pubpriv === 'private') { - ajax_function_input = 'z_getnewaddress'; + ajaxFunctionInput = 'z_getnewaddress'; } if (getPassthruAgent(coin) === 'iguana') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': getPassthruAgent(coin), 'method': 'passthru', 'asset': coin, - 'function': ajax_function_input, + 'function': ajaxFunctionInput, 'hex': '', }; } else { @@ -42,7 +41,7 @@ export function getNewKMDAddresses(coin, pubpriv) { 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'agent': coin, 'method': 'passthru', - 'function': ajax_function_input, + 'function': ajaxFunctionInput, 'hex': '', }; } @@ -53,12 +52,12 @@ export function getNewKMDAddresses(coin, pubpriv) { 'timestamp': _timestamp, 'function': 'getNewKMDAddresses', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/nativeSend.js b/react/src/actions/actions/nativeSend.js similarity index 67% rename from react/src/actions/nativeSend.js rename to react/src/actions/actions/nativeSend.js index 4d005d4..51bd2fd 100644 --- a/react/src/actions/nativeSend.js +++ b/react/src/actions/actions/nativeSend.js @@ -1,34 +1,34 @@ -import * as storeType from './storeType'; -import { translate } from '../translate/translate'; +import { DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS } from '../storeType'; +import { translate } from '../../translate/translate'; import { triggerToaster, Config, getPassthruAgent, iguanaHashHex -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState } from './log'; export function sendNativeTx(coin, _payload) { - let ajax_data_to_hex; + let ajaxDataToHex; let payload; let _apiMethod; if (_payload.addressType === 'public') { _apiMethod = 'sendtoaddress'; - ajax_data_to_hex = '["' + _payload.sendTo + '", ' + (Number(_payload.amount) - Number(_payload.fee)) + ']'; + ajaxDataToHex = `["${_payload.sendTo}", ${Number(_payload.amount) - Number(_payload.fee)}]`; } else { _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 iguanaHashHex(ajax_data_to_hex, dispatch).then((hashHexJson) => { + return iguanaHashHex(ajaxDataToHex, dispatch).then((hashHexJson) => { if (getPassthruAgent(coin) === 'iguana') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': getPassthruAgent(coin), 'method': 'passthru', 'asset': coin, @@ -37,7 +37,7 @@ export function sendNativeTx(coin, _payload) { }; } else { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': getPassthruAgent(coin), 'method': 'passthru', 'function': _apiMethod, @@ -50,12 +50,12 @@ export function sendNativeTx(coin, _payload) { 'timestamp': _timestamp, 'function': 'sendNativeTx', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -68,7 +68,16 @@ export function sendNativeTx(coin, _payload) { })); 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) { dispatch(logGuiHttp({ 'timestamp': _timestamp, @@ -83,45 +92,41 @@ export function sendNativeTx(coin, _payload) { 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) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS, + type: DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS, opids: json, } } export function getKMDOPID(opid, coin) { - let tmpopid_output = '', - ajax_data_to_hex; + let tmpopidOutput = '', + ajaxDataToHex; if (opid === undefined) { - ajax_data_to_hex = null; + ajaxDataToHex = null; } else { - ajax_data_to_hex = '["' + opid + '"]'; + ajaxDataToHex = `["${opid}"]`; } return dispatch => { - return iguanaHashHex(ajax_data_to_hex, dispatch).then((hashHexJson) => { + return iguanaHashHex(ajaxDataToHex, dispatch).then((hashHexJson) => { if (hashHexJson === '5b226e756c6c225d00') { hashHexJson = ''; } let payload, - passthru_agent = getPassthruAgent(coin), - tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); + passthruAgent = getPassthruAgent(coin), + tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`; - if (passthru_agent == 'iguana') { + if (passthruAgent == 'iguana') { payload = { 'userpass': tmpIguanaRPCAuth, - 'agent': passthru_agent, + 'agent': passthruAgent, 'method': 'passthru', 'asset': coin, 'function': 'z_getoperationstatus', @@ -130,7 +135,7 @@ export function getKMDOPID(opid, coin) { } else { payload = { 'userpass': tmpIguanaRPCAuth, - 'agent': passthru_agent, + 'agent': passthruAgent, 'method': 'passthru', 'function': 'z_getoperationstatus', 'hex': hashHexJson, @@ -142,12 +147,12 @@ export function getKMDOPID(opid, coin) { 'timestamp': _timestamp, 'function': 'getKMDOPID', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js similarity index 78% rename from react/src/actions/nativeSyncInfo.js rename to react/src/actions/actions/nativeSyncInfo.js index 5c0aa85..042842a 100644 --- a/react/src/actions/nativeSyncInfo.js +++ b/react/src/actions/actions/nativeSyncInfo.js @@ -1,10 +1,10 @@ -import * as storeType from './storeType'; +import { SYNCING_NATIVE_MODE } from '../storeType'; import { triggerToaster, Config, getPassthruAgent, getDebugLog -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -19,12 +19,12 @@ export function getSyncInfoNativeKMD(skipDebug) { 'timestamp': _timestamp, 'function': 'getSyncInfoNativeKMD', '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': '', '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', }) .catch(function(error) { @@ -60,7 +60,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) { return getSyncInfoNativeKMD(skipDebug); } else { return { - type: storeType.SYNCING_NATIVE_MODE, + type: SYNCING_NATIVE_MODE, progress: json, } } @@ -68,7 +68,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) { export function getSyncInfoNative(coin, skipDebug) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': getPassthruAgent(coin), 'method': 'passthru', 'asset': coin, @@ -82,12 +82,12 @@ export function getSyncInfoNative(coin, skipDebug) { 'timestamp': _timestamp, 'function': 'getSyncInfo', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/nativeTxHistory.js b/react/src/actions/actions/nativeTxHistory.js similarity index 79% rename from react/src/actions/nativeTxHistory.js rename to react/src/actions/actions/nativeTxHistory.js index 2b45e07..5e86753 100644 --- a/react/src/actions/nativeTxHistory.js +++ b/react/src/actions/actions/nativeTxHistory.js @@ -1,10 +1,9 @@ -import * as storeType from './storeType'; import { triggerToaster, Config, getPassthruAgent, getNativeTxHistoryState -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -15,7 +14,7 @@ export function getNativeTxHistory(coin) { if (getPassthruAgent(coin) === 'iguana') { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'iguana', 'method': 'passthru', 'asset': coin, @@ -24,7 +23,7 @@ export function getNativeTxHistory(coin) { }; } else { payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': getPassthruAgent(coin), 'method': 'passthru', 'function': 'listtransactions', @@ -38,12 +37,12 @@ export function getNativeTxHistory(coin) { 'timestamp': _timestamp, 'function': 'getNativeTxHistory', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/notary.js b/react/src/actions/actions/notary.js similarity index 74% rename from react/src/actions/notary.js rename to react/src/actions/actions/notary.js index 2582b70..591df50 100644 --- a/react/src/actions/notary.js +++ b/react/src/actions/actions/notary.js @@ -1,9 +1,12 @@ -import * as storeType from './storeType'; -import { translate } from '../translate/translate'; +import { + DASHBOARD_CONNECT_NOTARIES, + DASHBOARD_GET_NOTARIES_LIST +} from '../storeType'; +import { translate } from '../../translate/translate'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -13,7 +16,7 @@ function initNotaryNodesConSequence(nodes) { return dispatch => { Promise.all(nodes.map((node, index) => { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dex', 'method': 'getinfo', 'symbol': node, @@ -24,14 +27,14 @@ function initNotaryNodesConSequence(nodes) { const _timestamp = Date.now(); dispatch(logGuiHttp({ 'timestamp': _timestamp, - 'function': 'initNotaryNodesConSequence+' + node, + 'function': `initNotaryNodesConSequence+${node}`, 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort) + '/api/dex/getinfo?userpass=' + ('tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth')) + '&symbol=' + node, { + fetch(`http://127.0.0.1:${(Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}/api/dex/getinfo?userpass=${('tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'))}&symbol=${node}`, { method: 'GET', }) .catch(function(error) { @@ -41,7 +44,7 @@ function initNotaryNodesConSequence(nodes) { 'status': 'error', 'response': error, })); - dispatch(triggerToaster(true, 'getInfoDexNode+' + node, 'Error', 'error')); + dispatch(triggerToaster(true, `getInfoDexNode+${node}`, 'Error', 'error')); }) .then(response => response.json()) .then(json => { @@ -66,7 +69,7 @@ function updateNotaryNodeConState(json, totalNodes, currentNodeIndex, currentNod if (json && json.error === 'less than required responses') { return { - type: storeType.DASHBOARD_CONNECT_NOTARIES, + type: DASHBOARD_CONNECT_NOTARIES, total: totalNodes - 1, current: currentNodeIndex, name: currentNodeName, @@ -74,7 +77,7 @@ function updateNotaryNodeConState(json, totalNodes, currentNodeIndex, currentNod } } else { return { - type: storeType.DASHBOARD_CONNECT_NOTARIES, + type: DASHBOARD_CONNECT_NOTARIES, total: totalNodes - 1, current: currentNodeIndex, name: currentNodeName, @@ -89,7 +92,7 @@ function connectAllNotaryNodes(json, dispatch) { dispatch(initNotaryNodesConSequence(json)); return { - type: storeType.DASHBOARD_CONNECT_NOTARIES, + type: DASHBOARD_CONNECT_NOTARIES, total: json.length - 1, current: 0, name: json[0], @@ -99,13 +102,13 @@ function connectAllNotaryNodes(json, dispatch) { export function connectNotaries() { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dpow', 'method': 'notarychains', }; return dispatch => { - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -125,7 +128,7 @@ function getDexNotariesState(json) { } } else { return { - type: storeType.DASHBOARD_GET_NOTARIES_LIST, + type: DASHBOARD_GET_NOTARIES_LIST, notaries: json, } } @@ -133,7 +136,7 @@ function getDexNotariesState(json) { export function getDexNotaries(coin) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dex', 'method': 'getnotaries', 'symbol': coin, @@ -145,11 +148,11 @@ export function getDexNotaries(coin) { 'timestamp': _timestamp, 'function': 'getDexNotaries', '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, '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', body: JSON.stringify(payload), }) diff --git a/react/src/actions/openAlias.js b/react/src/actions/actions/openAlias.js similarity index 82% rename from react/src/actions/openAlias.js rename to react/src/actions/actions/openAlias.js index a9037f1..d562e4f 100644 --- a/react/src/actions/openAlias.js +++ b/react/src/actions/actions/openAlias.js @@ -1,8 +1,4 @@ -import * as storeType from './storeType'; -import { - triggerToaster, - Config -} from './actionCreators'; +import { triggerToaster } from '../actionCreators'; import { logGuiHttp, guiLogState diff --git a/react/src/actions/sendFullBasilisk.js b/react/src/actions/actions/sendFullBasilisk.js similarity index 80% rename from react/src/actions/sendFullBasilisk.js rename to react/src/actions/actions/sendFullBasilisk.js index 2ce0ce5..282f6d4 100644 --- a/react/src/actions/sendFullBasilisk.js +++ b/react/src/actions/actions/sendFullBasilisk.js @@ -1,9 +1,10 @@ -import * as storeType from './storeType'; -import { translate } from '../translate/translate'; +import { DASHBOARD_ACTIVE_COIN_SENDTO } from '../storeType'; +import { translate } from '../../translate/translate'; import { triggerToaster, - Config -} from './actionCreators'; + Config, + getDispatch +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -11,7 +12,7 @@ import { export function sendToAddress(coin, _payload) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'coin': coin, 'method': 'sendtoaddress', 'params': [ @@ -28,12 +29,12 @@ export function sendToAddress(coin, _payload) { 'timestamp': _timestamp, 'function': 'sendToAddress', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -60,7 +61,7 @@ export function sendToAddress(coin, _payload) { export function sendFromAddress(coin, _payload) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'coin': coin, 'method': 'sendfrom', 'params': [ @@ -78,12 +79,12 @@ export function sendFromAddress(coin, _payload) { 'timestamp': _timestamp, 'function': 'sendFromAddress', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -108,9 +109,9 @@ export function sendFromAddress(coin, _payload) { } } -export function iguanaUTXORawTX(data) { +export function iguanaUTXORawTX(data, dispatch) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'symbol': data.coin, 'agent': 'basilisk', 'method': 'utxorawtx', @@ -124,7 +125,6 @@ export function iguanaUTXORawTX(data) { }, 'utxos': data.utxos, }; - console.log('iguanaUTXORawTXExport', payload); return new Promise((resolve, reject) => { const _timestamp = Date.now(); @@ -132,18 +132,18 @@ export function iguanaUTXORawTX(data) { 'timestamp': _timestamp, 'function': 'iguanaUTXORawTX', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) .catch(function(error) { console.log(error); - dispatch(logGuiHttp({ + dispatch => dispatch(logGuiHttp({ 'timestamp': _timestamp, 'status': 'error', 'response': error, @@ -162,9 +162,9 @@ export function iguanaUTXORawTX(data) { }); } -export function dexSendRawTX(data) { +export function dexSendRawTX(data, dispatch) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'dex', 'method': 'sendrawtransaction', 'signedtx': data.signedtx, @@ -177,7 +177,7 @@ export function dexSendRawTX(data) { 'timestamp': _timestamp, 'function': 'dexSendRawTX', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); @@ -217,14 +217,14 @@ function sendToAddressState(json, dispatch) { dispatch(triggerToaster(true, json.error, 'Error', 'error')); return { - type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, + type: DASHBOARD_ACTIVE_COIN_SENDTO, lastSendToResponse: json, } } else if (json && json.result && json.complete) { dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success')); return { - type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, + type: DASHBOARD_ACTIVE_COIN_SENDTO, lastSendToResponse: json, } } @@ -232,14 +232,14 @@ function sendToAddressState(json, dispatch) { export function sendToAddressStateAlt(json) { return { - type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, + type: DASHBOARD_ACTIVE_COIN_SENDTO, lastSendToResponse: json, } } export function clearLastSendToResponseState() { return { - type: storeType.DASHBOARD_ACTIVE_COIN_SENDTO, + type: DASHBOARD_ACTIVE_COIN_SENDTO, lastSendToResponse: null, } } \ No newline at end of file diff --git a/react/src/actions/settings.js b/react/src/actions/actions/settings.js similarity index 85% rename from react/src/actions/settings.js rename to react/src/actions/actions/settings.js index 25d7832..5efe2e5 100644 --- a/react/src/actions/settings.js +++ b/react/src/actions/actions/settings.js @@ -1,9 +1,15 @@ -import * as storeType from './storeType'; -import { translate } from '../translate/translate'; +import { + LOAD_APP_INFO, + GET_WIF_KEY, + GET_DEBUG_LOG, + GET_PEERS_LIST, + LOAD_APP_CONFIG +} from '../storeType'; +import { translate } from '../../translate/translate'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -11,14 +17,14 @@ import { function getAppInfoState(json) { return { - type: storeType.LOAD_APP_INFO, + type: LOAD_APP_INFO, info: json, } } export function getAppInfo() { 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', headers: { 'Content-Type': 'application/json', @@ -35,8 +41,8 @@ export function getAppInfo() { export function settingsWifkeyState(json, coin) { return { - type: storeType.GET_WIF_KEY, - wifkey: json[coin + 'wif'], + type: GET_WIF_KEY, + wifkey: json[`{$coin}wif`], address: json[coin], } } @@ -63,7 +69,7 @@ function parseImportPrivKeyResponse(json, dispatch) { export function importPrivKey(wifKey) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'method': 'importprivkey', 'params': [ wifKey, @@ -77,12 +83,12 @@ export function importPrivKey(wifKey) { 'timestamp': _timestamp, 'function': 'importPrivKey', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -117,7 +123,7 @@ function getDebugLogState(json) { const _data = json.result.replace('\n', '\r\n'); return { - type: storeType.GET_DEBUG_LOG, + type: GET_DEBUG_LOG, data: _data, } } @@ -129,7 +135,7 @@ export function getDebugLog(target, linesCount) { }; 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', headers: { 'Content-Type': 'application/json', @@ -147,7 +153,7 @@ export function getDebugLog(target, linesCount) { export function getPeersList(coin) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'SuperNET', 'method': 'getpeers', 'activecoin': coin, @@ -159,12 +165,12 @@ export function getPeersList(coin) { 'timestamp': _timestamp, 'function': 'getPeersList', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -201,7 +207,7 @@ export function getPeersListState(json) { } return { - type: storeType.GET_PEERS_LIST, + type: GET_PEERS_LIST, supernetPeers: json && json.supernet[0] ? json.supernet : null, rawPeers: peersList, } @@ -232,7 +238,7 @@ function addPeerNodeState(json, dispatch) { export function addPeerNode(coin, ip) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'iguana', 'method': 'addnode', 'activecoin': coin, @@ -245,12 +251,12 @@ export function addPeerNode(coin, ip) { 'timestamp': _timestamp, 'function': 'addPeerNode', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -277,7 +283,7 @@ export function addPeerNode(coin, ip) { export function saveAppConfig(_payload) { 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', headers: { 'Content-Type': 'application/json', @@ -295,14 +301,14 @@ export function saveAppConfig(_payload) { function getAppConfigState(json) { return { - type: storeType.LOAD_APP_CONFIG, + type: LOAD_APP_CONFIG, config: json, } } export function getAppConfig() { 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/syncInfo.js b/react/src/actions/actions/syncInfo.js similarity index 82% rename from react/src/actions/syncInfo.js rename to react/src/actions/actions/syncInfo.js index 7a07627..a9ff460 100644 --- a/react/src/actions/syncInfo.js +++ b/react/src/actions/actions/syncInfo.js @@ -1,8 +1,8 @@ -import * as storeType from './storeType'; +import { SYNCING_FULL_MODE } from '../storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -18,14 +18,14 @@ function getSyncInfoState(json) { } return { - type: storeType.SYNCING_FULL_MODE, + type: SYNCING_FULL_MODE, progress: json, } } export function getSyncInfo(coin) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'coin': coin, 'agent': 'bitcoinrpc', 'method': 'getinfo', @@ -37,12 +37,12 @@ export function getSyncInfo(coin) { 'timestamp': _timestamp, 'function': 'getSyncInfo', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) diff --git a/react/src/actions/syncOnly.js b/react/src/actions/actions/syncOnly.js similarity index 74% rename from react/src/actions/syncOnly.js rename to react/src/actions/actions/syncOnly.js index 0415818..d43e29b 100644 --- a/react/src/actions/syncOnly.js +++ b/react/src/actions/actions/syncOnly.js @@ -1,9 +1,12 @@ -import * as storeType from './storeType'; -import { translate } from '../translate/translate'; +import { + SYNC_ONLY_MODAL_TOGGLE, + SYNC_ONLY_DATA +} from '../storeType'; +import { translate } from '../../translate/translate'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -11,21 +14,21 @@ import { export function toggleSyncOnlyModal(display) { return { - type: storeType.SYNC_ONLY_MODAL_TOGGLE, + type: SYNC_ONLY_MODAL_TOGGLE, display, } } function getSyncOnlyForksState(json) { return { - type: storeType.SYNC_ONLY_DATA, + type: SYNC_ONLY_DATA, forks: JSON.parse(json.result), } } export function getSyncOnlyForks() { 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', headers: { 'Content-Type': 'application/json', @@ -42,7 +45,7 @@ export function getSyncOnlyForks() { export function stopIguanaFork(pmid) { 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/sysInfo.js b/react/src/actions/actions/sysInfo.js similarity index 75% rename from react/src/actions/sysInfo.js rename to react/src/actions/actions/sysInfo.js index b652a27..42f601d 100644 --- a/react/src/actions/sysInfo.js +++ b/react/src/actions/actions/sysInfo.js @@ -1,8 +1,7 @@ -import * as storeType from './storeType'; import { triggerToaster, Config -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -10,7 +9,7 @@ import { export function shepherdGetSysInfo() { 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', headers: { 'Content-Type': 'application/json', diff --git a/react/src/actions/walletAuth.js b/react/src/actions/actions/walletAuth.js similarity index 83% rename from react/src/actions/walletAuth.js rename to react/src/actions/actions/walletAuth.js index 19dfe6a..a9fe0a7 100644 --- a/react/src/actions/walletAuth.js +++ b/react/src/actions/actions/walletAuth.js @@ -1,11 +1,14 @@ -import * as storeType from './storeType'; -import { translate } from '../translate/translate'; +import { + LOGIN, + ACTIVE_HANDLE +} from '../storeType'; +import { translate } from '../../translate/translate'; import { triggerToaster, Config, getMainAddressState, updateErrosStack -} from './actionCreators'; +} from '../actionCreators'; import { logGuiHttp, guiLogState @@ -13,7 +16,7 @@ import { export function encryptWallet(_passphrase, cb, coin) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'bitcoinrpc', 'method': 'encryptwallet', 'passphrase': _passphrase, @@ -25,12 +28,12 @@ export function encryptWallet(_passphrase, cb, coin) { 'timestamp': _timestamp, 'function': 'encryptWallet', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -58,7 +61,7 @@ export function encryptWallet(_passphrase, cb, coin) { export function walletPassphrase(_passphrase) { const payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'bitcoinrpc', 'method': 'walletpassphrase', 'password': _passphrase, @@ -71,12 +74,12 @@ export function walletPassphrase(_passphrase) { 'timestamp': _timestamp, 'function': 'walletpassphrase', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(payload), }) @@ -101,7 +104,7 @@ export function walletPassphrase(_passphrase) { export function iguanaWalletPassphrase(_passphrase) { const _payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'handle': '', 'password': _passphrase, 'timeout': '2592000', @@ -115,12 +118,12 @@ export function iguanaWalletPassphrase(_passphrase) { 'timestamp': _timestamp, 'function': 'iguanaWalletPassphrase', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': _payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(_payload), }) @@ -147,7 +150,7 @@ export function iguanaWalletPassphrase(_passphrase) { export function iguanaActiveHandle(getMainAddress) { const _payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'SuperNET', 'method': 'activehandle', }; @@ -158,12 +161,12 @@ export function iguanaActiveHandle(getMainAddress) { 'timestamp': _timestamp, 'function': 'iguanaActiveHandle', 'type': 'post', - 'url': 'http://127.0.0.1:' + Config.iguanaCorePort, + 'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'payload': _payload, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { method: 'POST', body: JSON.stringify(_payload), }) @@ -196,14 +199,14 @@ function iguanaWalletPassphraseState(json, dispatch) { dispatch(iguanaActiveHandleState(json)); return { - type: storeType.LOGIN, + type: LOGIN, isLoggedIn: json && json.pubkey ? true : false, } } function iguanaActiveHandleState(json) { 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, handle: json, } diff --git a/react/src/components/addcoin/addcoin.js b/react/src/components/addcoin/addcoin.js index 5efdf56..e3f54b0 100644 --- a/react/src/components/addcoin/addcoin.js +++ b/react/src/components/addcoin/addcoin.js @@ -97,12 +97,12 @@ class AddCoin extends React.Component { modalClassName: props.display ? 'show fade' : 'show fade', })); - setTimeout(function() { + setTimeout(() => { this.setState(Object.assign({}, this.state, { display: props.display, 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++) { const _item = this.state.coins[i]; - setTimeout(function() { + setTimeout(() => { Store.dispatch(addCoin( _item.selectedCoin.split('|')[0], _item.mode, @@ -237,7 +237,7 @@ class AddCoin extends React.Component { Store.dispatch(toggleAddcoinModal(false, false)); } - }.bind(this), 2000 * i); + }, 2000 * i); } } @@ -249,7 +249,7 @@ class AddCoin extends React.Component { const _coin = _item.selectedCoin || ''; items.push( -
+
+ onChange={ this.updateSelectedAPI }> { this.renderAtomicOptions() } diff --git a/react/src/components/dashboard/coinTile.js b/react/src/components/dashboard/coinTile.js index 4ca8c9f..bb44c56 100755 --- a/react/src/components/dashboard/coinTile.js +++ b/react/src/components/dashboard/coinTile.js @@ -1,5 +1,9 @@ import React from 'react'; import { translate } from '../../translate/translate'; +import { + getCoinTitle, + getModeInfo +} from '../../util/coinHelper'; import CoinTileItem from './coinTileItem'; class CoinTile extends React.Component { @@ -17,311 +21,20 @@ class CoinTile extends React.Component { 'full' ]; 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) { allCoins[mode].map(function(coin) { - var coinlogo = '', - coinname = '', - modecode = '', - modetip = '', - modecolor = ''; + const _coinMode = getModeInfo(mode), + modecode = _coinMode.code, + modetip = _coinMode.tip, + modecolor = _coinMode.color; - 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; - } - - 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; - } + const _coinTitle = getCoinTitle(coin), + coinlogo = _coinTitle.logo, + coinname = _coinTitle.name; items.push({ coinlogo, diff --git a/react/src/components/dashboard/coinTileItem.js b/react/src/components/dashboard/coinTileItem.js index 89049b7..5b5a40e 100644 --- a/react/src/components/dashboard/coinTileItem.js +++ b/react/src/components/dashboard/coinTileItem.js @@ -21,6 +21,11 @@ import { } from '../../actions/actionCreators'; 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 { constructor(props) { super(props); @@ -39,10 +44,13 @@ class CoinTileItem extends React.Component { dispatchCoinActions(coin, mode) { if (mode === 'native') { 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 && this.props.Dashboard.progress.blocks && 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(getKMDBalanceTotal(coin)); Store.dispatch(getNativeTxHistory(coin)); @@ -61,6 +69,7 @@ class CoinTileItem extends React.Component { } if (mode === 'basilisk') { const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin]; + Store.dispatch(iguanaActiveHandle(true)); Store.dispatch(getKMDAddressesNative(coin, mode, useAddress)); Store.dispatch(getShepherdCache(JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey, coin)); @@ -72,8 +81,8 @@ class CoinTileItem extends React.Component { if (!this.props.ActiveCoin.addresses) { Store.dispatch(getAddressesByAccount(coin, mode)); } + Store.dispatch(getBasiliskTransactionsList(coin, useAddress)); - //Store.dispatch(iguanaEdexBalance(coin, mode)); } } } @@ -87,16 +96,15 @@ class CoinTileItem extends React.Component { this.dispatchCoinActions(coin, mode); if (mode === 'full') { - var _iguanaActiveHandle = setInterval(function() { + const _iguanaActiveHandle = setInterval(() => { this.dispatchCoinActions(coin, mode); - }.bind(this), 3000); + }, IGUNA_ACTIVE_HANDLE_TIMEOUT); Store.dispatch(startInterval('sync', _iguanaActiveHandle)); } if (mode === 'native') { - // TODO: add conditions to skip txhistory, balances, addresses while "activating best chain" - var _iguanaActiveHandle = setInterval(function() { + const _iguanaActiveHandle = setInterval(() => { 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)); } if (mode === 'basilisk') { @@ -112,11 +120,11 @@ class CoinTileItem extends React.Component { 'address': _basiliskMainAddress, })); - var _iguanaActiveHandle = setInterval(function() { + const _iguanaActiveHandle = setInterval(() => { this.dispatchCoinActions(coin, mode); - }.bind(this), 3000); + }, IGUNA_ACTIVE_HANDLE_TIMEOUT); - var _basiliskCache = setInterval(function() { + const _basiliskCache = setInterval(() => { Store.dispatch(fetchNewCacheData({ 'pubkey': this.props.Dashboard.activeHandle.pubkey, 'allcoins': false, @@ -124,10 +132,9 @@ class CoinTileItem extends React.Component { 'calls': 'listtransactions:getbalance', 'address': _basiliskMainAddress, })); - }.bind(this), 240000); + }, BASILISK_CACHE_UPDATE_TIMEOUT); Store.dispatch(startInterval('sync', _iguanaActiveHandle)); Store.dispatch(startInterval('basilisk', _basiliskCache)); - // basilisk } } } @@ -145,9 +152,9 @@ class CoinTileItem extends React.Component {
{ item.coinname } ({ item.coinlogo.toUpperCase() })
diff --git a/react/src/components/dashboard/navbar.js b/react/src/components/dashboard/navbar.js index 7ca5e8e..9556432 100755 --- a/react/src/components/dashboard/navbar.js +++ b/react/src/components/dashboard/navbar.js @@ -19,6 +19,27 @@ class Navbar extends React.Component { }; this.openDropMenu = this.openDropMenu.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() { @@ -114,11 +135,6 @@ class Navbar extends React.Component { Atomic Explorer -
  • - this.openSyncOnlyModal() }> - { translate('ADD_COIN.SYNC_ONLY') } - -
  • ); } - - index++; } return items; @@ -123,21 +118,21 @@ class Notifications extends React.Component { this.openTab(0) }> - Success ({ this.state.totalSuccessCalls }) + Success ({ this.state.calls.success })
  • this.openTab(1) }> - Error ({ this.state.totalErrorCalls }) + Error ({ this.state.calls.error })
  • this.openTab(2) }> - Pending ({ this.state.totalPendingCalls }) + Pending ({ this.state.calls.pending })
  • @@ -192,9 +187,16 @@ class Notifications extends React.Component {
    - { this.state.totalSuccessCalls } - { this.state.totalErrorCalls } - { this.state.totalPendingCalls } + { this.state.calls.success } + { this.state.calls.error } + { this.state.calls.pending } +
    +
    +
    +
    +
    +
    +
    { this.renderNotificationsModal() }
    diff --git a/react/src/components/dashboard/sendCoin.js b/react/src/components/dashboard/sendCoin.js index 706b3df..6f1ff91 100644 --- a/react/src/components/dashboard/sendCoin.js +++ b/react/src/components/dashboard/sendCoin.js @@ -291,7 +291,7 @@ class SendCoin extends React.Component { renderAddressList() { return ( -
    +
    -
    { this.props.Settings.debugLog }
    +
    { this.renderDebugLogData() }
    -
    -
    this.openTab('AppSettings', 7) }> +
    this.openTab('AppSettings', 7) }> +
    { translate('SETTINGS.APP_CONFIG') } (config.json)

    diff --git a/react/src/components/dashboard/syncOnly.js b/react/src/components/dashboard/syncOnly.js index fd845d2..21617ca 100644 --- a/react/src/components/dashboard/syncOnly.js +++ b/react/src/components/dashboard/syncOnly.js @@ -1,5 +1,6 @@ import React from 'react'; import { translate } from '../../translate/translate'; +import { getCoinTitle } from '../../util/coinHelper'; import { stopInterval, addCoin, @@ -19,7 +20,8 @@ class SyncOnly extends React.Component { } isFullySynced(fork) { - if (fork.balances && ((Number(fork.balances) + + if (fork.balances && + ((Number(fork.balances) + Number(fork.validated) + Number(fork.bundles) + Number(fork.utxo)) / 4 === 100)) { @@ -30,96 +32,15 @@ class SyncOnly extends React.Component { } renderCoinName(coin) { - let coinlogo; - 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; - } + const _coinTitle = getCoinTitle(coin); return { - 'logo': coinlogo, - 'name': coinname + 'logo': _coinTitle.logo, + 'name': _coinTitle.name }; } componentWillReceiveProps(props) { - // console.log('SyncOnly', props); if (props.SyncOnly) { for (let port in this.props.SyncOnly.forks) { const forkInfo = this.props.SyncOnly.forks[port]; @@ -130,7 +51,6 @@ class SyncOnly extends React.Component { forkInfo.getinfo && forkInfo.getinfo.error && forkInfo.getinfo.error === 'bitcoinrpc needs coin that is active') { - console.log('fork add coin required'); let _autoRestartedForks = Object.assign({}, this.state.autoRestartedForks); _autoRestartedForks[port] = true; @@ -138,14 +58,15 @@ class SyncOnly extends React.Component { autoRestartedForks: _autoRestartedForks, }); Store.dispatch(addCoin(forkInfo.registry.coin, '1', null, port)); - setTimeout(function() { + + setTimeout(() => { let _autoRestartedForks = Object.assign({}, this.state.autoRestartedForks); _autoRestartedForks[port] = false; this.setState({ autoRestartedForks: _autoRestartedForks, }); - }.bind(this), 10000); + }, 10000); } } } @@ -237,12 +158,14 @@ class SyncOnly extends React.Component {

    { Full
    { this.renderCoinName(forkInfo.registry.coin).name } ({ forkInfo.registry.coin.toUpperCase() })
    - this._stopIguanaFork(forkInfo.registry.pmid) }> + this._stopIguanaFork(forkInfo.registry.pmid) }> { translate('INDEX.STOP') }
    - +
    diff --git a/react/src/components/dashboard/walletsBalance.js b/react/src/components/dashboard/walletsBalance.js index 41732b8..ed2e9f2 100755 --- a/react/src/components/dashboard/walletsBalance.js +++ b/react/src/components/dashboard/walletsBalance.js @@ -30,7 +30,7 @@ class WalletsBalance extends React.Component { this.props.ActiveCoin.mode === 'basilisk' && this.props.ActiveCoin.activeAddress && this.props.ActiveCoin.cache[this.props.ActiveCoin.coin] && - this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.props.ActiveCoin.activeAddress]&& + this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.props.ActiveCoin.activeAddress] && this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.props.ActiveCoin.activeAddress].getbalance && this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.props.ActiveCoin.activeAddress].getbalance.data && this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.props.ActiveCoin.activeAddress].getbalance.data.balance) { diff --git a/react/src/components/dashboard/walletsBasiliskConnection.js b/react/src/components/dashboard/walletsBasiliskConnection.js index debbf23..f590220 100755 --- a/react/src/components/dashboard/walletsBasiliskConnection.js +++ b/react/src/components/dashboard/walletsBasiliskConnection.js @@ -80,13 +80,13 @@ class WalletsBasiliskConnection extends React.Component {
    - { translate('IAPI.CON_STATUS') + '... ' + this.props.Dashboard.connectedNotaries.current + '/' + this.props.Dashboard.connectedNotaries.total + ': ' + this.props.Dashboard.connectedNotaries.currentNodeName} { Math.floor(this.props.Dashboard.connectedNotaries.current * 100 / this.props.Dashboard.connectedNotaries.total) }% + { `${translate('IAPI.CON_STATUS')}... ${this.props.Dashboard.connectedNotaries.current}/${this.props.Dashboard.connectedNotaries.total}:${this.props.Dashboard.connectedNotaries.currentNodeName}` } { Math.floor(this.props.Dashboard.connectedNotaries.current * 100 / this.props.Dashboard.connectedNotaries.total) }%
    -                  { this.props.Dashboard.connectedNotaries.failedToConnectNodes ? 'Failed: ' + this.props.Dashboard.connectedNotaries.failedToConnectNodes : null }
    +                  { this.props.Dashboard.connectedNotaries.failedToConnectNodes ? `Failed: ${this.props.Dashboard.connectedNotaries.failedToConnectNodes}` : null }
                       
    diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js index b315af0..667ab35 100644 --- a/react/src/components/dashboard/walletsData.js +++ b/react/src/components/dashboard/walletsData.js @@ -82,6 +82,7 @@ class WalletsData extends React.Component { } } + // deprecated toggleCacheApi() { const _useCache = !this.state.useCache; @@ -463,6 +464,7 @@ class WalletsData extends React.Component { } }*/ + // deprecated renderUseCacheToggle() { if (this.props.ActiveCoin.mode === 'basilisk') { return ( @@ -552,11 +554,11 @@ class WalletsData extends React.Component { this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] && this.props.ActiveCoin.mode === 'basilisk') { return ( -
    +
    -
    +
    + style={{ backgroundImage: `url("assets/images/bg/${this.props.activeSection}_transparent_header_bg.png")`, backgroundRepeat: 'no-repeat', backgroundPosition: '0%' }}>

    EasyDEX

    1. { translate('INDEX.DASHBOARD') }
    2. diff --git a/react/src/components/dashboard/walletsNative.js b/react/src/components/dashboard/walletsNative.js index a947881..022ce7a 100644 --- a/react/src/components/dashboard/walletsNative.js +++ b/react/src/components/dashboard/walletsNative.js @@ -33,10 +33,10 @@ class WalletsNative extends React.Component { return (
      -
      +
      1. - { this.props.ActiveCoin.coin } + { this.props.ActiveCoin.coin }
      diff --git a/react/src/components/dashboard/walletsNativeSend.js b/react/src/components/dashboard/walletsNativeSend.js index 69884ef..52e3e00 100644 --- a/react/src/components/dashboard/walletsNativeSend.js +++ b/react/src/components/dashboard/walletsNativeSend.js @@ -80,7 +80,7 @@ class WalletsNativeSend extends React.Component { renderAddressList() { return ( -
      +
      - + +
      ); diff --git a/react/src/components/main/main.js b/react/src/components/main/main.js index 9eebbd9..461ae17 100644 --- a/react/src/components/main/main.js +++ b/react/src/components/main/main.js @@ -8,6 +8,8 @@ import { iguanaActiveHandle } from '../../actions/actionCreators'; +const IGUANA_ACTIVE_HANDLE_TIMEOUT = 30000; + class Main extends React.Component { constructor(props) { super(props); @@ -24,7 +26,7 @@ class Main extends React.Component { Store.dispatch(iguanaActiveHandle()); const _iguanaActiveHandle = setInterval(function() { Store.dispatch(iguanaActiveHandle()); - }, 30000); + }, IGUANA_ACTIVE_HANDLE_TIMEOUT); this.setState(Object.assign({}, this.state, { activeHandleInterval: _iguanaActiveHandle, diff --git a/react/src/components/overrides.scss b/react/src/components/overrides.scss new file mode 100644 index 0000000..b1741e0 --- /dev/null +++ b/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; +} \ No newline at end of file diff --git a/react/src/components/toaster/toaster-item.js b/react/src/components/toaster/toaster-item.js index 94904d7..b422710 100644 --- a/react/src/components/toaster/toaster-item.js +++ b/react/src/components/toaster/toaster-item.js @@ -1,6 +1,6 @@ -import React from "react"; -import {dismissToasterMessage} from "../../actions/actionCreators"; -import Store from "../../store"; +import React from 'react'; +import { dismissToasterMessage } from '../../actions/actionCreators'; +import Store from '../../store'; // each toast will be displayed for 5 seconds const DISPLAY_LENGTH_MILLIS = 5000; @@ -10,7 +10,6 @@ const DISPLAY_LENGTH_MILLIS = 5000; * each messages has a type, title and a content message */ class ToasterItem extends React.Component { - constructor(props) { super(props); this.state = { @@ -60,9 +59,10 @@ class ToasterItem extends React.Component { } return ( -
      -
      { this.state.title }
      { this.state.message }
      diff --git a/react/src/components/toaster/toaster.js b/react/src/components/toaster/toaster.js index d8fdf6d..019ccb3 100644 --- a/react/src/components/toaster/toaster.js +++ b/react/src/components/toaster/toaster.js @@ -1,11 +1,8 @@ -import React from "react"; -import {dismissToasterMessage} from "../../actions/actionCreators"; -import Store from "../../store"; -import ToasterItem from "./toaster-item"; +import React from 'react'; +import { dismissToasterMessage } from '../../actions/actionCreators'; +import Store from '../../store'; +import ToasterItem from './toaster-item'; -/** - * Container component used for creating multiple toasts - */ class Toaster extends React.Component { constructor(props) { super(props); @@ -17,7 +14,7 @@ class Toaster extends React.Component { componentWillReceiveProps(props) { if (props && - props.toasts) { + props.toasts) { this.setState({ toasts: props.toasts, toastId: props.toasts.length @@ -34,24 +31,33 @@ class Toaster extends React.Component { Store.dispatch(dismissToasterMessage(toastId)); } + renderToasts() { + if (this.state.toasts && + this.state.toasts.length) { + return this.state.toasts.map((toast) => { + // sets the toastId for all new toasts + if (!toast.toastId) { + toast.toastId = this.toastId++; + } + + return ( + + ); + }); + } else { + return null; + } + } + // render all current toasts render() { return ( -