Browse Source

cleanup

v0.25
pbca26 7 years ago
parent
commit
6913905b41
  1. 23
      react/src/actions/actions/addCoin.js
  2. 1
      react/src/actions/actions/atomic.js
  3. 2
      react/src/actions/actions/cli.js
  4. 17
      react/src/actions/actions/coinList.js
  5. 2
      react/src/actions/actions/dexCoins.js
  6. 20
      react/src/actions/actions/electrum.js
  7. 4
      react/src/actions/actions/getTxDetails.js
  8. 4
      react/src/actions/actions/interest.js
  9. 18
      react/src/actions/actions/jumblr.js
  10. 1
      react/src/actions/actions/nativeDashboardUpdate.js
  11. 6
      react/src/actions/actions/nativeNetwork.js
  12. 1
      react/src/actions/actions/nativeNewAddress.js
  13. 12
      react/src/actions/actions/nativeSend.js
  14. 9
      react/src/actions/actions/nativeSyncInfo.js
  15. 4
      react/src/actions/actions/pin.js
  16. 187
      react/src/actions/actions/settings.js
  17. 2
      react/src/actions/actions/sysInfo.js
  18. 6
      react/src/actions/actions/update.js
  19. 2
      react/src/actions/actions/walletAuth.js
  20. 2
      react/src/components/dashboard/settings/settings.appInfoPanel.js
  21. 8
      react/src/components/dashboard/settings/settings.appUpdatePanel.js
  22. 1
      react/src/config.js
  23. 7
      react/src/reducers/settings.js
  24. 1
      react/src/translate/en.js

23
react/src/actions/actions/addCoin.js

@ -25,7 +25,7 @@ function iguanaActiveHandleState(json) {
export function activeHandle() {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/auth/status`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/auth/status?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -60,6 +60,7 @@ export function shepherdElectrumAuth(seed) {
body: JSON.stringify({
seed,
iguana: true,
token: Config.token,
}),
})
.catch((error) => {
@ -80,7 +81,7 @@ export function shepherdElectrumAuth(seed) {
} else {
dispatch(
triggerToaster(
'Icorrect WIF key format',
translate('TOASTR.INCORRECT_WIF'),
'Error',
'error'
)
@ -92,7 +93,7 @@ export function shepherdElectrumAuth(seed) {
export function shepherdElectrumAddCoin(coin) {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins/add?coin=${coin}`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins/add?coin=${coin}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -231,6 +232,7 @@ export function shepherdHerd(coin, mode, path, startupParams) {
body: JSON.stringify({
herd: _herd,
options: herdData,
token: Config.token,
}),
})
.catch((error) => {
@ -326,7 +328,10 @@ export function _shepherdGetConfig(coin, mode, startupParams) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ chain: 'komodod' })
body: JSON.stringify({
chain: 'komodod',
token: Config.token,
}),
})
.catch((error) => {
console.log(error);
@ -361,7 +366,10 @@ export function shepherdGetConfig(coin, mode, startupParams) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ chain: 'komodod' })
body: JSON.stringify({
chain: 'komodod',
token: Config.token,
}),
})
.catch((error) => {
console.log(error);
@ -392,7 +400,10 @@ export function shepherdGetConfig(coin, mode, startupParams) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'chain': coin })
body: JSON.stringify({
chain: coin,
token: Config.token,
}),
})
.catch((error) => {
console.log(error);

1
react/src/actions/actions/atomic.js

@ -9,6 +9,7 @@ export function atomic(payload) {
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
body: JSON.stringify(payload),
token: Config.token,
})
.catch((error) => {
console.log(error);

2
react/src/actions/actions/cli.js

@ -8,6 +8,7 @@ export function shepherdCliPromise(mode, chain, cmd) {
mode,
chain,
cmd,
token: Config.token,
};
return new Promise((resolve, reject) => {
@ -38,6 +39,7 @@ export function shepherdCli(mode, chain, cmd) {
mode,
chain,
cmd,
token: Config.token,
};
return dispatch => {

17
react/src/actions/actions/coinList.js

@ -10,7 +10,7 @@ export function shepherdElectrumLock() {
headers: {
'Content-Type': 'application/json',
},
body: '',
body: JSON.stringify({ token: Config.token }),
})
.catch((error) => {
console.log(error);
@ -34,7 +34,7 @@ export function shepherdElectrumLogout() {
headers: {
'Content-Type': 'application/json',
},
body: '',
body: JSON.stringify({ token: Config.token }),
})
.catch((error) => {
console.log(error);
@ -58,7 +58,7 @@ export function shepherdStopCoind(coin) {
headers: {
'Content-Type': 'application/json',
},
body: coin === 'KMD' ? '' : JSON.stringify({ chain: coin }),
body: coin === 'KMD' ? JSON.stringify({ token: Config.token }) : JSON.stringify({ chain: coin, token: Config.token }),
})
.catch((error) => {
console.log(error);
@ -84,9 +84,11 @@ export function shepherdRemoveCoin(coin, mode) {
},
body: JSON.stringify(coin === 'KMD' && mode === 'native' ? {
mode,
token: Config.token,
} : {
mode,
chain: coin,
token: Config.token,
}),
})
.catch((error) => {
@ -117,7 +119,7 @@ export function shepherdRemoveCoin(coin, mode) {
export function shepherdGetCoinList() {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coinslist`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coinslist?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -145,7 +147,10 @@ export function shepherdPostCoinList(data) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': data }),
body: JSON.stringify({
payload: data,
token: Config.token,
}),
})
.catch((error) => {
console.log(error);
@ -164,7 +169,7 @@ export function shepherdPostCoinList(data) {
export function shepherdClearCoindFolder(coin, keepWalletDat) {
return new Promise((resolve, reject) => {
fetch(keepWalletDat ? `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}&keepwallet=true` : `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}`, {
fetch(keepWalletDat ? `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}&keepwallet=true&token=${Config.token}` : `http://127.0.0.1:${Config.agamaPort}/shepherd/kick?coin=${coin}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

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

@ -8,7 +8,7 @@ import Config from '../../config';
export function getDexCoins() {
return dispatch => {
return fetch(
`http://127.0.0.1:${Config.agamaPort}/shepherd/InstantDEX/allcoins`, {
`http://127.0.0.1:${Config.agamaPort}/shepherd/InstantDEX/allcoins?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

20
react/src/actions/actions/electrum.js

@ -13,7 +13,7 @@ import Store from '../../store';
export function shepherdElectrumSetServer(coin, address, port) {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins/server/set?address=${address}&port=${port}&coin=${coin}`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins/server/set?address=${address}&port=${port}&coin=${coin}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -38,7 +38,7 @@ export function shepherdElectrumSetServer(coin, address, port) {
export function shepherdElectrumCheckServerConnection(address, port) {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/servers/test?address=${address}&port=${port}`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/servers/test?address=${address}&port=${port}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -72,6 +72,7 @@ export function shepherdElectrumKeys(seed) {
seed,
active: true,
iguana: true,
token: Config.token,
}),
})
.catch((error) => {
@ -93,7 +94,7 @@ export function shepherdElectrumKeys(seed) {
export function shepherdElectrumBalance(coin, address) {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/getbalance?coin=${coin}&address=${address}`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/getbalance?coin=${coin}&address=${address}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -125,7 +126,7 @@ export function shepherdElectrumBalanceState(json) {
export function shepherdElectrumTransactions(coin, address) {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/listtransactions?coin=${coin}&address=${address}&full=true&maxlength=20`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/listtransactions?coin=${coin}&address=${address}&full=true&maxlength=20&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -166,7 +167,7 @@ export function shepherdElectrumTransactionsState(json) {
export function shepherdElectrumCoins() {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -199,7 +200,7 @@ export function shepherdElectrumCoinsState(json) {
// value in sats
export function shepherdElectrumSend(coin, value, sendToAddress, changeAddress) {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=true&verify=true`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=true&verify=true&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -224,7 +225,7 @@ export function shepherdElectrumSend(coin, value, sendToAddress, changeAddress)
export function shepherdElectrumSendPromise(coin, value, sendToAddress, changeAddress) {
return new Promise((resolve, reject) => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=true&verify=true`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=true&verify=true&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -249,7 +250,7 @@ export function shepherdElectrumSendPromise(coin, value, sendToAddress, changeAd
export function shepherdElectrumSendPreflight(coin, value, sendToAddress, changeAddress) {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=false&verify=true`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=false&verify=true&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -274,7 +275,7 @@ export function shepherdElectrumSendPreflight(coin, value, sendToAddress, change
export function shepherdElectrumListunspent(coin, address) {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/listunspent?coin=${coin}&address=${address}&full=true`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/listunspent?coin=${coin}&address=${address}&full=true&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -309,6 +310,7 @@ export function shepherdElectrumBip39Keys(seed, match, addressdepth, accounts) {
match,
addressdepth,
accounts,
token: Config.token,
}),
})
.catch((error) => {

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

@ -12,6 +12,7 @@ export function getTxDetails(coin, txid, type) {
txid
],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
if (type === 'raw') {
@ -24,6 +25,7 @@ export function getTxDetails(coin, txid, type) {
1
],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
}
@ -33,7 +35,7 @@ export function getTxDetails(coin, txid, type) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
},
)
.catch((error) => {

4
react/src/actions/actions/interest.js

@ -9,6 +9,7 @@ export function getListUnspent(coin) {
chain: coin,
cmd: 'listunspent',
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -16,7 +17,7 @@ export function getListUnspent(coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -65,6 +66,7 @@ export function getRawTransaction(coin, txid) {
1
],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {

18
react/src/actions/actions/jumblr.js

@ -12,6 +12,7 @@ function getNewAddress(coin) {
chain: coin,
cmd: 'getnewaddress',
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -19,7 +20,7 @@ function getNewAddress(coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -51,6 +52,7 @@ export function setJumblrAddress(coin, type, address) {
cmd: type === 'deposit' ? 'jumblr_deposit' : 'jumblr_secret',
params: [address],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -58,7 +60,7 @@ export function setJumblrAddress(coin, type, address) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -90,6 +92,7 @@ export function pauseJumblr(coin) {
cmd: 'jumblr_pause',
params: [],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -97,7 +100,7 @@ export function pauseJumblr(coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -129,6 +132,7 @@ export function resumeJumblr(coin) {
cmd: 'jumblr_resume',
params: [],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -136,7 +140,7 @@ export function resumeJumblr(coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -168,6 +172,7 @@ function dumpPrivkey(coin, key) {
cmd: 'dumpprivkey',
params: [key],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -175,7 +180,7 @@ function dumpPrivkey(coin, key) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -211,6 +216,7 @@ export function importPrivkey(coin, key, rescan = false) {
rescan
],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -218,7 +224,7 @@ export function importPrivkey(coin, key, rescan = false) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(

1
react/src/actions/actions/nativeDashboardUpdate.js

@ -12,6 +12,7 @@ export function getDashboardUpdate(coin, activeCoinProps) {
body: JSON.stringify({
coin: coin,
rpc2cli: Config.rpc2cli,
token: Config.token,
}),
};

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

@ -13,6 +13,7 @@ export function getNativePeers(coin) {
chain: coin,
cmd: 'getpeerinfo',
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -20,7 +21,7 @@ export function getNativePeers(coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -52,6 +53,7 @@ export function getNativeNettotals(coin) {
chain: coin,
cmd: 'getnettotals',
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -59,7 +61,7 @@ export function getNativeNettotals(coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(

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

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

12
react/src/actions/actions/nativeSend.js

@ -24,6 +24,7 @@ export function sendNativeTx(coin, _payload) {
chain: coin,
cmd: _apiMethod,
rpc2cli: Config.rpc2cli,
token: Config.token,
params:
(_payload.addressType === 'public' && _payload.sendTo.length !== 95) || !_payload.sendFrom ?
(_payload.substractFee ?
@ -55,7 +56,7 @@ export function sendNativeTx(coin, _payload) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -142,6 +143,7 @@ export function getKMDOPID(opid, coin) {
chain: coin,
cmd: 'z_getoperationstatus',
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -149,7 +151,7 @@ export function getKMDOPID(opid, coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -181,6 +183,7 @@ export function sendToAddressPromise(coin, address, amount) {
chain: coin,
cmd: 'sendtoaddress',
rpc2cli: Config.rpc2cli,
token: Config.token,
params: [
address,
amount,
@ -195,7 +198,7 @@ export function sendToAddressPromise(coin, address, amount) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -241,6 +244,7 @@ export function validateAddressPromise(coin, address) {
cmd: 'validateaddress',
params: [ address ],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -248,7 +252,7 @@ export function validateAddressPromise(coin, address) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
fetch(

9
react/src/actions/actions/nativeSyncInfo.js

@ -98,13 +98,14 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) {
chain: coin,
cmd: 'getinfo',
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: payload }),
body: JSON.stringify({ payload }),
};
return fetch(
@ -208,6 +209,7 @@ export function getBlockTemplate(_json, coin) {
chain: coin,
cmd: 'getblocktemplate',
rpc2cli: Config.rpc2cli,
token: Config.token,
};
return dispatch => {
@ -216,7 +218,7 @@ export function getBlockTemplate(_json, coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
body: JSON.stringify({ payload }),
};
return fetch(
@ -273,6 +275,7 @@ export function getDebugLogProgress(_json, coin) {
mode: null,
chain: coin,
cmd: 'debug',
token: Config.token,
};
return dispatch => {
@ -281,7 +284,7 @@ export function getDebugLogProgress(_json, coin) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
body: JSON.stringify({ payload }),
};
return fetch(

4
react/src/actions/actions/pin.js

@ -11,6 +11,7 @@ export function encryptPassphrase(passphrase, key, pubKey) {
string: passphrase,
key: key,
pubkey: pubKey,
token: Config.token,
};
return dispatch => {
@ -48,6 +49,7 @@ export function loginWithPin(key, pubKey) {
const payload = {
key: key,
pubkey: pubKey,
token: Config.token,
};
return dispatch => {
@ -77,7 +79,7 @@ export function loginWithPin(key, pubKey) {
export function loadPinList() {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getpinlist`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getpinlist?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

187
react/src/actions/actions/settings.js

@ -19,7 +19,7 @@ function getAppInfoState(json) {
export function getAppInfo() {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appinfo`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appinfo?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -86,49 +86,6 @@ function parseImportPrivKeyResponse(json, dispatch) {
}
}
export function importPrivKey(wifKey) {
const payload = {
userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
method: 'importprivkey',
params: [
wifKey,
'imported'
],
};
return dispatch => {
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
body: JSON.stringify(payload),
})
.catch((error) => {
console.log(error);
dispatch(
triggerToaster(
'importPrivKey',
'Error',
'error'
)
);
})
.then(response => response.json())
.then(json => {
dispatch(
parseImportPrivKeyResponse(
json,
dispatch
)
);
})
.catch((ex) => {
dispatch(parseImportPrivKeyResponse({
error: 'privkey already in wallet',
}, dispatch));
console.log('parsing failed', ex);
});
}
}
function getDebugLogState(json) {
const _data = json.result.replace('\n', '\r\n');
@ -142,6 +99,7 @@ export function getDebugLog(target, linesCount, acName) {
const payload = {
herdname: target,
lastLines: linesCount,
token: Config.token,
};
if (acName) {
@ -171,129 +129,6 @@ export function getDebugLog(target, linesCount, acName) {
}
}
export function getPeersList(coin) {
const payload = {
userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
agent: 'SuperNET',
method: 'getpeers',
activecoin: coin,
};
return dispatch => {
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
body: JSON.stringify(payload),
})
.catch((error) => {
console.log(error);
dispatch(
triggerToaster(
'getPeersList',
'Error',
'error'
)
);
})
.then(response => response.json())
.then(json => {
dispatch(getPeersListState(json, dispatch));
});
}
}
export function getPeersListState(json) {
let peersList = {};
if (json &&
json.rawpeers &&
json.rawpeers.length) {
for (let i = 0; i < json.rawpeers.length; i++) {
peersList[json.rawpeers[i].coin] = json.rawpeers[i].peers;
}
}
return {
type: GET_PEERS_LIST,
supernetPeers: json && json.supernet[0] ? json.supernet : null,
rawPeers: peersList,
}
}
function addPeerNodeState(json, dispatch) {
if (json.error === 'addnode needs active coin, do an addcoin first') {
return dispatch => {
dispatch(
triggerToaster(
translate('API.ADDNODE_NEEDS_COIN'),
translate('TOASTR.SETTINGS_NOTIFICATION'),
'error'
)
);
}
} else if (json.result === 'peer was already connected') {
return dispatch => {
dispatch(
triggerToaster(
translate('API.PEER_ALREADY_CONN'),
translate('TOASTR.SETTINGS_NOTIFICATION'),
'warning'
)
);
}
} else if (json.result === 'addnode connection was already pending') {
return dispatch => {
dispatch(
triggerToaster(
translate('API.ADDNODE_ALREADY_PENDING'),
translate('TOASTR.SETTINGS_NOTIFICATION'),
'warning'
)
);
}
} else if (json.result === 'addnode submitted') {
return dispatch => {
dispatch(
triggerToaster(
translate('API.PEER_ADDED'),
translate('TOASTR.SETTINGS_NOTIFICATION'),
'success'
)
);
}
}
}
export function addPeerNode(coin, ip) {
const payload = {
userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
agent: 'iguana',
method: 'addnode',
activecoin: coin,
ipaddr: ip,
};
return dispatch => {
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
method: 'POST',
body: JSON.stringify(payload),
})
.catch((error) => {
console.log(error);
dispatch(
triggerToaster(
'addPeerNode',
'Error',
'error'
)
);
})
.then(response => response.json())
.then(json => {
dispatch(addPeerNodeState(json, dispatch));
});
}
}
export function saveAppConfig(_payload) {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appconf`, {
@ -301,7 +136,10 @@ export function saveAppConfig(_payload) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ payload: _payload }),
body: JSON.stringify({
payload: _payload,
token: Config.token,
}),
})
.catch((error) => {
console.log(error);
@ -336,7 +174,7 @@ function getAppConfigState(json) {
export function getAppConfig() {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appconf`, {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/appconf?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -364,6 +202,7 @@ export function resetAppConfig() {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ token: Config.token })
})
.catch((error) => {
console.log(error);
@ -393,7 +232,7 @@ export function coindGetStdout(chain) {
const _chain = chain === 'KMD' ? 'komodod' : chain;
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coind/stdout?chain=${chain}`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/coind/stdout?chain=${chain}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -420,7 +259,7 @@ export function getWalletDatKeys(chain, keyMatchPattern) {
const _chain = chain === 'KMD' ? null : chain;
return new Promise((resolve, reject) => {
fetch(keyMatchPattern ? `http://127.0.0.1:${Config.agamaPort}/shepherd/coindwalletkeys?chain=${_chain}&search=${keyMatchPattern}` : `http://127.0.0.1:${Config.agamaPort}/shepherd/coindwalletkeys?chain=${_chain}`, {
fetch(keyMatchPattern ? `http://127.0.0.1:${Config.agamaPort}/shepherd/coindwalletkeys?chain=${_chain}&search=${keyMatchPattern}&token=${Config.token}` : `http://127.0.0.1:${Config.agamaPort}/shepherd/coindwalletkeys?chain=${_chain}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -451,6 +290,7 @@ export function dumpPrivKey(coin, address, isZaddr) {
cmd: isZaddr ? 'z_exportkey' : 'dumpprivkey',
params: [ address ],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -458,7 +298,7 @@ export function dumpPrivKey(coin, address, isZaddr) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
body: JSON.stringify({ payload }),
};
fetch(
@ -490,6 +330,7 @@ export function validateAddress(coin, address, isZaddr) {
cmd: isZaddr ? 'z_validateaddress' : 'validateaddress',
params: [ address ],
rpc2cli: Config.rpc2cli,
token: Config.token,
};
const _fetchConfig = {
@ -497,7 +338,7 @@ export function validateAddress(coin, address, isZaddr) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ 'payload': payload }),
body: JSON.stringify({ payload }),
};
fetch(

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

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

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

@ -4,7 +4,7 @@ import Store from '../../store';
export function checkForUpdateUIPromise() {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/update/patch/check`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/update/patch/check?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -27,7 +27,7 @@ export function checkForUpdateUIPromise() {
export function updateUIPromise() {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/update/patch`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/update/patch?token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -50,7 +50,7 @@ export function updateUIPromise() {
export function downloadZCashParamsPromise(dloption) {
return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/zcparamsdl?dloption=${dloption}`, {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/zcparamsdl?dloption=${dloption}&token=${Config.token}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',

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

@ -1,3 +1,5 @@
// obsolete(?)
import {
LOGIN,
ACTIVE_HANDLE,

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

@ -33,8 +33,6 @@ class AppInfoPanel extends React.Component {
{ translate('SETTINGS.NAME') }: { this.props.Settings.appInfo.releaseInfo.name }
<br />
{ translate('SETTINGS.VERSION') }: { `${this.props.Settings.appInfo.releaseInfo.version.replace('version=', '')}${mainWindow.arch === 'x64' ? '' : '-32bit'}-beta` }
<br />
{ translate('SETTINGS.APP_SESSION') }: { this.props.Settings.appInfo.appSession }
</p>
<h5>{ translate('SETTINGS.SYS_INFO') }</h5>
<p>

8
react/src/components/dashboard/settings/settings.appUpdatePanel.js

@ -3,7 +3,6 @@ import { translate } from '../../../translate/translate';
import { connect } from 'react-redux';
import Config from '../../../config';
import {
getPeersList,
checkForUpdateUIPromise,
updateUIPromise,
} from '../../../actions/actionCreators';
@ -29,7 +28,6 @@ class AppUpdatePanel extends React.Component {
};
this._checkForUpdateUIPromise = this._checkForUpdateUIPromise.bind(this);
this._updateUIPromise = this._updateUIPromise.bind(this);
this.checkNodes = this.checkNodes.bind(this);
}
updateSocketsData(data) {
@ -94,12 +92,6 @@ class AppUpdatePanel extends React.Component {
socket.removeAllListeners('patch', msg => this.updateSocketsData(msg));
}
checkNodes() {
if (this.state.getPeersCoin) {
Store.dispatch(getPeersList(this.state.getPeersCoin.split('|')[0]));
}
}
_updateUIPromise() {
let _updateLog = [];
updateProgressBar.patch = 0;

1
react/src/config.js

@ -18,6 +18,7 @@ let _config = {
try {
Config = window.require('electron').remote.getCurrentWindow().appConfig;
Config.token = window.require('electron').remote.getCurrentWindow().appSessionHash;
} catch (e) {
Config = _config;
}

7
react/src/reducers/settings.js

@ -1,6 +1,5 @@
import {
GET_WIF_KEY,
GET_PEERS_LIST,
GET_DEBUG_LOG,
LOAD_APP_CONFIG,
LOAD_APP_INFO,
@ -22,12 +21,6 @@ export function Settings(state = {
wifkey: action.wifkey,
address: action.address,
};
case GET_PEERS_LIST:
return {
...state,
supernetPeers: action.supernetPeers,
rawPeers: action.rawPeers,
};
case GET_DEBUG_LOG:
return {
...state,

1
react/src/translate/en.js

@ -514,6 +514,7 @@ export const LANG_EN = {
'CURRENT_BLOCK_SM': 'current block',
},
'TOASTR': {
'INCORRECT_WIF': 'Icorrect WIF key format',
'ERROR': 'Error',
'FAILED_TO_VERIFY_ADDR': 'Failed to verify address',
'COIN_UNABLE_TO_STOP': 'Unable to stop @template@. Try again.',

Loading…
Cancel
Save