Browse Source

new addcoin native only pipeline

all-modes
pbca26 7 years ago
parent
commit
21d432e431
  1. 57
      react/src/actions/actions/addCoin.js
  2. 22
      react/src/actions/actions/dexCoins.js
  3. 22
      react/src/actions/actions/walletAuth.js
  4. 6
      react/src/components/login/login.js
  5. 2
      react/src/components/main/main.js
  6. 3
      react/src/config.js

57
react/src/actions/actions/addCoin.js

@ -4,7 +4,8 @@ import {
Config, Config,
toggleAddcoinModal, toggleAddcoinModal,
getDexCoins, getDexCoins,
startIguanaInstance startIguanaInstance,
iguanaWalletPassphraseState
} from '../actionCreators'; } from '../actionCreators';
import { import {
logGuiHttp, logGuiHttp,
@ -234,15 +235,24 @@ export function shepherdHerd(coin, mode, path) {
); );
}) })
.then(response => response.json()) .then(response => response.json())
.then( .then(function(json) {
json => dispatch( if (Config.iguanaLessMode) {
iguanaAddCoin( dispatch(
coin, addCoinResult(coin, mode)
mode, );
acData dispatch(
) iguanaActiveHandleBypass()
) );
); } else {
dispatch(
iguanaAddCoin(
coin,
mode,
acData
)
);
}
});
} }
} }
@ -298,6 +308,33 @@ export function _shepherdGetConfig(coin, mode) {
} }
} }
export function iguanaActiveHandleBypass() {
return dispatch => {
return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/SuperNET/activehandle`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
})
.catch(function(error) {
console.log(error);
dispatch(
triggerToaster(
'Failed to iguanaActiveHandleBypass',
'Error',
'error'
)
);
})
.then(response => response.json())
.then(
json => dispatch(
iguanaWalletPassphraseState(json, dispatch)
)
)
}
}
export function shepherdGetConfig(coin, mode) { export function shepherdGetConfig(coin, mode) {
if (coin === 'KMD' && if (coin === 'KMD' &&
mode === '-1') { mode === '-1') {

22
react/src/actions/actions/dexCoins.js

@ -21,15 +21,29 @@ export function getDexCoins() {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'getDexCoins', 'function': 'getDexCoins',
'type': 'post', 'type': 'post',
'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'url': Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/InstantDEX/allcoins` : `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { let _fetchConfig = {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload) body: JSON.stringify(_payload),
}) };
if (Config.iguanaLessMode) {
_fetchConfig = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
};
}
return fetch(
Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/InstantDEX/allcoins` : `http://127.0.0.1:${Config.iguanaCorePort}`,
_fetchConfig
)
.catch(function(error) { .catch(function(error) {
console.log(error); console.log(error);
dispatch(logGuiHttp({ dispatch(logGuiHttp({

22
react/src/actions/actions/walletAuth.js

@ -185,15 +185,29 @@ export function iguanaActiveHandle(getMainAddress) {
'timestamp': _timestamp, 'timestamp': _timestamp,
'function': 'iguanaActiveHandle', 'function': 'iguanaActiveHandle',
'type': 'post', 'type': 'post',
'url': `http://127.0.0.1:${Config.iguanaCorePort}`, 'url': Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/SuperNET/activehandle` : `http://127.0.0.1:${Config.iguanaCorePort}`,
'payload': _payload, 'payload': _payload,
'status': 'pending', 'status': 'pending',
})); }));
return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, { let _fetchConfig = {
method: 'POST', method: 'POST',
body: JSON.stringify(_payload), body: JSON.stringify(_payload),
}) };
if (Config.iguanaLessMode) {
_fetchConfig = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
};
}
return fetch(
Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/SuperNET/activehandle` : `http://127.0.0.1:${Config.iguanaCorePort}`,
_fetchConfig
)
.catch(function(error) { .catch(function(error) {
console.log(error); console.log(error);
dispatch(logGuiHttp({ dispatch(logGuiHttp({
@ -222,7 +236,7 @@ export function iguanaActiveHandle(getMainAddress) {
} }
} }
function iguanaWalletPassphraseState(json, dispatch) { export function iguanaWalletPassphraseState(json, dispatch) {
sessionStorage.setItem('IguanaActiveAccount', JSON.stringify(json)); sessionStorage.setItem('IguanaActiveAccount', JSON.stringify(json));
dispatch( dispatch(
triggerToaster( triggerToaster(

6
react/src/components/login/login.js

@ -194,7 +194,7 @@ class Login extends React.Component {
return null; return null;
} }
const passPhraseWords = passPhrase.split(" "); const passPhraseWords = passPhrase.split(' ');
if (!PassPhraseGenerator.arePassPhraseWordsValid(passPhraseWords)) if (!PassPhraseGenerator.arePassPhraseWordsValid(passPhraseWords))
return null; return null;
@ -246,7 +246,7 @@ class Login extends React.Component {
}); });
} }
// TODO: // TODO:
// 1) disable register btn if seed or seed conf is incorrect // 1) disable register btn if seed or seed conf is incorrect
// 2) display explicit custom seed validation message // 2) display explicit custom seed validation message
handleRegisterWallet() { handleRegisterWallet() {
@ -266,7 +266,7 @@ class Login extends React.Component {
isSeedConfirmError: !enteredSeedsMatch ? true : false, isSeedConfirmError: !enteredSeedsMatch ? true : false,
isSeedBlank: isSeedBlank ? true : false, isSeedBlank: isSeedBlank ? true : false,
}); });
if (enteredSeedsMatch && !isSeedBlank && _customSeed !== null) { if (enteredSeedsMatch && !isSeedBlank && _customSeed !== null) {
this.toggleSeedBackupModal(); this.toggleSeedBackupModal();
} }

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

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import Config from '../../config';
import WalletMain from './walletMain'; import WalletMain from './walletMain';
import { iguanaSetRPCAuth } from '../../util/auth'; import { iguanaSetRPCAuth } from '../../util/auth';
import Store from '../../store'; import Store from '../../store';
import { import {
Config,
getDexCoins, getDexCoins,
iguanaActiveHandle iguanaActiveHandle
} from '../../actions/actionCreators'; } from '../../actions/actionCreators';

3
react/src/config.js

@ -9,5 +9,6 @@ module.exports = {
cli: { cli: {
passthru: true, passthru: true,
default: true default: true
} },
iguanaLessMode: true,
}; };

Loading…
Cancel
Save