diff --git a/react/src/actions/addCoin.js b/react/src/actions/addCoin.js index dfa13a0..7fd8e06 100644 --- a/react/src/actions/addCoin.js +++ b/react/src/actions/addCoin.js @@ -4,7 +4,8 @@ import { triggerToaster, Config, toggleAddcoinModal, - getDexCoins + getDexCoins, + startIguanaInstance } from './actionCreators'; import { logGuiHttp, @@ -49,10 +50,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 +80,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 +127,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 +161,12 @@ 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 +193,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 +201,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 +221,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 +237,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/addressBalance.js index 8bf3e5f..63150d0 100644 --- a/react/src/actions/addressBalance.js +++ b/react/src/actions/addressBalance.js @@ -28,43 +28,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 +75,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 +99,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 +131,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 +146,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 +156,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 +169,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, @@ -247,7 +247,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 +271,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 +312,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/atomic.js index 7f10461..6faf20f 100644 --- a/react/src/actions/atomic.js +++ b/react/src/actions/atomic.js @@ -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), }) diff --git a/react/src/actions/basiliskCache.js b/react/src/actions/basiliskCache.js index 588df6c..f225e08 100644 --- a/react/src/actions/basiliskCache.js +++ b/react/src/actions/basiliskCache.js @@ -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', @@ -108,16 +108,16 @@ function getShepherdCacheState(json, pubkey, coin) { } 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/basiliskProcessAddress.js index fe1582f..7ca0707 100644 --- a/react/src/actions/basiliskProcessAddress.js +++ b/react/src/actions/basiliskProcessAddress.js @@ -11,7 +11,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 +24,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 +73,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 +86,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/basiliskTxHistory.js index 50d38f4..cb12126 100644 --- a/react/src/actions/basiliskTxHistory.js +++ b/react/src/actions/basiliskTxHistory.js @@ -13,7 +13,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/coinList.js index 0e4f31b..cf1f4d4 100644 --- a/react/src/actions/coinList.js +++ b/react/src/actions/coinList.js @@ -10,7 +10,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 +27,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/createWallet.js b/react/src/actions/createWallet.js index 425a2b6..9c16144 100644 --- a/react/src/actions/createWallet.js +++ b/react/src/actions/createWallet.js @@ -25,7 +25,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 +37,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/dexCoins.js index 7f10dd2..e69dc7d 100644 --- a/react/src/actions/dexCoins.js +++ b/react/src/actions/dexCoins.js @@ -11,7 +11,7 @@ import { export function getDexCoins() { const _payload = { - 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`, 'agent': 'InstantDEX', 'method': 'allcoins', }; @@ -22,12 +22,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/edexBalance.js index b760791..ecc96e2 100644 --- a/react/src/actions/edexBalance.js +++ b/react/src/actions/edexBalance.js @@ -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), }) @@ -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/edexGetTx.js index 8cd1139..eb5d3b7 100644 --- a/react/src/actions/edexGetTx.js +++ b/react/src/actions/edexGetTx.js @@ -8,9 +8,9 @@ import { 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 +24,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/fullTxHistory.js index f73492e..19120ee 100644 --- a/react/src/actions/fullTxHistory.js +++ b/react/src/actions/fullTxHistory.js @@ -11,7 +11,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 +27,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/getAddrByAccount.js index f1238d0..653d038 100644 --- a/react/src/actions/getAddrByAccount.js +++ b/react/src/actions/getAddrByAccount.js @@ -31,7 +31,7 @@ export function getAddressesByAccountState(json, coin, mode) { 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/iguanaHelpers.js index 97b8371..e2f6704 100644 --- a/react/src/actions/iguanaHelpers.js +++ b/react/src/actions/iguanaHelpers.js @@ -22,7 +22,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 +34,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/iguanaInstance.js index 4a6adfd..cd5be58 100644 --- a/react/src/actions/iguanaInstance.js +++ b/react/src/actions/iguanaInstance.js @@ -10,7 +10,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 +43,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 +64,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/log.js index 51e17ba..8fad44c 100644 --- a/react/src/actions/log.js +++ b/react/src/actions/log.js @@ -9,7 +9,7 @@ export function logGuiHttp(payload) { 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', diff --git a/react/src/actions/logout.js b/react/src/actions/logout.js index bfeb1e2..5c8affa 100644 --- a/react/src/actions/logout.js +++ b/react/src/actions/logout.js @@ -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/nativeBalance.js index f8931b2..cd13543 100644 --- a/react/src/actions/nativeBalance.js +++ b/react/src/actions/nativeBalance.js @@ -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), }) diff --git a/react/src/actions/nativeNewAddress.js b/react/src/actions/nativeNewAddress.js index 93f3425..f47a058 100644 --- a/react/src/actions/nativeNewAddress.js +++ b/react/src/actions/nativeNewAddress.js @@ -19,22 +19,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 +42,7 @@ export function getNewKMDAddresses(coin, pubpriv) { 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'agent': coin, 'method': 'passthru', - 'function': ajax_function_input, + 'function': ajaxFunctionInput, 'hex': '', }; } @@ -53,12 +53,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/nativeSend.js index 4d005d4..3bd6a95 100644 --- a/react/src/actions/nativeSend.js +++ b/react/src/actions/nativeSend.js @@ -12,23 +12,23 @@ import { } 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,10 +92,6 @@ 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); - }) }); } } @@ -99,29 +104,29 @@ export function getKMDOPIDState(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/nativeSyncInfo.js index 5c0aa85..d73e4d1 100644 --- a/react/src/actions/nativeSyncInfo.js +++ b/react/src/actions/nativeSyncInfo.js @@ -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) { @@ -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/nativeTxHistory.js index 2b45e07..e38ea18 100644 --- a/react/src/actions/nativeTxHistory.js +++ b/react/src/actions/nativeTxHistory.js @@ -15,7 +15,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 +24,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 +38,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/notary.js index 2582b70..72874fa 100644 --- a/react/src/actions/notary.js +++ b/react/src/actions/notary.js @@ -13,7 +13,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 +24,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 +41,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 => { @@ -99,13 +99,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), }) @@ -133,7 +133,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 +145,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/sendFullBasilisk.js b/react/src/actions/sendFullBasilisk.js index 2ce0ce5..3ade2ef 100644 --- a/react/src/actions/sendFullBasilisk.js +++ b/react/src/actions/sendFullBasilisk.js @@ -2,7 +2,8 @@ import * as storeType from './storeType'; import { translate } from '../translate/translate'; import { triggerToaster, - Config + Config, + getDispatch } from './actionCreators'; import { logGuiHttp, @@ -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', @@ -132,18 +133,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 +163,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 +178,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', })); diff --git a/react/src/actions/settings.js b/react/src/actions/settings.js index 25d7832..0204912 100644 --- a/react/src/actions/settings.js +++ b/react/src/actions/settings.js @@ -18,7 +18,7 @@ function getAppInfoState(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', @@ -36,7 +36,7 @@ export function getAppInfo() { export function settingsWifkeyState(json, coin) { return { type: storeType.GET_WIF_KEY, - wifkey: json[coin + 'wif'], + wifkey: json[`{$coin}wif`], address: json[coin], } } @@ -63,7 +63,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 +77,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), }) @@ -129,7 +129,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 +147,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 +159,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), }) @@ -232,7 +232,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 +245,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 +277,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', @@ -302,7 +302,7 @@ function getAppConfigState(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/syncInfo.js index 7a07627..edf78ef 100644 --- a/react/src/actions/syncInfo.js +++ b/react/src/actions/syncInfo.js @@ -25,7 +25,7 @@ function getSyncInfoState(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/syncOnly.js index 0415818..cb43f78 100644 --- a/react/src/actions/syncOnly.js +++ b/react/src/actions/syncOnly.js @@ -25,7 +25,7 @@ function getSyncOnlyForksState(json) { 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 +42,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/sysInfo.js index b652a27..909d8f5 100644 --- a/react/src/actions/sysInfo.js +++ b/react/src/actions/sysInfo.js @@ -10,7 +10,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/walletAuth.js index 19dfe6a..ccf491c 100644 --- a/react/src/actions/walletAuth.js +++ b/react/src/actions/walletAuth.js @@ -13,7 +13,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 +25,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 +58,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 +71,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 +101,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 +115,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 +147,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 +158,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), }) diff --git a/react/src/components/addcoin/addcoin.js b/react/src/components/addcoin/addcoin.js index e2816e6..4309a62 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); } } @@ -216,7 +216,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, @@ -233,7 +233,7 @@ class AddCoin extends React.Component { Store.dispatch(toggleAddcoinModal(false, false)); } - }.bind(this), 2000 * i); + }, 2000 * i); } } @@ -245,7 +245,7 @@ class AddCoin extends React.Component { const _coin = _item.selectedCoin || ''; items.push( -
- { this.props.Dashboard.connectedNotaries.failedToConnectNodes ? 'Failed: ' + this.props.Dashboard.connectedNotaries.failedToConnectNodes : null } + { this.props.Dashboard.connectedNotaries.failedToConnectNodes ? `Failed: ${this.props.Dashboard.connectedNotaries.failedToConnectNodes}` : null }