diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index be59a17..c079661 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -2,7 +2,13 @@ import 'whatwg-fetch'; import 'bluebird'; import Config from '../config'; -import { startCurrencyAssetChain, startAssetChain, startCrypto, checkCoinType } from '../components/addcoin/payload'; +import { + startCurrencyAssetChain, + startAssetChain, + startCrypto, + checkCoinType, + checkAC +} from '../components/addcoin/payload'; import { copyToClipboard } from '../util/copyToClipboard'; import { translate } from '../translate/translate'; @@ -29,6 +35,22 @@ export const SYNCING_NATIVE_MODE = 'SYNCING_NATIVE_MODE'; export const ACTIVE_COIN_GET_ADDRESSES = 'ACTIVE_COIN_GET_ADDRESSES'; export const START_INTERVAL= 'START_INTERVAL'; export const STOP_INTERVAL= 'STOP_INTERVAL'; +export const DASHBOARD_ACTIVE_SECTION = 'DASHBOARD_ACTIVE_SECTION'; +export const DASHBOARD_ACTIVE_TXINFO_MODAL = 'DASHBOARD_ACTIVE_TXINFO_MODAL'; + +export function toggleDashboardActiveSection(name) { + return { + type: DASHBOARD_ACTIVE_SECTION, + section: name, + } +} + +export function toggleDashboardTxInfoModal(display) { + return { + type: DASHBOARD_ACTIVE_TXINFO_MODAL, + showTransactionInfo: display, + } +} function basiliskConnectionState(display, json) { return { @@ -314,6 +336,17 @@ export function shepherdHerd(coin, mode, path) { }; } + if (coin === 'KMD') { + herdData = { + 'ac_name': 'komodod', + 'ac_options': [ + '-daemon=0', + '-server', + '-addnode=78.47.196.146' + ] + }; + } + if (checkCoinType(coin) === 'crypto') { acData = startCrypto(path.result, coin, mode); } @@ -539,6 +572,7 @@ export function walletPassphrase(_passphrase) { export function getPeersListState(json) { var peersList = {}; + if (json && json.rawpeers && json.rawpeers.length) { for (var i=0; i < json.rawpeers.length; i++) { peersList[json.rawpeers[i].coin] = json.rawpeers[i].peers; @@ -619,15 +653,18 @@ export function addPeerNode(coin, ip) { } } -export function getAddressesByAccountState(json, coin) { - test(['123', '456']); +export function getAddressesByAccountState(json, coin, mode) { + if (mode === 'basilisk') { + getDexBalance(coin, mode, json.result); + } + return { type: ACTIVE_COIN_GET_ADDRESSES, addresses: json.result, } } -export function getAddressesByAccount(coin) { +export function getAddressesByAccount(coin, mode) { const payload = { 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), 'coin': coin, @@ -646,7 +683,7 @@ export function getAddressesByAccount(coin) { dispatch(triggerToaster(true, 'getAddressesByAccount', 'Error', 'error')); }) .then(response => response.json()) - .then(json => dispatch(getAddressesByAccountState(json, dispatch))) + .then(json => dispatch(getAddressesByAccountState(json, coin, mode, dispatch))) } } @@ -821,7 +858,67 @@ export function shepherdGetSysInfo() { } } -/*export function test(coin, addr) { +export function getSyncInfoNativeKMD() { + const coin = 'KMD'; + + return dispatch => { + return fetch('http://127.0.0.1:' + Config.iguanaCorePort + '/api/dex/getinfo?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth') + '&symbol=' + coin, { + method: 'GET', + }) + .catch(function(error) { + console.log(error); + dispatch(triggerToaster(true, 'getSyncInfoNativeKMD', 'Error', 'error')); + }) + .then(response => response.json()) + .then(json => dispatch(getSyncInfoNativeState({ 'remoteKMDNode': json }))) + .then(dispatch(getDebugLog('komodo', 1))) + } +} + +function getSyncInfoNativeState(json) { + if (json && json.error && json.error === 'null return') { + return getSyncInfoNativeKMD(); + } else { + return { + type: SYNCING_NATIVE_MODE, + progress: json, + } + } +} + +export function getSyncInfoNative(coin) { + var payload = {}, + passthru_agent; + + if ( coin === 'KMD') { passthru_agent = 'komodo'; }; + if ( coin === 'ZEC') { passthru_agent = 'zcash'; }; + + if (checkAC(coin)) { passthru_agent = 'iguana'; }; + + payload = { + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'agent': passthru_agent, + 'method': 'passthru', + 'asset': coin, + 'function': 'getinfo', + 'hex': '' + }; + + return dispatch => { + return fetch('http://127.0.0.1:' + Config.iguanaCorePort, { + method: 'POST', + body: JSON.stringify(payload), + }) + .catch(function(error) { + console.log(error); + dispatch(triggerToaster(true, 'getSyncInfo', 'Error', 'error')); + }) + .then(response => response.json()) + .then(json => dispatch(getSyncInfoNativeState(json, dispatch))) + } +} + +export function getDexBalance(coin, addr) { Promise.all(addr.map((_addr, index) => { const payload = { 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), @@ -829,7 +926,7 @@ export function shepherdGetSysInfo() { 'method': 'listunspent', 'address': _addr, 'symbol': coin - } + }; console.log('addr', _addr); return new Promise((resolve, reject) => { fetch('http://127.0.0.1:' + Config.iguanaCorePort, { @@ -838,10 +935,12 @@ export function shepherdGetSysInfo() { }) .catch(function(error) { console.log(error); - dispatch(triggerToaster(true, 'getSyncInfo', 'Error', 'error')); + dispatch(triggerToaster(true, 'getDexBalance', 'Error', 'error')); }) .then(response => response.json()) - .then(json => dispatch(getSyncInfoState(json, dispatch))) + .then(json => console.log(json)) + //.then(json => dispatch(getSyncInfoState(json, dispatch))) + resolve(index); }); })) diff --git a/react/src/assets/images/bg/wireless_transparent_header_bg.png b/react/src/assets/images/bg/wireless_transparent_header_bg.png deleted file mode 100644 index e901bd2..0000000 Binary files a/react/src/assets/images/bg/wireless_transparent_header_bg.png and /dev/null differ diff --git a/react/src/assets/images/cryptologo/WIRELESS.png b/react/src/assets/images/cryptologo/WIRELESS.png deleted file mode 100644 index bd100c0..0000000 Binary files a/react/src/assets/images/cryptologo/WIRELESS.png and /dev/null differ diff --git a/react/src/assets/images/native/wireless_header_title_logo.png b/react/src/assets/images/native/wireless_header_title_logo.png deleted file mode 100644 index 48ad71e..0000000 Binary files a/react/src/assets/images/native/wireless_header_title_logo.png and /dev/null differ diff --git a/react/src/components/addcoin/addcoinOptionsAC.js b/react/src/components/addcoin/addcoinOptionsAC.js index 7b59e61..f226fbf 100644 --- a/react/src/components/addcoin/addcoinOptionsAC.js +++ b/react/src/components/addcoin/addcoinOptionsAC.js @@ -20,7 +20,7 @@ class AddCoinOptionsAC extends React.Component { - + ); } diff --git a/react/src/components/addcoin/payload.js b/react/src/components/addcoin/payload.js index cf785eb..3cf9a53 100644 --- a/react/src/components/addcoin/payload.js +++ b/react/src/components/addcoin/payload.js @@ -1,3 +1,59 @@ +export function checkAC(coinVal) { + if (coinVal == 'SUPERNET' || + coinVal == 'REVS' || + coinVal == 'WLC' || + coinVal == 'DEX' || + coinVal == 'PANGEA' || + coinVal == 'JUMBLR' || + coinVal == 'BET' || + coinVal == 'CRYPTO' || + coinVal == 'HODL' || + coinVal == 'SHARK' || + coinVal == 'BOTS' || + coinVal == 'MGW' || + coinVal == 'MVP' || + coinVal == 'KV' || + coinVal == 'CEAL' || + coinVal == 'MESH' || + coinVal == 'BTC' || + coinVal == 'USD' || + coinVal == 'RON' || + coinVal == 'EUR' || + coinVal == 'JPY' || + coinVal == 'GBP' || + coinVal == 'AUD' || + coinVal == 'CAD' || + coinVal == 'CHF' || + coinVal == 'NZD' || + coinVal == 'CNY' || + coinVal == 'RUB' || + coinVal == 'MXN' || + coinVal == 'BRL' || + coinVal == 'INR' || + coinVal == 'HKD' || + coinVal == 'TRY' || + coinVal == 'ZAR' || + coinVal == 'PLN' || + coinVal == 'NOK' || + coinVal == 'SEK' || + coinVal == 'DKK' || + coinVal == 'CZK' || + coinVal == 'HUF' || + coinVal == 'ILS' || + coinVal == 'KRW' || + coinVal == 'MYR' || + coinVal == 'PHP' || + coinVal == 'SGD' || + coinVal == 'THB' || + coinVal == 'BGN' || + coinVal == 'IDR' || + coinVal == 'HRK') { + return true; + } else { + return false; + } +} + export function checkCoinType(coin) { if (coin === 'USD' || coin === 'RON' || @@ -49,7 +105,7 @@ export function checkCoinType(coin) { coin === 'KV' || coin === 'CEAL' || coin === 'MESH' || - coin === 'WIRELESS') { + coin === 'WLC') { return 'ac'; } diff --git a/react/src/components/dashboard/coinTileItem.js b/react/src/components/dashboard/coinTileItem.js index da9ed9e..d632c86 100644 --- a/react/src/components/dashboard/coinTileItem.js +++ b/react/src/components/dashboard/coinTileItem.js @@ -7,7 +7,8 @@ import { getSyncInfo, startInterval, stopInterval, - iguanaEdexBalance + iguanaEdexBalance, + getSyncInfoNative } from '../../actions/actionCreators'; import Store from '../../store'; @@ -23,16 +24,23 @@ class CoinTileItem extends React.Component { Store.dispatch(stopInterval('sync', this.props.Interval.interval)); var _iguanaActiveHandle = setInterval(function() { Store.dispatch(getSyncInfo(coin)); + Store.dispatch(iguanaEdexBalance(coin, mode)); + }, 3000); + Store.dispatch(startInterval('sync', _iguanaActiveHandle)); + } else if (mode === 'native' && coin !== this.props.ActiveCoin.coin) { + Store.dispatch(stopInterval('sync', this.props.Interval.interval)); + var _iguanaActiveHandle = setInterval(function() { + Store.dispatch(getSyncInfoNative(coin)); }, 3000); Store.dispatch(startInterval('sync', _iguanaActiveHandle)); } else { Store.dispatch(stopInterval('sync', this.props.Interval.interval)); + // basilisk } Store.dispatch(dashboardChangeActiveCoin(coin, mode)); Store.dispatch(iguanaActiveHandle(true)); Store.dispatch(getAddressesByAccount(coin)); - Store.dispatch(iguanaEdexBalance(coin)); /*this.setState(Object.assign({}, this.state, { activeHandleInterval: _iguanaActiveHandle, diff --git a/react/src/components/dashboard/dashboard.js b/react/src/components/dashboard/dashboard.js index a129cb7..4078db8 100644 --- a/react/src/components/dashboard/dashboard.js +++ b/react/src/components/dashboard/dashboard.js @@ -27,7 +27,6 @@ class Dashboard extends React.Component { renderDashboard() { document.body.className = ''; - // return (
diff --git a/react/src/components/dashboard/receiveCoin.js b/react/src/components/dashboard/receiveCoin.js index efc79ee..6c23bf0 100644 --- a/react/src/components/dashboard/receiveCoin.js +++ b/react/src/components/dashboard/receiveCoin.js @@ -22,7 +22,7 @@ class ReceiveCoin extends React.Component { } render() { - if (this.props && this.props.receive) { + if (this.props && this.props.receive && this.props.mode !== 'native') { return (
diff --git a/react/src/components/dashboard/sendCoin.js b/react/src/components/dashboard/sendCoin.js index 57f1047..06e69ac 100644 --- a/react/src/components/dashboard/sendCoin.js +++ b/react/src/components/dashboard/sendCoin.js @@ -20,7 +20,7 @@ class SendCoin extends React.Component { } render() { - if (this.props && this.props.send) { + if (this.props && this.props.send && this.props.mode !== 'native') { return (
diff --git a/react/src/components/dashboard/walletsBalance.js b/react/src/components/dashboard/walletsBalance.js index 189ba99..d84127d 100644 --- a/react/src/components/dashboard/walletsBalance.js +++ b/react/src/components/dashboard/walletsBalance.js @@ -3,7 +3,7 @@ import { translate } from '../../translate/translate'; class WalletsBalance extends React.Component { render() { - if (this.props && this.props.coin) { + if (this.props && this.props.coin && this.props.mode !== 'native') { return (
diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js index b6539c2..5ef9714 100644 --- a/react/src/components/dashboard/walletsData.js +++ b/react/src/components/dashboard/walletsData.js @@ -38,7 +38,7 @@ class WalletsData extends React.Component { } render() { - if (this.props && this.props.ActiveCoin && this.props.ActiveCoin.coin) { + if (this.props && this.props.ActiveCoin && this.props.ActiveCoin.coin && this.props.ActiveCoin.mode !== 'native') { return (
diff --git a/react/src/components/dashboard/walletsNative.js b/react/src/components/dashboard/walletsNative.js index 4ead324..3248f04 100644 --- a/react/src/components/dashboard/walletsNative.js +++ b/react/src/components/dashboard/walletsNative.js @@ -1,549 +1,48 @@ import React from 'react'; import { translate } from '../../translate/translate'; +import WalletsNativeAlert from './walletsNativeAlert'; +import WalletsNativeBalance from './walletsNativeBalance'; +import WalletsNativeInfo from './walletsNativeInfo'; +import WalletsNativeReceive from './walletsNativeReceive'; +import WalletsNativeSend from './walletsNativeSend'; +import WalletsNativeSyncProgress from './walletsNativeSyncProgress'; +import WalletsNativeTxHistory from './walletsNativeTxHistory'; +import WalletsNativeTxInfo from './walletsNativeTxInfo'; class WalletsNative extends React.Component { + constructor(props) { + super(props); + } + + /*$('.header-easydex-section') + .html(' ' + _coin + ''); + $('#easydex-header-div').css('background-image', 'url("assets/images/bg/' + imgBgName + '_transparent_header_bg.png")');*/ + render() { if (this.props && this.props.ActiveCoin && this.props.ActiveCoin.mode === 'native') { return (
-
-