Browse Source

Merge pull request #10 from SuperNETorg/v0.25

V0.25
v0.25
pbca26 7 years ago
committed by GitHub
parent
commit
4a40022db7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      react/src/actions/actionCreators.js
  2. 29
      react/src/actions/actions/addCoin.js
  3. 4
      react/src/actions/actions/cli.js
  4. 14
      react/src/actions/actions/coinList.js
  5. 40
      react/src/actions/actions/electrum.js
  6. 4
      react/src/actions/actions/getTxDetails.js
  7. 6
      react/src/actions/actions/interest.js
  8. 16
      react/src/actions/actions/jumblr.js
  9. 20
      react/src/actions/actions/nativeDashboardUpdate.js
  10. 6
      react/src/actions/actions/nativeNetwork.js
  11. 1
      react/src/actions/actions/nativeNewAddress.js
  12. 18
      react/src/actions/actions/nativeSend.js
  13. 10
      react/src/actions/actions/nativeSyncInfo.js
  14. 6
      react/src/actions/actions/pin.js
  15. 58
      react/src/actions/actions/settings.js
  16. 6
      react/src/actions/actions/update.js
  17. 2
      react/src/actions/actions/walletAuth.js
  18. 63
      react/src/components/dashboard/coinTile/coinTileItem.js
  19. 32
      react/src/components/dashboard/coinTile/coinTileItem.render.js
  20. 25
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  21. 5
      react/src/components/dashboard/receiveCoin/receiveCoin.render.js
  22. 9
      react/src/components/dashboard/sendCoin/sendCoin.js
  23. 18
      react/src/components/dashboard/sendCoin/sendCoin.render.js
  24. 2
      react/src/components/dashboard/settings/settings.exportKeysPanel.js
  25. 2
      react/src/components/dashboard/walletsInfo/walletsInfo.render.js
  26. 2
      react/src/components/dashboard/walletsTxInfo/walletsTxInfo.render.js
  27. 18
      react/src/components/overrides.scss
  28. 5
      react/src/components/toaster/toaster-item.js
  29. 4
      react/src/components/toaster/toaster.scss
  30. 4
      react/src/translate/en.js

3
react/src/actions/actionCreators.js

@ -103,13 +103,14 @@ export function toggleSendReceiveCoinFormsState() {
} }
} }
export function triggerToaster(message, title, _type, autoClose = true) { export function triggerToaster(message, title, _type, autoClose = true, className) {
return { return {
type: ADD_TOASTER_MESSAGE, type: ADD_TOASTER_MESSAGE,
message, message,
title, title,
_type, _type,
autoClose, autoClose,
className,
} }
} }

29
react/src/actions/actions/addCoin.js

@ -70,12 +70,22 @@ export function shepherdElectrumAuth(seed) {
'Error', 'Error',
'error' 'error'
) )
) );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
dispatch(activeHandle()); if (json.msg !== 'error') {
dispatch(shepherdElectrumCoins()); dispatch(activeHandle());
dispatch(shepherdElectrumCoins());
} else {
dispatch(
triggerToaster(
'Icorrect WIF key format',
'Error',
'error'
)
);
}
}); });
} }
} }
@ -96,7 +106,7 @@ export function shepherdElectrumAddCoin(coin) {
'Error', 'Error',
'error' 'error'
) )
) );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
@ -140,7 +150,7 @@ export function shepherdHerd(coin, mode, path, startupParams) {
'-server', '-server',
`-ac_name=${coin}`, `-ac_name=${coin}`,
'-addnode=78.47.196.146', '-addnode=78.47.196.146',
] ],
}; };
if (coin === 'ZEC') { if (coin === 'ZEC') {
@ -149,7 +159,7 @@ export function shepherdHerd(coin, mode, path, startupParams) {
'ac_options': [ 'ac_options': [
'-daemon=0', '-daemon=0',
'-server=1', '-server=1',
] ],
}; };
} }
@ -159,7 +169,7 @@ export function shepherdHerd(coin, mode, path, startupParams) {
'ac_options': [ 'ac_options': [
'-daemon=0', '-daemon=0',
'-addnode=78.47.196.146', '-addnode=78.47.196.146',
] ],
}; };
} }
@ -268,10 +278,11 @@ export function addCoinResult(coin, mode) {
) )
); );
dispatch(toggleAddcoinModal(false, false)); dispatch(toggleAddcoinModal(false, false));
if (Number(mode) === 0) { if (Number(mode) === 0) {
dispatch(activeHandle()); dispatch(activeHandle());
dispatch(shepherdElectrumCoins()); dispatch(shepherdElectrumCoins());
dispatch(getDexCoins()); dispatch(getDexCoins());
setTimeout(() => { setTimeout(() => {
dispatch(activeHandle()); dispatch(activeHandle());
@ -372,7 +383,7 @@ export function shepherdGetConfig(coin, mode, startupParams) {
startupParams startupParams
) )
) )
) );
} }
} else { } else {
return dispatch => { return dispatch => {

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

@ -29,7 +29,7 @@ export function shepherdCliPromise(mode, chain, cmd) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -59,7 +59,7 @@ export function shepherdCli(mode, chain, cmd) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => dispatch(cliResponseState(json))) .then(json => dispatch(cliResponseState(json)));
} }
} }

14
react/src/actions/actions/coinList.js

@ -23,7 +23,7 @@ export function shepherdElectrumLock() {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -47,7 +47,7 @@ export function shepherdElectrumLogout() {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -71,7 +71,7 @@ export function shepherdStopCoind(coin) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -111,7 +111,7 @@ export function shepherdRemoveCoin(coin, mode) {
) )
); );
} }
}) });
}); });
} }
@ -134,7 +134,7 @@ export function shepherdGetCoinList() {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -158,7 +158,7 @@ export function shepherdPostCoinList(data) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -181,6 +181,6 @@ export function shepherdClearCoindFolder(coin, keepWalletDat) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }

40
react/src/actions/actions/electrum.js

@ -17,7 +17,7 @@ export function shepherdElectrumSetServer(coin, address, port) {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -42,7 +42,7 @@ export function shepherdElectrumCheckServerConnection(address, port) {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -56,11 +56,7 @@ export function shepherdElectrumCheckServerConnection(address, port) {
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
if (!json.result) { resolve(!json.result ? 'error' : json);
resolve('error');
} else {
resolve(json);
}
}); });
}); });
} }
@ -90,11 +86,7 @@ export function shepherdElectrumKeys(seed) {
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
if (!json.result) { resolve(!json.result ? 'error' : json);
resolve('error');
} else {
resolve(json);
}
}); });
}); });
} }
@ -105,7 +97,7 @@ export function shepherdElectrumBalance(coin, address) {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -137,7 +129,7 @@ export function shepherdElectrumTransactions(coin, address) {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -178,7 +170,7 @@ export function shepherdElectrumCoins() {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -211,7 +203,7 @@ export function shepherdElectrumSend(coin, value, sendToAddress, changeAddress)
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -225,11 +217,7 @@ export function shepherdElectrumSend(coin, value, sendToAddress, changeAddress)
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
if (json.msg === 'error') { dispatch(sendToAddressState(json.msg === 'error' ? json : json.result));
dispatch(sendToAddressState(json));
} else {
dispatch(sendToAddressState(json.result));
}
}); });
} }
} }
@ -240,7 +228,7 @@ export function shepherdElectrumSendPromise(coin, value, sendToAddress, changeAd
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -265,7 +253,7 @@ export function shepherdElectrumSendPreflight(coin, value, sendToAddress, change
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} },
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.log(error);
@ -304,11 +292,7 @@ export function shepherdElectrumListunspent(coin, address) {
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
if (!json.result) { resolve(!json.result ? 'error' : json);
resolve('error');
} else {
resolve(json);
}
}); });
}); });
} }

4
react/src/actions/actions/getTxDetails.js

@ -11,6 +11,7 @@ export function getTxDetails(coin, txid, type) {
params: [ params: [
txid txid
], ],
rpc2cli: Config.rpc2cli,
}; };
if (type === 'raw') { if (type === 'raw') {
@ -22,6 +23,7 @@ export function getTxDetails(coin, txid, type) {
txid, txid,
1 1
], ],
rpc2cli: Config.rpc2cli,
}; };
} }
@ -47,6 +49,6 @@ export function getTxDetails(coin, txid, type) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
resolve(json.result ? json.result : json); resolve(json.result ? json.result : json);
}) });
}); });
} }

6
react/src/actions/actions/interest.js

@ -8,6 +8,7 @@ export function getListUnspent(coin) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'listunspent', cmd: 'listunspent',
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -49,7 +50,7 @@ export function getListUnspent(coin) {
} }
resolve(json.result ? json.result : json); resolve(json.result ? json.result : json);
}) });
}); });
} }
@ -63,6 +64,7 @@ export function getRawTransaction(coin, txid) {
txid, txid,
1 1
], ],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -90,6 +92,6 @@ export function getRawTransaction(coin, txid) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
resolve(json.result ? json.result : json); resolve(json.result ? json.result : json);
}) });
}); });
} }

16
react/src/actions/actions/jumblr.js

@ -1,16 +1,17 @@
import { import {
triggerToaster, triggerToaster,
getNewKMDAddresses getNewKMDAddresses,
} from '../actionCreators'; } from '../actionCreators';
import Config from '../../config'; import Config from '../../config';
import Store from '../../store'; import Store from '../../store';
function getNewAddress(coin) { // TODO: remove(?) function getNewAddress(coin) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const payload = { const payload = {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'getnewaddress', cmd: 'getnewaddress',
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -38,7 +39,7 @@ function getNewAddress(coin) { // TODO: remove(?)
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
resolve(json.result ? json.result : json); resolve(json.result ? json.result : json);
}) });
}); });
} }
@ -49,6 +50,7 @@ export function setJumblrAddress(coin, type, address) {
chain: coin, chain: coin,
cmd: type === 'deposit' ? 'jumblr_deposit' : 'jumblr_secret', cmd: type === 'deposit' ? 'jumblr_deposit' : 'jumblr_secret',
params: [address], params: [address],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -87,6 +89,7 @@ export function pauseJumblr(coin) {
chain: coin, chain: coin,
cmd: 'jumblr_pause', cmd: 'jumblr_pause',
params: [], params: [],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -125,6 +128,7 @@ export function resumeJumblr(coin) {
chain: coin, chain: coin,
cmd: 'jumblr_resume', cmd: 'jumblr_resume',
params: [], params: [],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -163,6 +167,7 @@ function dumpPrivkey(coin, key) {
chain: coin, chain: coin,
cmd: 'dumpprivkey', cmd: 'dumpprivkey',
params: [key], params: [key],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -190,7 +195,7 @@ function dumpPrivkey(coin, key) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
resolve(json.result ? json.result : json); resolve(json.result ? json.result : json);
}) });
}); });
} }
@ -205,6 +210,7 @@ export function importPrivkey(coin, key, rescan = false) {
'', '',
rescan rescan
], ],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -232,6 +238,6 @@ export function importPrivkey(coin, key, rescan = false) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
resolve(json.result ? json.result : json); resolve(json.result ? json.result : json);
}) });
}); });
} }

20
react/src/actions/actions/nativeDashboardUpdate.js

@ -9,7 +9,10 @@ export function getDashboardUpdate(coin, activeCoinProps) {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ coin: coin }), body: JSON.stringify({
coin: coin,
rpc2cli: Config.rpc2cli,
}),
}; };
return fetch( return fetch(
@ -38,7 +41,7 @@ export function getDashboardUpdate(coin, activeCoinProps) {
dispatch(getDashboardUpdateState(json, coin)); dispatch(getDashboardUpdateState(json, coin));
}, 100); }, 100);
} }
}) });
} }
} }
@ -80,7 +83,7 @@ export function getDashboardUpdateState(json, coin, fakeResponse) {
txhistory: _listtransactions, txhistory: _listtransactions,
balance: { balance: {
transparent: json.result.getbalance.result, transparent: json.result.getbalance.result,
total: json.result.getbalance.result total: json.result.getbalance.result,
}, },
addresses: json.result.addresses, addresses: json.result.addresses,
coin: coin, coin: coin,
@ -89,13 +92,14 @@ export function getDashboardUpdateState(json, coin, fakeResponse) {
}; };
} else { } else {
// calc transparent balance properly // calc transparent balance properly
const _addresses = json.result.addresses;
let _tbalance = 0; let _tbalance = 0;
if (json.result.addresses && if (_addresses &&
json.result.addresses.public && _addresses.public &&
json.result.addresses.public.length) { _addresses.public.length) {
for (let i = 0; i < json.result.addresses.public.length; i++) { for (let i = 0; i < _addresses.public.length; i++) {
_tbalance += json.result.addresses.public[i].spendable; _tbalance += _addresses.public[i].spendable;
} }
} }

6
react/src/actions/actions/nativeNetwork.js

@ -12,6 +12,7 @@ export function getNativePeers(coin) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'getpeerinfo', cmd: 'getpeerinfo',
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -40,7 +41,7 @@ export function getNativePeers(coin) {
.then(json => { .then(json => {
json = json.result; json = json.result;
dispatch(getNativePeersState(json)); dispatch(getNativePeersState(json));
}) });
}; };
} }
@ -50,6 +51,7 @@ export function getNativeNettotals(coin) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'getnettotals', cmd: 'getnettotals',
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -78,7 +80,7 @@ export function getNativeNettotals(coin) {
.then(json => { .then(json => {
json = json.result; json = json.result;
dispatch(getNativeNettotalsState(json)); dispatch(getNativeNettotalsState(json));
}) });
}; };
} }

1
react/src/actions/actions/nativeNewAddress.js

@ -11,6 +11,7 @@ export function getNewKMDAddresses(coin, pubpriv, mode) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: pubpriv === 'public' ? 'getnewaddress' : 'z_getnewaddress', cmd: pubpriv === 'public' ? 'getnewaddress' : 'z_getnewaddress',
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {

18
react/src/actions/actions/nativeSend.js

@ -1,6 +1,6 @@
import { import {
DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS, DASHBOARD_ACTIVE_COIN_NATIVE_OPIDS,
DASHBOARD_ACTIVE_COIN_SENDTO DASHBOARD_ACTIVE_COIN_SENDTO,
} from '../storeType'; } from '../storeType';
import { translate } from '../../translate/translate'; import { translate } from '../../translate/translate';
import { triggerToaster } from '../actionCreators'; import { triggerToaster } from '../actionCreators';
@ -23,6 +23,7 @@ export function sendNativeTx(coin, _payload) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: _apiMethod, cmd: _apiMethod,
rpc2cli: Config.rpc2cli,
params: params:
(_payload.addressType === 'public' && _payload.sendTo.length !== 95) || !_payload.sendFrom ? (_payload.addressType === 'public' && _payload.sendTo.length !== 95) || !_payload.sendFrom ?
(_payload.substractFee ? (_payload.substractFee ?
@ -77,8 +78,8 @@ export function sendNativeTx(coin, _payload) {
}) })
.then((json) => { .then((json) => {
if (json.indexOf('"code":') > -1) { if (json.indexOf('"code":') > -1) {
const _message = json.substring( let _message = json.substring(
`${json.indexOf('"message":"')}11`, `${json.indexOf('"message":"') + 11}`,
json.indexOf('"},"id":"jl777"') json.indexOf('"},"id":"jl777"')
); );
@ -100,6 +101,10 @@ export function sendNativeTx(coin, _payload) {
) )
); );
} else { } else {
if (Config.rpc2cli) {
_message = JSON.parse(json).error.message;
}
dispatch( dispatch(
triggerToaster( triggerToaster(
_message, _message,
@ -118,7 +123,7 @@ export function sendNativeTx(coin, _payload) {
) )
); );
} }
}) });
} }
} }
@ -136,6 +141,7 @@ export function getKMDOPID(opid, coin) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'z_getoperationstatus', cmd: 'z_getoperationstatus',
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -164,7 +170,7 @@ export function getKMDOPID(opid, coin) {
.then(json => { .then(json => {
json = json.result; json = json.result;
dispatch(getKMDOPIDState(json)); dispatch(getKMDOPIDState(json));
}) });
}; };
} }
@ -174,6 +180,7 @@ export function sendToAddressPromise(coin, address, amount) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'sendtoaddress', cmd: 'sendtoaddress',
rpc2cli: Config.rpc2cli,
params: [ params: [
address, address,
amount, amount,
@ -233,6 +240,7 @@ export function validateAddressPromise(coin, address) {
chain: coin, chain: coin,
cmd: 'validateaddress', cmd: 'validateaddress',
params: [ address ], params: [ address ],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {

10
react/src/actions/actions/nativeSyncInfo.js

@ -1,6 +1,6 @@
import { import {
SYNCING_NATIVE_MODE, SYNCING_NATIVE_MODE,
DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE DASHBOARD_ACTIVE_COIN_GETINFO_FAILURE,
} from '../storeType'; } from '../storeType';
import { import {
triggerToaster, triggerToaster,
@ -97,6 +97,7 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'getinfo', cmd: 'getinfo',
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
method: 'POST', method: 'POST',
@ -197,7 +198,7 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) {
); );
} }
} }
}) });
} }
} }
@ -206,6 +207,7 @@ export function getBlockTemplate(_json, coin) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: 'getblocktemplate', cmd: 'getblocktemplate',
rpc2cli: Config.rpc2cli,
}; };
return dispatch => { return dispatch => {
@ -262,7 +264,7 @@ export function getBlockTemplate(_json, coin) {
); );
} }
} }
}) });
} }
} }
@ -338,6 +340,6 @@ export function getDebugLogProgress(_json, coin) {
) )
); );
} }
}) });
} }
} }

6
react/src/actions/actions/pin.js

@ -40,7 +40,7 @@ export function encryptPassphrase(passphrase, key, pubKey) {
'success' 'success'
) )
); );
}) });
} }
} }
@ -71,7 +71,7 @@ export function loginWithPin(key, pubKey) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
dispatch(iguanaWalletPassphrase(json.result)); dispatch(iguanaWalletPassphrase(json.result));
}) });
} }
} }
@ -105,6 +105,6 @@ export function loadPinList() {
dispatch( dispatch(
getPinList(json.result) getPinList(json.result)
); );
}) });
} }
} }

58
react/src/actions/actions/settings.js

@ -36,7 +36,7 @@ export function getAppInfo() {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => dispatch(getAppInfoState(json))) .then(json => dispatch(getAppInfoState(json)));
} }
} }
@ -125,7 +125,7 @@ export function importPrivKey(wifKey) {
error: 'privkey already in wallet', error: 'privkey already in wallet',
}, dispatch)); }, dispatch));
console.log('parsing failed', ex); console.log('parsing failed', ex);
}) });
} }
} }
@ -167,7 +167,7 @@ export function getDebugLog(target, linesCount, acName) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => dispatch(getDebugLogState(json))) .then(json => dispatch(getDebugLogState(json)));
} }
} }
@ -197,7 +197,7 @@ export function getPeersList(coin) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
dispatch(getPeersListState(json, dispatch)); dispatch(getPeersListState(json, dispatch));
}) });
} }
} }
@ -290,7 +290,7 @@ export function addPeerNode(coin, ip) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
dispatch(addPeerNodeState(json, dispatch)); dispatch(addPeerNodeState(json, dispatch));
}) });
} }
} }
@ -323,7 +323,7 @@ export function saveAppConfig(_payload) {
'success' 'success'
) )
); );
}) });
} }
} }
@ -353,7 +353,7 @@ export function getAppConfig() {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => dispatch(getAppConfigState(json))) .then(json => dispatch(getAppConfigState(json)));
} }
} }
@ -385,7 +385,7 @@ export function resetAppConfig() {
'success' 'success'
) )
); );
}) });
} }
} }
@ -449,7 +449,8 @@ export function dumpPrivKey(coin, address, isZaddr) {
mode: null, mode: null,
chain: coin, chain: coin,
cmd: isZaddr ? 'z_exportkey' : 'dumpprivkey', cmd: isZaddr ? 'z_exportkey' : 'dumpprivkey',
params: [ address ] params: [ address ],
rpc2cli: Config.rpc2cli,
}; };
const _fetchConfig = { const _fetchConfig = {
@ -477,6 +478,45 @@ export function dumpPrivKey(coin, address, isZaddr) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
resolve(json.result ? json.result : json); resolve(json.result ? json.result : json);
});
});
}
export function validateAddress(coin, address, isZaddr) {
return new Promise((resolve, reject) => {
const payload = {
mode: null,
chain: coin,
cmd: isZaddr ? 'z_validateaddress' : 'validateaddress',
params: [ address ],
rpc2cli: Config.rpc2cli,
};
const _fetchConfig = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
};
fetch(
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
.catch(function(error) {
console.log(error);
Store.dispatch(
triggerToaster(
'validateAddress',
'Error',
'error'
)
);
}) })
.then(response => response.json())
.then(json => {
resolve(json.result ? json.result : json);
});
}); });
} }

6
react/src/actions/actions/update.js

@ -21,7 +21,7 @@ export function checkForUpdateUIPromise() {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -44,7 +44,7 @@ export function updateUIPromise() {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }
@ -67,6 +67,6 @@ export function downloadZCashParamsPromise(dloption) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then(json => resolve(json)) .then(json => resolve(json));
}); });
} }

2
react/src/actions/actions/walletAuth.js

@ -1,6 +1,6 @@
import { import {
LOGIN, LOGIN,
ACTIVE_HANDLE ACTIVE_HANDLE,
} from '../storeType'; } from '../storeType';
import { translate } from '../../translate/translate'; import { translate } from '../../translate/translate';
import Config from '../../config'; import Config from '../../config';

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

@ -46,8 +46,55 @@ class CoinTileItem extends React.Component {
activeCoin: null, activeCoin: null,
activeCoinMode: null, activeCoinMode: null,
propsUpdatedCounter: 0, propsUpdatedCounter: 0,
toggledCoinMenu: null,
}; };
this.autoSetActiveCoin = this.autoSetActiveCoin.bind(this); this.autoSetActiveCoin = this.autoSetActiveCoin.bind(this);
this.toggleCoinMenu = this.toggleCoinMenu.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
}
componentWillMount() {
const appConfig = mainWindow.appConfig;
if (!this.props.ActiveCoin.coin) {
this.autoSetActiveCoin();
}
this.setState({
appConfig,
});
document.addEventListener(
'click',
this.handleClickOutside,
false
);
}
componentWillUnmount() {
document.removeEventListener(
'click',
this.handleClickOutside,
false
);
}
handleClickOutside(e) {
if (e &&
e.srcElement &&
e.srcElement.offsetParent &&
e.srcElement.offsetParent.className.indexOf('dropdown') === -1 &&
(e.srcElement.offsetParent && e.srcElement.offsetParent.className.indexOf('dropdown') === -1)) {
this.setState({
toggledCoinMenu: e.srcElement.className.indexOf('coin-tile-context-menu-trigger') === -1 ? null : this.state.toggledCoinMenu,
});
}
}
toggleCoinMenu(coin) {
this.setState({
toggledCoinMenu: this.state.toggledCoinMenu === coin ? null : coin,
});
} }
openCoindDownModal() { openCoindDownModal() {
@ -130,19 +177,11 @@ class CoinTileItem extends React.Component {
} }
} }
componentWillMount() { removeCoin(coin, mode) {
if (!this.props.ActiveCoin.coin) {
this.autoSetActiveCoin();
}
const appConfig = mainWindow.appConfig;
this.setState({ this.setState({
appConfig, toggledCoinMenu: null,
}); });
}
removeCoin(coin, mode) {
shepherdRemoveCoin(coin, mode) shepherdRemoveCoin(coin, mode)
.then((res) => { .then((res) => {
Store.dispatch( Store.dispatch(
@ -163,6 +202,10 @@ class CoinTileItem extends React.Component {
} }
stopCoind(coin) { stopCoind(coin) {
this.setState({
toggledCoinMenu: null,
});
shepherdStopCoind(coin) shepherdStopCoind(coin)
.then((res) => { .then((res) => {
if (res.msg === 'error') { if (res.msg === 'error') {

32
react/src/components/dashboard/coinTile/coinTileItem.render.js

@ -24,17 +24,41 @@ const CoinTileItemRender = function() {
</div> </div>
</div> </div>
</div> </div>
{ this.renderStopCoinButton() && <button
onClick={ () => this.toggleCoinMenu(item.coin) }
className="btn btn-default btn-xs clipboard-edexaddr coin-tile-context-menu-trigger coind-actions-menu">
<i
title="Toggle coin context menu"
className="fa fa-ellipsis-v coin-tile-context-menu-trigger"></i>
</button>
{ this.state.toggledCoinMenu &&
this.state.toggledCoinMenu === item.coin &&
<div className="coin-tile-context-menu">
<ul>
{ this.renderStopCoinButton() &&
<li onClick={ () => this.stopCoind(item.coin, item.mode) }>
<i className="icon fa-stop-circle margin-right-5"></i> { translate('DASHBOARD.STOP') }
</li>
}
{ this.renderRemoveCoinButton() &&
<li onClick={ () => this.removeCoin(item.coin, item.mode) }>
<i className="icon fa-trash-o margin-right-5"></i> { translate('DASHBOARD.REMOVE') }
</li>
}
</ul>
</div>
}
{ /*this.renderStopCoinButton() &&
<i <i
onClick={ () => this.stopCoind(item.coin, item.mode) } onClick={ () => this.stopCoind(item.coin, item.mode) }
title={ translate('DASHBOARD.STOP') } title={ translate('DASHBOARD.STOP') }
className="icon fa-stop-circle coind-stop-icon"></i> className="icon fa-stop-circle coind-stop-icon"></i>*/
} }
{ this.renderRemoveCoinButton() && { /*this.renderRemoveCoinButton() &&
<i <i
onClick={ () => this.removeCoin(item.coin, item.mode) } onClick={ () => this.removeCoin(item.coin, item.mode) }
title={ translate('DASHBOARD.REMOVE') } title={ translate('DASHBOARD.REMOVE') }
className={ 'icon fa-plus-circle coind-remove-icon' + (item.mode === 'spv' ? ' coind-remove-icon-spv' : '') }></i> className={ 'icon fa-plus-circle coind-remove-icon' + (item.mode === 'spv' ? ' coind-remove-icon-spv' : '') }></i>*/
} }
{ this.props.Dashboard && { this.props.Dashboard &&
this.props.Dashboard.electrumCoins && this.props.Dashboard.electrumCoins &&

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

@ -5,6 +5,8 @@ import {
getNewKMDAddresses, getNewKMDAddresses,
dumpPrivKey, dumpPrivKey,
copyString, copyString,
triggerToaster,
validateAddress,
} from '../../../actions/actionCreators'; } from '../../../actions/actionCreators';
import Store from '../../../store'; import Store from '../../../store';
import { import {
@ -33,6 +35,7 @@ class ReceiveCoin extends React.Component {
this.ReceiveCoinTableRender = _ReceiveCoinTableRender.bind(this); this.ReceiveCoinTableRender = _ReceiveCoinTableRender.bind(this);
this.toggleAddressMenu = this.toggleAddressMenu.bind(this); this.toggleAddressMenu = this.toggleAddressMenu.bind(this);
this.toggleIsMine = this.toggleIsMine.bind(this); this.toggleIsMine = this.toggleIsMine.bind(this);
this.validateCoinAddress = this.validateCoinAddress.bind(this);
} }
toggleAddressMenu(address) { toggleAddressMenu(address) {
@ -61,6 +64,28 @@ class ReceiveCoin extends React.Component {
); );
} }
validateCoinAddress(address, isZaddr) {
this.toggleAddressMenu(address);
validateAddress(this.props.coin, address, isZaddr)
.then((json) => {
let _items = [];
for (let key in json) {
_items.push(`${key}: ${json[key]}`);
}
Store.dispatch(
triggerToaster(
_items,
translate('TOASTR.COIN_NOTIFICATION'),
json && json.ismine ? 'info' : 'warning',
false,
'toastr--validate-address'
)
);
});
}
dumpPrivKey(address, isZaddr) { dumpPrivKey(address, isZaddr) {
this.toggleAddressMenu(address); this.toggleAddressMenu(address);
dumpPrivKey(this.props.coin, address, isZaddr) dumpPrivKey(this.props.coin, address, isZaddr)

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

@ -30,6 +30,11 @@ export const AddressActionsNonBasiliskModeRender = function(address, type) {
<i className="icon fa-key margin-right-5"></i> { translate('INDEX.COPY') + ' priv key (WIF)' } <i className="icon fa-key margin-right-5"></i> { translate('INDEX.COPY') + ' priv key (WIF)' }
</li> </li>
} }
{ this.props.mode !== 'spv' &&
<li onClick={ () => this.validateCoinAddress(address, type !== 'public' ? true : null) }>
<i className="icon fa-check margin-right-5"></i> validate address
</li>
}
<li className="receive-address-context-menu-get-qr"> <li className="receive-address-context-menu-get-qr">
<QRModal content={ address } /> <QRModal content={ address } />
</li> </li>

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

@ -211,11 +211,12 @@ class SendCoin extends React.Component {
renderAddressByType(type) { renderAddressByType(type) {
let _items = []; let _items = [];
const _coinAddresses = this.props.ActiveCoin.addresses;
if (this.props.ActiveCoin.addresses && if (_coinAddresses &&
this.props.ActiveCoin.addresses[type] && _coinAddresses[type] &&
this.props.ActiveCoin.addresses[type].length) { _coinAddresses[type].length) {
this.props.ActiveCoin.addresses[type].map((address) => { _coinAddresses[type].map((address) => {
if (address.amount > 0 && if (address.amount > 0 &&
(type !== 'public' || (address.canspend && type === 'public'))) { (type !== 'public' || (address.canspend && type === 'public'))) {
_items.push( _items.push(

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

@ -275,14 +275,16 @@ export const SendRender = function() {
<span className="label label-success">{ translate('SEND.SUCCESS_SM') }</span> <span className="label label-success">{ translate('SEND.SUCCESS_SM') }</span>
</td> </td>
</tr> </tr>
<tr> { this.state.sendFrom &&
<td className="padding-left-30"> <tr>
{ translate('INDEX.SEND_FROM') } <td className="padding-left-30">
</td> { translate('INDEX.SEND_FROM') }
<td className="padding-left-30"> </td>
{ this.props.ActiveCoin.mode === 'spv' ? this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].pub : this.state.sendFrom } <td className="padding-left-30">
</td> { this.props.ActiveCoin.mode === 'spv' ? this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].pub : this.state.sendFrom }
</tr> </td>
</tr>
}
<tr> <tr>
<td className="padding-left-30"> <td className="padding-left-30">
{ translate('INDEX.SEND_TO') } { translate('INDEX.SEND_TO') }

2
react/src/components/dashboard/settings/settings.exportKeysPanel.js

@ -43,7 +43,7 @@ class ExportKeysPanel extends React.Component {
if (keys === 'error') { if (keys === 'error') {
Store.dispatch( Store.dispatch(
triggerToaster( triggerToaster(
translate('SETTINGS.WRONG_PASSPHRASE'), translate('SETTINGS.WRONG_PASSPHRASE') + ' or WIF key format',
translate('TOASTR.WALLET_NOTIFICATION'), translate('TOASTR.WALLET_NOTIFICATION'),
'error' 'error'
) )

2
react/src/components/dashboard/walletsInfo/walletsInfo.render.js

@ -28,7 +28,7 @@ const WalletsInfoRender = function() {
</td> </td>
</tr> </tr>
<tr> <tr>
<td>{ translate('WALLETS_INFO.ADRESS_LOCAL') }</td> <td>{ translate('WALLETS_INFO.ADDRESS_LOCAL') }</td>
<td> <td>
{ _netPeers[i].addrlocal } { _netPeers[i].addrlocal }
</td> </td>

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

@ -2,6 +2,7 @@ import React from 'react';
import { translate } from '../../../translate/translate'; import { translate } from '../../../translate/translate';
import { secondsToString } from '../../../util/time'; import { secondsToString } from '../../../util/time';
import Config from '../../../config'; import Config from '../../../config';
import { isKomodoCoin } from '../../../util/coinHelper';
const WalletsTxInfoRender = function(txInfo) { const WalletsTxInfoRender = function(txInfo) {
return ( return (
@ -190,6 +191,7 @@ const WalletsTxInfoRender = function(txInfo) {
<div className="modal-footer"> <div className="modal-footer">
{ this.state.txDetails && { this.state.txDetails &&
this.props.ActiveCoin.coin !== 'CHIPS' && this.props.ActiveCoin.coin !== 'CHIPS' &&
isKomodoCoin(this.props.ActiveCoin.coin) &&
<button <button
type="button" type="button"
className="btn btn-sm white btn-dark waves-effect waves-light pull-left" className="btn btn-sm white btn-dark waves-effect waves-light pull-left"

18
react/src/components/overrides.scss

@ -549,7 +549,8 @@ select{
background-image: none !important; background-image: none !important;
} }
.receive-address-context-menu { .receive-address-context-menu,
.coin-tile-context-menu {
box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.4); box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.4);
background: #fff; background: #fff;
position: absolute; position: absolute;
@ -697,3 +698,18 @@ select{
} }
} }
} }
.coind-actions-menu {
position: absolute;
top: 22px;
left: 20px;
}
.coin-tile-context-menu {
top: 45px;
left: -34px;
li {
color: #757575;
}
}

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

@ -19,6 +19,7 @@ class ToasterItem extends React.Component {
title: props.title, title: props.title,
autoClose: props.autoClose, autoClose: props.autoClose,
toastId: props.toastId, toastId: props.toastId,
className: props.className,
}; };
this.dismissToast = this.dismissToast.bind(this); this.dismissToast = this.dismissToast.bind(this);
@ -35,6 +36,7 @@ class ToasterItem extends React.Component {
title: props.title, title: props.title,
autoClose: props.autoClose, autoClose: props.autoClose,
toastId: props.toastId, toastId: props.toastId,
className: props.className,
}); });
} else { } else {
this.setState({ this.setState({
@ -43,6 +45,7 @@ class ToasterItem extends React.Component {
title: null, title: null,
autoClose: true, autoClose: true,
toastId: null, toastId: null,
className: null,
}); });
} }
} }
@ -86,7 +89,7 @@ class ToasterItem extends React.Component {
} }
return ( return (
<div className={ `toast toast-${this.state.type}` }> <div className={ `toast toast-${this.state.type}${this.state.className ? ' ' + this.state.className : ''}` }>
<button <button
className="toast-close-button" className="toast-close-button"
onClick={ () => this.dismissToast(this.state.toastId) }>× onClick={ () => this.dismissToast(this.state.toastId) }>×

4
react/src/components/toaster/toaster.scss

@ -4,4 +4,8 @@
width: 310px; width: 310px;
opacity: 1; opacity: 1;
} }
.toastr--validate-address {
width: 430px;
}
} }

4
react/src/translate/en.js

@ -515,7 +515,7 @@ export const LANG_EN = {
'ERROR': 'Error', 'ERROR': 'Error',
'FAILED_TO_VERIFY_ADDR': 'Failed to verify address', 'FAILED_TO_VERIFY_ADDR': 'Failed to verify address',
'COIN_UNABLE_TO_STOP': 'Unable to stop @template@. Try again.', 'COIN_UNABLE_TO_STOP': 'Unable to stop @template@. Try again.',
'COIN_IS_STOPED': 'is stopped', 'COIN_IS_STOPPED': 'is stopped',
'COIN_IS_REMOVED': 'is removed', 'COIN_IS_REMOVED': 'is removed',
'JUMBLR_RESUMED': 'Jumblr resumed', 'JUMBLR_RESUMED': 'Jumblr resumed',
'JUMBLR_PAUSED': 'Jumblr paused', 'JUMBLR_PAUSED': 'Jumblr paused',
@ -680,7 +680,7 @@ export const LANG_EN = {
'BIP39_DESC_P1': 'Description: the form below is going to search for a pub key depending on a range of key path combinations is chosen (No of accounts * account address path depth).', 'BIP39_DESC_P1': 'Description: the form below is going to search for a pub key depending on a range of key path combinations is chosen (No of accounts * account address path depth).',
'BIP39_DESC_P2': 'The app might temporary freeze for several seconds during search procedure.', 'BIP39_DESC_P2': 'The app might temporary freeze for several seconds during search procedure.',
'SHOW_APP_RUNTIME_LOG': 'Show app runtime log', 'SHOW_APP_RUNTIME_LOG': 'Show app runtime log',
'WRONG_PASSPHRASE': 'Wrong passphrase!', 'WRONG_PASSPHRASE': 'Wrong passphrase',
'SPV_SERVER_LIST_DESC': 'Server list selection is only available for active coins that have more than 1 server to connect to.', 'SPV_SERVER_LIST_DESC': 'Server list selection is only available for active coins that have more than 1 server to connect to.',
'SPV_SERVERS': 'SPV servers list', 'SPV_SERVERS': 'SPV servers list',
'SPV_SINGLE_SERVER_NOTICE': 'There is only one electrum server available. SPV verification is coming from the same server providing all remote data.', 'SPV_SINGLE_SERVER_NOTICE': 'There is only one electrum server available. SPV verification is coming from the same server providing all remote data.',

Loading…
Cancel
Save