Browse Source

es6 string literals (wip #2)

all-modes
Petr Balashov 8 years ago
parent
commit
6b0447b7a2
  1. 6
      react/src/actions/addCoin.js
  2. 70
      react/src/actions/addressBalance.js
  3. 4
      react/src/actions/atomic.js
  4. 38
      react/src/actions/basiliskCache.js
  5. 12
      react/src/actions/basiliskProcessAddress.js
  6. 2
      react/src/actions/basiliskTxHistory.js
  7. 4
      react/src/actions/coinList.js
  8. 6
      react/src/actions/createWallet.js
  9. 6
      react/src/actions/dexCoins.js
  10. 12
      react/src/actions/edexBalance.js
  11. 8
      react/src/actions/edexGetTx.js
  12. 6
      react/src/actions/fullTxHistory.js
  13. 6
      react/src/actions/getAddrByAccount.js
  14. 6
      react/src/actions/iguanaHelpers.js
  15. 6
      react/src/actions/iguanaInstance.js
  16. 4
      react/src/actions/log.js
  17. 6
      react/src/actions/logout.js
  18. 8
      react/src/actions/nativeBalance.js
  19. 16
      react/src/actions/nativeNewAddress.js
  20. 55
      react/src/actions/nativeSend.js
  21. 10
      react/src/actions/nativeSyncInfo.js
  22. 8
      react/src/actions/nativeTxHistory.js
  23. 20
      react/src/actions/notary.js
  24. 31
      react/src/actions/sendFullBasilisk.js
  25. 28
      react/src/actions/settings.js
  26. 6
      react/src/actions/syncInfo.js
  27. 4
      react/src/actions/syncOnly.js
  28. 2
      react/src/actions/sysInfo.js
  29. 24
      react/src/actions/walletAuth.js
  30. 2
      react/src/components/addcoin/addcoin.js
  31. 22
      react/src/components/addcoin/payload.js
  32. 2
      react/src/components/dashboard/atomic.js
  33. 315
      react/src/components/dashboard/coinTile.js
  34. 13
      react/src/components/dashboard/coinTileItem.js
  35. 11
      react/src/components/dashboard/sendCoin.js
  36. 5
      react/src/components/toaster/toaster.js
  37. 316
      react/src/util/coinHelper.js

6
react/src/actions/addCoin.js

@ -126,7 +126,7 @@ export function shepherdHerd(coin, mode, path) {
'ac_options': [ 'ac_options': [
'-daemon=0', '-daemon=0',
'-server', '-server',
'-ac_name=' + coin, `-ac_name=${coin}`,
'-addnode=78.47.196.146' '-addnode=78.47.196.146'
] ]
}; };
@ -220,7 +220,7 @@ export function shepherdGetConfig(coin, mode) {
if (coin === 'KMD' && if (coin === 'KMD' &&
mode === '-1') { mode === '-1') {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getconf`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -236,7 +236,7 @@ export function shepherdGetConfig(coin, mode) {
} }
} else { } else {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getconf`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

70
react/src/actions/addressBalance.js

@ -28,43 +28,43 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
Promise.all(type.map((_type, index) => { Promise.all(type.map((_type, index) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let payload, let payload,
ajax_data_to_hex = '', ajaxFunctionInput = '',
ajax_function_input = '', tmplistaddrHexInput = '',
tmplistaddr_hex_input = '', passthruAgent = getPassthruAgent(coin),
passthru_agent = getPassthruAgent(coin), tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
if (_type === 'public') { if (_type === 'public') {
ajax_function_input = 'getaddressesbyaccount'; ajaxFunctionInput = 'getaddressesbyaccount';
tmplistaddr_hex_input = '222200'; tmplistaddrHexInput = '222200';
} }
if (_type === 'private') { if (_type === 'private') {
ajax_function_input = 'z_listaddresses'; ajaxFunctionInput = 'z_listaddresses';
tmplistaddr_hex_input = ''; tmplistaddrHexInput = '';
} }
if (passthru_agent === 'iguana') { if (passthruAgent === 'iguana') {
payload = { payload = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
'function': ajax_function_input, 'function': ajaxFunctionInput,
'hex': tmplistaddr_hex_input, 'hex': tmplistaddrHexInput,
}; };
} else { } else {
payload = { payload = {
'userpass': tmpIguanaRPCAuth, 'userpass': tmpIguanaRPCAuth,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'function': ajax_function_input, 'function': ajaxFunctionInput,
'hex': tmplistaddr_hex_input, 'hex': tmplistaddrHexInput,
}; };
} }
if (mode === 'full' || mode === 'basilisk') { if (mode === 'full' ||
mode === 'basilisk') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'getaddressesbyaccount', 'method': 'getaddressesbyaccount',
@ -75,7 +75,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (mode === 'basilisk') { if (mode === 'basilisk') {
const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/cache?pubkey=' + pubkey, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -99,12 +99,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDAddressesNative', 'function': 'getKMDAddressesNative',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -131,14 +131,14 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})) }))
.then(result => { .then(result => {
// TODO: split into 2 functions // TODO: split into 2 functions
const passthru_agent = getPassthruAgent(coin), const passthruAgent = getPassthruAgent(coin),
tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
let payload; let payload;
if (passthru_agent === 'iguana') { if (passthruAgent === 'iguana') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
'function': 'listunspent', 'function': 'listunspent',
@ -146,8 +146,8 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
}; };
} else { } else {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': passthru_agent, 'agent': passthruAgent,
'method': 'passthru', 'method': 'passthru',
'function': 'listunspent', 'function': 'listunspent',
'hex': '', 'hex': '',
@ -156,7 +156,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (mode === 'full') { if (mode === 'full') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'listunspent', 'method': 'listunspent',
'params': [ 'params': [
@ -169,7 +169,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
// if api cache option is off // if api cache option is off
if (mode === 'basilisk') { if (mode === 'basilisk') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'listunspent', 'method': 'listunspent',
'address': currentAddress, 'address': currentAddress,
@ -247,7 +247,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (mode === 'basilisk') { if (mode === 'basilisk') {
const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/cache?pubkey=' + pubkey, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -271,12 +271,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDAddressesNative+Balance', 'function': 'getKMDAddressesNative+Balance',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -312,12 +312,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDAddressesNative+Balance', 'function': 'getKMDAddressesNative+Balance',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

4
react/src/actions/atomic.js

@ -15,12 +15,12 @@ export function atomic(payload) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'atomic', 'function': 'atomic',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

38
react/src/actions/basiliskCache.js

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

12
react/src/actions/basiliskProcessAddress.js

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

2
react/src/actions/basiliskTxHistory.js

@ -13,7 +13,7 @@ export function getBasiliskTransactionsList(coin, address) {
const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey; const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/cache?pubkey=' + pubkey, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

4
react/src/actions/coinList.js

@ -10,7 +10,7 @@ import {
export function shepherdGetCoinList() { export function shepherdGetCoinList() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/coinslist', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coinslist`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -27,7 +27,7 @@ export function shepherdGetCoinList() {
export function shepherdPostCoinList(data) { export function shepherdPostCoinList(data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/coinslist', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coinslist`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

6
react/src/actions/createWallet.js

@ -25,7 +25,7 @@ function createNewWalletState(json) {
export function createNewWallet(_passphrase) { export function createNewWallet(_passphrase) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'encryptwallet', 'method': 'encryptwallet',
'passphrase': _passphrase, 'passphrase': _passphrase,
@ -37,12 +37,12 @@ export function createNewWallet(_passphrase) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'createNewWallet', 'function': 'createNewWallet',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

6
react/src/actions/dexCoins.js

@ -11,7 +11,7 @@ import {
export function getDexCoins() { export function getDexCoins() {
const _payload = { const _payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'InstantDEX', 'agent': 'InstantDEX',
'method': 'allcoins', 'method': 'allcoins',
}; };
@ -22,12 +22,12 @@ export function getDexCoins() {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getDexCoins', 'function': 'getDexCoins',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload) body: JSON.stringify(_payload)
}) })

12
react/src/actions/edexBalance.js

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

8
react/src/actions/edexGetTx.js

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

6
react/src/actions/fullTxHistory.js

@ -11,7 +11,7 @@ import {
export function getFullTransactionsList(coin) { export function getFullTransactionsList(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'listtransactions', 'method': 'listtransactions',
'params': [ 'params': [
@ -27,12 +27,12 @@ export function getFullTransactionsList(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getFullTransactionsList', 'function': 'getFullTransactionsList',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

6
react/src/actions/getAddrByAccount.js

@ -31,7 +31,7 @@ export function getAddressesByAccountState(json, coin, mode) {
export function getAddressesByAccount(coin, mode) { export function getAddressesByAccount(coin, mode) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'getaddressesbyaccount', 'method': 'getaddressesbyaccount',
@ -44,12 +44,12 @@ export function getAddressesByAccount(coin, mode) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getAddressesByAccount', 'function': 'getAddressesByAccount',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

6
react/src/actions/iguanaHelpers.js

@ -22,7 +22,7 @@ export function getPassthruAgent(coin) {
export function iguanaHashHex(data, dispatch) { export function iguanaHashHex(data, dispatch) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'hash', 'agent': 'hash',
'method': 'hex', 'method': 'hex',
'message': data, 'message': data,
@ -34,12 +34,12 @@ export function iguanaHashHex(data, dispatch) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaHashHex', 'function': 'iguanaHashHex',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

6
react/src/actions/iguanaInstance.js

@ -10,7 +10,7 @@ import {
export function restartIguanaInstance(pmid) { export function restartIguanaInstance(pmid) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks/restart?pmid=' + pmid, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/restart?pmid=${pmid}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -43,7 +43,7 @@ export function restartBasiliskInstance() {
export function startIguanaInstance(mode, coin) { export function startIguanaInstance(mode, coin) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -64,7 +64,7 @@ export function startIguanaInstance(mode, coin) {
export function getIguanaInstancesList() { export function getIguanaInstancesList() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks', { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

4
react/src/actions/log.js

@ -9,7 +9,7 @@ export function logGuiHttp(payload) {
dispatch(guiLogState(payload)); dispatch(guiLogState(payload));
// disabled for now // disabled for now
/*return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/guilog', { /*return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/guilog`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -26,7 +26,7 @@ export function logGuiHttp(payload) {
export function getAgamaLog(type) { export function getAgamaLog(type) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getlog?type=' + type, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getlog?type=${type}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

6
react/src/actions/logout.js

@ -25,7 +25,7 @@ export function logout() {
function walletLock() { function walletLock() {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'walletlock', 'method': 'walletlock',
}; };
@ -36,12 +36,12 @@ function walletLock() {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'walletLock', 'function': 'walletLock',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

8
react/src/actions/nativeBalance.js

@ -15,7 +15,7 @@ export function getKMDBalanceTotal(coin) {
if (coin !== 'KMD' && if (coin !== 'KMD' &&
coin !== 'ZEC') { coin !== 'ZEC') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'iguana', 'agent': 'iguana',
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
@ -24,7 +24,7 @@ export function getKMDBalanceTotal(coin) {
}; };
} else { } else {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'function': 'z_gettotalbalance', 'function': 'z_gettotalbalance',
@ -38,12 +38,12 @@ export function getKMDBalanceTotal(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getKMDBalanceTotal', 'function': 'getKMDBalanceTotal',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

16
react/src/actions/nativeNewAddress.js

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

55
react/src/actions/nativeSend.js

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

10
react/src/actions/nativeSyncInfo.js

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

8
react/src/actions/nativeTxHistory.js

@ -15,7 +15,7 @@ export function getNativeTxHistory(coin) {
if (getPassthruAgent(coin) === 'iguana') { if (getPassthruAgent(coin) === 'iguana') {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'iguana', 'agent': 'iguana',
'method': 'passthru', 'method': 'passthru',
'asset': coin, 'asset': coin,
@ -24,7 +24,7 @@ export function getNativeTxHistory(coin) {
}; };
} else { } else {
payload = { payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': getPassthruAgent(coin), 'agent': getPassthruAgent(coin),
'method': 'passthru', 'method': 'passthru',
'function': 'listtransactions', 'function': 'listtransactions',
@ -38,12 +38,12 @@ export function getNativeTxHistory(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getNativeTxHistory', 'function': 'getNativeTxHistory',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

20
react/src/actions/notary.js

@ -13,7 +13,7 @@ function initNotaryNodesConSequence(nodes) {
return dispatch => { return dispatch => {
Promise.all(nodes.map((node, index) => { Promise.all(nodes.map((node, index) => {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'getinfo', 'method': 'getinfo',
'symbol': node, 'symbol': node,
@ -24,14 +24,14 @@ function initNotaryNodesConSequence(nodes) {
const _timestamp = Date.now(); const _timestamp = Date.now();
dispatch(logGuiHttp({ dispatch(logGuiHttp({
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'initNotaryNodesConSequence+' + node, 'function': `initNotaryNodesConSequence+${node}`,
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort) + '/api/dex/getinfo?userpass=' + ('tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth')) + '&symbol=' + node, { fetch(`http://127.0.0.1:${(Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}/api/dex/getinfo?userpass=${('tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'))}&symbol=${node}`, {
method: 'GET', method: 'GET',
}) })
.catch(function(error) { .catch(function(error) {
@ -41,7 +41,7 @@ function initNotaryNodesConSequence(nodes) {
'status': 'error', 'status': 'error',
'response': error, 'response': error,
})); }));
dispatch(triggerToaster(true, 'getInfoDexNode+' + node, 'Error', 'error')); dispatch(triggerToaster(true, `getInfoDexNode+${node}`, 'Error', 'error'));
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
@ -99,13 +99,13 @@ function connectAllNotaryNodes(json, dispatch) {
export function connectNotaries() { export function connectNotaries() {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dpow', 'agent': 'dpow',
'method': 'notarychains', 'method': 'notarychains',
}; };
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -133,7 +133,7 @@ function getDexNotariesState(json) {
export function getDexNotaries(coin) { export function getDexNotaries(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'getnotaries', 'method': 'getnotaries',
'symbol': coin, 'symbol': coin,
@ -145,11 +145,11 @@ export function getDexNotaries(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getDexNotaries', 'function': 'getDexNotaries',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), 'url': `http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort), { return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

31
react/src/actions/sendFullBasilisk.js

@ -2,7 +2,8 @@ import * as storeType from './storeType';
import { translate } from '../translate/translate'; import { translate } from '../translate/translate';
import { import {
triggerToaster, triggerToaster,
Config Config,
getDispatch
} from './actionCreators'; } from './actionCreators';
import { import {
logGuiHttp, logGuiHttp,
@ -11,7 +12,7 @@ import {
export function sendToAddress(coin, _payload) { export function sendToAddress(coin, _payload) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'sendtoaddress', 'method': 'sendtoaddress',
'params': [ 'params': [
@ -28,12 +29,12 @@ export function sendToAddress(coin, _payload) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'sendToAddress', 'function': 'sendToAddress',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -60,7 +61,7 @@ export function sendToAddress(coin, _payload) {
export function sendFromAddress(coin, _payload) { export function sendFromAddress(coin, _payload) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'method': 'sendfrom', 'method': 'sendfrom',
'params': [ 'params': [
@ -78,12 +79,12 @@ export function sendFromAddress(coin, _payload) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'sendFromAddress', 'function': 'sendFromAddress',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -108,9 +109,9 @@ export function sendFromAddress(coin, _payload) {
} }
} }
export function iguanaUTXORawTX(data) { export function iguanaUTXORawTX(data, dispatch) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'symbol': data.coin, 'symbol': data.coin,
'agent': 'basilisk', 'agent': 'basilisk',
'method': 'utxorawtx', 'method': 'utxorawtx',
@ -132,18 +133,18 @@ export function iguanaUTXORawTX(data) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaUTXORawTX', 'function': 'iguanaUTXORawTX',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
fetch('http://127.0.0.1:' + Config.iguanaCorePort, { fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
.catch(function(error) { .catch(function(error) {
console.log(error); console.log(error);
dispatch(logGuiHttp({ dispatch => dispatch(logGuiHttp({
'timestamp': _timestamp, 'timestamp': _timestamp,
'status': 'error', 'status': 'error',
'response': error, 'response': error,
@ -162,9 +163,9 @@ export function iguanaUTXORawTX(data) {
}); });
} }
export function dexSendRawTX(data) { export function dexSendRawTX(data, dispatch) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'dex', 'agent': 'dex',
'method': 'sendrawtransaction', 'method': 'sendrawtransaction',
'signedtx': data.signedtx, 'signedtx': data.signedtx,
@ -177,7 +178,7 @@ export function dexSendRawTX(data) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'dexSendRawTX', 'function': 'dexSendRawTX',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));

28
react/src/actions/settings.js

@ -18,7 +18,7 @@ function getAppInfoState(json) {
export function getAppInfo() { export function getAppInfo() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/appinfo', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appinfo`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -36,7 +36,7 @@ export function getAppInfo() {
export function settingsWifkeyState(json, coin) { export function settingsWifkeyState(json, coin) {
return { return {
type: storeType.GET_WIF_KEY, type: storeType.GET_WIF_KEY,
wifkey: json[coin + 'wif'], wifkey: json[`{$coin}wif`],
address: json[coin], address: json[coin],
} }
} }
@ -63,7 +63,7 @@ function parseImportPrivKeyResponse(json, dispatch) {
export function importPrivKey(wifKey) { export function importPrivKey(wifKey) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'method': 'importprivkey', 'method': 'importprivkey',
'params': [ 'params': [
wifKey, wifKey,
@ -77,12 +77,12 @@ export function importPrivKey(wifKey) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'importPrivKey', 'function': 'importPrivKey',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -129,7 +129,7 @@ export function getDebugLog(target, linesCount) {
}; };
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/debuglog', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/debuglog`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -147,7 +147,7 @@ export function getDebugLog(target, linesCount) {
export function getPeersList(coin) { export function getPeersList(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'SuperNET', 'agent': 'SuperNET',
'method': 'getpeers', 'method': 'getpeers',
'activecoin': coin, 'activecoin': coin,
@ -159,12 +159,12 @@ export function getPeersList(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getPeersList', 'function': 'getPeersList',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -232,7 +232,7 @@ function addPeerNodeState(json, dispatch) {
export function addPeerNode(coin, ip) { export function addPeerNode(coin, ip) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'iguana', 'agent': 'iguana',
'method': 'addnode', 'method': 'addnode',
'activecoin': coin, 'activecoin': coin,
@ -245,12 +245,12 @@ export function addPeerNode(coin, ip) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'addPeerNode', 'function': 'addPeerNode',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -277,7 +277,7 @@ export function addPeerNode(coin, ip) {
export function saveAppConfig(_payload) { export function saveAppConfig(_payload) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/appconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appconf`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -302,7 +302,7 @@ function getAppConfigState(json) {
export function getAppConfig() { export function getAppConfig() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/appconf', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appconf`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

6
react/src/actions/syncInfo.js

@ -25,7 +25,7 @@ function getSyncInfoState(json) {
export function getSyncInfo(coin) { export function getSyncInfo(coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'coin': coin, 'coin': coin,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'getinfo', 'method': 'getinfo',
@ -37,12 +37,12 @@ export function getSyncInfo(coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getSyncInfo', 'function': 'getSyncInfo',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })

4
react/src/actions/syncOnly.js

@ -25,7 +25,7 @@ function getSyncOnlyForksState(json) {
export function getSyncOnlyForks() { export function getSyncOnlyForks() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks/info/show', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/info/show`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -42,7 +42,7 @@ export function getSyncOnlyForks() {
export function stopIguanaFork(pmid) { export function stopIguanaFork(pmid) {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks/stop?pmid=' + pmid, { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/stop?pmid=${pmid}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

2
react/src/actions/sysInfo.js

@ -10,7 +10,7 @@ import {
export function shepherdGetSysInfo() { export function shepherdGetSysInfo() {
return dispatch => { return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/sysinfo', { return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/sysinfo`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

24
react/src/actions/walletAuth.js

@ -13,7 +13,7 @@ import {
export function encryptWallet(_passphrase, cb, coin) { export function encryptWallet(_passphrase, cb, coin) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'encryptwallet', 'method': 'encryptwallet',
'passphrase': _passphrase, 'passphrase': _passphrase,
@ -25,12 +25,12 @@ export function encryptWallet(_passphrase, cb, coin) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'encryptWallet', 'function': 'encryptWallet',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -58,7 +58,7 @@ export function encryptWallet(_passphrase, cb, coin) {
export function walletPassphrase(_passphrase) { export function walletPassphrase(_passphrase) {
const payload = { const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'bitcoinrpc', 'agent': 'bitcoinrpc',
'method': 'walletpassphrase', 'method': 'walletpassphrase',
'password': _passphrase, 'password': _passphrase,
@ -71,12 +71,12 @@ export function walletPassphrase(_passphrase) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'walletpassphrase', 'function': 'walletpassphrase',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload, 'payload': payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
}) })
@ -101,7 +101,7 @@ export function walletPassphrase(_passphrase) {
export function iguanaWalletPassphrase(_passphrase) { export function iguanaWalletPassphrase(_passphrase) {
const _payload = { const _payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'handle': '', 'handle': '',
'password': _passphrase, 'password': _passphrase,
'timeout': '2592000', 'timeout': '2592000',
@ -115,12 +115,12 @@ export function iguanaWalletPassphrase(_passphrase) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaWalletPassphrase', 'function': 'iguanaWalletPassphrase',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload), body: JSON.stringify(_payload),
}) })
@ -147,7 +147,7 @@ export function iguanaWalletPassphrase(_passphrase) {
export function iguanaActiveHandle(getMainAddress) { export function iguanaActiveHandle(getMainAddress) {
const _payload = { const _payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'userpass': `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
'agent': 'SuperNET', 'agent': 'SuperNET',
'method': 'activehandle', 'method': 'activehandle',
}; };
@ -158,12 +158,12 @@ export function iguanaActiveHandle(getMainAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaActiveHandle', 'function': 'iguanaActiveHandle',
'type': 'post', 'type': 'post',
'url': 'http://127.0.0.1:' + Config.iguanaCorePort, 'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload), body: JSON.stringify(_payload),
}) })

2
react/src/components/addcoin/addcoin.js

@ -245,7 +245,7 @@ class AddCoin extends React.Component {
const _coin = _item.selectedCoin || ''; const _coin = _item.selectedCoin || '';
items.push( items.push(
<div className={ this.state.coins.length > 1 ? 'multi' : 'single' } key={ 'add-coin-' + i }> <div className={ this.state.coins.length > 1 ? 'multi' : 'single' } key={ `add-coin-${i}` }>
<div className="col-sm-8"> <div className="col-sm-8">
<div className="form-group"> <div className="form-group">
<select <select

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

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

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

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

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

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

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

@ -87,14 +87,13 @@ class CoinTileItem extends React.Component {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
if (mode === 'full') { if (mode === 'full') {
var _iguanaActiveHandle = setInterval(function() { const _iguanaActiveHandle = setInterval(function() {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
}.bind(this), 3000); }.bind(this), 3000);
Store.dispatch(startInterval('sync', _iguanaActiveHandle)); Store.dispatch(startInterval('sync', _iguanaActiveHandle));
} }
if (mode === 'native') { if (mode === 'native') {
// TODO: add conditions to skip txhistory, balances, addresses while "activating best chain" const _iguanaActiveHandle = setInterval(function() {
var _iguanaActiveHandle = setInterval(function() {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
}.bind(this), coin === 'KMD' ? 15000 : 3000); }.bind(this), coin === 'KMD' ? 15000 : 3000);
Store.dispatch(startInterval('sync', _iguanaActiveHandle)); Store.dispatch(startInterval('sync', _iguanaActiveHandle));
@ -112,11 +111,11 @@ class CoinTileItem extends React.Component {
'address': _basiliskMainAddress, 'address': _basiliskMainAddress,
})); }));
var _iguanaActiveHandle = setInterval(function() { const _iguanaActiveHandle = setInterval(function() {
this.dispatchCoinActions(coin, mode); this.dispatchCoinActions(coin, mode);
}.bind(this), 3000); }.bind(this), 3000);
var _basiliskCache = setInterval(function() { const _basiliskCache = setInterval(function() {
Store.dispatch(fetchNewCacheData({ Store.dispatch(fetchNewCacheData({
'pubkey': this.props.Dashboard.activeHandle.pubkey, 'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false, 'allcoins': false,
@ -145,9 +144,9 @@ class CoinTileItem extends React.Component {
<a className="avatar margin-bottom-5" id="edexcoin-logo"> <a className="avatar margin-bottom-5" id="edexcoin-logo">
<img <img
className="img-responsive" className="img-responsive"
src={ 'assets/images/cryptologo/' + item.coinlogo + '.png' } src={ `assets/images/cryptologo/${item.coinlogo}.png` }
alt={ item.coinname }/> alt={ item.coinname }/>
<span className={ 'badge up badge-' + item.modecolor } id="basfull">{ item.modecode }</span> <span className={ `badge up badge-${item.modecolor}` } id="basfull">{ item.modecode }</span>
</a> </a>
<div className="coin-name">{ item.coinname } ({ item.coinlogo.toUpperCase() })</div> <div className="coin-name">{ item.coinname } ({ item.coinlogo.toUpperCase() })</div>
</div> </div>

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

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

5
react/src/components/toaster/toaster.js

@ -3,9 +3,6 @@ import { dismissToasterMessage } from '../../actions/actionCreators';
import Store from '../../store'; import Store from '../../store';
import ToasterItem from './toaster-item'; import ToasterItem from './toaster-item';
/**
* Container component used for creating multiple toasts
*/
class Toaster extends React.Component { class Toaster extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -37,7 +34,7 @@ class Toaster extends React.Component {
renderToasts() { renderToasts() {
if (this.state.toasts && if (this.state.toasts &&
this.state.toasts.length) { this.state.toasts.length) {
this.state.toasts.map((toast) => { return this.state.toasts.map((toast) => {
// sets the toastId for all new toasts // sets the toastId for all new toasts
if (!toast.toastId) { if (!toast.toastId) {
toast.toastId = this.toastId++; toast.toastId = this.toastId++;

316
react/src/util/coinHelper.js

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