From 13d092222affec67faa4a77008e4425e2c4df050 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Tue, 4 Jul 2017 18:18:46 +0300 Subject: [PATCH] addcoin (wip) --- react/src/actions/actions/addCoin.js | 118 +++++++++++++++------------ 1 file changed, 68 insertions(+), 50 deletions(-) diff --git a/react/src/actions/actions/addCoin.js b/react/src/actions/actions/addCoin.js index f42fed9..505a510 100644 --- a/react/src/actions/actions/addCoin.js +++ b/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 + ) + ); + } } } }