Browse Source

Merge branch 'cli' of https://github.com/SuperNETorg/EasyDEX-GUI into cli

all-modes
pbca26 8 years ago
parent
commit
04da839261
  1. 118
      react/src/actions/actions/addCoin.js

118
react/src/actions/actions/addCoin.js

@ -5,7 +5,7 @@ import {
toggleAddcoinModal,
getDexCoins,
startIguanaInstance,
iguanaWalletPassphraseState
iguanaWalletPassphraseState,
} from '../actionCreators';
import {
logGuiHttp,
@ -20,72 +20,90 @@ import {
} from '../../components/addcoin/payload';
export function addCoin(coin, mode, syncOnly, port) {
if (mode === '-1') {
if (Config &&
Config.iguanaLessMode &&
mode !== '-1') {
return dispatch => {
dispatch(shepherdGetConfig(coin, mode));
startIguanaInstance('main', coin)
.then(function(json) {
setTimeout(function() {
console.log(`started ${coin} / main`, json);
_addCoin();
}, 2000);
});
}
} else {
if (checkCoinType(coin) === 'currency_ac') {
const _acData = startCurrencyAssetChain('', coin, mode);
_addCoin();
}
function _addCoin() {
if (mode === '-1') {
return dispatch => {
dispatch(iguanaAddCoin(coin, mode, _acData));
dispatch(shepherdGetConfig(coin, mode));
}
}
if (checkCoinType(coin) === 'ac') {
const _acData = startAssetChain('', coin, mode);
} else {
if (checkCoinType(coin) === 'currency_ac') {
const _acData = startCurrencyAssetChain('', coin, mode);
return dispatch => {
dispatch(iguanaAddCoin(coin, mode, _acData));
return dispatch => {
dispatch(iguanaAddCoin(coin, mode, _acData));
}
}
}
if (checkCoinType(coin) === 'crypto') {
const _acData = startCrypto('', coin, mode);
if (syncOnly) {
const modeToValue = {
'1': 'full',
'0': 'basilisk',
'-1': 'native'
};
if (checkCoinType(coin) === 'ac') {
const _acData = startAssetChain('', coin, mode);
return dispatch => {
startIguanaInstance(`${modeToValue[mode]}/sync`, coin)
.then(function(json) {
setTimeout(function() {
console.log(`started ${coin} / ${modeToValue[mode]} fork`, json);
dispatch(iguanaAddCoin(coin, mode, _acData));
}
}
if (checkCoinType(coin) === 'crypto') {
const _acData = startCrypto('', coin, mode);
if (syncOnly) {
const modeToValue = {
'1': 'full',
'0': 'basilisk',
'-1': 'native'
};
return dispatch => {
startIguanaInstance(`${modeToValue[mode]}/sync`, coin)
.then(function(json) {
setTimeout(function() {
console.log(`started ${coin} / ${modeToValue[mode]} fork`, json);
dispatch(
iguanaAddCoin(
coin,
mode,
_acData,
json.result
)
);
}, 2000);
});
}
} else {
if (port) {
return dispatch => {
dispatch(
iguanaAddCoin(
coin,
mode,
_acData,
json.result
port
)
);
}, 2000);
});
}
} else {
if (port) {
return dispatch => {
dispatch(
iguanaAddCoin(
coin,
mode,
_acData,
port
)
);
}
} else {
return dispatch => {
dispatch(
iguanaAddCoin(
coin,
mode,
_acData
)
);
}
} else {
return dispatch => {
dispatch(
iguanaAddCoin(
coin,
mode,
_acData
)
);
}
}
}
}

Loading…
Cancel
Save