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( -