Browse Source

Merge branch 'redux' into tx-history-improvements

# Conflicts:
#	react/src/components/dashboard/walletsData/walletsData.js
#	react/src/components/dashboard/walletsData/walletsData.render.js
#	react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js
all-modes
Ivana Trajanovska 8 years ago
parent
commit
e775f76693
  1. 3
      react/change.log
  2. 4
      react/src/actions/actionCreators.js
  3. 6
      react/src/actions/actions/addCoin.js
  4. 30
      react/src/actions/actions/addressBalance.js
  5. 6
      react/src/actions/actions/atomic.js
  6. 12
      react/src/actions/actions/basiliskProcessAddress.js
  7. 6
      react/src/actions/actions/createWallet.js
  8. 6
      react/src/actions/actions/dexCoins.js
  9. 10
      react/src/actions/actions/edexBalance.js
  10. 6
      react/src/actions/actions/edexGetTx.js
  11. 6
      react/src/actions/actions/fullTxHistory.js
  12. 6
      react/src/actions/actions/getAddrByAccount.js
  13. 6
      react/src/actions/actions/iguanaHelpers.js
  14. 6
      react/src/actions/actions/logout.js
  15. 6
      react/src/actions/actions/nativeBalance.js
  16. 6
      react/src/actions/actions/nativeNewAddress.js
  17. 21
      react/src/actions/actions/nativeSend.js
  18. 12
      react/src/actions/actions/nativeSyncInfo.js
  19. 6
      react/src/actions/actions/nativeTxHistory.js
  20. 12
      react/src/actions/actions/notary.js
  21. 24
      react/src/actions/actions/sendFullBasilisk.js
  22. 18
      react/src/actions/actions/settings.js
  23. 6
      react/src/actions/actions/syncInfo.js
  24. 24
      react/src/actions/actions/walletAuth.js
  25. 10
      react/src/components/dashboard/coinTile/coinTileItem.js
  26. 20
      react/src/components/dashboard/main/dashboard.render.js
  27. 16
      react/src/components/dashboard/qrModal/qrModal.js
  28. 8
      react/src/components/dashboard/qrModal/qrModal.render.js
  29. 14
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  30. 8
      react/src/components/dashboard/receiveCoin/receiveCoin.render.js
  31. 36
      react/src/components/dashboard/sendCoin/sendCoin.js
  32. 24
      react/src/components/dashboard/sendCoin/sendCoin.render.js
  33. 29
      react/src/components/dashboard/settings/settings.js
  34. 12
      react/src/components/dashboard/settings/settings.render.js
  35. 31
      react/src/components/dashboard/walletsBalance/walletsBalance.js
  36. 39
      react/src/components/dashboard/walletsBalance/walletsBalance.render.js
  37. 70
      react/src/components/dashboard/walletsData/walletsData.js
  38. 12
      react/src/components/dashboard/walletsData/walletsData.render.js
  39. 77
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.js
  40. 44
      react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js
  41. 46
      react/src/components/dashboard/walletsNav/walletsNav.js
  42. 16
      react/src/components/dashboard/walletsNav/walletsNav.render.js
  43. 16
      react/src/components/dashboard/walletsProgress/walletsProgress.js
  44. 4
      react/src/components/dashboard/walletsTxInfo/walletsTxInfo.js
  45. 36
      react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js
  46. 2
      react/src/components/login/login.js
  47. 10
      react/src/components/main/main.js
  48. 1
      react/src/components/main/walletMain.js
  49. 36
      react/src/components/overrides.scss
  50. 4
      react/src/translate/en.js
  51. 8
      react/src/translate/translate.js
  52. 13
      react/src/util/formatValue.js
  53. 15
      react/src/util/sort.js
  54. 6
      react/src/util/time.js
  55. 3
      react/www/index.html

3
react/change.log

@ -13,6 +13,9 @@ UI:
- reset app setting to default
- manual balance / transactions list refresh
- quick access dropdown on login to open settings / about / sync only modals
- qr code generator / scan
- basilisk send form reset fix
- added native wallet info button
v0.2.0.21a-beta
--------------

4
react/src/actions/actionCreators.js

@ -325,9 +325,9 @@ export function getNativeTxHistoryState(json) {
if (json &&
json.error) {
json = null;
} else if (json && json.result) {
} else if (json && json.result && json.result.length) {
json = json.result;
} else if (!json.length) {
} else if (!json || !json.result.length) {
json = 'no data';
}

6
react/src/actions/actions/addCoin.js

@ -97,6 +97,7 @@ export function addCoin(coin, mode, syncOnly, port, startupParams) {
export function iguanaAddCoin(coin, mode, acData, port) {
function _iguanaAddCoin(dispatch) {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'iguanaAddCoin',
@ -105,6 +106,7 @@ export function iguanaAddCoin(coin, mode, acData, port) {
'payload': acData,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, {
method: 'POST',
@ -112,11 +114,13 @@ export function iguanaAddCoin(coin, mode, acData, port) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
translate('TOASTR.FAILED_TO_ADDCOIN'),
@ -127,11 +131,13 @@ export function iguanaAddCoin(coin, mode, acData, port) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(
addCoinResult(
coin,

30
react/src/actions/actions/addressBalance.js

@ -106,6 +106,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
}
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getKMDAddressesNative',
@ -114,6 +115,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -137,11 +139,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative',
@ -152,11 +156,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
resolve(Config.cli.default && mode === 'native' ? json.result : json);
})
}
@ -249,6 +255,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
for (let a = 0; a < result.length; a++) {
newAddressArray[a] = [];
if (result[a]) {
for (let b = 0; b < result[a].length; b++) {
let filteredArray;
@ -270,6 +277,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
};
}
}
}
// get zaddr balance
if (result[1] &&
@ -277,7 +285,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
Promise.all(result[1].map((_address, index) => {
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
let ajaxDataToHex = `[\"${_address}\"]`;
let ajaxDataToHex = '["' + _address + '"]';
iguanaHashHex(ajaxDataToHex, dispatch)
.then((hashHexJson) => {
@ -299,6 +307,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'hex': hashHexJson,
};
}
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getKMDAddressesNative+ZBalance',
@ -307,6 +316,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -339,11 +349,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+ZBalance',
@ -357,11 +369,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
if (json &&
json.error) {
resolve(0);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': json,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+ZBalance',
@ -380,12 +394,14 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
amount: json,
type: 'private',
};
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
}
});
});
});
@ -433,6 +449,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
calcBalance(result, json[coin][currentAddress].refresh.data, dispatch, mode);
} else {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getKMDAddressesNative+Balance',
@ -441,6 +458,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'payload': payload,
'status': 'pending',
}));
}
fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, {
method: 'POST',
@ -448,11 +466,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+Balance',
@ -463,11 +483,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
.then(response => response.json())
.then(function(json) {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
updatedCache.basilisk[coin][currentAddress].refresh = {
'data': json,
'status': 'done',
@ -485,6 +507,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
})
} else {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getKMDAddressesNative+Balance',
@ -493,6 +516,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -523,11 +547,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getKMDAddressesNative+Balance',
@ -542,11 +568,13 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
mode === 'native') {
json = json.result;
}
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
calcBalance(
result,
json,

6
react/src/actions/actions/atomic.js

@ -9,6 +9,7 @@ import Config from '../../config';
export function atomic(payload) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'atomic',
@ -17,6 +18,7 @@ export function atomic(payload) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -24,11 +26,13 @@ export function atomic(payload) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
payload.method,
@ -39,11 +43,13 @@ export function atomic(payload) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(atomicState(json));
});
}

12
react/src/actions/actions/basiliskProcessAddress.js

@ -17,6 +17,7 @@ export function checkAddressBasilisk(coin, address) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'checkAddressBasilisk',
@ -25,6 +26,7 @@ export function checkAddressBasilisk(coin, address) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST',
@ -32,11 +34,13 @@ export function checkAddressBasilisk(coin, address) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'checkAddressBasilisk',
@ -47,11 +51,13 @@ export function checkAddressBasilisk(coin, address) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(checkAddressBasiliskHandle(json));
})
}
@ -97,6 +103,7 @@ export function validateAddressBasilisk(coin, address) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'validateAddressBasilisk',
@ -105,6 +112,7 @@ export function validateAddressBasilisk(coin, address) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST',
@ -112,11 +120,13 @@ export function validateAddressBasilisk(coin, address) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'validateAddressBasilisk',
@ -127,11 +137,13 @@ export function validateAddressBasilisk(coin, address) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(validateAddressBasiliskHandle(json));
})
}

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

@ -42,6 +42,7 @@ export function createNewWallet(_passphrase) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'createNewWallet',
@ -50,6 +51,7 @@ export function createNewWallet(_passphrase) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -57,11 +59,13 @@ export function createNewWallet(_passphrase) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'createNewWallet',
@ -72,11 +76,13 @@ export function createNewWallet(_passphrase) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(createNewWalletState(json));
})
}

6
react/src/actions/actions/dexCoins.js

@ -17,6 +17,7 @@ export function getDexCoins() {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getDexCoins',
@ -25,6 +26,7 @@ export function getDexCoins() {
'payload': _payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -46,11 +48,13 @@ export function getDexCoins() {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'Error getDexCoins',
@ -61,11 +65,13 @@ export function getDexCoins() {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(dashboardCoinsState(json));
});
}

10
react/src/actions/actions/edexBalance.js

@ -17,6 +17,7 @@ export function iguanaEdexBalance(coin) {
return dispatch => {
if (coin) {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'iguanaEdexBalance',
@ -25,6 +26,7 @@ export function iguanaEdexBalance(coin) {
'payload': _payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -32,11 +34,13 @@ export function iguanaEdexBalance(coin) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'Error iguanaEdexBalance',
@ -70,6 +74,7 @@ export function getDexBalance(coin, mode, addr) {
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getDexBalance',
@ -78,6 +83,7 @@ export function getDexBalance(coin, mode, addr) {
'payload': payload,
'status': 'pending',
}));
}
fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST',
@ -85,11 +91,13 @@ export function getDexBalance(coin, mode, addr) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getDexBalance',
@ -101,11 +109,13 @@ export function getDexBalance(coin, mode, addr) {
.then(response => response.json())
.then(json => {
console.log(json);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
})
resolve(index);

6
react/src/actions/actions/edexGetTx.js

@ -17,6 +17,7 @@ export function edexGetTransaction(data, dispatch) {
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'edexGetTransaction',
@ -25,6 +26,7 @@ export function edexGetTransaction(data, dispatch) {
'payload': payload,
'status': 'pending',
}));
}
fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -32,11 +34,13 @@ export function edexGetTransaction(data, dispatch) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'edexGetTransaction',
@ -47,11 +51,13 @@ export function edexGetTransaction(data, dispatch) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
resolve(json);
})
});

6
react/src/actions/actions/fullTxHistory.js

@ -22,6 +22,7 @@ export function getFullTransactionsList(coin) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getFullTransactionsList',
@ -30,6 +31,7 @@ export function getFullTransactionsList(coin) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -37,11 +39,13 @@ export function getFullTransactionsList(coin) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getFullTransactionsList',
@ -52,11 +56,13 @@ export function getFullTransactionsList(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(getNativeTxHistoryState(json));
})
}

6
react/src/actions/actions/getAddrByAccount.js

@ -37,6 +37,7 @@ export function getAddressesByAccount(coin, mode) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getAddressesByAccount',
@ -45,6 +46,7 @@ export function getAddressesByAccount(coin, mode) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -52,11 +54,13 @@ export function getAddressesByAccount(coin, mode) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(updateErrosStack('activeHandle'));
dispatch(
triggerToaster(
@ -68,11 +72,13 @@ export function getAddressesByAccount(coin, mode) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(
getAddressesByAccountState(
json,

6
react/src/actions/actions/iguanaHelpers.js

@ -30,6 +30,7 @@ export function iguanaHashHex(data, dispatch) {
resolve(true);
} else {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'iguanaHashHex',
@ -38,6 +39,7 @@ export function iguanaHashHex(data, dispatch) {
'payload': payload,
'status': 'pending',
}));
}
fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -45,11 +47,13 @@ export function iguanaHashHex(data, dispatch) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'iguanaHashHex',
@ -60,11 +64,13 @@ export function iguanaHashHex(data, dispatch) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
resolve(json.hex);
})
}

6
react/src/actions/actions/logout.js

@ -39,6 +39,7 @@ function walletLock() {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'walletLock',
@ -47,6 +48,7 @@ function walletLock() {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -54,11 +56,13 @@ function walletLock() {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'walletLock',
@ -69,11 +73,13 @@ function walletLock() {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(logoutState(json));
dispatch(logoutResetAppState());
})

6
react/src/actions/actions/nativeBalance.js

@ -42,6 +42,7 @@ export function getKMDBalanceTotal(coin) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getKMDBalanceTotal',
@ -50,6 +51,7 @@ export function getKMDBalanceTotal(coin) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -72,11 +74,13 @@ export function getKMDBalanceTotal(coin) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getKMDBalanceTotal',
@ -87,11 +91,13 @@ export function getKMDBalanceTotal(coin) {
})
.then(response => response.json())
.then(function(json) { // TODO: figure out why komodod spits out "parse error"
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
if (json &&
!json.error) {
dispatch(getNativeBalancesState(json));

6
react/src/actions/actions/nativeNewAddress.js

@ -49,6 +49,7 @@ export function getNewKMDAddresses(coin, pubpriv) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getNewKMDAddresses',
@ -57,6 +58,7 @@ export function getNewKMDAddresses(coin, pubpriv) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -85,11 +87,13 @@ export function getNewKMDAddresses(coin, pubpriv) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getNewKMDAddresses',
@ -103,11 +107,13 @@ export function getNewKMDAddresses(coin, pubpriv) {
if (Config.cli.default) {
json = json.result;
}
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(
handleGetNewKMDAddresses(
pubpriv,

21
react/src/actions/actions/nativeSend.js

@ -16,8 +16,9 @@ export function sendNativeTx(coin, _payload) {
let payload;
let _apiMethod;
if (_payload.addressType === 'public' && // transparent
_payload.sendTo.length !== 95) {
// iguana core
if ((_payload.addressType === 'public' && // transparent
_payload.sendTo.length !== 95) || !_payload.sendFrom) {
_apiMethod = 'sendtoaddress';
ajaxDataToHex = `["${_payload.sendTo}", ${Number(_payload.amount) - Number(_payload.fee)}]`;
} else { // private
@ -47,6 +48,7 @@ export function sendNativeTx(coin, _payload) {
}
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'sendNativeTx',
@ -55,19 +57,20 @@ export function sendNativeTx(coin, _payload) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
body: JSON.stringify(payload),
};
if (Config.cli.default) {
if (Config.cli.default) { // rpc
payload = {
mode: null,
chain: coin,
cmd: payload.function,
params:
_payload.addressType === 'public' && _payload.sendTo.length !== 95 ?
(_payload.addressType === 'public' && _payload.sendTo.length !== 95) || !_payload.sendFrom ?
[
_payload.sendTo,
_payload.amount
@ -97,11 +100,13 @@ export function sendNativeTx(coin, _payload) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'sendNativeTx',
@ -115,11 +120,13 @@ export function sendNativeTx(coin, _payload) {
return _response;
})
.then(function(json) {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
if (json.indexOf('"code":') > -1) {
const _message = json.substring(
@ -208,6 +215,7 @@ export function getKMDOPID(opid, coin) {
}
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getKMDOPID',
@ -216,6 +224,7 @@ export function getKMDOPID(opid, coin) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -244,11 +253,13 @@ export function getKMDOPID(opid, coin) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getKMDOPID',
@ -262,11 +273,13 @@ export function getKMDOPID(opid, coin) {
if (Config.cli.default) {
json = json.result;
}
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(getKMDOPIDState(json));
})
})

12
react/src/actions/actions/nativeSyncInfo.js

@ -16,6 +16,7 @@ export function getSyncInfoNativeKMD(skipDebug) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getSyncInfoNativeKMD',
@ -24,6 +25,7 @@ export function getSyncInfoNativeKMD(skipDebug) {
'payload': '',
'status': 'pending',
}));
}
return fetch(
Config.iguanaLessMode ? 'http://kmd.explorer.supernet.org/api/status?q=getInfo' : `http://127.0.0.1:${Config.iguanaCorePort}/api/dex/getinfo?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}&symbol=${coin}`, {
@ -31,11 +33,13 @@ export function getSyncInfoNativeKMD(skipDebug) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getSyncInfoNativeKMD',
@ -46,11 +50,13 @@ export function getSyncInfoNativeKMD(skipDebug) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': Config.iguanaLessMode ? json.info : json,
}));
}
dispatch(getSyncInfoNativeState({ 'remoteKMDNode': Config.iguanaLessMode ? json.info : json }));
})
.then(function() {
@ -104,6 +110,7 @@ export function getSyncInfoNative(coin, skipDebug) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getSyncInfo',
@ -112,6 +119,7 @@ export function getSyncInfoNative(coin, skipDebug) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
body: JSON.stringify(payload),
@ -133,11 +141,13 @@ export function getSyncInfoNative(coin, skipDebug) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getSyncInfo',
@ -172,11 +182,13 @@ export function getSyncInfoNative(coin, skipDebug) {
dispatch(getDebugLog('komodo', 1));
}
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(
getSyncInfoNativeState(
json,

6
react/src/actions/actions/nativeTxHistory.js

@ -33,6 +33,7 @@ export function getNativeTxHistory(coin) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getNativeTxHistory',
@ -41,6 +42,7 @@ export function getNativeTxHistory(coin) {
'payload': payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -69,11 +71,13 @@ export function getNativeTxHistory(coin) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getNativeTxHistory',
@ -84,11 +88,13 @@ export function getNativeTxHistory(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(getNativeTxHistoryState(json));
})
}

12
react/src/actions/actions/notary.js

@ -23,6 +23,7 @@ function initNotaryNodesConSequence(nodes) {
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': `initNotaryNodesConSequence+${node}`,
@ -31,17 +32,20 @@ function initNotaryNodesConSequence(nodes) {
'payload': payload,
'status': 'pending',
}));
}
fetch(`http://127.0.0.1:${(Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}/api/dex/getinfo?userpass=${('tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'))}&symbol=${node}`, {
method: 'GET',
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
`getInfoDexNode+${node}`,
@ -52,11 +56,13 @@ function initNotaryNodesConSequence(nodes) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(
updateNotaryNodeConState(
json,
@ -171,6 +177,7 @@ export function getDexNotaries(coin) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getDexNotaries',
@ -179,17 +186,20 @@ export function getDexNotaries(coin) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
method: 'POST',
body: JSON.stringify(payload),
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getDexNotaries',
@ -200,11 +210,13 @@ export function getDexNotaries(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(getDexNotariesState(json));
})
}

24
react/src/actions/actions/sendFullBasilisk.js

@ -25,6 +25,7 @@ export function sendToAddress(coin, _payload) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'sendToAddress',
@ -33,6 +34,7 @@ export function sendToAddress(coin, _payload) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -40,11 +42,13 @@ export function sendToAddress(coin, _payload) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'sendToAddress',
@ -55,11 +59,13 @@ export function sendToAddress(coin, _payload) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(sendToAddressState(json, dispatch));
})
}
@ -81,6 +87,7 @@ export function sendFromAddress(coin, _payload) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'sendFromAddress',
@ -89,6 +96,7 @@ export function sendFromAddress(coin, _payload) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -96,11 +104,13 @@ export function sendFromAddress(coin, _payload) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'sendFromAddress',
@ -111,11 +121,13 @@ export function sendFromAddress(coin, _payload) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(sendToAddressState(json, dispatch));
})
}
@ -140,6 +152,7 @@ export function iguanaUTXORawTX(data, dispatch) {
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'iguanaUTXORawTX',
@ -148,6 +161,7 @@ export function iguanaUTXORawTX(data, dispatch) {
'payload': payload,
'status': 'pending',
}));
}
fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -155,11 +169,13 @@ export function iguanaUTXORawTX(data, dispatch) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch => dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'iguanaUTXORawTX',
@ -170,11 +186,13 @@ export function iguanaUTXORawTX(data, dispatch) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
resolve(json);
})
});
@ -191,6 +209,7 @@ export function dexSendRawTX(data, dispatch) {
return new Promise((resolve, reject) => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'dexSendRawTX',
@ -199,6 +218,7 @@ export function dexSendRawTX(data, dispatch) {
'payload': payload,
'status': 'pending',
}));
}
fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
method: 'POST',
@ -206,11 +226,13 @@ export function dexSendRawTX(data, dispatch) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'dexSendRawTX',
@ -225,11 +247,13 @@ export function dexSendRawTX(data, dispatch) {
return _response;
})
.then(function(json) {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
resolve(json);
})
});

18
react/src/actions/actions/settings.js

@ -101,6 +101,7 @@ export function importPrivKey(wifKey) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'importPrivKey',
@ -109,6 +110,7 @@ export function importPrivKey(wifKey) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -116,11 +118,13 @@ export function importPrivKey(wifKey) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'importPrivKey',
@ -131,11 +135,13 @@ export function importPrivKey(wifKey) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(
parseImportPrivKeyResponse(
json,
@ -200,6 +206,7 @@ export function getPeersList(coin) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getPeersList',
@ -208,6 +215,7 @@ export function getPeersList(coin) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -215,11 +223,13 @@ export function getPeersList(coin) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getPeersList',
@ -230,11 +240,13 @@ export function getPeersList(coin) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(getPeersListState(json, dispatch));
})
}
@ -316,6 +328,7 @@ export function addPeerNode(coin, ip) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'addPeerNode',
@ -324,6 +337,7 @@ export function addPeerNode(coin, ip) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -331,11 +345,13 @@ export function addPeerNode(coin, ip) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'addPeerNode',
@ -346,11 +362,13 @@ export function addPeerNode(coin, ip) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(addPeerNodeState(json, dispatch));
})
}

6
react/src/actions/actions/syncInfo.js

@ -31,6 +31,7 @@ export function getSyncInfo(coin) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'getSyncInfo',
@ -39,6 +40,7 @@ export function getSyncInfo(coin) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -46,11 +48,13 @@ export function getSyncInfo(coin) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'getSyncInfo',
@ -65,11 +69,13 @@ export function getSyncInfo(coin) {
return _response;
})
.then(function(json) {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
if (json.indexOf('coin is busy processing') === -1) {
dispatch(getSyncInfoState(json, dispatch));
}

24
react/src/actions/actions/walletAuth.js

@ -24,6 +24,7 @@ export function encryptWallet(_passphrase, cb, coin) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'encryptWallet',
@ -32,6 +33,7 @@ export function encryptWallet(_passphrase, cb, coin) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -39,11 +41,13 @@ export function encryptWallet(_passphrase, cb, coin) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'encryptWallet',
@ -55,11 +59,13 @@ export function encryptWallet(_passphrase, cb, coin) {
.then(dispatch(walletPassphrase(_passphrase)))
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(
cb.call(
this,
@ -82,6 +88,7 @@ export function walletPassphrase(_passphrase) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'walletpassphrase',
@ -90,6 +97,7 @@ export function walletPassphrase(_passphrase) {
'payload': payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -97,11 +105,13 @@ export function walletPassphrase(_passphrase) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'walletPassphrase',
@ -111,11 +121,13 @@ export function walletPassphrase(_passphrase) {
);
})
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
})
}
}
@ -132,6 +144,7 @@ export function iguanaWalletPassphrase(_passphrase) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'iguanaWalletPassphrase',
@ -140,6 +153,7 @@ export function iguanaWalletPassphrase(_passphrase) {
'payload': _payload,
'status': 'pending',
}));
}
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
@ -147,11 +161,13 @@ export function iguanaWalletPassphrase(_passphrase) {
})
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(
triggerToaster(
'Error iguanaWalletPassphrase',
@ -162,11 +178,13 @@ export function iguanaWalletPassphrase(_passphrase) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(iguanaWalletPassphraseState(json, dispatch));
});
}
@ -181,6 +199,7 @@ export function iguanaActiveHandle(getMainAddress) {
return dispatch => {
const _timestamp = Date.now();
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'function': 'iguanaActiveHandle',
@ -189,6 +208,7 @@ export function iguanaActiveHandle(getMainAddress) {
'payload': _payload,
'status': 'pending',
}));
}
let _fetchConfig = {
method: 'POST',
@ -210,11 +230,13 @@ export function iguanaActiveHandle(getMainAddress) {
)
.catch(function(error) {
console.log(error);
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'error',
'response': error,
}));
}
dispatch(updateErrosStack('activeHandle'));
dispatch(
triggerToaster(
@ -226,11 +248,13 @@ export function iguanaActiveHandle(getMainAddress) {
})
.then(response => response.json())
.then(json => {
if (Config.debug) {
dispatch(logGuiHttp({
'timestamp': _timestamp,
'status': 'success',
'response': json,
}));
}
dispatch(getMainAddress ? getMainAddressState(json) : iguanaActiveHandleState(json));
});
}

10
react/src/components/dashboard/coinTile/coinTileItem.js

@ -107,6 +107,11 @@ class CoinTileItem extends React.Component {
dashboardChangeActiveCoin(coin, mode) {
if (coin !== this.props.ActiveCoin.coin) {
Store.dispatch(dashboardChangeActiveCoin(coin, mode));
setTimeout(() => {
this.dispatchCoinActions(coin, mode);
}, 100);
Store.dispatch(
stopInterval(
'sync',
@ -121,10 +126,6 @@ class CoinTileItem extends React.Component {
)
);
Store.dispatch(dashboardChangeActiveCoin(coin, mode));
this.dispatchCoinActions(coin, mode);
if (mode === 'full') {
const _iguanaActiveHandle = setInterval(() => {
this.dispatchCoinActions(coin, mode);
@ -147,6 +148,7 @@ class CoinTileItem extends React.Component {
if (mode === 'basilisk') {
const _activeHandle = this.props.Dashboard.activeHandle;
const _basiliskMainAddress = _activeHandle[coin] || JSON.parse(sessionStorage.getItem('IguanaActiveAccount'))[coin];
Store.dispatch(changeActiveAddress(_basiliskMainAddress));
if (_basiliskMainAddress) {

20
react/src/components/dashboard/main/dashboard.render.js

@ -36,21 +36,21 @@ const DashboardRender = function() {
<WalletsTxInfo {...this.props} />
<WalletsNative {...this.props} />
</div>
<div className={ this.isSectionActive('edex') ? 'show' : 'hide' }>
{ this.isSectionActive('edex') &&
<EDEX {...this.props} />
</div>
<div className={ this.isSectionActive('atomic') ? 'show full-height' : 'hide' }>
}
{ this.isSectionActive('atomic') &&
<Atomic {...this.props} />
</div>
<div className={ this.isSectionActive('jumblr') ? 'show' : 'hide' }>
}
{ this.isSectionActive('jumblr') &&
<Jumblr {...this.props} />
</div>
<div className={ this.isSectionActive('settings') ? 'show' : 'hide' }>
}
{ this.isSectionActive('settings') &&
<Settings {...this.props} />
</div>
<div className={ this.isSectionActive('about') ? 'show' : 'hide' }>
}
{ this.isSectionActive('about') &&
<About {...this.props} />
</div>
}
</div>
</div>
);

16
react/src/components/dashboard/qrModal/qrModal.js

@ -19,23 +19,29 @@ class QRModal extends React.Component {
this.closeModal = this.closeModal.bind(this);
this.handleScan = this.handleScan.bind(this);
this.handleError = this.handleError.bind(this);
document.body.addEventListener('click', this.closeModal);
}
handleScan(data) {
if (data !== null) {
if (this.props.mode === 'scan') {
this.props.setRecieverFromScan(data)
this.props.setRecieverFromScan(data);
}
this.closeModal();
}
}
handleError(err) {
if (err.name === 'NoVideoInputDevicesError') {
this.setState({
error: 'Error: No video input devices found!',
});
} else {
this.setState({
error: err,
error: 'Error: unknown error!',
});
}
}
openModal() {
this.setState({
@ -60,10 +66,6 @@ class QRModal extends React.Component {
this.setState({
modalIsOpen: false,
});
if (this.props.mode === 'scan') {
ReactDOM.unmountComponentAtNode(document.getElementById('webcam'));
}
}
render() {

8
react/src/components/dashboard/qrModal/qrModal.render.js

@ -66,7 +66,13 @@ export const QRModalReaderRender = function () {
</div>
<div className="modal-body">
<div className="animsition vertical-align fade-in">
<div className="page-content vertical-align-middle">
<div
className="page-content vertical-align-middle"
style={{
width: '100%',
textAlign: 'center',
fontSize: '16px'
}}>
<div id="webcam">
{ this.state.error }
</div>

14
react/src/components/dashboard/receiveCoin/receiveCoin.js

@ -167,15 +167,17 @@ class ReceiveCoin extends React.Component {
if (this.isBasiliskMode() &&
this.hasNoAmount(address)) {
address.amount = _cache && _cache[_coin][address.address]
&& _cache[_coin][address.address].getbalance.data
&& _cache[_coin][address.address].getbalance.data.balance ? _cache[_coin][address.address].getbalance.data.balance : 'N/A';
address.amount = _cache && _cache[_coin][address.address] &&
_cache[_coin][address.address].getbalance &&
_cache[_coin][address.address].getbalance.data &&
_cache[_coin][address.address].getbalance.data.balance ? _cache[_coin][address.address].getbalance.data.balance : 'N/A';
}
if (this.isBasiliskMode() &&
this.hasNoInterest(address)) {
address.interest = _cache && _cache[_coin][address.address]
&& _cache[_coin][address.address].getbalance.data
&& _cache[_coin][address.address].getbalance.data.interest ? _cache[_coin][address.address].getbalance.data.interest : 'N/A';
address.interest = _cache && _cache[_coin][address.address] &&
_cache[_coin][address.address].getbalance &&
_cache[_coin][address.address].getbalance.data &&
_cache[_coin][address.address].getbalance.data.interest ? _cache[_coin][address.address].getbalance.data.interest : 'N/A';
}
if (this.state.hideZeroAddresses) {

8
react/src/components/dashboard/receiveCoin/receiveCoin.render.js

@ -26,9 +26,7 @@ export const AddressActionsBasiliskModeRender = function(address) {
onClick={ () => this._validateAddressBasilisk(address) }>
<i className="icon fa-info-circle"></i>
</span>
<QRModal
content={address}
/>
<QRModal content={ address } />
</td>
);
};
@ -45,9 +43,7 @@ export const AddressActionsNonBasiliskModeRender = function(address, type) {
onClick={ () => this._copyCoinAddress(address) }>
<i className="icon wb-copy"></i> { translate('INDEX.COPY') }
</button>
<QRModal
content={address}
/>
<QRModal content={ address } />
</td>
);
};

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

@ -1,9 +1,7 @@
import React from 'react';
import Config from '../../../config';
import { translate } from '../../../translate/translate';
import {
checkTimestamp
} from '../../../util/time';
import { checkTimestamp } from '../../../util/time';
import {
edexGetTxIDList,
edexRemoveTXID
@ -55,7 +53,6 @@ class SendCoin extends React.Component {
currentStackLength: 0,
totalStackLength: 0,
utxoMethodInProgress: false,
isCameraFeatureDetected: false,
};
this.updateInput = this.updateInput.bind(this);
this.handleBasiliskSend = this.handleBasiliskSend.bind(this);
@ -66,27 +63,9 @@ class SendCoin extends React.Component {
this._fetchNewUTXOData = this._fetchNewUTXOData.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
this.setRecieverFromScan = this.setRecieverFromScan.bind(this);
this.detectCamera = this.detectCamera.bind(this);
socket.on('messages', msg => this.updateSocketsData(msg));
}
// test device camera capabilities
detectCamera() {
const _getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
_getUserMedia(
{ 'video': true },
function() {
this.setState({
isCameraFeatureDetected: true,
});
},
function() {
console.warn('this device doesn\'t have camera!');
}
);
}
setRecieverFromScan(receiver) {
this.setState({
sendTo: receiver
@ -101,8 +80,6 @@ class SendCoin extends React.Component {
this.handleClickOutside,
false
);
this.detectCamera();
}
componentWillUnmount() {
@ -323,7 +300,7 @@ class SendCoin extends React.Component {
);
} else {
return (
<span>- { translate('SEND.SELECT_T_OR_Z_ADDR') } -</span>
<span>{ translate('SEND.SELECT_T_OR_Z_ADDR') }</span>
);
}
}
@ -347,7 +324,7 @@ class SendCoin extends React.Component {
<ul className="dropdown-menu inner">
<li className="selected">
<a>
<span className="text"> - { translate('SEND.SELECT_T_OR_Z_ADDR') } - </span>
<span className="text">{ translate('SEND.SELECT_T_OR_Z_ADDR') }</span>
<span className="glyphicon glyphicon-ok check-mark"></span>
</a>
</li>
@ -395,7 +372,7 @@ class SendCoin extends React.Component {
amount: 0,
fee: 0.0001,
sendSig: false,
sendApiType: false,
sendApiType: true,
addressSelectorOpen: false,
currentStackLength: 0,
totalStackLength: 0,
@ -697,6 +674,8 @@ class SendCoin extends React.Component {
);
}
} else if (key === 'sendrawtransaction') {
const _lastSendToResponse = this.props.ActiveCoin.lastSendToResponse;
if (_lastSendToResponse[key] === 'success') {
return (
<span className="label label-success">true</span>
@ -707,6 +686,8 @@ class SendCoin extends React.Component {
);
}
} else if (key === 'txid' || key === 'sent') {
const _lastSendToResponse = this.props.ActiveCoin.lastSendToResponse;
return (
<span>{ _lastSendToResponse[key] }</span>
);
@ -775,6 +756,7 @@ class SendCoin extends React.Component {
return null;
}
render() {
if (this.props.ActiveCoin &&
this.props.ActiveCoin.send &&

24
react/src/components/dashboard/sendCoin/sendCoin.render.js

@ -8,6 +8,8 @@ import {
import QRModal from '../qrModal/qrModal';
export const UTXOCacheInfoRender = function(refreshCacheData, isReadyToUpdate, waitUntilCallIsFinished, timestamp) {
const _progress = 100 - this.state.currentStackLength * 100 / this.state.totalStackLength;
return (
<div className="col-lg-12">
<hr />
@ -25,7 +27,7 @@ export const UTXOCacheInfoRender = function(refreshCacheData, isReadyToUpdate, w
<div className={ 'full-width margin-bottom-10 margin-top-10 ' + (this.state.currentStackLength === 1 || (this.state.currentStackLength === 0 && this.state.totalStackLength === 0) ? 'hide' : 'progress progress-sm') }>
<div
className="progress-bar progress-bar-striped active progress-bar-indicating progress-bar-success font-size-80-percent"
style={{ width: 100 - `${(this.state.currentStackLength * 100 / this.state.totalStackLength)}%` }}>
style={{ width: `${_progress}%` }}>
{ translate('SEND.PROCESSING_REQ') }: { this.state.currentStackLength } / { this.state.totalStackLength }
</div>
</div>
@ -59,6 +61,8 @@ export const SendCoinResponseRender = function () {
return items;
} else {
return (
<tr className="hover--none">
<td colSpan="2">
<div className="padding-20 text-align-center">
<div className="vertical-padding-10 horizontal-padding-0">
{ translate('SEND.PROCESSING_TRANSACTION') }...<br />
@ -103,6 +107,8 @@ export const SendCoinResponseRender = function () {
</div>
</div>
</div>
</td>
</tr>
);
}
}
@ -144,7 +150,8 @@ export const SendApiTypeSelectorRender = function () {
<label className="switch">
<input
type="checkbox"
checked={ this.state.sendApiType } />
checked={ this.state.sendApiType }
readOnly />
<div
className="slider"
onClick={ this.toggleSendAPIType }></div>
@ -156,13 +163,11 @@ export const SendApiTypeSelectorRender = function () {
</div>
</span>
</div>
{ this.stateisCameraFeatureDetected &&
<div className="col-lg-4 text-right">
<QRModal
mode="scan"
setRecieverFromScan={ this.setRecieverFromScan } />
</div>
}
</div>
);
};
@ -247,9 +252,8 @@ export const SendCoinRender = function () {
className="form-control"
id="edexcoinAmount"
name="amount"
placeholder="0.000"
placeholder="0.001"
autoComplete="off"
defaultValue={ this.state.amount }
value={ this.state.amount }
onChange={ this.updateInput } />
</div>
@ -264,16 +268,15 @@ export const SendCoinRender = function () {
className="form-control"
id="edexcoinFee"
name="fee"
defaultValue={ this.state.fee }
value={ this.state.fee }
placeholder="0.000"
placeholder="0.001"
autoComplete="off"
onChange={ this.updateInput } />
</div>
<div className="col-lg-12">
<strong>
{ translate('INDEX.TOTAL') }&nbsp;
({ translate('INDEX.AMOUNT_SM') } - txfee):
({ translate('INDEX.AMOUNT_SM') } - fee):
</strong>&nbsp;
{ Number(this.state.amount) - Number(this.state.fee) } { this.props.ActiveCoin.coin }
</div>
@ -282,7 +285,8 @@ export const SendCoinRender = function () {
<label className="switch">
<input
type="checkbox"
checked={ this.state.sendSig } />
checked={ this.state.sendSig }
readOnly />
<div
className="slider"
onClick={ this.toggleSendSig }></div>

29
react/src/components/dashboard/settings/settings.js

@ -79,9 +79,21 @@ class Settings extends React.Component {
this.toggleSeedInputVisibility = this.toggleSeedInputVisibility.bind(this);
this._checkForUpdateUIPromise = this._checkForUpdateUIPromise.bind(this);
this._updateUIPromise = this._updateUIPromise.bind(this);
}
componentWillMount() {
socket.on('patch', msg => this.updateSocketsData(msg));
}
componentWillUnmount() {
socket.removeAllListeners('patch', msg => this.updateSocketsData(msg));
if (!this.state.disableWalletSpecificUI) {
document.documentElement.style.height = '100%';
document.body.style.height = '100%';
}
}
componentDidMount() {
if (!this.props.disableWalletSpecificUI) {
Store.dispatch(iguanaActiveHandle());
@ -207,10 +219,11 @@ class Settings extends React.Component {
for (let i = 0; i < this.state.updateLog.length; i++) {
items.push(
<div>{ this.state.updateLog[i] }</div>
<div key={ `settings-update-log-${i}` }>{ this.state.updateLog[i] }</div>
);
}
if (this.state.updateLog.length) {
return (
<div style={{ minHeight: '200px' }}>
<hr />
@ -224,6 +237,9 @@ class Settings extends React.Component {
</div>
</div>
);
} else {
return null;
}
}
toggleSeedInputVisibility() {
@ -251,6 +267,17 @@ class Settings extends React.Component {
activeTabHeight: _height,
tabElId: elemId,
}));
// body size hack
if (!this.state.disableWalletSpecificUI) {
document.documentElement.style.height = '100%';
document.body.style.height = '100%';
setTimeout(() => {
document.documentElement.style.height = _height <= 200 ? '100%' : 'inherit';
document.body.style.height = _height <= 200 ? '100%' : 'inherit';
}, 100);
}
}, 100);
}

12
react/src/components/dashboard/settings/settings.render.js

@ -24,7 +24,7 @@ export const AppUpdateTabRender = function() {
<div className="padding-top-15">
<button
type="button"
className="btn btn-primary waves-effect waves-light"
className="btn btn-info waves-effect waves-light"
onClick={ this._checkForUpdateUIPromise }>{ translate('INDEX.CHECK_FOR_UPDATE') }</button>
<button
type="button"
@ -38,7 +38,7 @@ export const AppUpdateTabRender = function() {
<div className="padding-top-15">
<button
type="button"
className="btn btn-primary waves-effect waves-light"
className="btn btn-info waves-effect waves-light"
onClick={ this._checkForUpdateUIPromise }>{ translate('INDEX.CHECK_FOR_UPDATE') }</button>
<button
type="button"
@ -77,7 +77,7 @@ export const AppInfoTabRender = function() {
{ translate('SETTINGS.NAME') }: { this.props.Settings.appInfo.releaseInfo.name }
</div>
<div>
{ translate('SETTINGS.VERSION') }: { this.props.Settings.appInfo.releaseInfo.version }
{ translate('SETTINGS.VERSION') }: { `${this.props.Settings.appInfo.releaseInfo.version.replace('version=', '')}-beta` }
</div>
<div>
{ translate('SETTINGS.APP_SESSION') }: { this.props.Settings.appInfo.appSession }
@ -144,9 +144,9 @@ export const AppInfoTabRender = function() {
export const SettingsRender = function() {
return (
<div className="margin-left-0">
<div className="margin-left-0 full-height">
<div
className="page-content"
className="page-content full-height"
id="section-iguana-wallet-settings">
<div className="row">
<div className="col-xlg-12 col-md-12">
@ -593,7 +593,7 @@ export const SettingsRender = function() {
<textarea
type="text"
className="form-control"
name="cliCmd"
name="cliCmdString"
id="cliCmd"
value={ this.state.cliCmdString }
onChange={ this.updateInput }></textarea>

31
react/src/components/dashboard/walletsBalance/walletsBalance.js

@ -70,14 +70,13 @@ class WalletsBalance extends React.Component {
if (_mode === 'full') {
_balance = this.props.ActiveCoin.balance || 0;
} else {
} else if (_mode === 'basilisk') {
if (this.props.ActiveCoin.cache) {
const _cache = this.props.ActiveCoin.cache;
const _coin = this.props.ActiveCoin.coin;
const _address = this.props.ActiveCoin.activeAddress;
if (type === 'main' &&
_mode === 'basilisk' &&
if (type === 'transparent' &&
_address &&
_cache[_coin] &&
_cache[_coin][_address] &&
@ -88,7 +87,6 @@ class WalletsBalance extends React.Component {
}
if (type === 'interest' &&
_mode === 'basilisk' &&
_address &&
_cache[_coin] &&
_cache[_coin][_address] &&
@ -99,7 +97,6 @@ class WalletsBalance extends React.Component {
}
if (type === 'total' &&
_mode === 'basilisk' &&
_address &&
_cache[_coin] &&
_cache[_coin][_address] &&
@ -113,6 +110,30 @@ class WalletsBalance extends React.Component {
_balance = _regBalance + _regInterest;
}
}
} else if (_mode === 'native') {
if (type === 'total' &&
this.props.ActiveCoin.balance &&
this.props.ActiveCoin.balance.total) {
_balance = this.props.ActiveCoin.balance.total;
}
if (type === 'interest' &&
this.props.Dashboard.progress &&
this.props.Dashboard.progress.interest) {
_balance = this.props.Dashboard.progress.interest;
}
if (type === 'private' &&
this.props.ActiveCoin.balance &&
this.props.ActiveCoin.balance.private) {
_balance = this.props.ActiveCoin.balance.private;
}
if (type === 'transparent' &&
this.props.ActiveCoin.balance &&
this.props.ActiveCoin.balance.transparent) {
_balance = this.props.ActiveCoin.balance.transparent;
}
}
return _balance;

39
react/src/components/dashboard/walletsBalance/walletsBalance.render.js

@ -5,8 +5,8 @@ import Config from '../../../config';
const WalletsBalanceRender = function() {
return (
<div id="wallet-widgets">
<div className="col-xs-12">
<div id="wallet-widgets" className="wallet-widgets">
<div className="col-xs-12 flex">
<div className={ this.isFullMode() && !this.isFullySynced() ? 'col-xs-12' : 'col-xs-12 hide' }>
<div className="alert alert-info alert-dismissible">
<h4>{ translate('INDEX.ACTIVATING_WALLET_RT') }</h4>
@ -37,14 +37,8 @@ const WalletsBalanceRender = function() {
</div>
<span
className="pull-right padding-top-10 font-size-22"
title={ Config.roundValues ? this.renderBalance('main') : null }>
{ this.isNativeMode() ?
this.props.ActiveCoin.balance.transparent ? this.props.ActiveCoin.balance.transparent : '-'
:
<span>
{ Config.roundValues ? formatValue('round', this.renderBalance('main'), -6) : this.renderBalance('main') } { this.props.ActiveCoin.coin }
</span>
}
title={ this.renderBalance('transparent') }>
{ Config.roundValues ? formatValue('round', this.renderBalance('transparent'), -6) : this.renderBalance('transparent') }
</span>
</div>
</div>
@ -63,8 +57,8 @@ const WalletsBalanceRender = function() {
</div>
<span
className="pull-right padding-top-10 font-size-22"
title={ Config.roundValues ? this.props.ActiveCoin.balance.private : null }>
{ this.props.ActiveCoin.balance.private ? (Config.roundValues ? formatValue('round', this.props.ActiveCoin.balance.private, -6) : this.props.ActiveCoin.balance.private) : '-' }
title={ this.renderBalance('private') }>
{ Config.roundValues ? formatValue('round', this.renderBalance('private'), -6) : this.renderBalance('private') }
</span>
</div>
</div>
@ -84,15 +78,8 @@ const WalletsBalanceRender = function() {
</div>
<span
className="pull-right padding-top-10 font-size-22"
title={ Config.roundValues ? this.renderBalance('interest') : null }>
{ this.isNativeMode() ?
this.props.Dashboard.progress
&& this.props.Dashboard.progress.interest ? this.props.Dashboard.progress.interest : '-'
:
<span>
{ Config.roundValues ? formatValue('round', this.renderBalance('interest'), -6) : this.renderBalance('interest') } { this.props.ActiveCoin.coin }
</span>
}
title={ this.renderBalance('interest') }>
{ Config.roundValues ? formatValue('round', this.renderBalance('interest'), -6) : this.renderBalance('interest') }
</span>
</div>
</div>
@ -112,14 +99,8 @@ const WalletsBalanceRender = function() {
</div>
<span
className="pull-right padding-top-10 font-size-22"
title={ Config.roundValues ? this.renderBalance('total') : null }>
{ this.isNativeMode() ?
this.props.ActiveCoin.balance.total ? this.props.ActiveCoin.balance.total : '-'
:
<span>
{ Config.roundValues ? formatValue('round', this.renderBalance('total'), -6) : this.renderBalance('total') } { this.props.ActiveCoin.coin }
</span>
}
title={ this.renderBalance('total') }>
{ Config.roundValues ? formatValue('round', this.renderBalance('total'), -6) : this.renderBalance('total') }
</span>
</div>
</div>

70
react/src/components/dashboard/walletsData/walletsData.js

@ -56,6 +56,8 @@ class WalletsData extends React.Component {
pageSize: 20,
showPagination: false,
searchTerm: null
coin: null,
txhistory: null,
};
this.toggleBasiliskActionsMenu = this.toggleBasiliskActionsMenu.bind(this);
@ -71,7 +73,6 @@ class WalletsData extends React.Component {
this.basiliskRefreshActionOne = this.basiliskRefreshActionOne.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
this.refreshTxHistory = this.refreshTxHistory.bind(this);
socket.on('messages', msg => this.updateSocketsData(msg));
}
componentWillMount() {
@ -80,6 +81,14 @@ class WalletsData extends React.Component {
this.handleClickOutside,
false
);
setTimeout(() => {
if (this.props.ActiveCoin.mode === 'basilisk' || (Object.keys(this.props.Main.coins.basilisk).length && (Object.keys(this.props.Main.coins.native).length || Object.keys(this.props.Main.coins.full).length)) || Object.keys(this.props.Main.coins.basilisk).length) {
socket.on('messages', msg => this.updateSocketsData(msg));
} else {
socket.removeAllListeners('messages');
}
}, 100);
}
componentWillUnmount() {
@ -88,7 +97,8 @@ class WalletsData extends React.Component {
this.handleClickOutside,
false
);
socket.off('messages');
socket.removeAllListeners('messages');
}
generateItemsListColumns() {
@ -195,21 +205,24 @@ class WalletsData extends React.Component {
}
updateSocketsData(data) {
let stateObj = {};
if (this.props.ActiveCoin.mode === 'basilisk') {
if (data &&
data.message &&
data.message.shepherd.iguanaAPI &&
data.message.shepherd.iguanaAPI.totalStackLength) {
this.setState(Object.assign({}, this.state, {
stateObj = Object.assign(stateObj, {
totalStackLength: data.message.shepherd.iguanaAPI.totalStackLength,
}));
});
}
if (data &&
data.message &&
data.message.shepherd.iguanaAPI &&
data.message.shepherd.iguanaAPI.currentStackLength) {
this.setState(Object.assign({}, this.state, {
stateObj = Object.assign(stateObj, {
currentStackLength: data.message.shepherd.iguanaAPI.currentStackLength,
}));
});
}
if (data &&
data.message &&
@ -218,6 +231,11 @@ class WalletsData extends React.Component {
data.message.shepherd.status === 'done') {
Store.dispatch(basiliskRefresh(false));
}
if (Object.keys(stateObj).length) {
this.setState(Object.assign({}, this.state, stateObj));
}
}
}
refreshTxHistory() {
@ -305,6 +323,16 @@ class WalletsData extends React.Component {
Store.dispatch(toggleDashboardTxInfoModal(display, txIndex));
}
indexTxHistory(txhistoryArr) {
if (txhistoryArr.length > 1) {
for (let i = 0; i < txhistoryArr.length; i++) {
this.props.ActiveCoin.txhistory[i]['index'] = i + 1;
}
}
return this.props.ActiveCoin.txhistory;
}
componentWillReceiveProps(props) {
if (!this.state.currentAddress &&
this.props.ActiveCoin.activeAddress) {
@ -362,15 +390,15 @@ class WalletsData extends React.Component {
if (this.state.itemsList === 'loading') {
if (!this.isNativeMode() || this.isFullySynced()) {
return (
<tr>
<td colSpan="6">{ translate('INDEX.LOADING_HISTORY') }...</td>
<tr className="hover--none">
<td colSpan="7">{ translate('INDEX.LOADING_HISTORY') }...</td>
</tr>
);
}
} else if (this.state.itemsList === 'no data' || this.state.itemsList.length == 0) {
return (
<tr>
<td colSpan="6">{ translate('INDEX.NO_DATA') }</td>
<tr className="hover--none">
<td colSpan="7">{ translate('INDEX.NO_DATA') }</td>
</tr>
);
} else if (this.state.itemsList) {
@ -437,10 +465,12 @@ class WalletsData extends React.Component {
let _amount = address.amount;
if (this.props.ActiveCoin.mode === 'basilisk') {
_amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A';
_amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A';
}
if (_amount !== 'N/A') {
_amount = formatValue('round', _amount, -6);
}
items.push(
AddressItemRender.call(this, address, type, _amount, _coin)
@ -472,12 +502,20 @@ class WalletsData extends React.Component {
if (_addresses.public[i].address === this.state.currentAddress) {
if (_addresses.public[i].amount &&
_addresses.public[i].amount !== 'N/A') {
return _addresses.public[i].amount;
let _amount = _addresses.public[i].amount;
if (_amount !== 'N/A') {
_amount = formatValue('round', _amount, -6);
}
return _amount;
} else {
const address = _addresses.public[i].address;
let _amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A';
if (_amount !== 'N/A') {
_amount = formatValue('round', _amount, -6);
}
return _amount;
}
@ -567,8 +605,14 @@ class WalletsData extends React.Component {
if (this.props &&
this.props.ActiveCoin &&
this.props.ActiveCoin.coin &&
(
this.props.ActiveCoin.mode !== 'native' &&
!this.props.ActiveCoin.send &&
!this.props.ActiveCoin.receive) {
!this.props.ActiveCoin.receive
) || (
this.props.ActiveCoin.mode === 'native' &&
this.props.ActiveCoin.nativeActiveSection === 'default'
)) {
return WalletsDataRender.call(this);
} else {
return null;

12
react/src/components/dashboard/walletsData/walletsData.render.js

@ -66,7 +66,7 @@ export const AddressListRender = function() {
if (isMultiPublicAddress ||
isMultiPrivateAddress) {
return (
<div className={ `btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ${(this.state.addressSelectorOpen ? 'open' : '')}` }>
<div className={ `btn-group bootstrap-select form-control form-material showkmdwalletaddrs show-tick ${(this.state.addressSelectorOpen ? 'open margin-bottom-10' : 'margin-bottom-10')}` }>
<button
type="button"
className="btn dropdown-toggle btn-info"
@ -80,7 +80,7 @@ export const AddressListRender = function() {
<div className="dropdown-menu open">
<ul className="dropdown-menu inner">
<li className="selected">
<a><span className="text"> - { translate('KMD_NATIVE.SELECT_ADDRESS') } - </span><span className="glyphicon glyphicon-ok check-mark"></span></a>
<a><span className="text"> - { translate('KMD_NATIVE.SELECT_ADDRESS') } - </span></a>
</li>
{ this.renderAddressByType('public') }
</ul>
@ -196,19 +196,19 @@ export const WalletsDataRender = function() {
<span className="caret"></span>
</a>
<ul className="dropdown-menu dropdown-menu-right">
<li>
<li className="hide">
<a onClick={ this.getDexNotariesAction }>
<i className="icon fa-sitemap"></i> { translate('INDEX.GET_NOTARY_NODES_LIST') }
</a>
</li>
<li>
<li className="hide">
<a onClick={ this.basiliskConnectionAction }>
<i className="icon wb-refresh"></i> { translate('INDEX.REFRESH_BASILISK_CONNECTIONS') }
</a>
</li>
<li className={ !this.state.useCache ? 'hide' : '' }>
<a onClick={ this.basiliskRefreshActionOne }>
<i className="icon fa-cloud-download"></i> { translate('INDEX.FETCH_WALLET_DATA') }
<i className="icon fa-cloud-download"></i> { translate('INDEX.FETCH_WALLET_DATA') }&nbsp;
({ translate('INDEX.ACTIVE_ADDRESS') })
</a>
</li>
@ -228,7 +228,7 @@ export const WalletsDataRender = function() {
<i className="icon fa-refresh"></i> Restart Basilisk Instance (unsafe!)
</a>
</li>
<li className={ !this.state.useCache ? 'hide' : '' }>
<li className="hide">
<a onClick={ this._toggleViewCacheModal }>
<i className="icon fa-list-alt"></i> { translate('INDEX.VIEW_CACHE_DATA') }
</a>

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

@ -25,14 +25,18 @@ class WalletsNativeSend extends React.Component {
sendTo: '',
sendToOA: null,
amount: 0,
fee: 0.0001,
fee: 0,
addressSelectorOpen: false,
renderAddressDropdown: true,
};
this.updateInput = this.updateInput.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.openDropMenu = this.openDropMenu.bind(this);
this.getOAdress = this.getOAdress.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
this.checkZAddressCount = this.checkZAddressCount.bind(this);
this.setRecieverFromScan = this.setRecieverFromScan.bind(this);
this.renderOPIDListCheck = this.renderOPIDListCheck.bind(this);
}
componentWillMount() {
@ -51,6 +55,18 @@ class WalletsNativeSend extends React.Component {
);
}
componentWillReceiveProps() {
this.checkZAddressCount();
}
setRecieverFromScan(receiver) {
this.setState({
sendTo: receiver
});
document.getElementById('kmdWalletSendTo').focus();
}
handleClickOutside(e) {
if (e.srcElement.className !== 'btn dropdown-toggle btn-info' &&
(e.srcElement.offsetParent && e.srcElement.offsetParent.className !== 'btn dropdown-toggle btn-info') &&
@ -61,27 +77,61 @@ class WalletsNativeSend extends React.Component {
}
}
checkZAddressCount() {
if (this.props.ActiveCoin.addresses &&
(!this.props.ActiveCoin.addresses.private ||
this.props.ActiveCoin.addresses.private.length === 0)) {
this.setState({
renderAddressDropdown: false,
});
} else {
this.setState({
renderAddressDropdown: true,
});
}
}
renderAddressByType(type) {
let _items = [];
if (this.props.ActiveCoin.addresses &&
this.props.ActiveCoin.addresses[type] &&
this.props.ActiveCoin.addresses[type].length) {
return this.props.ActiveCoin.addresses[type].map((address) =>
<li key={ address.address } className={ address.amount <= 0 ? 'hide' : '' }>
this.props.ActiveCoin.addresses[type].map((address) => {
if (address.amount > 0) {
_items.push(
<li
className="selected"
key={ address.address }>
<a onClick={ () => this.updateAddressSelection(address.address, type, address.amount) }>
<i className={ 'icon fa-eye' + (type === 'public' ? '' : '-slash') }></i>&nbsp;&nbsp;
<span className="text">
[ { address.amount } { this.props.ActiveCoin.coin } ]&nbsp;&nbsp;
{ type === 'public' ? address.address : address.address.substring(0, 34) + '...' }
</span>
<span className="glyphicon glyphicon-ok check-mark"></span>
<span
className="glyphicon glyphicon-ok check-mark pull-right"
style={{ display: this.state.sendFrom === address.address ? 'inline-block' : 'none' }}></span>
</a>
</li>
);
}
});
return _items;
} else {
return null;
}
}
renderOPIDListCheck() {
if (this.state.renderAddressDropdown &&
this.props.ActiveCoin.opids &&
this.props.ActiveCoin.opids.length) {
return true;
}
}
renderSelectorCurrentLabel() {
if (this.state.sendFrom) {
return (
@ -89,13 +139,13 @@ class WalletsNativeSend extends React.Component {
<i className={ 'icon fa-eye' + this.state.addressType === 'public' ? '' : '-slash' }></i>
<span className="text">
[ { this.state.sendFromAmount } { this.props.ActiveCoin.coin } ]
{ this.state.sendFrom }
{ this.state.addressType === 'public' ? this.state.sendFrom : this.state.sendFrom.substring(0, 34) + '...' }
</span>
</span>
);
} else {
return (
<span>- { translate('SEND.SELECT_T_OR_Z_ADDR') } -</span>
<span>Transparent funds</span>
);
}
}
@ -218,6 +268,8 @@ class WalletsNativeSend extends React.Component {
this.state
)
);
if (this.state.addressType === 'private') {
setTimeout(() => {
Store.dispatch(
getKMDOPID(
@ -228,6 +280,19 @@ class WalletsNativeSend extends React.Component {
}, 1000);
}
this.setState({
addressType: null,
sendFrom: null,
sendFromAmount: 0,
sendTo: '',
sendToOA: null,
amount: 0,
fee: 0,
addressSelectorOpen: false,
renderAddressDropdown: true,
});
}
getOAdress() {
resolveOpenAliasAddress(this.state.sendToOA)
.then((json) => {

44
react/src/components/dashboard/walletsNativeSend/walletsNativeSend.render.js

@ -1,5 +1,6 @@
import React from 'react';
import { translate } from '../../../translate/translate';
import QRModal from '../qrModal/qrModal';
export const AddressListRender = function() {
return (
@ -7,7 +8,7 @@ export const AddressListRender = function() {
<button
type="button"
className="btn dropdown-toggle btn-info"
title="- { translate('SEND.SELECT_T_OR_Z_ADDR') } -"
title="Select private address"
onClick={ this.openDropMenu }>
<span className="filter-option pull-left">{ this.renderSelectorCurrentLabel() } </span>
<span className="bs-caret">
@ -16,11 +17,16 @@ export const AddressListRender = function() {
</button>
<div className="dropdown-menu open">
<ul className="dropdown-menu inner">
<li className="selected">
<a><span className="text"> - { translate('SEND.SELECT_T_OR_Z_ADDR') } - </span>
<span className="glyphicon glyphicon-ok check-mark"></span></a>
<li
className="selected"
onClick={ () => this.updateAddressSelection(null, 'public', null) }>
<a>
<span className="text">Transparent funds</span>
<span
className="glyphicon glyphicon-ok check-mark pull-right"
style={{ display: this.state.sendFrom === null ? 'inline-block' : 'none' }}></span>
</a>
</li>
{ this.renderAddressByType('public') }
{ this.renderAddressByType('private') }
</ul>
</div>
@ -28,6 +34,8 @@ export const AddressListRender = function() {
);
};
// { this.renderAddressByType('public') }
export const OASendUIRender = function() {
return (
<div className="row">
@ -69,17 +77,24 @@ export const WalletsNativeSendRender = function() {
{ translate('INDEX.SEND') } { this.props.ActiveCoin.coin }
</h3>
</div>
<div className="qr-modal-send-block">
<QRModal
mode="scan"
setRecieverFromScan={ this.setRecieverFromScan } />
</div>
<div className="panel-body container-fluid">
<form
className="extcoin-send-form"
method="post"
autoComplete="off">
{ this.state.renderAddressDropdown &&
<div className="row">
<div className="col-xlg-12 form-group form-material">
<label className="control-label">{ translate('INDEX.SEND_FROM') }</label>
{ this.renderAddressList() }
</div>
</div>
}
{ this.renderOASendUI() }
<div className="row">
<div className="col-xlg-12 form-group form-material">
@ -97,22 +112,23 @@ export const WalletsNativeSendRender = function() {
autoComplete="off"
required />
</div>
<div className="col-lg-6 form-group form-material">
<div className="col-lg-12 form-group form-material">
<label
className="control-label"
htmlFor="kmdWalletAmount">
{ this.props.ActiveCoin.coin }
{ translate('INDEX.AMOUNT') }
</label>
<input
type="text"
className="form-control"
name="amount"
value={ this.state.amount !== 0 ? this.state.amount : '' }
onChange={ this.updateInput }
id="kmdWalletAmount"
placeholder="0.000"
autoComplete="off" />
</div>
<div className="col-lg-6 form-group form-material">
<div className="col-lg-6 form-group form-material hide">
<label
className="control-label"
htmlFor="kmdWalletFee">
@ -125,13 +141,13 @@ export const WalletsNativeSendRender = function() {
onChange={ this.updateInput }
id="kmdWalletFee"
placeholder="0.000"
value={ this.state.fee }
value={ this.state.fee !== 0 ? this.state.fee : '' }
autoComplete="off" />
</div>
<div className="col-lg-12">
<div className="col-lg-12 hide">
<span>
<strong>{ translate('INDEX.TOTAL') }:</strong>
{ this.state.amount } - { this.state.fee }/kb = { Number(this.state.amount) - Number(this.state.fee) }
<strong>{ translate('INDEX.TOTAL') }:</strong>&nbsp;
{ this.state.amount } - { this.state.fee }/kb = { Number(this.state.amount) - Number(this.state.fee) }&nbsp;
{ this.props.ActiveCoin.coin }
</span>
</div>
@ -140,7 +156,7 @@ export const WalletsNativeSendRender = function() {
type="button"
className="btn btn-primary waves-effect waves-light pull-right"
onClick={ this.handleSubmit }
disabled={ !this.state.sendFrom || !this.state.sendTo || !this.state.amount }>
disabled={ !this.state.sendTo || !this.state.amount }>
{ translate('INDEX.SEND') } { this.state.amount } { this.props.ActiveCoin.coin }
</button>
</div>
@ -150,6 +166,7 @@ export const WalletsNativeSendRender = function() {
</div>
</div>
{ this.renderOPIDListCheck() &&
<div className="col-xs-12">
<div className="row">
<div className="panel nav-tabs-horizontal">
@ -192,6 +209,7 @@ export const WalletsNativeSendRender = function() {
</div>
</div>
</div>
}
</div>
);
};

46
react/src/components/dashboard/walletsNav/walletsNav.js

@ -21,6 +21,9 @@ class WalletsNav extends React.Component {
nativeOnly: Config.iguanaLessMode,
};
this.toggleSendReceiveCoinForms = this.toggleSendReceiveCoinForms.bind(this);
this.toggleNativeWalletInfo = this.toggleNativeWalletInfo.bind(this);
this.toggleNativeWalletTransactions = this.toggleNativeWalletTransactions.bind(this);
this.checkTotalBalance = this.checkTotalBalance.bind(this);
}
componentWillMount() {
@ -31,6 +34,41 @@ class WalletsNav extends React.Component {
Store.dispatch(copyCoinAddress(address));
}
checkTotalBalance() {
let _balance = '0';
const _mode = this.props.ActiveCoin.mode;
if (_mode === 'full') {
_balance = this.props.ActiveCoin.balance || 0;
} else if (_mode === 'basilisk') {
if (this.props.ActiveCoin.cache) {
const _cache = this.props.ActiveCoin.cache;
const _coin = this.props.ActiveCoin.coin;
const _address = this.props.ActiveCoin.activeAddress;
if (_address &&
_cache[_coin] &&
_cache[_coin][_address] &&
_cache[_coin][_address].getbalance &&
_cache[_coin][_address].getbalance.data &&
(_cache[_coin][_address].getbalance.data.balance ||
_cache[_coin][_address].getbalance.data.interest)) {
const _regBalance = _cache[_coin][_address].getbalance.data.balance ? _cache[_coin][_address].getbalance.data.balance : 0;
const _regInterest = _cache[_coin][_address].getbalance.data.interest ? _cache[_coin][_address].getbalance.data.interest : 0;
_balance = _regBalance + _regInterest;
}
}
} else if (_mode === 'native') {
if (this.props.ActiveCoin.balance &&
this.props.ActiveCoin.balance.total) {
_balance = this.props.ActiveCoin.balance.total;
}
}
return _balance;
}
toggleSendReceiveCoinForms() {
if (this.props.ActiveCoin.mode === 'native') {
Store.dispatch(
@ -43,6 +81,14 @@ class WalletsNav extends React.Component {
}
}
toggleNativeWalletInfo() {
Store.dispatch(toggleDashboardActiveSection('settings'));
}
toggleNativeWalletTransactions() {
Store.dispatch(toggleDashboardActiveSection('default'));
}
toggleSendCoinForm(display) {
if (this.props.ActiveCoin.mode === 'native') {
Store.dispatch(

16
react/src/components/dashboard/walletsNav/walletsNav.render.js

@ -38,21 +38,31 @@ export const WalletsNavWithWalletRender = function() {
</ol>
<div className="page-header-actions">
<div id="kmd_header_button">
{ this.props.ActiveCoin.mode === 'native' &&
<button
type="button"
className="btn btn-info waves-effect waves-light"
onClick={ this.toggleNativeWalletInfo }>
<i className="icon fa-info"></i>
</button>
}
<button
type="button"
className="btn btn-dark waves-effect waves-light"
onClick={ this.toggleSendReceiveCoinForms }>
<i className="icon md-view-dashboard"></i> { this.props.ActiveCoin.mode !== 'native' ? translate('INDEX.DASHBOARD') : translate('INDEX.WALLET_INFO') }
onClick={ this.props.ActiveCoin.mode !== 'native' ? this.toggleSendReceiveCoinForms : this.toggleNativeWalletTransactions }>
<i className="icon md-view-dashboard"></i> { translate('INDEX.TRANSACTIONS') }
</button>
{ this.checkTotalBalance() > 0 &&
<button
type="button"
className="btn btn-primary waves-effect waves-light"
onClick={ () => this.toggleSendCoinForm(!this.props.ActiveCoin.send) }>
<i className="icon fa-send"></i> { translate('INDEX.SEND') }
</button>
}
<button
type="button"
className="btn btn-info waves-effect waves-light"
className="btn btn-success waves-effect waves-light"
onClick={ () => this.toggleReceiveCoinForm(!this.props.ActiveCoin.receive) }>
<i className="icon fa-inbox"></i> { translate('INDEX.RECEIVE') }
</button>

16
react/src/components/dashboard/walletsProgress/walletsProgress.js

@ -73,6 +73,7 @@ class WalletsProgress extends React.Component {
}
if (temp[i].indexOf('progress=') > -1) {
currentProgress = Number(temp[i].replace('progress=', '')) * 1000;
currentProgress = currentProgress >= 100 ? 100 : currentProgress;
}
}
@ -93,7 +94,7 @@ class WalletsProgress extends React.Component {
if (_progress &&
_progress[1]) {
return SyncPercentageRender.call(this, _progress[1].toFixed(2));
return SyncPercentageRender.call(this, _progress[1] === 1000 ? 100 : _progress[1].toFixed(2));
} else {
return LoadingBlocksRender.call(this);
}
@ -112,9 +113,8 @@ class WalletsProgress extends React.Component {
if (this.props.Dashboard.progress &&
this.props.Dashboard.progress.blocks) {
const syncPercentage = (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100
/ parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2) + '%').replace('NaN', 0);
return SyncPercentageRender.call(this, syncPercentage);
const syncPercentage = (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100 / parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2) + '%').replace('NaN', 0);
return SyncPercentageRender.call(this, syncPercentage === 1000 ? 100 : syncPercentage);
}
return LoadingBlocksRender.call(this);
@ -189,18 +189,22 @@ class WalletsProgress extends React.Component {
} else {
if (currentProgress) {
return (
`: ${currentProgress}% (${ translate('INDEX.RESCAN_SM') })`
`: ${currentProgress.toFixed(2)}% (${ translate('INDEX.RESCAN_SM') })`
);
} else {
return null;
}
}
} else if (this.props.Settings.debugLog.indexOf('Rescanning last') > -1) {
return (
`: (${ translate('INDEX.RESCANNING_LAST_BLOCKS') })`
);
} else if (
this.props.Settings.debugLog.indexOf('LoadExternalBlockFile:') > -1 ||
this.props.Settings.debugLog.indexOf('Reindexing block file') > -1
) {
return (
`: ({ translate('INDEX.REINDEX') })`
`: (${ translate('INDEX.REINDEX') })`
);
} else {
return (

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

@ -15,6 +15,10 @@ class WalletsTxInfo extends React.Component {
toggleTxInfoModal() {
Store.dispatch(toggleDashboardTxInfoModal(false));
this.setState(Object.assign({}, this.state, {
activeTab: 0,
}));
}
openTab(tab) {

36
react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js

@ -20,23 +20,20 @@ const WalletsTxInfoRender = function(txInfo) {
<i className="icon md-balance-wallet"></i>TxID Info
</a>
</li>
{ this.isNativeMode() &&
<li className={ this.state.activeTab === 1 ? 'active' : '' }>
<li className={ this.state.activeTab === 1 ? 'hide active' : 'hide' }>
<a onClick={ () => this.openTab(1) }>
<i className="icon md-plus-square"></i>Vjointsplits, Details
</a>
</li>
}
{ this.isNativeMode() &&
<li className={ this.state.activeTab === 2 ? 'active' : '' }>
<li className={ this.state.activeTab === 2 ? 'hide active' : 'hide' }>
<a onClick={ () => this.openTab(2) }>
<i className="icon wb-briefcase"></i>Hex
</a>
</li>
}
<li className={ this.state.activeTab === 3 ? 'active' : '' }>
<a onClick={ () => this.openTab(3) }>
<i className="icon wb-file"></i>Raw info
@ -45,13 +42,14 @@ const WalletsTxInfoRender = function(txInfo) {
</ul>
<div className="panel-body">
<div className="tab-content">
<div className={ 'tab-pane' + (this.state.activeTab === 0 ? ' active' : '') }>
{ this.state.activeTab === 0 &&
<div className="tab-pane active">
<table className="table table-striped">
<tbody>
<tr>
<td>{ translate('TX_INFO.ADDRESS') }</td>
<td>
{ txInfo.address }
{ this.props.ActiveCoin.mode === 'basilisk' ? this.props.ActiveCoin.activeAddress : txInfo.address }
</td>
</tr>
<tr>
@ -72,34 +70,36 @@ const WalletsTxInfoRender = function(txInfo) {
{ txInfo.confirmations }
</td>
</tr>
{ txInfo.blockhash &&
<tr>
<td>blockhash</td>
<td>
{ txInfo.blockhash }
</td>
</tr>
}
{ (txInfo.blocktime || txInfo.timestamp) &&
<tr>
<td>blocktime</td>
<td>
{ secondsToString(txInfo.blocktime || txInfo.timestamp) }
</td>
</tr>
}
<tr>
<td>txid</td>
<td>
{ txInfo.txid }
</td>
</tr>
{ this.isNativeMode() &&
<tr>
<td>walletconflicts</td>
<td>
{ txInfo.walletconflicts ? txInfo.walletconflicts.length : null }
{ txInfo.walletconflicts.length }
</td>
</tr>
}
{ this.isNativeMode() &&
<tr>
<td>time</td>
@ -108,7 +108,6 @@ const WalletsTxInfoRender = function(txInfo) {
</td>
</tr>
}
{ this.isNativeMode() &&
<tr>
<td>timereceived</td>
@ -120,8 +119,9 @@ const WalletsTxInfoRender = function(txInfo) {
</tbody>
</table>
</div>
<div className={ 'tab-pane' + (this.state.activeTab === 1 ? ' active' : '') }>
}
{ this.state.activeTab === 1 &&
<div className="tab-pane active">
<table className="table table-striped">
<tbody>
<tr>
@ -139,7 +139,9 @@ const WalletsTxInfoRender = function(txInfo) {
</tbody>
</table>
</div>
<div className={ 'tab-pane' + (this.state.activeTab === 2 ? ' active' : '') }>
}
{ this.state.activeTab === 2 &&
<div className="tab-pane active">
<textarea
className="full-width height-170"
rows="10"
@ -147,8 +149,9 @@ const WalletsTxInfoRender = function(txInfo) {
defaultValue={ txInfo.hex }
disabled></textarea>
</div>
<div className={ 'tab-pane' + (this.state.activeTab === 3 ? ' active' : '') }>
}
{ this.state.activeTab === 3 &&
<div className="tab-pane active">
<textarea
className="full-width height-400"
rows="40"
@ -156,6 +159,7 @@ const WalletsTxInfoRender = function(txInfo) {
defaultValue={ JSON.stringify(txInfo, null, '\t') }
disabled></textarea>
</div>
}
</div>
</div>
</div>

2
react/src/components/login/login.js

@ -21,6 +21,8 @@ import { translate } from '../../translate/translate';
const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000;
const IGUNA_ACTIVE_COINS_TIMEOUT = 10000;
// TODO: remove duplicate activehandle and activecoins calls
class Login extends React.Component {
constructor(props) {
super(props);

10
react/src/components/main/main.js

@ -23,6 +23,16 @@ class Main extends React.Component {
}
componentDidMount() {
let appVersion;
try {
appVersion = window.require('electron').remote.getCurrentWindow().appBasicInfo;
} catch (e) {}
if (appVersion) {
document.title = `${appVersion.name} (v${appVersion.version.replace('version=', '')}-beta)`;
}
Store.dispatch(iguanaActiveHandle());
const _iguanaActiveHandle = setInterval(function() {
Store.dispatch(iguanaActiveHandle());

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

@ -10,6 +10,7 @@ class WalletMain extends React.Component {
render() {
return (
<div className="full-height">
<input type="text" id="js-copytextarea" />
<SyncOnly {...this.props} />
<Dashboard {...this.props} />
<AddCoin {...this.props} />

36
react/src/components/overrides.scss

@ -649,3 +649,39 @@ select{
right: 4px;
top: 3px;
}
.table-striped {
> tbody {
> tr.hover--none {
background-color: inherit;
}
}
}
.qr-modal-send-block {
position: absolute;
top: 15px;
right: 30px;
}
@media only screen and (min-width : 1201px) {
.wallet-widgets {
.flex {
display: flex;
flex-wrap: wrap;
}
> div {
display: flex;
.widget,
.widget-content {
height: 100%;
> div,
.clearfix {
height: 100%;
}
}
}
}
}

4
react/src/translate/en.js

@ -17,6 +17,7 @@ export const _lang = {
'NO_ACTIVE_COIN': 'No active coin',
},
'INDEX': {
'RESCANNING_LAST_BLOCKS': 'Rescanning last blocks...',
'NO_DATA_AVAILABLE': 'No data available',
'LOADING': 'Loading',
'ACTIVATING_SM': 'activating',
@ -193,7 +194,8 @@ export const _lang = {
'- Your External Wallet/daemon is setup, but is not setup with config settings like<br>',
'ACTIVATING_CHAIN': 'Activating best chain',
'KMD_STARTED': 'Komodo daemon has been started and is processing.<br>' +
'Please wait while the best chain is being activated.',
'Please wait while the best chain is being activated.<br>' +
'Tip: in case sync is stuck restart the wallet.',
'CONNECTIONS': 'Connections',
'TRANSPARENT_BALANCE': 'Transparent Balance',
'Z_BALANCE': 'Private (Z) Balance',

8
react/src/translate/translate.js

@ -13,13 +13,13 @@ export function translate(langID) {
_lang[defaultLang][langIDComponents[0]][langIDComponents[1]]) {
return _lang[defaultLang][langIDComponents[0]][langIDComponents[1]];
} else {
console.warn('Missing translation in js/' + defaultLang.toLowerCase() + '.js ' + langID);
return '--> ' + langID + ' <--';
console.warn(`Missing translation ${langID} in js/${defaultLang.toLowerCase()}.js`);
return `--> ${langID} <--`;
}
} else {
if (langID.length) {
console.warn('Missing translation in js/' + defaultLang.toLowerCase() + '.js ' + langID);
return '--> ' + langID + ' <--';
console.warn(`Missing translation ${langID} in js/${defaultLang.toLowerCase()}.js`);
return `--> ${langID} <--`;
}
}
}

13
react/src/util/formatValue.js

@ -1,5 +1,6 @@
// ref: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Math/round#Decimal_rounding
export function formatValue(formatType, formatValue, formatExp) {
let _formatExp;
/**
* Decimal adjustment of a number.
*
@ -31,19 +32,21 @@ export function formatValue(formatType, formatValue, formatExp) {
return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
}
if (formatValue >= 1) {
formatExp = -3;
if (Math.abs(Number(formatValue)) >= 1) {
_formatExp = -3;
} else {
_formatExp = formatExp;
}
switch (formatType) {
case 'round':
return decimalAdjust('round', formatValue, formatExp);
return decimalAdjust('round', formatValue, _formatExp);
break;
case 'floor':
return decimalAdjust('floor', formatValue, formatExp);
return decimalAdjust('floor', formatValue, _formatExp);
break;
case 'ceil':
return decimalAdjust('ceil', formatValue, formatExp);
return decimalAdjust('ceil', formatValue, _formatExp);
break;
}
}

15
react/src/util/sort.js

@ -1,10 +1,13 @@
export function sortByDate(data) {
export function sortByDate(data, sortKey) {
return data.sort(function(a, b) {
if (a.timestamp &&
b.timestamp) {
return b.timestamp - a.timestamp;
} else {
return b.blocktime - a.blocktime;
if (a[sortKey] < b[sortKey]) {
return -1;
}
if (a[sortKey] > b[sortKey]) {
return 1;
}
return 0;
});
}

6
react/src/util/time.js

@ -37,9 +37,9 @@ export function secondsElapsedToString(timestamp) { // in seconds
const hours = Math.floor(timestamp / 3600);
const minutes = Math.floor((timestamp - (hours * 3600)) / 60);
const seconds = timestamp - (hours * 3600) - (minutes * 60);
const returnTimeVal = (hours > 0 ? hours + ' hour(s) ' : '') +
(minutes > 0 ? minutes + ' minute(s) ' : '') +
(seconds > 0 ? seconds + ' second(s) ' : '');
const returnTimeVal = (hours > 0 ? `${hours} hour(s) ` : '') +
(minutes > 0 ? `${minutes} minute(s) ` : '') +
(seconds > 0 ? `${seconds} second(s) ` : '');
return returnTimeVal;
}

3
react/www/index.html

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="description" content="bootstrap admin template">
<meta name="author" content="SuperNET Team">
<title>Agama (v0.2.0.21a-beta)</title>
<title>Agama</title>
<link rel="apple-touch-icon" href="assets/images/android-chrome-192x192.png">
<link rel="icon" type="image/png" href="assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="assets/images/favicon-194x194.png" sizes="194x194">
@ -15,7 +15,6 @@
<link rel="icon" type="image/png" href="assets/images/favicon-16x16.png" sizes="16x16">
</head>
<body id="body" class="page-login layout-full page-dark">
<input type="text" id="js-copytextarea" />
<div id="app" class="full-height"></div>
</body>
</html>

Loading…
Cancel
Save