Browse Source

rpc cond. getinfo, ztotalbalance, listtx

all-modes
pbca26 8 years ago
parent
commit
464af79278
  1. 1
      react/change.log
  2. 5
      react/src/actions/actionCreators.js
  3. 12
      react/src/actions/actions/addCoin.js
  4. 14
      react/src/actions/actions/addressBalance.js
  5. 2
      react/src/actions/actions/atomic.js
  6. 14
      react/src/actions/actions/basiliskCache.js
  7. 16
      react/src/actions/actions/basiliskProcessAddress.js
  8. 2
      react/src/actions/actions/basiliskTxHistory.js
  9. 4
      react/src/actions/actions/cli.js
  10. 4
      react/src/actions/actions/coinList.js
  11. 4
      react/src/actions/actions/copyAddress.js
  12. 6
      react/src/actions/actions/createWallet.js
  13. 2
      react/src/actions/actions/dexCoins.js
  14. 4
      react/src/actions/actions/edexBalance.js
  15. 2
      react/src/actions/actions/edexGetTx.js
  16. 2
      react/src/actions/actions/fullTxHistory.js
  17. 2
      react/src/actions/actions/getAddrByAccount.js
  18. 2
      react/src/actions/actions/iguanaHelpers.js
  19. 6
      react/src/actions/actions/iguanaInstance.js
  20. 4
      react/src/actions/actions/log.js
  21. 2
      react/src/actions/actions/logout.js
  22. 33
      react/src/actions/actions/nativeBalance.js
  23. 4
      react/src/actions/actions/nativeNewAddress.js
  24. 6
      react/src/actions/actions/nativeSend.js
  25. 16
      react/src/actions/actions/nativeSyncInfo.js
  26. 31
      react/src/actions/actions/nativeTxHistory.js
  27. 8
      react/src/actions/actions/notary.js
  28. 2
      react/src/actions/actions/openAlias.js
  29. 12
      react/src/actions/actions/sendFullBasilisk.js
  30. 28
      react/src/actions/actions/settings.js
  31. 2
      react/src/actions/actions/syncInfo.js
  32. 6
      react/src/actions/actions/syncOnly.js
  33. 2
      react/src/actions/actions/sysInfo.js
  34. 10
      react/src/actions/actions/walletAuth.js
  35. 63
      react/src/components/addcoin/addcoin.js
  36. 2
      react/src/components/dashboard/atomic/atomic.js
  37. 20
      react/src/components/dashboard/sendCoin/sendCoin.js
  38. 4
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
  39. 2
      react/src/components/main/walletMain.js
  40. 19
      react/src/components/toaster/toaster-item.js
  41. 6
      react/src/translate/en.js

1
react/change.log

@ -12,6 +12,7 @@ front:
- sort http stack history desc
- swapped gettotalbalance interest with getinfo interest
- extended settings / export keys ui
- added error message if coin is already running in another mode
back:
- added cli route

5
react/src/actions/actionCreators.js

@ -190,10 +190,9 @@ export function toggleSendReceiveCoinFormsState() {
}
}
export function triggerToaster(display, message, title, _type, autoClose = true) {
export function triggerToaster(message, title, _type, autoClose = true) {
return {
type: ADD_TOASTER_MESSAGE,
display,
message,
title,
_type,
@ -295,7 +294,7 @@ export function rpcErrorHandler(json, dispatch) {
if (json &&
json.error) {
if (json.error === 'bitcoinrpc needs coin that is active') {
dispatch(triggerToaster(true, 'No active coin', translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
dispatch(triggerToaster('No active coin', translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
}
}
}

12
react/src/actions/actions/addCoin.js

@ -95,7 +95,7 @@ export function iguanaAddCoin(coin, mode, acData, port) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, translate('TOASTR.FAILED_TO_ADDCOIN'), translate('TOASTR.ACCOUNT_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('TOASTR.FAILED_TO_ADDCOIN'), translate('TOASTR.ACCOUNT_NOTIFICATION'), 'error'));
})
.then(response => response.json())
.then(json => {
@ -176,7 +176,7 @@ export function shepherdHerd(coin, mode, path) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, translate('FAILED_SHEPHERD_HERD'), translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('FAILED_SHEPHERD_HERD'), translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
})
.then(response => response.json())
.then(json => dispatch(iguanaAddCoin(coin, mode, acData)));
@ -191,7 +191,7 @@ export function addCoinResult(coin, mode) {
};
return dispatch => {
dispatch(triggerToaster(true, `${coin} ${translate('TOASTR.STARTED_IN')} ${modeToValue[mode]} ${translate('TOASTR.MODE')}`, translate('TOASTR.COIN_NOTIFICATION'), 'success'));
dispatch(triggerToaster(`${coin} ${translate('TOASTR.STARTED_IN')} ${modeToValue[mode]} ${translate('TOASTR.MODE')}`, translate('TOASTR.COIN_NOTIFICATION'), 'success'));
dispatch(toggleAddcoinModal(false, false));
dispatch(getDexCoins());
}
@ -208,7 +208,7 @@ export function _shepherdGetConfig(coin, mode) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'Failed to get mode config', 'Error', 'error'));
dispatch(triggerToaster('Failed to get mode config', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(shepherdHerd(coin, mode, json)));
@ -228,7 +228,7 @@ export function shepherdGetConfig(coin, mode) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'Failed to get KMD config', 'Error', 'error'));
dispatch(triggerToaster('Failed to get KMD config', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(shepherdHerd(coin, mode, json)))
@ -244,7 +244,7 @@ export function shepherdGetConfig(coin, mode) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'Failed to get mode config', 'Error', 'error'));
dispatch(triggerToaster('Failed to get mode config', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(shepherdHerd(coin, mode, json)));

14
react/src/actions/actions/addressBalance.js

@ -89,7 +89,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getKMDAddressesNative+addresslist+cache', 'Error', 'error'));
dispatch(triggerToaster('getKMDAddressesNative+addresslist+cache', 'Error', 'error'));
})
.then(response => response.json())
.then(function(json) {
@ -121,7 +121,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getKMDAddressesNative', 'Error', 'error'));
dispatch(triggerToaster('getKMDAddressesNative', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -296,7 +296,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getKMDAddressesNative+ZBalance', 'Error', 'error'));
dispatch(triggerToaster('getKMDAddressesNative+ZBalance', 'Error', 'error'));
})
.then(response => response.json())
.then(function(json) {
@ -308,7 +308,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'status': 'error',
'response': json,
}));
dispatch(triggerToaster(true, 'getKMDAddressesNative+ZBalance', 'Error', 'error'));
dispatch(triggerToaster('getKMDAddressesNative+ZBalance', 'Error', 'error'));
} else {
resolve(json);
newAddressArray[1][index] = {
@ -351,7 +351,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getKMDAddressesNative+addresslist+cache', 'Error', 'error'));
dispatch(triggerToaster('getKMDAddressesNative+addresslist+cache', 'Error', 'error'));
})
.then(response => response.json())
.then(function(json) {
@ -383,7 +383,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getKMDAddressesNative+Balance', 'Error', 'error'));
dispatch(triggerToaster('getKMDAddressesNative+Balance', 'Error', 'error'));
})
.then(response => response.json())
.then(function(json) {
@ -424,7 +424,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getKMDAddressesNative+Balance', 'Error', 'error'));
dispatch(triggerToaster('getKMDAddressesNative+Balance', 'Error', 'error'));
})
.then(response => response.json())
.then(function(json) {

2
react/src/actions/actions/atomic.js

@ -31,7 +31,7 @@ export function atomic(payload) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, payload.method, 'Atomic Explorer error', 'error'));
dispatch(triggerToaster(payload.method, 'Atomic Explorer error', 'error'));
})
.then(response => response.json())
.then(json => {

14
react/src/actions/actions/basiliskCache.js

@ -19,7 +19,7 @@ export function deleteCacheFile(_payload) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'deleteCacheFile', 'Error', 'error'))
dispatch(triggerToaster('deleteCacheFile', 'Error', 'error'))
})
.then(response => response.json())
.then(json => dispatch(fetchNewCacheData(_payload)));
@ -38,7 +38,7 @@ export function getCacheFile(pubkey) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getCacheFile', 'Error', 'error'))
dispatch(triggerToaster('getCacheFile', 'Error', 'error'))
})
.then(response => response.json())
.then(json => resolve(json))
@ -63,7 +63,7 @@ export function fetchNewCacheData(_payload) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'fetchNewCacheData', 'Error', 'error'));
dispatch(triggerToaster('fetchNewCacheData', 'Error', 'error'));
})
.then(response => response.json())
.then(json => console.log(json))
@ -80,7 +80,7 @@ export function getShepherdCache(pubkey, coin) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getShepherdCache', 'Error', 'error'));
dispatch(triggerToaster('getShepherdCache', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getShepherdCacheState(json, pubkey, coin)))
@ -125,7 +125,7 @@ export function fetchUtxoCache(_payload) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'fetchNewCacheData', 'Error', 'error'));
dispatch(triggerToaster('fetchNewCacheData', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getShepherdCache(_pubkey)))
@ -146,7 +146,7 @@ export function shepherdGroomPost(_filename, _payload) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'shepherdGroomPost', 'Error', 'error'));
dispatch(triggerToaster('shepherdGroomPost', 'Error', 'error'));
})
.then(response => response.json())
.then(json => console.log(json))
@ -167,7 +167,7 @@ export function shepherdGroomPostPromise(_filename, _payload) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'shepherdGroomPostPromise', 'Error', 'error'));
dispatch(triggerToaster('shepherdGroomPostPromise', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))

16
react/src/actions/actions/basiliskProcessAddress.js

@ -39,7 +39,7 @@ export function checkAddressBasilisk(coin, address) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'checkAddressBasilisk', 'Error', 'error'));
dispatch(triggerToaster('checkAddressBasilisk', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -57,7 +57,7 @@ function checkAddressBasiliskHandle(json) {
if (json &&
json.error) {
return dispatch => {
dispatch(triggerToaster(true, json.error, translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
dispatch(triggerToaster(json.error, translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
}
}
@ -65,7 +65,7 @@ function checkAddressBasiliskHandle(json) {
json.coin &&
json.randipbits) {
return dispatch => {
dispatch(triggerToaster(true, 'Address already registered', translate('TOASTR.WALLET_NOTIFICATION'), 'warning'));
dispatch(triggerToaster('Address already registered', translate('TOASTR.WALLET_NOTIFICATION'), 'warning'));
}
}
}
@ -101,7 +101,7 @@ export function validateAddressBasilisk(coin, address) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'validateAddressBasilisk', 'Error', 'error'));
dispatch(triggerToaster('validateAddressBasilisk', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -118,16 +118,16 @@ export function validateAddressBasilisk(coin, address) {
function validateAddressBasiliskHandle(json) {
return dispatch => {
if (json.iswatchonly === true) {
dispatch(triggerToaster(true, translate('TOASTR.VALIDATION_SUCCESS'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('TOASTR.VALIDATION_SUCCESS'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
}
if (json.iswatchonly === false) {
dispatch(triggerToaster(true, translate('TOASTR.ADDR_ISNT_REG'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('TOASTR.ADDR_ISNT_REG'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
}
if (json.iswatchonly === undefined) {
dispatch(triggerToaster(true, translate('TOASTR.INVALID_QUERY_ALT'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('TOASTR.INVALID_QUERY_ALT'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
}
if (json.error === 'less than required responses') {
dispatch(triggerToaster(true, translate('TOASTR.LESS_RESPONSES_REQ'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('TOASTR.LESS_RESPONSES_REQ'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
}
}
}

2
react/src/actions/actions/basiliskTxHistory.js

@ -20,7 +20,7 @@ export function getBasiliskTransactionsList(coin, address) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getBasiliskTransactionsList+cache', 'Error', 'error'));
dispatch(triggerToaster('getBasiliskTransactionsList+cache', 'Error', 'error'));
})
.then(response => response.json())
.then(function(json) {

4
react/src/actions/actions/cli.js

@ -25,7 +25,7 @@ export function shepherdCliPromise(mode, chain, cmd) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'shepherdCli', 'Error', 'error'));
dispatch(triggerToaster('shepherdCli', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))
@ -49,7 +49,7 @@ export function shepherdCli(mode, chain, cmd) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'shepherdCli', 'Error', 'error'));
dispatch(triggerToaster('shepherdCli', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(cliResponseState(json)))

4
react/src/actions/actions/coinList.js

@ -17,7 +17,7 @@ export function shepherdGetCoinList() {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'shepherdGetCoinList', 'Error', 'error'));
dispatch(triggerToaster('shepherdGetCoinList', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))
@ -35,7 +35,7 @@ export function shepherdPostCoinList(data) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'shepherdPostCoinList', 'Error', 'error'));
dispatch(triggerToaster('shepherdPostCoinList', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))

4
react/src/actions/actions/copyAddress.js

@ -7,11 +7,11 @@ export function copyCoinAddress(address) {
if (_result) {
return dispatch => {
dispatch(triggerToaster(true, translate('DASHBOARD.ADDR_COPIED'), translate('TOASTR.COIN_NOTIFICATION'), 'success'));
dispatch(triggerToaster(translate('DASHBOARD.ADDR_COPIED'), translate('TOASTR.COIN_NOTIFICATION'), 'success'));
}
} else {
return dispatch => {
dispatch(triggerToaster(true, 'Couldn\'t copy address to clipboard', translate('TOASTR.COIN_NOTIFICATION'), 'error'));
dispatch(triggerToaster('Couldn\'t copy address to clipboard', translate('TOASTR.COIN_NOTIFICATION'), 'error'));
}
}
}

6
react/src/actions/actions/createWallet.js

@ -13,11 +13,11 @@ function createNewWalletState(json) {
json.result &&
json.result === 'success') {
return dispatch => {
dispatch(triggerToaster(true, translate('TOASTR.WALLET_CREATED_SUCCESFULLY'), translate('TOASTR.ACCOUNT_NOTIFICATION'), 'success'));
dispatch(triggerToaster(translate('TOASTR.WALLET_CREATED_SUCCESFULLY'), translate('TOASTR.ACCOUNT_NOTIFICATION'), 'success'));
}
} else {
return dispatch => {
dispatch(triggerToaster(true, 'Couldn\'t create new wallet seed', translate('TOASTR.ACCOUNT_NOTIFICATION'), 'error'));
dispatch(triggerToaster('Couldn\'t create new wallet seed', translate('TOASTR.ACCOUNT_NOTIFICATION'), 'error'));
}
}
}
@ -52,7 +52,7 @@ export function createNewWallet(_passphrase) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'createNewWallet', 'Error', 'error'));
dispatch(triggerToaster('createNewWallet', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

2
react/src/actions/actions/dexCoins.js

@ -37,7 +37,7 @@ export function getDexCoins() {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'Error getDexCoins', 'Error', 'error'));
dispatch(triggerToaster('Error getDexCoins', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

4
react/src/actions/actions/edexBalance.js

@ -39,7 +39,7 @@ export function iguanaEdexBalance(coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'Error iguanaEdexBalance', 'Error', 'error'));
dispatch(triggerToaster('Error iguanaEdexBalance', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(iguanaEdexBalanceState(json)));
@ -86,7 +86,7 @@ export function getDexBalance(coin, mode, addr) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getDexBalance', 'Error', 'error'));
dispatch(triggerToaster('getDexBalance', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

2
react/src/actions/actions/edexGetTx.js

@ -39,7 +39,7 @@ export function edexGetTransaction(data, dispatch) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'edexGetTransaction', 'Error', 'error'));
dispatch(triggerToaster('edexGetTransaction', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

2
react/src/actions/actions/fullTxHistory.js

@ -42,7 +42,7 @@ export function getFullTransactionsList(coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getFullTransactionsList', 'Error', 'error'));
dispatch(triggerToaster('getFullTransactionsList', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

2
react/src/actions/actions/getAddrByAccount.js

@ -61,7 +61,7 @@ export function getAddressesByAccount(coin, mode) {
'response': error,
}));
dispatch(updateErrosStack('activeHandle'));
dispatch(triggerToaster(true, 'getAddressesByAccount', 'Error', 'error'));
dispatch(triggerToaster('getAddressesByAccount', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

2
react/src/actions/actions/iguanaHelpers.js

@ -49,7 +49,7 @@ export function iguanaHashHex(data, dispatch) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'iguanaHashHex', 'Error', 'error'));
dispatch(triggerToaster('iguanaHashHex', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

6
react/src/actions/actions/iguanaInstance.js

@ -17,7 +17,7 @@ export function restartIguanaInstance(pmid) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'restartIguanaInstance', 'Error', 'error'));
dispatch(triggerToaster('restartIguanaInstance', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))
@ -54,7 +54,7 @@ export function startIguanaInstance(mode, coin) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'startIguanaInstance', 'Error', 'error'));
dispatch(triggerToaster('startIguanaInstance', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))
@ -71,7 +71,7 @@ export function getIguanaInstancesList() {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getIguanaInstanceList', 'Error', 'error'));
dispatch(triggerToaster('getIguanaInstanceList', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))

4
react/src/actions/actions/log.js

@ -18,7 +18,7 @@ export function logGuiHttp(payload) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'logGuiHttp', 'Error', 'error'));
dispatch(triggerToaster('logGuiHttp', 'Error', 'error'));
})
.then(response => response.json())*/
}
@ -34,7 +34,7 @@ export function getAgamaLog(type) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getAgamaLog', 'Error', 'error'));
dispatch(triggerToaster('getAgamaLog', 'Error', 'error'));
})
.then(response => response.json())
.then()

2
react/src/actions/actions/logout.js

@ -52,7 +52,7 @@ function walletLock() {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'walletLock', 'Error', 'error'));
dispatch(triggerToaster('walletLock', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

33
react/src/actions/actions/nativeBalance.js

@ -32,21 +32,44 @@ export function getKMDBalanceTotal(coin) {
};
}
if (Config.cli.default === true) {
payload = {
mode: null,
coin,
cmd: 'z_gettotalbalance'
};
}
return dispatch => {
const _timestamp = Date.now();
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getKMDBalanceTotal',
'type': 'post',
'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload,
'status': 'pending',
}));
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
let _fetchConfig = {
method: 'POST',
body: JSON.stringify(payload),
})
};
if (Config.cli.default === true) {
_fetchConfig = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
};
}
return fetch(
Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
_fetchConfig
)
.catch(function(error) {
console.log(error);
dispatch(logGuiHttp({
@ -54,7 +77,7 @@ export function getKMDBalanceTotal(coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getKMDBalanceTotal', 'Error', 'error'));
dispatch(triggerToaster('getKMDBalanceTotal', 'Error', 'error'));
})
.then(response => response.json())
.then(function(json) { // TODO: figure out why komodod spits out "parse error"
@ -74,6 +97,6 @@ export function getKMDBalanceTotal(coin) {
export function getNativeBalancesState(json) {
return {
type: DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE,
balance: json && !json.error ? json : 0,
balance: json && !json.error ? (Config.cli.default ? json.result : json) : 0,
}
}

4
react/src/actions/actions/nativeNewAddress.js

@ -11,7 +11,7 @@ import {
} from './log';
function handleGetNewKMDAddresses(pubpriv, coin, dispatch) {
dispatch(triggerToaster(true, translate('KMD_NATIVE.NEW_ADDR_GENERATED'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
dispatch(triggerToaster(translate('KMD_NATIVE.NEW_ADDR_GENERATED'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
dispatch(getKMDAddressesNative(coin));
return {};
@ -69,7 +69,7 @@ export function getNewKMDAddresses(coin, pubpriv) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getNewKMDAddresses', 'Error', 'error'));
dispatch(triggerToaster('getNewKMDAddresses', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

6
react/src/actions/actions/nativeSend.js

@ -67,7 +67,7 @@ export function sendNativeTx(coin, _payload) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'sendNativeTx', 'Error', 'error'));
dispatch(triggerToaster('sendNativeTx', 'Error', 'error'));
})
.then(function(response) {
const _response = response.text().then(function(text) { return text; });
@ -88,7 +88,7 @@ export function sendNativeTx(coin, _payload) {
dispatch(triggerToaster(true, 'Your wallet.dat is not matching the blockchain. Please resync from the scratch.', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
}
} else {
dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
dispatch(triggerToaster(translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
}
})
});
@ -162,7 +162,7 @@ export function getKMDOPID(opid, coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getKMDOPID', 'Error', 'error'));
dispatch(triggerToaster('getKMDOPID', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

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

@ -34,7 +34,7 @@ export function getSyncInfoNativeKMD(skipDebug) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getSyncInfoNativeKMD', 'Error', 'error'));
dispatch(triggerToaster('getSyncInfoNativeKMD', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -61,7 +61,7 @@ function getSyncInfoNativeState(json, coin, skipDebug) {
} else {
return {
type: SYNCING_NATIVE_MODE,
progress: json,
progress: Config.cli.default === true ? json.result : json,
}
}
}
@ -77,7 +77,6 @@ export function getSyncInfoNative(coin, skipDebug) {
};
if (Config.cli.default === true) {
console.log('getSyncInfoNativeCLI', true);
payload = {
mode: null,
coin,
@ -91,7 +90,7 @@ export function getSyncInfoNative(coin, skipDebug) {
'timestamp': _timestamp,
'function': 'getSyncInfo',
'type': 'post',
'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload,
'status': 'pending',
}));
@ -110,13 +109,6 @@ export function getSyncInfoNative(coin, skipDebug) {
};
}
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
})
return fetch(
Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
_fetchConfig
@ -128,7 +120,7 @@ export function getSyncInfoNative(coin, skipDebug) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getSyncInfo', 'Error', 'error'));
dispatch(triggerToaster('getSyncInfo', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

31
react/src/actions/actions/nativeTxHistory.js

@ -31,21 +31,44 @@ export function getNativeTxHistory(coin) {
};
}
if (Config.cli.default === true) {
payload = {
mode: null,
coin,
cmd: 'listtransactions'
};
}
return dispatch => {
const _timestamp = Date.now();
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getNativeTxHistory',
'type': 'post',
'url': `http://127.0.0.1:${Config.iguanaCorePort}`,
'url': Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': payload,
'status': 'pending',
}));
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
let _fetchConfig = {
method: 'POST',
body: JSON.stringify(payload),
})
};
if (Config.cli.default === true) {
_fetchConfig = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
};
}
return fetch(
Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
_fetchConfig
)
.catch(function(error) {
console.log(error);
dispatch(logGuiHttp({
@ -53,7 +76,7 @@ export function getNativeTxHistory(coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getNativeTxHistory', 'Error', 'error'));
dispatch(triggerToaster('getNativeTxHistory', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

8
react/src/actions/actions/notary.js

@ -44,7 +44,7 @@ function initNotaryNodesConSequence(nodes) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, `getInfoDexNode+${node}`, 'Error', 'error'));
dispatch(triggerToaster(`getInfoDexNode+${node}`, 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -114,7 +114,7 @@ export function connectNotaries() {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'connectNotaries', 'Error', 'error'));
dispatch(triggerToaster('connectNotaries', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(connectAllNotaryNodes(json, dispatch)))
@ -124,7 +124,7 @@ export function connectNotaries() {
function getDexNotariesState(json) {
if (json.error === 'less than required responses') {
return dispatch => {
dispatch(triggerToaster(true, translate('TOASTR.LESS_RESPONSES_REQ'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('TOASTR.LESS_RESPONSES_REQ'), translate('TOASTR.BASILISK_NOTIFICATION'), 'error'));
}
} else {
return {
@ -163,7 +163,7 @@ export function getDexNotaries(coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getDexNotaries', 'Error', 'error'));
dispatch(triggerToaster('getDexNotaries', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {

2
react/src/actions/actions/openAlias.js

@ -13,7 +13,7 @@ export function resolveOpenAliasAddress(email) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'resolveOpenAliasAddress', 'Error', 'error'));
dispatch(triggerToaster('resolveOpenAliasAddress', 'Error', 'error'));
})
.then(response => response.json())
.then(json => resolve(json))

12
react/src/actions/actions/sendFullBasilisk.js

@ -45,7 +45,7 @@ export function sendToAddress(coin, _payload) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'sendToAddress', 'Error', 'error'));
dispatch(triggerToaster('sendToAddress', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -95,7 +95,7 @@ export function sendFromAddress(coin, _payload) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'sendFromAddress', 'Error', 'error'));
dispatch(triggerToaster('sendFromAddress', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -148,7 +148,7 @@ export function iguanaUTXORawTX(data, dispatch) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'iguanaUTXORawTX', 'Error', 'error'));
dispatch(triggerToaster('iguanaUTXORawTX', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -193,7 +193,7 @@ export function dexSendRawTX(data, dispatch) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'dexSendRawTX', 'Error', 'error'));
dispatch(triggerToaster('dexSendRawTX', 'Error', 'error'));
})
.then(function(response) {
const _response = response.text().then(function(text) { return text; });
@ -214,14 +214,14 @@ export function dexSendRawTX(data, dispatch) {
function sendToAddressState(json, dispatch) {
if (json &&
json.error) {
dispatch(triggerToaster(true, json.error, 'Error', 'error'));
dispatch(triggerToaster(json.error, 'Error', 'error'));
return {
type: DASHBOARD_ACTIVE_COIN_SENDTO,
lastSendToResponse: json,
}
} else if (json && json.result && json.complete) {
dispatch(triggerToaster(true, translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
dispatch(triggerToaster(translate('TOASTR.TX_SENT_ALT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
return {
type: DASHBOARD_ACTIVE_COIN_SENDTO,

28
react/src/actions/actions/settings.js

@ -32,7 +32,7 @@ export function getAppInfo() {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getAppInfo', 'Error', 'error'));
dispatch(triggerToaster('getAppInfo', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getAppInfoState(json)))
@ -50,19 +50,19 @@ export function settingsWifkeyState(json, coin) {
function parseImportPrivKeyResponse(json, dispatch) {
if (json.error === 'illegal privkey') {
return dispatch => {
dispatch(triggerToaster(true, 'Illegal privkey', translate('TOASTR.SETTINGS_NOTIFICATION'), 'error'));
dispatch(triggerToaster('Illegal privkey', translate('TOASTR.SETTINGS_NOTIFICATION'), 'error'));
}
}
if (json.error === 'privkey already in wallet') {
return dispatch => {
dispatch(triggerToaster(true, 'Privkey already in wallet', translate('TOASTR.SETTINGS_NOTIFICATION'), 'warning'));
dispatch(triggerToaster('Privkey already in wallet', translate('TOASTR.SETTINGS_NOTIFICATION'), 'warning'));
}
}
if (json &&
json.result !== undefined &&
json.result == 'success') {
return dispatch => {
dispatch(triggerToaster(true, translate('TOASTR.PRIV_KEY_IMPORTED'), translate('TOASTR.SETTINGS_NOTIFICATION'), 'success'));
dispatch(triggerToaster(translate('TOASTR.PRIV_KEY_IMPORTED'), translate('TOASTR.SETTINGS_NOTIFICATION'), 'success'));
}
}
}
@ -99,7 +99,7 @@ export function importPrivKey(wifKey) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'importPrivKey', 'Error', 'error'));
dispatch(triggerToaster('importPrivKey', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -144,7 +144,7 @@ export function getDebugLog(target, linesCount) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getDebugLog', 'Error', 'error'));
dispatch(triggerToaster('getDebugLog', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getDebugLogState(json)))
@ -181,7 +181,7 @@ export function getPeersList(coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getPeersList', 'Error', 'error'));
dispatch(triggerToaster('getPeersList', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -216,22 +216,22 @@ export function getPeersListState(json) {
function addPeerNodeState(json, dispatch) {
if (json.error === 'addnode needs active coin, do an addcoin first') {
return dispatch => {
dispatch(triggerToaster(true, 'Addnode needs active coin', translate('TOASTR.SETTINGS_NOTIFICATION'), 'error'));
dispatch(triggerToaster('Addnode needs active coin', translate('TOASTR.SETTINGS_NOTIFICATION'), 'error'));
}
}
if (json.result === 'peer was already connected') {
return dispatch => {
dispatch(triggerToaster(true, 'Peer was already connected', translate('TOASTR.SETTINGS_NOTIFICATION'), 'warning'));
dispatch(triggerToaster('Peer was already connected', translate('TOASTR.SETTINGS_NOTIFICATION'), 'warning'));
}
}
if (json.result === 'addnode connection was already pending') {
return dispatch => {
dispatch(triggerToaster(true, 'Addnode connection was already pending', translate('TOASTR.SETTINGS_NOTIFICATION'), 'warning'));
dispatch(triggerToaster('Addnode connection was already pending', translate('TOASTR.SETTINGS_NOTIFICATION'), 'warning'));
}
}
if (json.result === 'addnode submitted') {
return dispatch => {
dispatch(triggerToaster(true, 'Peer is added', translate('TOASTR.SETTINGS_NOTIFICATION'), 'success'));
dispatch(triggerToaster('Peer is added', translate('TOASTR.SETTINGS_NOTIFICATION'), 'success'));
}
}
}
@ -267,7 +267,7 @@ export function addPeerNode(coin, ip) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'addPeerNode', 'Error', 'error'));
dispatch(triggerToaster('addPeerNode', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -292,7 +292,7 @@ export function saveAppConfig(_payload) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'saveAppConfig', 'Error', 'error'));
dispatch(triggerToaster('saveAppConfig', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getAppConfig()))
@ -316,7 +316,7 @@ export function getAppConfig() {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getAppConfig', 'Error', 'error'));
dispatch(triggerToaster('getAppConfig', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getAppConfigState(json)))

2
react/src/actions/actions/syncInfo.js

@ -53,7 +53,7 @@ export function getSyncInfo(coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'getSyncInfo', 'Error', 'error'));
dispatch(triggerToaster('getSyncInfo', 'Error', 'error'));
})
.then(function(response) {
const _response = response.text().then(function(text) { return text; });

6
react/src/actions/actions/syncOnly.js

@ -36,7 +36,7 @@ export function getSyncOnlyForks() {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'getSyncOnlyForks', 'Error', 'error'));
dispatch(triggerToaster('getSyncOnlyForks', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(getSyncOnlyForksState(json)))
@ -53,9 +53,9 @@ export function stopIguanaFork(pmid) {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'stopIguanaFork', 'Error', 'error'));
dispatch(triggerToaster('stopIguanaFork', 'Error', 'error'));
})
.then(response => response.json())
.then(json => dispatch(triggerToaster(true, 'Iguana instance is stopped', translate('TOASTR.SERVICE_NOTIFICATION'), 'success')))
.then(json => dispatch(triggerToaster('Iguana instance is stopped', translate('TOASTR.SERVICE_NOTIFICATION'), 'success')))
}
}

2
react/src/actions/actions/sysInfo.js

@ -17,7 +17,7 @@ export function shepherdGetSysInfo() {
})
.catch(function(error) {
console.log(error);
dispatch(triggerToaster(true, 'Failed to get sys info', 'Error', 'error'))
dispatch(triggerToaster('Failed to get sys info', 'Error', 'error'))
})
.then(response => response.json())
.then(json => console.log(json));

10
react/src/actions/actions/walletAuth.js

@ -44,7 +44,7 @@ export function encryptWallet(_passphrase, cb, coin) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'encryptWallet', 'Error', 'error'));
dispatch(triggerToaster('encryptWallet', 'Error', 'error'));
})
.then(dispatch(walletPassphrase(_passphrase)))
.then(response => response.json())
@ -90,7 +90,7 @@ export function walletPassphrase(_passphrase) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'walletPassphrase', 'Error', 'error'));
dispatch(triggerToaster('walletPassphrase', 'Error', 'error'));
})
.then(json => {
dispatch(logGuiHttp({
@ -134,7 +134,7 @@ export function iguanaWalletPassphrase(_passphrase) {
'status': 'error',
'response': error,
}));
dispatch(triggerToaster(true, 'Error iguanaWalletPassphrase', 'Error', 'error'));
dispatch(triggerToaster('Error iguanaWalletPassphrase', 'Error', 'error'));
})
.then(response => response.json())
.then(json => {
@ -178,7 +178,7 @@ export function iguanaActiveHandle(getMainAddress) {
'response': error,
}));
dispatch(updateErrosStack('activeHandle'));
dispatch(triggerToaster(true, translate('TOASTR.IGUANA_ARE_YOU_SURE'), translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
dispatch(triggerToaster(translate('TOASTR.IGUANA_ARE_YOU_SURE'), translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
})
.then(response => response.json())
.then(json => {
@ -194,7 +194,7 @@ export function iguanaActiveHandle(getMainAddress) {
function iguanaWalletPassphraseState(json, dispatch) {
sessionStorage.setItem('IguanaActiveAccount', JSON.stringify(json));
dispatch(triggerToaster(true, translate('TOASTR.LOGIN_SUCCESSFULL'), translate('TOASTR.ACCOUNT_NOTIFICATION'), 'success'));
dispatch(triggerToaster(translate('TOASTR.LOGIN_SUCCESSFULL'), translate('TOASTR.ACCOUNT_NOTIFICATION'), 'success'));
dispatch(getMainAddressState(json));
dispatch(iguanaActiveHandleState(json));

63
react/src/components/addcoin/addcoin.js

@ -38,6 +38,7 @@ class AddCoin extends React.Component {
actionsMenu: false,
modalClassName: 'hide',
};
this.existingCoins = null;
this.activateCoin = this.activateCoin.bind(this);
this.dismiss = this.dismiss.bind(this);
this.addNewItem = this.addNewItem.bind(this);
@ -63,7 +64,7 @@ class AddCoin extends React.Component {
actionsMenu: false,
}));
} else {
Store.dispatch(triggerToaster(true, translate('TOASTR.SELECTION_NOT_FOUND'), translate('TOASTR.COIN_SELECTION'), 'info'));
Store.dispatch(triggerToaster(translate('TOASTR.SELECTION_NOT_FOUND'), translate('TOASTR.COIN_SELECTION'), 'info'));
}
}.bind(this));
}
@ -91,16 +92,18 @@ class AddCoin extends React.Component {
}
componentWillReceiveProps(props) {
if (props && props.display !== this.state.display) {
this.existingCoins = props && props.Main ? props.Main.coins : null;
const addCoinProps = props ? props.AddCoin : null;
if (addCoinProps && addCoinProps.display !== this.state.display) {
this.setState(Object.assign({}, this.state, {
display: props.display,
modalClassName: props.display ? 'show fade' : 'show fade',
display: addCoinProps.display,
modalClassName: addCoinProps.display ? 'show fade' : 'show fade',
}));
setTimeout(() => {
this.setState(Object.assign({}, this.state, {
display: props.display,
modalClassName: props.display ? 'show in' : 'hide',
display: addCoinProps.display,
modalClassName: addCoinProps.display ? 'show in' : 'hide',
}));
}, 100);
}
@ -172,8 +175,14 @@ class AddCoin extends React.Component {
}
activateCoin() {
const coin = this.state.coins[0].selectedCoin.split('|')[0];
if (this.isCoinAlreadyAdded(coin)) {
this.dismiss();
return;
}
Store.dispatch(addCoin(
this.state.coins[0].selectedCoin.split('|')[0],
coin,
this.state.coins[0].mode,
this.state.coins[0].syncOnly
));
@ -211,21 +220,27 @@ class AddCoin extends React.Component {
}
activateAllCoins() {
Store.dispatch(addCoin(
this.state.coins[0].selectedCoin.split('|')[0],
this.state.coins[0].mode,
this.state.coins[0].syncOnly
));
const coin = this.state.coins[0].selectedCoin.split('|')[0];
if (!this.isCoinAlreadyAdded(coin)) {
Store.dispatch(addCoin(
coin,
this.state.coins[0].mode,
this.state.coins[0].syncOnly
));
}
for (let i = 1; i < this.state.coins.length; i++) {
const _item = this.state.coins[i];
const itemCoin = _item.selectedCoin.split('|')[0];
setTimeout(() => {
Store.dispatch(addCoin(
_item.selectedCoin.split('|')[0],
_item.mode,
_item.syncOnly
));
if (!this.isCoinAlreadyAdded(itemCoin)) {
Store.dispatch(addCoin(
itemCoin,
_item.mode,
_item.syncOnly
));
}
if (i === this.state.coins.length - 1) {
let _coins = [];
@ -261,6 +276,20 @@ class AddCoin extends React.Component {
AddCoinRender.call(this)
);
}
isCoinAlreadyAdded(coin) {
const modes = ['basilisk', 'full', 'native'];
for (let mode of modes) {
if (this.existingCoins[mode].indexOf(coin) !== -1) {
const message = `${coin} ${translate('ADD_COIN.ALREADY_ADDED')} ${translate('ADD_COIN.IN')} ${mode} ${translate('ADD_COIN.MODE')}`;
Store.dispatch(triggerToaster(message, translate('ADD_COIN.COIN_ALREADY_ADDED'), 'error'));
return true;
}
}
return false;
}
}
export default AddCoin;

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

@ -340,7 +340,7 @@ class Atomic extends React.Component {
}
if (props.Atomic.response.error === 'less than required responses') {
Store.dispatch(triggerToaster(true, 'Basilisk connection error', translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
Store.dispatch(triggerToaster('Basilisk connection error', translate('TOASTR.SERVICE_NOTIFICATION'), 'error'));
}
}
}

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

@ -394,7 +394,7 @@ class SendCoin extends React.Component {
console.log('iguanaUTXORawTXJSON', json);
if (json.result === 'success' &&
json.completed === true) {
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_GENERATED') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
Store.dispatch(triggerToaster(translate('TOASTR.SIGNED_TX_GENERATED') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
if (sendData.sendsig === 1) {
const dexrawtxData = {
@ -405,19 +405,19 @@ class SendCoin extends React.Component {
.then(function(dexRawTxJSON) {
console.log('dexRawTxJSON', dexRawTxJSON);
if (dexRawTxJSON.indexOf('"error":{"code"') > -1) {
Store.dispatch(triggerToaster(true, 'Transaction failed', translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
Store.dispatch(triggerToaster('Transaction failed', translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
Store.dispatch(sendToAddressStateAlt(JSON.parse(dexRawTxJSON)));
this.setState(Object.assign({}, this.state, {
utxoMethodInProgress: false,
}));
} else {
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_SENT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
Store.dispatch(triggerToaster(translate('TOASTR.SIGNED_TX_SENT'), translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
Store.dispatch(sendToAddressStateAlt(json));
let getTxidData = function() {
return new Promise(function(resolve, reject) {
Store.dispatch(triggerToaster(true, translate('TOASTR.GETTING_TXID_INFO') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
Store.dispatch(triggerToaster(translate('TOASTR.GETTING_TXID_INFO') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
edexGetTransaction({
'coin': sendData.coin,
@ -464,7 +464,7 @@ class SendCoin extends React.Component {
console.log(result);
resolve(result);
forceUpdateCache();
Store.dispatch(triggerToaster(true, translate('TOASTR.LOCAL_UTXO_UPDATED'), translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
Store.dispatch(triggerToaster(translate('TOASTR.LOCAL_UTXO_UPDATED'), translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
this.setState(Object.assign({}, this.state, {
utxoMethodInProgress: false,
@ -473,10 +473,10 @@ class SendCoin extends React.Component {
}.bind(this));
}.bind(this);
Store.dispatch(triggerToaster(true, translate('TOASTR.AWAITING_TX_RESP') + '...', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
Store.dispatch(triggerToaster(translate('TOASTR.AWAITING_TX_RESP') + '...', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
function waterfallUTXOProcess() {
Store.dispatch(triggerToaster(true, translate('TOASTR.PROCESSING_UTXO') + '...', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
Store.dispatch(triggerToaster(translate('TOASTR.PROCESSING_UTXO') + '...', translate('TOASTR.WALLET_NOTIFICATION'), 'info'));
getTxidData()
.then(function(gettxdata) {
@ -512,7 +512,7 @@ class SendCoin extends React.Component {
}
} else {
Store.dispatch(sendToAddressStateAlt(json));
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_GENERATED_FAIL') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
Store.dispatch(triggerToaster(translate('TOASTR.SIGNED_TX_GENERATED_FAIL') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
this.setState(Object.assign({}, this.state, {
utxoMethodInProgress: false,
@ -622,10 +622,10 @@ class SendCoin extends React.Component {
}
if (this.state.sendTo === '') {
Store.dispatch(triggerToaster(true, 'Couldn\'t find any ' + this.props.ActiveCoin.coin + ' addresses', 'OpenAlias', 'error'));
Store.dispatch(triggerToaster('Couldn\'t find any ' + this.props.ActiveCoin.coin + ' addresses', 'OpenAlias', 'error'));
}
} else {
Store.dispatch(triggerToaster(true, 'Couldn\'t find any addresses', 'OpenAlias', 'error'));
Store.dispatch(triggerToaster('Couldn\'t find any addresses', 'OpenAlias', 'error'));
}
}.bind(this));
}

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

@ -218,10 +218,10 @@ class WalletsNativeSend extends React.Component {
}
if (this.state.sendTo === '') {
Store.dispatch(triggerToaster(true, 'Couldn\'t find any ' + this.props.ActiveCoin.coin + ' addresses', 'OpenAlias', 'error'));
Store.dispatch(triggerToaster('Couldn\'t find any ' + this.props.ActiveCoin.coin + ' addresses', 'OpenAlias', 'error'));
}
} else {
Store.dispatch(triggerToaster(true, 'Couldn\'t find any addresses', 'OpenAlias', 'error'));
Store.dispatch(triggerToaster('Couldn\'t find any addresses', 'OpenAlias', 'error'));
}
});
}

2
react/src/components/main/walletMain.js

@ -12,7 +12,7 @@ class WalletMain extends React.Component {
<div className="full-height">
<SyncOnly {...this.props} />
<Dashboard {...this.props} />
<AddCoin {...this.props.AddCoin} />
<AddCoin {...this.props} />
<Login {...this.props} />
<Toaster {...this.props.toaster} />
<Notifications {...this.props} />

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

@ -13,11 +13,12 @@ class ToasterItem extends React.Component {
constructor(props) {
super(props);
this.state = {
display: false,
message: null,
type: null,
title: null,
autoClose: true
display: props.display,
message: props.message,
type: props._type,
title: props.title,
autoClose: props.autoClose,
toastId: props.toastId
};
this.dismissToast = this.dismissToast.bind(this);
@ -27,11 +28,9 @@ class ToasterItem extends React.Component {
componentWillReceiveProps(props) {
if (props &&
props.message &&
props.display) {
props.message) {
this.setState({
message: props.message,
display: props.display,
type: props._type,
title: props.title,
autoClose: props.autoClose,
@ -39,7 +38,6 @@ class ToasterItem extends React.Component {
});
} else {
this.setState({
display: false,
message: null,
type: null,
title: null,
@ -74,8 +72,7 @@ class ToasterItem extends React.Component {
}
render() {
return (this.state.message && this.state.display) ?
this.renderToast() : null;
return this.state.message ? this.renderToast() : null;
}
}

6
react/src/translate/en.js

@ -221,7 +221,11 @@ export const _lang = {
'SAVE_SELECTION': 'Save Selection',
'LOAD_SELECTION': 'Load Selection',
'ACTIVATE_ALL': 'Activate all',
'ADD_ANOTHER_COIN': 'Add another coin'
'ADD_ANOTHER_COIN': 'Add another coin',
'ALREADY_ADDED': 'is already added',
'COIN_ALREADY_ADDED': 'Coin already added',
'IN': 'in',
'MODE': 'mode'
},
'JUMBLR': {
'NOTICE': 'EXPERIMENTAL TEST VERSION ONLY',

Loading…
Cancel
Save