diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js index d946d3c..a282c96 100644 --- a/react/src/actions/actionCreators.js +++ b/react/src/actions/actionCreators.js @@ -1,9 +1,42 @@ import 'whatwg-fetch'; import { startCurrencyAssetChain } from '../components/addcoin/payload'; +import { copyToClipboard } from '../util/copyToClipboard'; import { translate } from '../translate/translate'; export const TOASTER_MESSAGE = 'TOASTER_MESSAGE'; export const DISPLAY_ADDCOIN_MODAL = 'DISPLAY_ADDCOIN_MODAL'; +export const GET_ACTIVE_COINS = 'GET_ACTIVE_COINS'; +export const LOGIN = 'LOGIN'; +export const ACTIVE_HANDLE = 'ACTIVE_HANDLE'; +export const DASHBOARD_SECTION_CHANGE = 'DASHBOARD_SECTION_CHANGE'; +export const DASHBOARD_ACTIVE_COIN_CHANGE = 'DASHBOARD_ACTIVE_COIN_CHANGE'; +export const GET_MAIN_ADDRESS = 'GET_MAIN_ADDRESS'; +export const DASHBOARD_ACTIVE_COIN_BALANCE = 'DASHBOARD_ACTIVE_COIN_BALANCE'; +export const DASHBOARD_ACTIVE_COIN_SEND_FORM = 'DASHBOARD_ACTIVE_COIN_SEND_FORM'; +export const DASHBOARD_ACTIVE_COIN_RECEIVE_FORM = 'DASHBOARD_ACTIVE_COIN_RECEIVE_FORM'; +export const DASHBOARD_ACTIVE_COIN_RESET_FORMS = 'DASHBOARD_ACTIVE_COIN_RESET_FORMS'; + +function toggleSendCoinFormState(display) { + return { + type: DASHBOARD_ACTIVE_COIN_SEND_FORM, + send: display, + } +} + +function toggleReceiveCoinFormState(display) { + return { + type: DASHBOARD_ACTIVE_COIN_SEND_FORM, + send: display, + } +} + +function toggleSendReceiveCoinFormsState() { + return { + type: DASHBOARD_ACTIVE_COIN_RESET_FORMS, + send: false, + receive: false, + } +} function triggerToaster(display, message, title, _type) { return { @@ -23,12 +56,134 @@ function toggleAddcoinModalState(display, isLogin) { } } +function dashboardCoinsState(json) { + return { + type: GET_ACTIVE_COINS, + coins: json, + activeCoins: Object.keys(json.native).length || Object.keys(json.basilisk).length || Object.keys(json.full).length ? true : false + } +} + +function iguanaWalletPassphraseState(json, dispatch) { + console.log('passp', json); + sessionStorage.setItem('IguanaActiveAccount', JSON.stringify(json)); + dispatch(triggerToaster(true, translate('TOASTR.LOGIN_SUCCESSFULL'), translate('TOASTR.ACCOUNT_NOTIFICATION'), 'success')); + + return { + type: LOGIN, + isLoggedIn: json && json.pubkey ? true : false, + } +} + +function iguanaActiveHandleState(json) { + return { + type: ACTIVE_HANDLE, + isLoggedIn: sessionStorage.getItem('IguanaActiveAccount') && JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey === json.pubkey && json.status === 'unlocked' ? true : false, + handle: json, + } +} + +function getMainAddressState(json) { + return { + type: GET_MAIN_ADDRESS, + activeHandle: json, + } +} + +export function toggleSendCoinForm(display) { + return dispatch => { + dispatch(toggleSendCoinFormState(display)); + } +} + +export function toggleReceiveCoinForm(display) { + return dispatch => { + dispatch(toggleReceiveCoinFormState(display)); + } +} + +export function toggleSendReceiveCoinForms() { + return dispatch => { + dispatch(toggleSendReceiveCoinFormsState()); + } +} + +function logoutState(json, dispatch) { + console.log('passp', json); + sessionStorage.removeItem('IguanaActiveAccount'); + + return { + type: LOGIN, + isLoggedIn: false, + } +} + +export function logout() { + return dispatch => { + dispatch(logoutState()); + } +} + +function dashboardChangeSectionState(sectionName) { + return { + type: DASHBOARD_SECTION_CHANGE, + activeSection: sectionName, + } +} + +export function dashboardChangeSection(sectionName) { + return dispatch => { + dispatch(dashboardChangeSectionState(sectionName)); + } +} + +function dashboardChangeActiveCoinState(coin, mode) { + return { + type: DASHBOARD_ACTIVE_COIN_CHANGE, + coin: coin, + mode: mode, + } +} + +function iguanaEdexBalanceState(json) { + return { + type: DASHBOARD_ACTIVE_COIN_BALANCE, + balance: json && json.result ? json.result : 0, + } +} + +export function dashboardChangeActiveCoin(coin, mode) { + return dispatch => { + dispatch(dashboardChangeActiveCoinState(coin, mode)); + } +} + export function toggleAddcoinModal(display, isLogin) { return dispatch => { dispatch(toggleAddcoinModalState(display, isLogin)); } } +export function copyCoinAddress(address) { + var _result = copyToClipboard(address); + + if (_result) { + return dispatch => { + dispatch(triggerToaster(true, translate('DASHBOARD.ADDR_COPIED'), translate('TOASTR.COIN_NOTIFICATION'), 'success')) + } + } else { + return dispatch => { + dispatch(triggerToaster(true, 'Couldn\'t copy address to clipboard', translate('TOASTR.COIN_NOTIFICATION'), 'error')) + } + } +} + +export function dismissToasterMessage() { + return dispatch => { + dispatch(triggerToaster(false)) + } +} + export function addCoin(coin, mode) { console.log('coin, mode', coin + ' ' + mode); return dispatch => { @@ -87,14 +242,15 @@ export function shepherdHerd(coin, mode, path) { export function addCoinResult(coin, mode) { const modeToValue = { - 'full': 1, - 'basilisk': 0, - 'native': -1, + '1': 'full', + '0': 'basilisk', + '-1': 'native' }; return dispatch => { - //dispatch(shepherdGetConfig(coin, mode)); - dispatch(triggerToaster(true, coin + ' ' + translate('TOASTR.COIN_STARTED') + modeToValue[defaultMode] + ' ' + translate('TOASTR.MODE'), translate('TOASTR.COIN_NOTIFICATION'), 'success')); + dispatch(triggerToaster(true, coin + ' ' + translate('TOASTR.STARTED_IN') + ' ' + modeToValue[mode] + ' ' + translate('TOASTR.MODE'), translate('TOASTR.COIN_NOTIFICATION'), 'success')); + dispatch(toggleAddcoinModal(false, false)); + dispatch(getDexCoins()); } } @@ -115,3 +271,121 @@ export function shepherdGetConfig(coin, mode) { .then(json => dispatch(shepherdHerd(coin, mode, json))); } } + +export function getDexCoins() { + return dispatch => { + return fetch('http://127.0.0.1:7778', { + method: 'POST', + //mode: 'no-cors' + body: JSON.stringify({ + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'agent': 'InstantDEX', + 'method': 'allcoins', + }) + }) + .catch(function(error) { + console.log(error); + dispatch(triggerToaster(true, 'Error getDexCoins', 'Error', 'error')) + + }) + .then(response => response.json()) + .then(json => dispatch(dashboardCoinsState(json))); + } +} + +function rpcErrorHandler(json, dispatch) { + console.log('json', json); + if (json && json.error) { + if (json.error === 'bitcoinrpc needs coin that is active') { + dispatch(triggerToaster(true, 'No active coin', translate('TOASTR.SERVICE_NOTIFICATION'), 'error')); + } + } +} + +export function iguanaWalletPassphrase(_passphrase) { + return dispatch => { + return fetch('http://127.0.0.1:7778', { + method: 'POST', + body: JSON.stringify({ + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'handle': '', + 'password': _passphrase, + 'timeout': '2592000', + 'agent': 'bitcoinrpc', + 'method': 'walletpassphrase' + }), + }) + .catch(function(error) { + console.log(error); + dispatch(triggerToaster(true, 'Error iguanaWalletPassphrase', 'Error', 'error')) + }) + .then(response => response.json()) + .then(json => dispatch(iguanaWalletPassphraseState(json, dispatch))); + } +} + +export function iguanaActiveHandle(getMainAddress) { + return dispatch => { + return fetch('http://127.0.0.1:7778', { + method: 'POST', + body: JSON.stringify({ + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'agent': 'SuperNET', + 'method': 'activehandle' + }), + }) + .catch(function(error) { + console.log(error); + dispatch(triggerToaster(true, 'Error iguanaActiveHandle', 'Error', 'error')) + }) + .then(response => response.json()) + .then(json => dispatch(getMainAddress ? getMainAddressState(json) : iguanaActiveHandleState(json))); + } +} + +export function iguanaEdexBalance(coin) { + return dispatch => { + return fetch('http://127.0.0.1:7778', { + method: 'POST', + body: JSON.stringify({ + 'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'), + 'agent': 'bitcoinrpc', + 'method': 'getbalance', + 'coin': coin + }), + }) + .catch(function(error) { + console.log(error); + dispatch(triggerToaster(true, 'Error iguanaEdexBalance', 'Error', 'error')) + }) + .then(response => response.json()) + .then(json => dispatch(iguanaEdexBalanceState(json))); + } +} + +/*function Shepherd_SysInfo() { + return new Promise((resolve) => { + $.ajax({ + type: 'GET', + url: 'http://127.0.0.1:17777/shepherd/sysinfo', + contentType: 'application/json' // send as JSON + }) + .done(function(data) { + resolve(data); + }); + }); +} + +function Shepherd_SendPendValue() { + Shepherd_SysInfo().then(function(result){ + var ram_data = formatBytes(result.totalmem_bytes) + var pend_val = null; + if (ram_data.size === 'GB') { + if (ram_data.ramsize >= '63' ) { pend_val = 16; } + if (ram_data.ramsize >= '31' ) { pend_val = 8; } + if (ram_data.ramsize >= '15' ) { pend_val = 4; } + if (ram_data.ramsize <= '15' ) { pend_val = 1; } + } else { pend_val = 1; } + sessionStorage.setItem('IguanaPendValue', pend_val); + }) +}*/ \ No newline at end of file diff --git a/react/src/components/addcoin/payload.js b/react/src/components/addcoin/payload.js index 07979d5..d79e676 100644 --- a/react/src/components/addcoin/payload.js +++ b/react/src/components/addcoin/payload.js @@ -1,4 +1,4 @@ -function checkCoinType(coin) { +export function checkCoinType(coin) { if (coin === 'USD' || coin === 'RON' || coin === 'RUB' || @@ -59,494 +59,456 @@ export function startCurrencyAssetChain(confpath, coin, mode) { var tmpPendValue = 4; var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'); - if ( checkCoinType(coin) === 'currency_ac' ) { - var _payloadVar = { - 'userpass': tmpIguanaRPCAuth, - 'unitval': '20', - 'zcash': 1, - 'RELAY': mode, - 'VALIDATE': mode, - 'prefetchlag': -1, - 'poll': 100, - 'active': 1, - 'agent': 'iguana', - 'method': 'addcoin', - 'startpend': tmpPendValue, - 'endpend': tmpPendValue, - 'services': 129, - 'maxpeers': 8, - 'newcoin': coin, - 'name': coin, - 'hasheaders': 1, - 'useaddmultisig': 0, + var _payloadVar = { + 'userpass': tmpIguanaRPCAuth, + 'unitval': '20', + 'zcash': 1, + 'RELAY': mode, + 'VALIDATE': mode, + 'prefetchlag': -1, + 'poll': 100, + 'active': 1, + 'agent': 'iguana', + 'method': 'addcoin', + 'startpend': tmpPendValue, + 'endpend': tmpPendValue, + 'services': 129, + 'maxpeers': 8, + 'newcoin': coin, + 'name': coin, + 'hasheaders': 1, + 'useaddmultisig': 0, + 'netmagic': '2d8e7803', + 'p2p': 13966, + 'rpc': 13967, + 'pubval': 60, + 'p2shval': 85, + 'wifval': 188, + 'txfee_satoshis': '10000', + 'isPoS': 0, + 'minoutput': 10000, + 'minconfirms': 2, + 'genesishash': '027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71', + 'protover': 170002, + 'genesisblock': '0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2', + 'debug': 0, + 'seedipaddr': '78.47.196.146' + }; + + if (mode === '-1') { + var _payloadVarRegular = Object.assign({}, _payloadVar); + delete _payloadVarRegular.userpass; + _payloadVarRegular.RELAY = -1; + _payloadVarRegular.VALIDATE = 1; + _payloadVarRegular.startpend = 4; + _payloadVarRegular.endpend = 4; + _payloadVarRegular.path = confpath; + + const USDDiff = { + 'coin': 'USD', + 'conf': 'USD.conf' + }; + AddCoinDataPayload.USD = Object.assign({}, _payloadVarRegular, USDDiff); + + const RONDiff = { + 'coin': 'RON', + 'conf': 'RON.conf' + }; + AddCoinDataPayload.RON = Object.assign({}, _payloadVarRegular, RONDiff); + + const RUBDiff = { + 'coin': 'RUB', + 'conf': 'RUB.conf' + }; + AddCoinDataPayload.RUB = Object.assign({}, _payloadVarRegular, RUBDiff); + + const SEKDiff = { + 'coin': 'SEK', + 'conf': 'SEK.conf' + }; + AddCoinDataPayload.SEK = Object.assign({}, _payloadVarRegular, SEKDiff); + + const SGDDiff = { + 'coin': 'SGD', + 'conf': 'SGD.conf' + }; + AddCoinDataPayload.SGD = Object.assign({}, _payloadVarRegular, SGDDiff); + + const THBDiff = { + 'coin': 'THB', + 'conf': 'THB.conf' + }; + AddCoinDataPayload.THB = Object.assign({}, _payloadVarRegular, THBDiff); + + const TRYDiff = { + 'coin': 'TRY', + 'conf': 'TRY.conf' + }; + AddCoinDataPayload.TRY = Object.assign({}, _payloadVarRegular, TRYDiff); + + const ZARDiff = { + 'coin': 'ZAR', + 'conf': 'ZAR.conf' + }; + AddCoinDataPayload.ZAR = Object.assign({}, _payloadVarRegular, ZARDiff); + + const CNYDiff = { + 'coin': 'CNY', + 'conf': 'CNY.conf' + }; + AddCoinDataPayload.CNY = Object.assign({}, _payloadVarRegular, CNYDiff); + + const CZKDiff = { + 'coin': 'CZK', + 'conf': 'CZK.conf' + }; + AddCoinDataPayload.CZK = Object.assign({}, _payloadVarRegular, CZKDiff); + + const DKKDiff = { + 'coin': 'DKK', + 'conf': 'DKK.conf' + }; + AddCoinDataPayload.DKK = Object.assign({}, _payloadVarRegular, DKKDiff); + + const EURDiff = { + 'coin': 'EUR', + 'conf': 'EUR.conf' + }; + AddCoinDataPayload.EUR = Object.assign({}, _payloadVarRegular, EURDiff); + + const GBPDiff = { + 'coin': 'GBP', + 'conf': 'GBP.conf' + }; + AddCoinDataPayload.GBP = Object.assign({}, _payloadVarRegular, GBPDiff); + + const HKDDiff = { + 'coin': 'HKD', + 'conf': 'HKD.conf' + }; + AddCoinDataPayload.HKD = Object.assign({}, _payloadVarRegular, HKDDiff); + + const HUFDiff = { + 'coin': 'HUF', + 'conf': 'HUF.conf' + }; + AddCoinDataPayload.HUF = Object.assign({}, _payloadVarRegular, HUFDiff); + + const IDRDiff = { + 'coin': 'IDR', + 'conf': 'IDR.conf' + }; + AddCoinDataPayload.IDR = Object.assign({}, _payloadVarRegular, IDRDiff); + + const ILSDiff = { + 'coin': 'ILS', + 'conf': 'ILS.conf' + }; + AddCoinDataPayload.ILS = Object.assign({}, _payloadVarRegular, ILSDiff); + + const INRDiff = { + 'coin': 'INR', + 'conf': 'INR.conf' + }; + AddCoinDataPayload.INR = Object.assign({}, _payloadVarRegular, INRDiff); + + const JPYDiff = { + 'coin': 'JPY', + 'conf': 'JPY.conf' + }; + AddCoinDataPayload.JPY = Object.assign({}, _payloadVarRegular, JPYDiff); + + const KRWDiff = { + 'coin': 'KRW', + 'conf': 'KRW.conf' + }; + AddCoinDataPayload.KRW = Object.assign({}, _payloadVarRegular, KRWDiff); + + const MXNDiff = { + 'coin': 'MXN', + 'conf': 'MXN.conf' + }; + AddCoinDataPayload.MXN = Object.assign({}, _payloadVarRegular, MXNDiff); + + const MYRDiff = { + 'coin': 'MYR', + 'conf': 'MYR.conf' + }; + AddCoinDataPayload.MYR = Object.assign({}, _payloadVarRegular, MYRDiff); + + const NOKDiff = { + 'coin': 'NOK', + 'conf': 'NOK.conf' + }; + AddCoinDataPayload.NOK = Object.assign({}, _payloadVarRegular, NOKDiff); + + const NZDDiff = { + 'coin': 'NZD', + 'conf': 'NZD.conf' + }; + AddCoinDataPayload.NZD = Object.assign({}, _payloadVarRegular, NZDDiff); + + const PHPDiff = { + 'coin': 'PHP', + 'conf': 'PHP.conf' + }; + AddCoinDataPayload.PHP = Object.assign({}, _payloadVarRegular, PHPDiff); + + const PLNDiff = { + 'coin': 'PLN', + 'conf': 'PLN.conf' + }; + AddCoinDataPayload.PLN = Object.assign({}, _payloadVarRegular, PLNDiff); + + const AUDDiff = { + 'coin': 'AUD', + 'conf': 'AUD.conf' + }; + AddCoinDataPayload.AUD = Object.assign({}, _payloadVarRegular, AUDDiff); + + const BGNDiff = { + 'coin': 'BGN', + 'conf': 'BGN.conf' + }; + AddCoinDataPayload.BGN = Object.assign({}, _payloadVarRegular, BGNDiff); + + const BRLDiff = { + 'coin': 'BRL', + 'conf': 'BRL.conf' + }; + AddCoinDataPayload.BRL = Object.assign({}, _payloadVarRegular, BRLDiff); + + const CADDiff = { + 'coin': 'CAD', + 'conf': 'CAD.conf' + }; + AddCoinDataPayload.CAD = Object.assign({}, _payloadVarRegular, CADDiff); + + const CHFDiff = { + 'coin': 'CHF', + 'conf': 'CHF.conf' + }; + AddCoinDataPayload.CHF = Object.assign({}, _payloadVarRegular, CHFDiff); + + return AddCoinDataPayload[coin]; + } else { + const USDDiff = { 'netmagic': '2d8e7803', 'p2p': 13966, - 'rpc': 13967, - 'pubval': 60, - 'p2shval': 85, - 'wifval': 188, - 'txfee_satoshis': '10000', - 'isPoS': 0, - 'minoutput': 10000, - 'minconfirms': 2, - 'genesishash': '027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71', - 'protover': 170002, - 'genesisblock': '0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2', - 'debug': 0, - 'seedipaddr': '78.47.196.146' - }; - - /*if ( mode == '-1' ) { - console.log('native'); - logincoinmodeinfo = 'Native'; - var confpath = Shepherd_getConf(coin); - console.log(confpath[0].path); - - var setconfig = function() { - return new Promise(function(resolve, reject) { - Shepherd_setConf(coin); - var result = 'setconfig: DONE'; - console.log(result); - resolve(result); - }); - } - - var startcoin = function() { - return new Promise(function(resolve, reject) { - Shepherd_herd('komodod', { - 'ac_name': coin, - 'ac_options': [ - '-daemon=0', - '-server', - '-ac_name=' + coin, - '-addnode=78.47.196.146' - ] - }); - - var result = 'startcoin: DONE'; - console.log(result); - resolve(result); - }); - } - - startcoin();*/ - //var AddCoinData = AddCoinDataPayload[coin + 'Var']; - - if (mode === '-1') { - var _payloadVarRegular = Object.assign({}, _payloadVar); - delete _payloadVarRegular.userpass; - _payloadVarRegular.RELAY = -1; - _payloadVarRegular.VALIDATE = 1; - _payloadVarRegular.startpend = 4; - _payloadVarRegular.endpend = 4; - _payloadVarRegular.path = confpath; - - const USDDiff = { - 'coin': 'USD', - 'conf': 'USD.conf' - }; - AddCoinDataPayload.USD = Object.assign({}, _payloadVarRegular, USDDiff); - - const RONDiff = { - 'coin': 'RON', - 'conf': 'RON.conf' - }; - AddCoinDataPayload.RON = Object.assign({}, _payloadVarRegular, RONDiff); - - const RUBDiff = { - 'coin': 'RUB', - 'conf': 'RUB.conf' - }; - AddCoinDataPayload.RUB = Object.assign({}, _payloadVarRegular, RUBDiff); - - const SEKDiff = { - 'coin': 'SEK', - 'conf': 'SEK.conf' - }; - AddCoinDataPayload.SEK = Object.assign({}, _payloadVarRegular, SEKDiff); - - const SGDDiff = { - 'coin': 'SGD', - 'conf': 'SGD.conf' - }; - AddCoinDataPayload.SGD = Object.assign({}, _payloadVarRegular, SGDDiff); - - const THBDiff = { - 'coin': 'THB', - 'conf': 'THB.conf' - }; - AddCoinDataPayload.THB = Object.assign({}, _payloadVarRegular, THBDiff); - - const TRYDiff = { - 'coin': 'TRY', - 'conf': 'TRY.conf' - }; - AddCoinDataPayload.TRY = Object.assign({}, _payloadVarRegular, TRYDiff); - - const ZARDiff = { - 'coin': 'ZAR', - 'conf': 'ZAR.conf' - }; - AddCoinDataPayload.ZAR = Object.assign({}, _payloadVarRegular, ZARDiff); - - const CNYDiff = { - 'coin': 'CNY', - 'conf': 'CNY.conf' - }; - AddCoinDataPayload.CNY = Object.assign({}, _payloadVarRegular, CNYDiff); - - const CZKDiff = { - 'coin': 'CZK', - 'conf': 'CZK.conf' - }; - AddCoinDataPayload.CZK = Object.assign({}, _payloadVarRegular, CZKDiff); - - const DKKDiff = { - 'coin': 'DKK', - 'conf': 'DKK.conf' - }; - AddCoinDataPayload.DKK = Object.assign({}, _payloadVarRegular, DKKDiff); - - const EURDiff = { - 'coin': 'EUR', - 'conf': 'EUR.conf' - }; - AddCoinDataPayload.EUR = Object.assign({}, _payloadVarRegular, EURDiff); - - const GBPDiff = { - 'coin': 'GBP', - 'conf': 'GBP.conf' - }; - AddCoinDataPayload.GBP = Object.assign({}, _payloadVarRegular, GBPDiff); - - const HKDDiff = { - 'coin': 'HKD', - 'conf': 'HKD.conf' - }; - AddCoinDataPayload.HKD = Object.assign({}, _payloadVarRegular, HKDDiff); - - const HUFDiff = { - 'coin': 'HUF', - 'conf': 'HUF.conf' - }; - AddCoinDataPayload.HUF = Object.assign({}, _payloadVarRegular, HUFDiff); - - const IDRDiff = { - 'coin': 'IDR', - 'conf': 'IDR.conf' - }; - AddCoinDataPayload.IDR = Object.assign({}, _payloadVarRegular, IDRDiff); - - const ILSDiff = { - 'coin': 'ILS', - 'conf': 'ILS.conf' - }; - AddCoinDataPayload.ILS = Object.assign({}, _payloadVarRegular, ILSDiff); - - const INRDiff = { - 'coin': 'INR', - 'conf': 'INR.conf' - }; - AddCoinDataPayload.INR = Object.assign({}, _payloadVarRegular, INRDiff); - - const JPYDiff = { - 'coin': 'JPY', - 'conf': 'JPY.conf' - }; - AddCoinDataPayload.JPY = Object.assign({}, _payloadVarRegular, JPYDiff); - - const KRWDiff = { - 'coin': 'KRW', - 'conf': 'KRW.conf' - }; - AddCoinDataPayload.KRW = Object.assign({}, _payloadVarRegular, KRWDiff); - - const MXNDiff = { - 'coin': 'MXN', - 'conf': 'MXN.conf' - }; - AddCoinDataPayload.MXN = Object.assign({}, _payloadVarRegular, MXNDiff); - - const MYRDiff = { - 'coin': 'MYR', - 'conf': 'MYR.conf' - }; - AddCoinDataPayload.MYR = Object.assign({}, _payloadVarRegular, MYRDiff); - - const NOKDiff = { - 'coin': 'NOK', - 'conf': 'NOK.conf' - }; - AddCoinDataPayload.NOK = Object.assign({}, _payloadVarRegular, NOKDiff); - - const NZDDiff = { - 'coin': 'NZD', - 'conf': 'NZD.conf' - }; - AddCoinDataPayload.NZD = Object.assign({}, _payloadVarRegular, NZDDiff); - - const PHPDiff = { - 'coin': 'PHP', - 'conf': 'PHP.conf' - }; - AddCoinDataPayload.PHP = Object.assign({}, _payloadVarRegular, PHPDiff); - - const PLNDiff = { - 'coin': 'PLN', - 'conf': 'PLN.conf' - }; - AddCoinDataPayload.PLN = Object.assign({}, _payloadVarRegular, PLNDiff); - - const AUDDiff = { - 'coin': 'AUD', - 'conf': 'AUD.conf' - }; - AddCoinDataPayload.AUD = Object.assign({}, _payloadVarRegular, AUDDiff); - - const BGNDiff = { - 'coin': 'BGN', - 'conf': 'BGN.conf' - }; - AddCoinDataPayload.BGN = Object.assign({}, _payloadVarRegular, BGNDiff); - - const BRLDiff = { - 'coin': 'BRL', - 'conf': 'BRL.conf' - }; - AddCoinDataPayload.BRL = Object.assign({}, _payloadVarRegular, BRLDiff); - - const CADDiff = { - 'coin': 'CAD', - 'conf': 'CAD.conf' - }; - AddCoinDataPayload.CAD = Object.assign({}, _payloadVarRegular, CADDiff); - - const CHFDiff = { - 'coin': 'CHF', - 'conf': 'CHF.conf' - }; - AddCoinDataPayload.CHF = Object.assign({}, _payloadVarRegular, CHFDiff); - - return AddCoinDataPayload[coin]; - } else { - const USDDiff = { - 'netmagic': '2d8e7803', - 'p2p': 13966, - 'rpc': 13967 - }; - AddCoinDataPayload.USDVar = Object.assign({}, _payloadVar, USDDiff); - - const CHFDiff = { - 'netmagic': '59fbeb5c', - 'p2p': 15311, - 'rpc': 15312 - }; - AddCoinDataPayload.CHFVar = Object.assign({}, _payloadVar, CHFDiff); - - const CADDiff = { - 'netmagic': '3c212763', - 'p2p': 8719, - 'rpc': 8720 - }; - AddCoinDataPayload.CADVar = Object.assign({}, _payloadVar, CADDiff); - - const BRLDiff = { - 'netmagic': 'ab82d10d', - 'p2p': 9913, - 'rpc': 9914 - }; - AddCoinDataPayload.BRLVar = Object.assign({}, _payloadVar, BRLDiff); - - const BGNDiff = { - 'netmagic': '93056ad4', - 'p2p': 9109, - 'rpc': 9110 - }; - AddCoinDataPayload.BGNVar = Object.assign({}, _payloadVar, BGNDiff); - - const AUDDiff = { - 'netmagic': '07220d4e', - 'p2p': 8044, - 'rpc': 8045 - }; - AddCoinDataPayload.AUDVar = Object.assign({}, _payloadVar, AUDDiff); - - const PLNDiff = { - 'netmagic': '46ab3c28', - 'p2p': 13492, - 'rpc': 13493 - }; - AddCoinDataPayload.PLNVar = Object.assign({}, _payloadVar, PLNDiff); - - const PHPDiff = { - 'netmagic': '21535fb6', - 'p2p': 11180, - 'rpc': 11181 - }; - AddCoinDataPayload.PHPVar = Object.assign({}, _payloadVar, PHPDiff); - - const NZDDiff = { - 'netmagic': 'f579c9c2', - 'p2p': 10914, - 'rpc': 10915 - }; - AddCoinDataPayload.NZDVar = Object.assign({}, _payloadVar, NZDDiff); - - const NOKDiff = { - 'netmagic': '7082c365', - 'p2p': 11587, - 'rpc': 11588 - }; - AddCoinDataPayload.NOKVar = Object.assign({}, _payloadVar, NOKDiff); - - const MYRDiff = { - 'netmagic': '3e21761f', - 'p2p': 10687, - 'rpc': 10688 - }; - AddCoinDataPayload.MYRVar = Object.assign({}, _payloadVar, MYRDiff); - - const MXNDiff = { - 'netmagic': '304c6c12', - 'p2p': 13969, - 'rpc': 13970 - }; - AddCoinDataPayload.MXNVar = Object.assign({}, _payloadVar, MXNDiff); - - const KRWDiff = { - 'netmagic': 'c8706588', - 'p2p': 14019, - 'rpc': 14020 - }; - AddCoinDataPayload.KRWVar = Object.assign({}, _payloadVar, KRWDiff); - - const JPYDiff = { - 'netmagic': '7a55295c', - 'p2p': 13144, - 'rpc': 13145 - }; - AddCoinDataPayload.JPYVar = Object.assign({}, _payloadVar, JPYDiff); - - const INRDiff = { - 'netmagic': '740dfc1d', - 'p2p': 10535, - 'rpc': 10536 - }; - AddCoinDataPayload.INRVar = Object.assign({}, _payloadVar, INRDiff); - - const ILSDiff = { - 'netmagic': '605fcd58', - 'p2p': 14637, - 'rpc': 14638 - }; - AddCoinDataPayload.ILSVar = Object.assign({}, _payloadVar, ILSDiff); - - const IDRDiff = { - 'netmagic': 'fee513e7', - 'p2p': 14458, - 'rpc': 14459 - }; - AddCoinDataPayload.IDRVar = Object.assign({}, _payloadVar, IDRDiff); - - const HKDDiff = { - 'netmagic': '57269d95', - 'p2p': 15408, - 'rpc': 15409 - }; - AddCoinDataPayload.HKDVar = Object.assign({}, _payloadVar, HKDDiff); - - const HUFDiff = { - 'netmagic': 'a478d2af', - 'p2p': 13698, - 'rpc': 13699 - }; - AddCoinDataPayload.HUFVar = Object.assign({}, _payloadVar, HUFDiff); - - const GBPDiff = { - 'netmagic': '5e0ed955', - 'p2p': 11504, - 'rpc': 11505 - }; - AddCoinDataPayload.GBPVar = Object.assign({}, _payloadVar, GBPDiff); - - const EURDiff = { - 'netmagic': '8a3fd0bd', - 'p2p': 8064, - 'rpc': 8065 - }; - AddCoinDataPayload.EURVar = Object.assign({}, _payloadVar, EURDiff); - - const DKKDiff = { - 'netmagic': 'a2c2380c', - 'p2p': 13829, - 'rpc': 13830 - }; - AddCoinDataPayload.DKKVar = Object.assign({}, _payloadVar, DKKDiff); - - const CNYDiff = { - 'netmagic': '2a51b987', - 'p2p': 10383, - 'rpc': 10384 - }; - AddCoinDataPayload.CNYVar = Object.assign({}, _payloadVar, CNYDiff); - - const ZARDiff = { - 'netmagic': '920c0484', - 'p2p': 15159, - 'rpc': 15160 - }; - AddCoinDataPayload.ZARVar = Object.assign({}, _payloadVar, ZARDiff); - - const TRYDiff = { - 'netmagic': '82b9a778', - 'p2p': 13923, - 'rpc': 13924 - }; - AddCoinDataPayload.TRYVar = Object.assign({}, _payloadVar, TRYDiff); - - const THBDiff = { - 'netmagic': 'b58aef42', - 'p2p': 11846, - 'rpc': 11847 - }; - AddCoinDataPayload.THBVar = Object.assign({}, _payloadVar, THBDiff); - - const SGDDiff = { - 'netmagic': 'ca255b29', - 'p2p': 14474, - 'rpc': 14475 - }; - AddCoinDataPayload.SGDVar = Object.assign({}, _payloadVar, SGDDiff); - - const SEKDiff = { - 'netmagic': 'd95ad28b', - 'p2p': 11446, - 'rpc': 11447 - }; - AddCoinDataPayload.SEKVar = Object.assign({}, _payloadVar, SEKDiff); - - const RONDiff = { - 'netmagic': 'eb2c9500', - 'p2p': 8674, - 'rpc': 8675 - }; - AddCoinDataPayload.RONVar = Object.assign({}, _payloadVar, RONDiff); - - const RUBDiff = { - 'netmagic': '1b9a0eb9', - 'p2p': 8198, - 'rpc': 8199 - }; - AddCoinDataPayload.RUBVar = Object.assign({}, _payloadVar, RUBDiff); - - const CZKDiff = { - 'netmagic': '37f7ae5a', - 'p2p': 9481, - 'rpc': 9482 - }; - AddCoinDataPayload.CZKVar = Object.assign({}, _payloadVar, CZKDiff); - - return AddCoinDataPayload[coin + 'Var']; - } + 'rpc': 13967 + }; + AddCoinDataPayload.USDVar = Object.assign({}, _payloadVar, USDDiff); + + const CHFDiff = { + 'netmagic': '59fbeb5c', + 'p2p': 15311, + 'rpc': 15312 + }; + AddCoinDataPayload.CHFVar = Object.assign({}, _payloadVar, CHFDiff); + + const CADDiff = { + 'netmagic': '3c212763', + 'p2p': 8719, + 'rpc': 8720 + }; + AddCoinDataPayload.CADVar = Object.assign({}, _payloadVar, CADDiff); + + const BRLDiff = { + 'netmagic': 'ab82d10d', + 'p2p': 9913, + 'rpc': 9914 + }; + AddCoinDataPayload.BRLVar = Object.assign({}, _payloadVar, BRLDiff); + + const BGNDiff = { + 'netmagic': '93056ad4', + 'p2p': 9109, + 'rpc': 9110 + }; + AddCoinDataPayload.BGNVar = Object.assign({}, _payloadVar, BGNDiff); + + const AUDDiff = { + 'netmagic': '07220d4e', + 'p2p': 8044, + 'rpc': 8045 + }; + AddCoinDataPayload.AUDVar = Object.assign({}, _payloadVar, AUDDiff); + + const PLNDiff = { + 'netmagic': '46ab3c28', + 'p2p': 13492, + 'rpc': 13493 + }; + AddCoinDataPayload.PLNVar = Object.assign({}, _payloadVar, PLNDiff); + + const PHPDiff = { + 'netmagic': '21535fb6', + 'p2p': 11180, + 'rpc': 11181 + }; + AddCoinDataPayload.PHPVar = Object.assign({}, _payloadVar, PHPDiff); + + const NZDDiff = { + 'netmagic': 'f579c9c2', + 'p2p': 10914, + 'rpc': 10915 + }; + AddCoinDataPayload.NZDVar = Object.assign({}, _payloadVar, NZDDiff); + + const NOKDiff = { + 'netmagic': '7082c365', + 'p2p': 11587, + 'rpc': 11588 + }; + AddCoinDataPayload.NOKVar = Object.assign({}, _payloadVar, NOKDiff); + + const MYRDiff = { + 'netmagic': '3e21761f', + 'p2p': 10687, + 'rpc': 10688 + }; + AddCoinDataPayload.MYRVar = Object.assign({}, _payloadVar, MYRDiff); + + const MXNDiff = { + 'netmagic': '304c6c12', + 'p2p': 13969, + 'rpc': 13970 + }; + AddCoinDataPayload.MXNVar = Object.assign({}, _payloadVar, MXNDiff); + + const KRWDiff = { + 'netmagic': 'c8706588', + 'p2p': 14019, + 'rpc': 14020 + }; + AddCoinDataPayload.KRWVar = Object.assign({}, _payloadVar, KRWDiff); + + const JPYDiff = { + 'netmagic': '7a55295c', + 'p2p': 13144, + 'rpc': 13145 + }; + AddCoinDataPayload.JPYVar = Object.assign({}, _payloadVar, JPYDiff); + + const INRDiff = { + 'netmagic': '740dfc1d', + 'p2p': 10535, + 'rpc': 10536 + }; + AddCoinDataPayload.INRVar = Object.assign({}, _payloadVar, INRDiff); + + const ILSDiff = { + 'netmagic': '605fcd58', + 'p2p': 14637, + 'rpc': 14638 + }; + AddCoinDataPayload.ILSVar = Object.assign({}, _payloadVar, ILSDiff); + + const IDRDiff = { + 'netmagic': 'fee513e7', + 'p2p': 14458, + 'rpc': 14459 + }; + AddCoinDataPayload.IDRVar = Object.assign({}, _payloadVar, IDRDiff); + + const HKDDiff = { + 'netmagic': '57269d95', + 'p2p': 15408, + 'rpc': 15409 + }; + AddCoinDataPayload.HKDVar = Object.assign({}, _payloadVar, HKDDiff); + + const HUFDiff = { + 'netmagic': 'a478d2af', + 'p2p': 13698, + 'rpc': 13699 + }; + AddCoinDataPayload.HUFVar = Object.assign({}, _payloadVar, HUFDiff); + + const GBPDiff = { + 'netmagic': '5e0ed955', + 'p2p': 11504, + 'rpc': 11505 + }; + AddCoinDataPayload.GBPVar = Object.assign({}, _payloadVar, GBPDiff); + + const EURDiff = { + 'netmagic': '8a3fd0bd', + 'p2p': 8064, + 'rpc': 8065 + }; + AddCoinDataPayload.EURVar = Object.assign({}, _payloadVar, EURDiff); + + const DKKDiff = { + 'netmagic': 'a2c2380c', + 'p2p': 13829, + 'rpc': 13830 + }; + AddCoinDataPayload.DKKVar = Object.assign({}, _payloadVar, DKKDiff); + + const CNYDiff = { + 'netmagic': '2a51b987', + 'p2p': 10383, + 'rpc': 10384 + }; + AddCoinDataPayload.CNYVar = Object.assign({}, _payloadVar, CNYDiff); + + const ZARDiff = { + 'netmagic': '920c0484', + 'p2p': 15159, + 'rpc': 15160 + }; + AddCoinDataPayload.ZARVar = Object.assign({}, _payloadVar, ZARDiff); + + const TRYDiff = { + 'netmagic': '82b9a778', + 'p2p': 13923, + 'rpc': 13924 + }; + AddCoinDataPayload.TRYVar = Object.assign({}, _payloadVar, TRYDiff); + + const THBDiff = { + 'netmagic': 'b58aef42', + 'p2p': 11846, + 'rpc': 11847 + }; + AddCoinDataPayload.THBVar = Object.assign({}, _payloadVar, THBDiff); + + const SGDDiff = { + 'netmagic': 'ca255b29', + 'p2p': 14474, + 'rpc': 14475 + }; + AddCoinDataPayload.SGDVar = Object.assign({}, _payloadVar, SGDDiff); + + const SEKDiff = { + 'netmagic': 'd95ad28b', + 'p2p': 11446, + 'rpc': 11447 + }; + AddCoinDataPayload.SEKVar = Object.assign({}, _payloadVar, SEKDiff); + + const RONDiff = { + 'netmagic': 'eb2c9500', + 'p2p': 8674, + 'rpc': 8675 + }; + AddCoinDataPayload.RONVar = Object.assign({}, _payloadVar, RONDiff); + + const RUBDiff = { + 'netmagic': '1b9a0eb9', + 'p2p': 8198, + 'rpc': 8199 + }; + AddCoinDataPayload.RUBVar = Object.assign({}, _payloadVar, RUBDiff); + + const CZKDiff = { + 'netmagic': '37f7ae5a', + 'p2p': 9481, + 'rpc': 9482 + }; + AddCoinDataPayload.CZKVar = Object.assign({}, _payloadVar, CZKDiff); + + return AddCoinDataPayload[coin + 'Var']; } } \ No newline at end of file diff --git a/react/src/components/app/app.js b/react/src/components/app/app.js index 1df4370..27dff68 100644 --- a/react/src/components/app/app.js +++ b/react/src/components/app/app.js @@ -7,6 +7,9 @@ function mapStateToProps(state) { return { toaster: state.toaster, AddCoin: state.AddCoin, + Main: state.Main, + Dashboard: state.Dashboard, + ActiveCoin: state.ActiveCoin, }; } diff --git a/react/src/components/dashboard/atomic.js b/react/src/components/dashboard/atomic.js new file mode 100644 index 0000000..7ecceeb --- /dev/null +++ b/react/src/components/dashboard/atomic.js @@ -0,0 +1,162 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +/*import { dashboardChangeSection, toggleAddcoinModal, logout } from '../../actions/actionCreators'; +import Store from '../../store';*/ + +class Atomic extends React.Component { + constructor(props) { + super(props); + this.state = { + }; + } + + render() { + return ( +
+
+
+
+

Atomic Explorer

+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+

Raw Output

+
+
+
+

+                  
+
+
+
+
+
+
+ ); + } +} + +export default Atomic; diff --git a/react/src/components/dashboard/coinTile.js b/react/src/components/dashboard/coinTile.js new file mode 100644 index 0000000..21756a1 --- /dev/null +++ b/react/src/components/dashboard/coinTile.js @@ -0,0 +1,383 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +import CoinTileItem from './coinTileItem'; + +class CoinTile extends React.Component { + constructor(props) { + super(props); + this.state = { + }; + this.renderTiles = this.renderTiles.bind(this); + } + + renderTiles() { + const modes = [ + 'native', + 'basilisk', + 'full' + ]; + const allCoins = this.props.Main.coins; + var items = []; + console.log('tiles', this.props.Main.coins); + + if (this.props.Main && this.props.Main.coins) { + modes.map(function(mode) { + allCoins[mode].map(function(coin) { + console.log(coin); + var coinlogo = '', + coinname = '', + modecode = '', + modetip = '', + modecolor = ''; + + switch (mode) { + case 'native': + modecode = 'Native'; + modetip = 'Native'; + modecolor = 'primary'; + break; + case 'basilisk': + modecode = 'Basilisk'; + modetip = 'Basilisk'; + modecolor = 'info'; + break; + case 'full': + modecode = 'Full'; + modetip = 'Full'; + modecolor = 'success'; + break; + case 'virtual': + modecode = 'Virtual'; + modetip = 'Virtual'; + modecolor = 'danger'; + break; + case 'notarychains': + modecode = 'Notarychains'; + modetip = 'Notarychains'; + modecolor = 'dark'; + break; + } + + switch (coin) { + case 'BTC': + coinlogo = 'bitcoin'; + coinname = 'Bitcoin'; + break; + case 'BTCD': + coinlogo = 'bitcoindark'; + coinname = 'BitcoinDark'; + break; + case 'LTC': + coinlogo = 'litecoin'; + coinname = 'Litecoin'; + break; + case 'VPN': + coinlogo = 'vpncoin'; + coinname = 'VPNcoin'; + break; + case 'SYS': + coinlogo = 'syscoin'; + coinname = 'Syscoin'; + break; + case 'ZEC': + coinlogo = 'zcash'; + coinname = 'Zcash'; + break; + case 'NMC': + coinlogo = 'namecoin'; + coinname = 'Namecoin'; + break; + case 'DEX': + coinlogo = 'dex'; + coinname = 'InstantDEX'; + break; + case 'DOGE': + coinlogo = 'dogecoin'; + coinname = 'Dogecoin'; + break; + case 'DGB': + coinlogo = 'digibyte'; + coinname = 'Digibyte'; + break; + case 'MZC': + coinlogo = 'mazacoin'; + coinname = 'Mazacoin'; + break; + case 'UNO': + coinlogo = 'unobtanium'; + coinname = 'Unobtanium'; + break; + case 'ZET': + coinlogo = 'zetacoin'; + coinname = 'Zetacoin'; + break; + case 'KMD': + coinlogo = 'komodo'; + coinname = 'Komodo'; + break; + case 'BTM': + coinlogo = 'bitmark'; + coinname = 'Bitmark'; + break; + case 'CARB': + coinlogo = 'carboncoin'; + coinname = 'Carboncoin'; + break; + case 'ANC': + coinlogo = 'anoncoin'; + coinname = 'AnonCoin'; + break; + case 'FRK': + coinlogo = 'franko'; + coinname = 'Franko'; + break; + case 'GAME': + coinlogo = 'GAME'; + coinname = 'GameCredits'; + break; + case 'SUPERNET': + coinlogo = 'SUPERNET'; + coinname = 'SUPERNET'; + break; + case 'REVS': + coinlogo = 'REVS'; + coinname = 'REVS'; + break; + case 'WLC': + coinlogo = 'WLC'; + coinname = 'WIRELESS'; + break; + case 'PANGEA': + coinlogo = 'PANGEA'; + coinname = 'PANGEA'; + break; + case 'JUMBLR': + coinlogo = 'JUMBLR'; + coinname = 'JUMBLR'; + break; + case 'BET': + coinlogo = 'BET'; + coinname = 'BET'; + break; + case 'CRYPTO': + coinlogo = 'CRYPTO'; + coinname = 'CRYPTO'; + break; + case 'HODL': + coinlogo = 'HODL'; + coinname = 'HODL'; + break; + case 'SHARK': + coinlogo = 'SHARK'; + coinname = 'SHARK'; + break; + case 'BOTS': + coinlogo = 'BOTS'; + coinname = 'BOTS'; + break; + case 'MGW': + coinlogo = 'MGW'; + coinname = 'MultiGateway'; + break; + case 'MVP': + coinlogo = 'MVP'; + coinname = 'MVP Lineup'; + break; + case 'KV': + coinlogo = 'KV'; + coinname = 'KV'; + break; + case 'CEAL': + coinlogo = 'CEAL'; + coinname = 'CEAL NET'; + break; + case 'MESH': + coinlogo = 'MESH'; + coinname = 'SpaceMesh'; + break; + case 'USD': + coinlogo = 'usd'; + coinname = 'US Dollar'; + break; + case 'RON': + coinlogo = 'RON'; + coinname = 'Romanian Leu'; + break; + case 'EUR': + coinlogo = 'EUR'; + coinname = 'Euro'; + break; + case 'JPY': + coinlogo = 'JPY'; + coinname = 'Japanese Yen'; + break; + case 'GBP': + coinlogo = 'GBP'; + coinname = 'British Pound'; + break; + case 'AUD': + coinlogo = 'AUD'; + coinname = 'Australian Dollar'; + break; + case 'CAD': + coinlogo = 'CAD'; + coinname = 'Canadian Dollar'; + break; + case 'CHF': + coinlogo = 'CHF'; + coinname = 'Swiss Franc'; + break; + case 'NZD': + coinlogo = 'NZD'; + coinname = 'New Zealand Dollar'; + break; + case 'CNY': + coinlogo = 'CNY'; + coinname = 'Chinese Yuan'; + break; + case 'RUB': + coinlogo = 'RUB'; + coinname = 'Russian Ruble'; + break; + case 'MXN': + coinlogo = 'MXN'; + coinname = 'Mexican peso'; + break; + case 'BRL': + coinlogo = 'BRL'; + coinname = 'Brazilian Real'; + break; + case 'INR': + coinlogo = 'INR'; + coinname = 'Indian Rupee'; + break; + case 'HKD': + coinlogo = 'HKD'; + coinname = 'Hong Kong Dollar'; + break; + case 'TRY': + coinlogo = 'TRY'; + coinname = 'Turkish Lira'; + break; + case 'ZAR': + coinlogo = 'ZAR'; + coinname = 'South African Rand'; + break; + case 'PLN': + coinlogo = 'PLN'; + coinname = 'Polish Zloty'; + break; + case 'NOK': + coinlogo = 'NOK'; + coinname = 'Norwegian Krone'; + break; + case 'SEK': + coinlogo = 'SEK'; + coinname = 'Swedish Krona'; + break; + case 'DKK': + coinlogo = 'DKK'; + coinname = 'Danish Krone'; + break; + case 'CZK': + coinlogo = 'CZK'; + coinname = 'Czech Koruna'; + break; + case 'HUF': + coinlogo = 'HUF'; + coinname = 'Hungarian Forint'; + break; + case 'ILS': + coinlogo = 'ILS'; + coinname = 'Israeli Shekel'; + break; + case 'KRW': + coinlogo = 'KRW'; + coinname = 'Korean Won'; + break; + case 'MYR': + coinlogo = 'MYR'; + coinname = 'Malaysian Ringgit'; + break; + case 'PHP': + coinlogo = 'PHP'; + coinname = 'Philippine Peso'; + break; + case 'SGD': + coinlogo = 'SGD'; + coinname = 'Singapore Dollar'; + break; + case 'THB': + coinlogo = 'THB'; + coinname = 'Thai Baht'; + break; + case 'BGN': + coinlogo = 'BGN'; + coinname = 'Bulgarian Lev'; + break; + case 'IDR': + coinlogo = 'IDR'; + coinname = 'Indonesian Rupiah'; + break; + case 'HRK': + coinlogo = 'HRK'; + coinname = 'Croatian Kuna'; + break; + } + + items.push({ + coinlogo, + coinname, + coin, + mode, + modecolor, + modetip, + modecode, + }); + }); + }); + } + + return ( + items.map((item, i) => + ) + ); + } + + render() { + return ( +
+
+ + +
+
+
+
+
+
+ + +
+
+

{translate('INDEX.ACTIVE_COINS')}

+
+
+
+
+
+
+ {this.renderTiles()} +
+
+
+
+
+
+ ); + } +} + +export default CoinTile; diff --git a/react/src/components/dashboard/coinTileItem.js b/react/src/components/dashboard/coinTileItem.js new file mode 100644 index 0000000..9b18719 --- /dev/null +++ b/react/src/components/dashboard/coinTileItem.js @@ -0,0 +1,36 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +import { dashboardChangeActiveCoin, iguanaActiveHandle } from '../../actions/actionCreators'; +import Store from '../../store'; + +class CoinTileItem extends React.Component { + constructor(props) { + super(props); + this.state = { + }; + } + + dashboardChangeActiveCoin(coin, mode) { + Store.dispatch(dashboardChangeActiveCoin(coin, mode)); + Store.dispatch(iguanaActiveHandle(true)); + } + + render() { + const { item } = this.props; + return ( +
+
+
this.dashboardChangeActiveCoin(item.coin, item.mode)}> + +
{item.coinname} ({item.coinlogo})
+
+
+
+ ); + } +} + +export default CoinTileItem; diff --git a/react/src/components/dashboard/dashboard.js b/react/src/components/dashboard/dashboard.js new file mode 100644 index 0000000..c9bde37 --- /dev/null +++ b/react/src/components/dashboard/dashboard.js @@ -0,0 +1,56 @@ +import React from 'react'; +import Navbar from './navbar'; +import CoinTile from './coinTile'; +import EDEX from './edex'; +import WalletsBalance from './walletsBalance'; +import WalletsHeader from './walletsHeader'; +import WalletsProgress from './walletsProgress'; +import WalletsNav from './walletsNav'; +import SendCoin from './sendCoin'; +import WalletsData from './walletsData'; +import Atomic from './atomic'; + +class Dashboard extends React.Component { + constructor(props) { + super(props); + this.state = { + }; + this.renderDashboard = this.renderDashboard.bind(this); + } + + renderDashboard() { + document.body.className = 'page-login'; + // + return ( +
+
+ +
+ + + + + + +
+
+ +
+
+ +
+
+
+ ); + } + + render() { + if (this.props && this.props.Main && this.props.Main.isLoggedIn) { + return this.renderDashboard(); + } else { + return null; + } + } +} + +export default Dashboard; diff --git a/react/src/components/dashboard/dashboard.scss b/react/src/components/dashboard/dashboard.scss new file mode 100644 index 0000000..863428a --- /dev/null +++ b/react/src/components/dashboard/dashboard.scss @@ -0,0 +1,3 @@ +.dashboard { + +} \ No newline at end of file diff --git a/react/src/components/dashboard/edex.js b/react/src/components/dashboard/edex.js new file mode 100644 index 0000000..4563481 --- /dev/null +++ b/react/src/components/dashboard/edex.js @@ -0,0 +1,16 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; + +class EDEX extends React.Component { + render() { + return ( +
+
+

Coming Soon!

+
+
+ ); + } +} + +export default EDEX; diff --git a/react/src/components/dashboard/navbar.js b/react/src/components/dashboard/navbar.js new file mode 100644 index 0000000..67cf3d2 --- /dev/null +++ b/react/src/components/dashboard/navbar.js @@ -0,0 +1,133 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +import { dashboardChangeSection, toggleAddcoinModal, logout } from '../../actions/actionCreators'; +import Store from '../../store'; + +class Navbar extends React.Component { + constructor(props) { + super(props); + this.state = { + openDropMenu: false, + }; + this.openDropMenu = this.openDropMenu.bind(this); + this.logout = this.logout.bind(this); + } + + openDropMenu() { + this.setState(Object.assign({}, this.state, { + openDropMenu: !this.state.openDropMenu, + })); + } + + toggleAddCoinModal() { + Store.dispatch(toggleAddcoinModal(true, false)); + } + + dashboardChangeSection(sectionName) { + Store.dispatch(dashboardChangeSection(sectionName)); + } + + logout() { + Store.dispatch(logout()); + } + + render() { + return ( + + ); + } +} + +export default Navbar; diff --git a/react/src/components/dashboard/sendCoin.js b/react/src/components/dashboard/sendCoin.js new file mode 100644 index 0000000..f17b4d5 --- /dev/null +++ b/react/src/components/dashboard/sendCoin.js @@ -0,0 +1,173 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +//import { } from '../../actions/actionCreators'; +//import Store from '../../store'; + +// TODO: implement logic + +class SendCoin extends React.Component { + constructor(props) { + super(props); + this.state = { + currentStep: 0, + }; + } + + changeSendCoinStep(step) { + this.setState(Object.assign({}, this.state, { + currentStep: step, + })); + } + + render() { + console.log('sendcoin', this.props); + if (this.props && this.props.send) { + return ( +
+
+
+
+ 1 +
+ {translate('INDEX.FILL_SEND_FORM')} +

{translate('INDEX.FILL_SEND_DETAILS')}

+
+
+
+ 2 +
+ {translate('INDEX.CONFIRMING')} +

{translate('INDEX.CONFIRM_DETAILS')}

+
+
+
+ 3 +
+ {translate('INDEX.PROCESSING_TX')} +

{translate('INDEX.PROCESSING_DETAILS')}

+
+
+
+ +
+
+

+ {translate('INDEX.SEND')} +

+ +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + {translate('INDEX.TOTAL')} ({translate('INDEX.AMOUNT_SM')} - txfee): 0.000 + +
+
+
+ +
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ {translate('INDEX.TO')} +
+
[coin-address-goes-here]
+
+ 0.00000000 [COIN] +
+
{translate('INDEX.TX_FEE_REQ')}
+
+ 0.00000000 [COIN] +
+
+
+ +
+
+ {translate('INDEX.FROM')} +
+
[coin-address-goes-here]
+
+ -0.00000000 [COIN] +
+
+
+ this.changeSendCoinStep(0)}>{translate('INDEX.BACK')} +
+ +
+
+
+
+
+ +
+
+
+

{translate('INDEX.TRANSACTION_RESULT')}

+ + + + + + + + + +
{translate('INDEX.KEY')}{translate('INDEX.INFO')}
+
+
+ +
+
+
+
+
+
+ ); + } else { + return null; + } + } +} + +export default SendCoin; diff --git a/react/src/components/dashboard/walletsBalance.js b/react/src/components/dashboard/walletsBalance.js new file mode 100644 index 0000000..189ba99 --- /dev/null +++ b/react/src/components/dashboard/walletsBalance.js @@ -0,0 +1,90 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; + +class WalletsBalance extends React.Component { + render() { + if (this.props && this.props.coin) { + return ( +
+
+
+ + + +
+
+
+
+
+
+
+ {translate('INDEX.BALANCE')} +
+ + {this.props && this.props.ActiveCoin && this.props.ActiveCoin.balance ? this.props.ActiveCoin.balance : 0} + +
+
+
+
+
+ +
+
+
+
+
+
+ {translate('INDEX.INTEREST_EARNED')} +
+ + + +
+
+
+
+
+ +
+
+
+
+
+
+ {translate('INDEX.TOTAL_BALANCE')} +
+ + + +
+
+
+
+
+
+
+ ); + } else { + return null; + } + } +} + +export default WalletsBalance; diff --git a/react/src/components/dashboard/walletsBasiliskRefresh.js b/react/src/components/dashboard/walletsBasiliskRefresh.js new file mode 100644 index 0000000..0a1d494 --- /dev/null +++ b/react/src/components/dashboard/walletsBasiliskRefresh.js @@ -0,0 +1,39 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; + +classNameName WalletsBasiliskRefresh extends React.Component { + render() { + return ( +
+
+
+
+
+

{translate('INDEX.FETCHING_BASILISK_DATA')}

+
+ +
+
+
+ + + + + + + + + + + +
{translate('INDEX.ADDRESS')}{translate('INDEX.LIST_UNSPENT')}{translate('INDEX.LIST_TRANSACTIONS')}{translate('INDEX.GET_BALANCE')}{translate('INDEX.REFRESH')}
+
+
+
+
+
+ ); + } +} + +export default WalletsBasiliskRefresh; diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js new file mode 100644 index 0000000..7fe62fd --- /dev/null +++ b/react/src/components/dashboard/walletsData.js @@ -0,0 +1,104 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +/*import { } from '../../actions/actionCreators'; +import Store from '../../store';*/ + +class WalletsData extends React.Component { + constructor(props) { + super(props); + this.state = { + basiliskActionsMenu: false, + }; + this.toggleBasiliskActionsMenu = this.toggleBasiliskActionsMenu.bind(this); + } + + toggleBasiliskActionsMenu() { + this.setState(Object.assign({}, this.state, { + basiliskActionsMenu: !this.state.basiliskActionsMenu, + })); + } + + render() { + if (this.props && this.props.coin) { + return ( +
+
+
+
+
+
+
+ +

{translate('INDEX.TRANSACTION_HISTORY')}

+
+
+ + + + + + + + + + + + + + + + + + + + + +
{translate('INDEX.DIRECTION')}{translate('INDEX.CONFIRMATIONS')}{translate('INDEX.AMOUNT')}{translate('INDEX.TIME')}{translate('INDEX.DEST_ADDRESS')}{translate('INDEX.TX_DETAIL')}
{translate('INDEX.DIRECTION')}{translate('INDEX.CONFIRMATIONS')}{translate('INDEX.AMOUNT')}{translate('INDEX.TIME')}{translate('INDEX.DEST_ADDRESS')}{translate('INDEX.TX_DETAIL')}
+
+
+
+
+
+
+
+ ); + } else { + return null; + } + } +} + +export default WalletsData; diff --git a/react/src/components/dashboard/walletsHeader.js b/react/src/components/dashboard/walletsHeader.js new file mode 100644 index 0000000..5b2f74c --- /dev/null +++ b/react/src/components/dashboard/walletsHeader.js @@ -0,0 +1,108 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +//import { dashboardChangeSection, toggleAddcoinModal } from '../../actions/actionCreators'; +//import Store from '../../store'; + +class WalletsHeader extends React.Component { + render() { + if (this.props && this.props.coin) { + return ( +
+

EasyDEX

+
    +
  1. {translate('INDEX.DASHBOARD')}
  2. +
+
+ + + + +
+ +
+ + + +
+
+
+ - BTC + - USD +
+
+
+
+ - BTCD + - USD +
+
+
+
+
+ ); + } else { + return null; + } + } +} + +export default WalletsHeader; diff --git a/react/src/components/dashboard/walletsNav.js b/react/src/components/dashboard/walletsNav.js new file mode 100644 index 0000000..812781a --- /dev/null +++ b/react/src/components/dashboard/walletsNav.js @@ -0,0 +1,73 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; +import { copyCoinAddress, iguanaEdexBalance, toggleSendCoinForm, toggleReceiveCoinForm, toggleSendReceiveCoinForms } from '../../actions/actionCreators'; +import Store from '../../store'; + +class WalletsNav extends React.Component { + constructor(props) { + super(props); + this.toggleSendReceiveCoinForms = this.toggleSendReceiveCoinForms.bind(this); + } + + componentWillMount() { + Store.dispatch(iguanaEdexBalance(this.props.ActiveCoin.coin)); + } + + copyMyAddress(address) { + Store.dispatch(copyCoinAddress(address)); + } + + toggleSendReceiveCoinForms() { + Store.dispatch(toggleSendReceiveCoinForms()); + } + + toggleSendCoinForm(display) { + console.log(display); + Store.dispatch(toggleSendCoinForm(display)); + } + + render() { + if (this.props && this.props.ActiveCoin && !this.props.ActiveCoin.coin) { + return ( +
+
+
+ + + {translate('INDEX.NO_WALLET_CAPS')} + +
+ {translate('INDEX.PLEASE_SELECT_A_WALLET')}. +
+
+
+ ); + } else { + return ( +
+
+
    + {translate('INDEX.MY')} {this.props && this.props.ActiveCoin ? this.props.ActiveCoin.coin : '-'} {translate('INDEX.ADDRESS')}: {this.props && this.props.Dashboard && this.props.Dashboard.activeHandle ? this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] : '-'} +
+
+
+ + + +
+
+
+
+ ); + } + } +} + +export default WalletsNav; diff --git a/react/src/components/dashboard/walletsProgress.js b/react/src/components/dashboard/walletsProgress.js new file mode 100644 index 0000000..5779c9f --- /dev/null +++ b/react/src/components/dashboard/walletsProgress.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { translate } from '../../translate/translate'; + +class WalletsProgress extends React.Component { + render() { + if (this.props && this.props.ActiveCoin && this.props.ActiveCoin.mode === 'full') { + return ( + + ); + } else { + return null; + } + } +} + +export default WalletsProgress; \ No newline at end of file diff --git a/react/src/components/dummy/dummy.js b/react/src/components/dummy/dummy.js index ed76393..da9f1a8 100644 --- a/react/src/components/dummy/dummy.js +++ b/react/src/components/dummy/dummy.js @@ -1,6 +1,6 @@ import React from 'react'; -function Dummy() { +class Dummy extends React.Component () { return ( ); } diff --git a/react/src/components/login/login.js b/react/src/components/login/login.js index 7dd8ba7..058e47a 100644 --- a/react/src/components/login/login.js +++ b/react/src/components/login/login.js @@ -1,119 +1,158 @@ import React from 'react'; import { translate } from '../../translate/translate'; -import { toggleAddcoinModal } from '../../actions/actionCreators'; +import { toggleAddcoinModal, iguanaWalletPassphrase } from '../../actions/actionCreators'; import Store from '../../store'; class Login extends React.Component { constructor(props) { super(props); this.state = { - display: true, - ieWarning: false, - login: false, - signup: false, - activateCoin: true, + display: false, + activeLoginSection: 'activateCoin', + loginPassphrase: null, }; this.toggleActivateCoinForm = this.toggleActivateCoinForm.bind(this); + this.updatePassphraseLoginInput = this.updatePassphraseLoginInput.bind(this); + this.loginSeed = this.loginSeed.bind(this); + } + + componentWillReceiveProps(props) { + console.log('loginprops', props.Main); + if (props && props.Main && props.Main.isLoggedIn) { + this.setState({ + display: false, + }); + console.log(this.state); + } + if (props && props.Main && !props.Main.isLoggedIn) { + this.setState({ + display: true, + }); + } + if (props && props.Main && props.Main.activeCoins) { + this.setState({ + activeLoginSection: 'login', + }); + } else { + this.setState({ + activeLoginSection: 'activateCoin', + }); + } } toggleActivateCoinForm() { Store.dispatch(toggleAddcoinModal(true, false)); } + updatePassphraseLoginInput(e) { + this.setState({ + [e.target.name]: e.target.value, + }); + } + + loginSeed() { + Store.dispatch(iguanaWalletPassphrase(this.state.loginPassphrase)); + console.log(this.state); + } + render() { - return ( -
-
-
-
- SuperNET Iguana -
+ if (this.state && this.state.display) { + return ( +
+
+
+
+ SuperNET Iguana +
-
-
-
-

{translate('INDEX.UNSUPPORTED_BROWSER')}

-
-
- - {translate('INDEX.IE_UNSUPPORTED')} -
-
-

- {translate('INDEX.PLEASE_USE')} Google Chrome {translate('INDEX.OR')} Mozilla FireFox {translate('INDEX.TO_USE')} EasyDEX-GUI. {translate('INDEX.PLEASE_CLICK_ON')}. -

-
- Google Chrome +
+
+
+

{translate('INDEX.UNSUPPORTED_BROWSER')}

-
- Mozilla FireFox +
+ + {translate('INDEX.IE_UNSUPPORTED')} +
+
+

+ {translate('INDEX.PLEASE_USE')} Google Chrome {translate('INDEX.OR')} Mozilla FireFox {translate('INDEX.TO_USE')} EasyDEX-GUI. {translate('INDEX.PLEASE_CLICK_ON')}. +

+
+ Google Chrome +
+
+ Mozilla FireFox +
-
-
-

{translate('INDEX.WELCOME_LOGIN')}

-
-
- - -
- -
- - -
-
-
+
+

{translate('INDEX.WELCOME_LOGIN')}

+
+
+ + +
+ +
+ + +
+
+
-
-

{translate('INDEX.WELCOME_PLEASE_ADD')}

-
- +
+

{translate('INDEX.WELCOME_PLEASE_ADD')}

+
+ +
-
-
-
-

- {translate('INDEX.SELECT_SEED_TYPE')}: -

-
-
- - +
+ +

+ {translate('INDEX.SELECT_SEED_TYPE')}: +

+
+
+ + +
+
+ + +
+
+ + +
-
- - +
+ +
-
- - +
+ +
-
-
- - -
-
- - -
- -
- -
- + +
+ +
+ +
-
- ); + ); + } else { + return null; + } } } diff --git a/react/src/components/main/main.js b/react/src/components/main/main.js index 0e5522f..7285c93 100644 --- a/react/src/components/main/main.js +++ b/react/src/components/main/main.js @@ -2,6 +2,8 @@ import React from 'react'; import Config from '../../config'; import WalletMain from './walletMain'; import { iguanaSetRPCAuth } from '../../util/auth'; +import Store from '../../store'; +import { getDexCoins, iguanaActiveHandle } from '../../actions/actionCreators'; class Main extends React.Component { constructor(props) { @@ -11,13 +13,28 @@ class Main extends React.Component { this.loading = this.loading.bind(this); this.isWalletUnlocked = this.isWalletUnlocked.bind(this); this.state = { - user: false, + isLoggedIn: false, + coins: null, + activeCoins: false, + activeHandleInterval: null, }; } + componentDidMount() { + Store.dispatch(iguanaActiveHandle()); + var _iguanaActiveHandle = setInterval(function() { + Store.dispatch(iguanaActiveHandle()); + }, 30000); + + this.setState(Object.assign({}, this.state, { + activeHandleInterval: _iguanaActiveHandle, + })); + } + componentWillMount() { console.log('mounting main component'); // set userpass param + Store.dispatch(getDexCoins()); iguanaSetRPCAuth(); if (sessionStorage.getItem('session')) { this.setState({ diff --git a/react/src/components/main/walletMain.js b/react/src/components/main/walletMain.js index 49902b9..62b8fdd 100644 --- a/react/src/components/main/walletMain.js +++ b/react/src/components/main/walletMain.js @@ -2,11 +2,13 @@ import React from 'react'; import Toaster from '../toaster/toaster'; import AddCoin from '../addcoin/addcoin'; import Login from '../login/login'; +import Dashboard from '../dashboard/dashboard'; class WalletMain extends React.Component { render() { return ( -
+
+ diff --git a/react/src/components/toaster/toaster.js b/react/src/components/toaster/toaster.js index c02436e..197c828 100644 --- a/react/src/components/toaster/toaster.js +++ b/react/src/components/toaster/toaster.js @@ -1,4 +1,6 @@ import React from 'react'; +import { dismissToasterMessage } from '../../actions/actionCreators'; +import Store from '../../store'; class Toaster extends React.Component { constructor(props) { @@ -20,26 +22,24 @@ class Toaster extends React.Component { type: props.type, title: props.title, }); + } else { + this.setState({ + display: false, + message: null, + type: null, + title: null, + }); } } - setInitialState() { - this.setState({ - display: false, - message: null, - type: null, - title: null, - }); - } - dismissToast() { - this.setInitialState(); + Store.dispatch(dismissToasterMessage()); } // TODO: multiple toasts renderToast() { setTimeout(() => { - this.setInitialState(); + Store.dispatch(dismissToasterMessage()); }, 5000); return ( diff --git a/react/src/reducers/activeCoin.js b/react/src/reducers/activeCoin.js new file mode 100644 index 0000000..c2cbb74 --- /dev/null +++ b/react/src/reducers/activeCoin.js @@ -0,0 +1,40 @@ +import { DASHBOARD_ACTIVE_COIN_CHANGE, DASHBOARD_ACTIVE_COIN_BALANCE, DASHBOARD_ACTIVE_COIN_SEND_FORM, DASHBOARD_ACTIVE_COIN_RECEIVE_FORM, DASHBOARD_ACTIVE_COIN_RESET_FORMS } from '../actions/actionCreators'; + +export function ActiveCoin(state = { + coin: null, + mode: null, + send: false, + receive: false, + balance: 0, +}, action) { + switch (action.type) { + case DASHBOARD_ACTIVE_COIN_CHANGE: + return Object.assign({}, state, { + coin: action.coin, + mode: action.mode, + }); + case DASHBOARD_ACTIVE_COIN_BALANCE: + return Object.assign({}, state, { + balance: action.balance, + }); + case DASHBOARD_ACTIVE_COIN_SEND_FORM: + return Object.assign({}, state, { + send: action.send, + receive: false, + }); + case DASHBOARD_ACTIVE_COIN_RECEIVE_FORM: + return Object.assign({}, state, { + send: false, + receive: action.receive, + }); + case DASHBOARD_ACTIVE_COIN_RESET_FORMS: + return Object.assign({}, state, { + send: false, + receive: false, + }); + default: + return state; + } +} + +export default ActiveCoin; diff --git a/react/src/reducers/dashboard.js b/react/src/reducers/dashboard.js new file mode 100644 index 0000000..7068616 --- /dev/null +++ b/react/src/reducers/dashboard.js @@ -0,0 +1,21 @@ +import { DASHBOARD_SECTION_CHANGE, GET_MAIN_ADDRESS } from '../actions/actionCreators'; + +export function Dashboard(state = { + activeSection: 'wallets', + activeHandle: null, +}, action) { + switch (action.type) { + case DASHBOARD_SECTION_CHANGE: + return Object.assign({}, state, { + activeSection: action.activeSection, + }); + case GET_MAIN_ADDRESS: + return Object.assign({}, state, { + activeHandle: action.activeHandle, + }); + default: + return state; + } +} + +export default Dashboard; diff --git a/react/src/reducers/index.js b/react/src/reducers/index.js index 951bcc7..0379dfe 100644 --- a/react/src/reducers/index.js +++ b/react/src/reducers/index.js @@ -3,12 +3,16 @@ import { routerReducer } from 'react-router-redux'; import { AddCoin } from './addcoin'; import { toaster } from './toaster'; -//import { loader } from './loader'; +import { Main } from './main'; +import { Dashboard } from './dashboard'; +import { ActiveCoin } from './activeCoin'; const rootReducer = combineReducers({ AddCoin, toaster, - //loader, + Main, + Dashboard, + ActiveCoin, routing: routerReducer, }); diff --git a/react/src/reducers/main.js b/react/src/reducers/main.js new file mode 100644 index 0000000..9ac1bbf --- /dev/null +++ b/react/src/reducers/main.js @@ -0,0 +1,26 @@ +import { GET_ACTIVE_COINS, LOGIN, ACTIVE_HANDLE } from '../actions/actionCreators' + +export function Main(state = { + isLoggedIn: false, + activeCoins: [], +}, action) { + switch (action.type) { + case GET_ACTIVE_COINS: + return Object.assign({}, state, { + activeCoins: action.activeCoins, + coins: action.coins, + }); + case LOGIN: + return Object.assign({}, state, { + isLoggedIn: action.isLoggedIn, + }); + case ACTIVE_HANDLE: + return Object.assign({}, state, { + isLoggedIn: action.isLoggedIn, + }); + default: + return state; + } +} + +export default Main; diff --git a/react/src/store.js b/react/src/store.js index cb4d78f..d44e661 100644 --- a/react/src/store.js +++ b/react/src/store.js @@ -11,6 +11,7 @@ const loggerMiddleware = createLogger(); const defaultState = { toaster: null, AddCoin: null, + Main: null, }; const enhancers = compose(window.devToolsExtension ? window.devToolsExtension() : f => f); diff --git a/react/src/styles/index.scss b/react/src/styles/index.scss index b5b0958..4b2cafd 100644 --- a/react/src/styles/index.scss +++ b/react/src/styles/index.scss @@ -31,6 +31,26 @@ @import '../assets/global/fonts/brand-icons/brand-icons.min.css'; @import '../assets/skins/orange.min.css'; +#app > div { + height: 100%; +} + +.page-main { + background: #f3f4f5; +} + +#kmd_header_button button { + margin-right: 5px; +} + +.widget.active .bg-white { + box-shadow: inset 1px 1px 10px #ccc; +} + +body { + padding-top: 44px; +} + /*.toaster .single-toast:nth-child(0) { bottom: 12px; } diff --git a/react/src/util/copyToClipboard.js b/react/src/util/copyToClipboard.js new file mode 100644 index 0000000..bc8094e --- /dev/null +++ b/react/src/util/copyToClipboard.js @@ -0,0 +1,16 @@ +export function copyToClipboard(value) { + var result; + var copyTextarea = document.querySelector('#js-copytextarea'); + + document.getElementById('js-copytextarea').value = value; + copyTextarea.select(); + + try { + var successful = document.execCommand('copy'); + result = 1; + } catch (err) { + result = 0; + } + + return result; +}; \ No newline at end of file diff --git a/react/www/index.html b/react/www/index.html index 5a0bec1..b9e5c06 100644 --- a/react/www/index.html +++ b/react/www/index.html @@ -14,7 +14,9 @@ - -
+ + + +