diff --git a/assets/mainWindow/css/loading.css b/assets/mainWindow/css/loading.css
index 6b798de35..ce2afc51d 100644
--- a/assets/mainWindow/css/loading.css
+++ b/assets/mainWindow/css/loading.css
@@ -31,11 +31,11 @@ body.agama-default-window-height {
}
body.closing-window-height {
- height: 300px;
+ height: 320px;
}
body.agama-app-settings-window {
- height: 570px;
+ height: 610px;
}
.agama-logo {
@@ -149,6 +149,9 @@ body.agama-app-settings-window {
.margin-right-20 {
margin-right: 20px;
}
+.margin-left-20 {
+ margin-left: 20px;
+}
.margin-top-15 {
margin-top: 15px;
}
@@ -208,7 +211,7 @@ body.agama-app-settings-window {
}
.settings-buttons-block {
- margin-top: 50px;
+ margin-top: 40px;
margin-right: 50px;
text-align: right;
}
@@ -437,11 +440,30 @@ button.toast-close-button {
display: inherit;
top: inherit;
left: inherit;
- right: 33.1%;
padding: 2px 0;
}
+.dropdown-menu.native {
+ right: 256px;
+}
+
+.dropdown-menu.lite {
+ right: 74px;
+}
+
.dropdown-menu li {
cursor: pointer;
margin: 5px 0;
+}
+
+small {
+ display: block;
+ font-size: 14px;
+ width: 80%;
+ text-align: center;
+ margin: 0 auto;
+}
+
+.padding-top-40 {
+ padding-top: 40px;
}
\ No newline at end of file
diff --git a/assets/mainWindow/img/fa-flash.png b/assets/mainWindow/img/fa-flash.png
new file mode 100644
index 000000000..3680e31b7
Binary files /dev/null and b/assets/mainWindow/img/fa-flash.png differ
diff --git a/assets/mainWindow/js/loading.js b/assets/mainWindow/js/loading.js
index 0eab70648..83063a583 100644
--- a/assets/mainWindow/js/loading.js
+++ b/assets/mainWindow/js/loading.js
@@ -1,14 +1,16 @@
// TODO: merge into react app
let _configCopy;
-function toggleDropdown() {
- const _dropdown = $('.dropdown-menu');
+function toggleDropdown(type) {
+ const _dropdown = $('.dropdown-menu.' + (type === 'lite' ? 'lite' : 'native'));
if (_dropdown.hasClass('hide')) {
_dropdown.removeClass('hide');
} else {
_dropdown.addClass('hide');
}
+
+ $('.dropdown-menu.' + (type === 'lite' ? 'native' : 'lite')).addClass('hide');;
}
function initSettingsForm() {
@@ -23,7 +25,7 @@ function initSettingsForm() {
appConfSchema[key].initDisplay) {
_htmlOut = `
${_htmlOut}
-
${appConfSchema[key].displayName}`;
@@ -129,9 +131,9 @@ function handleSaveSettings() {
remote.getCurrentWindow().testLocation(_configCopy.dataDir)
.then(function(res) {
if (res === -1) {
- showToast('error', 'Komodo datadir path is invalid');
+ showToast('error', 'Komodo datadir path is invalid. It must be an absolute path to an existing folder that doesn\'t contain spaces and/or any special characters.');
} else if (res === false) {
- showToast('error', 'Komodo datadir path is not a directory');
+ showToast('error', 'Komodo datadir path is not a directory. It must be an absolute path to an existing folder that doesn\'t contain spaces and/or any special characters.');
} else {
// save settings
remote.getCurrentWindow().updateAppSettings(_configCopy);
@@ -178,7 +180,8 @@ function openSettingsWindow() {
const remote = require('electron').remote;
const window = remote.getCurrentWindow();
- $('.dropdown-menu').addClass('hide');
+ $('.dropdown-menu.lite').addClass('hide');
+ $('.dropdown-menu.native').addClass('hide');
window.createAppSettingsWindow();
}
@@ -186,7 +189,22 @@ function startKMDPassive() {
const remote = require('electron').remote;
const window = remote.getCurrentWindow();
- $('.dropdown-menu').addClass('hide');
+ $('.dropdown-menu.lite').addClass('hide');
+ $('.dropdown-menu.native').addClass('hide');
+ disableModeButtons();
+
+ window.startKMDNative('KMD', true);
+
+ window.createWindow('open');
+ window.hide();
+}
+
+function startKMDPassive() {
+ const remote = require('electron').remote;
+ const window = remote.getCurrentWindow();
+
+ $('.dropdown-menu.lite').addClass('hide');
+ $('.dropdown-menu.native').addClass('hide');
disableModeButtons();
window.startKMDNative('KMD', true);
@@ -195,11 +213,26 @@ function startKMDPassive() {
window.hide();
}
+function startSPV(coin) {
+ const remote = require('electron').remote;
+ const window = remote.getCurrentWindow();
+
+ $('.dropdown-menu.lite').addClass('hide');
+ $('.dropdown-menu.native').addClass('hide');
+ disableModeButtons();
+
+ window.startSPV(coin);
+
+ window.createWindow('open');
+ window.hide();
+}
+
function closeMainWindow(isKmdOnly, isCustom) {
const remote = require('electron').remote;
const window = remote.getCurrentWindow();
- $('.dropdown-menu').addClass('hide');
+ $('.dropdown-menu.lite').addClass('hide');
+ $('.dropdown-menu.native').addClass('hide');
disableModeButtons();
if (!isCustom) {
@@ -227,6 +260,8 @@ function disableModeButtons() {
$('#normalStartBtn').attr('disabled', true);
$('#settingsBtn').attr('disabled', true);
$('#nativeOnlyBtnCarret').attr('disabled', true);
+ $('#spvBtn').attr('disabled', true);
+ $('#spvBtnCarret').attr('disabled', true);
}
function normalStart() {
@@ -234,6 +269,21 @@ function normalStart() {
let appConf = remote.getCurrentWindow().appConfig;
appConf.iguanaLessMode = false;
- $('.dropdown-menu').addClass('hide');
+ $('.dropdown-menu.lite').addClass('hide');
+ $('.dropdown-menu.native').addClass('hide');
disableModeButtons();
+}
+
+function init() {
+ const remote = require('electron').remote;
+ var window = remote.getCurrentWindow();
+ var appConf = remote.getCurrentWindow().appConfig;
+
+ if (!appConf.experimentalFeatures) {
+ $('#spvBtn').hide();
+ $('#spvBtnCarret').hide();
+ $('.dropdown-menu.native').css('right', '165px');
+ $('#nativeOnlyBtnCarret').css('margin-right', '0');
+ $('#settingsBtn').css('margin', '0');
+ }
}
\ No newline at end of file
diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index 5214535bd..ff46bf5a5 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -27,23 +27,17 @@ import {
GET_PIN_LIST,
DASHBOARD_SYNC_ONLY_UPDATE,
DISPLAY_IMPORT_KEY_MODAL,
+ ELECTRUM_SERVER_CHANGED,
+ DISPLAY_ZCASH_PARAMS_FETCH,
} from './storeType';
export * from './actions/nativeSyncInfo';
export * from './actions/nativeSend';
export * from './actions/coinList';
-// export * from './actions/createWallet';
-//export * from './actions/nativeTxHistory';
-//export * from './actions/nativeBalance';
export * from './actions/nativeNewAddress';
// export * from './actions/logout';
-//export * from './actions/edexGetTx';
export * from './actions/settings';
-// export * from './actions/edexBalance';
export * from './actions/addCoin';
-//export * from './actions/addressBalance';
-//export * from './actions/syncInfo';
-//export * from './actions/getAddrByAccount';
// export * from './actions/walletAuth';
export * from './actions/copyAddress';
export * from './actions/sysInfo';
@@ -54,6 +48,8 @@ export * from './actions/update';
export * from './actions/jumblr';
export * from './actions/interest';
export * from './actions/nativeDashboardUpdate';
+export * from './actions/getTxDetails';
+export * from './actions/electrum';
export function changeActiveAddress(address) {
return {
@@ -137,7 +133,7 @@ export function dashboardCoinsState(json) {
return {
type: GET_ACTIVE_COINS,
coins: json,
- activeCoins: Object.keys(json.native).length ? true : false,
+ total: json.total,
}
}
@@ -278,4 +274,18 @@ export function displayImportKeyModal(display) {
type: DISPLAY_IMPORT_KEY_MODAL,
displayImportKeyModal: display,
}
+}
+
+export function electrumServerChanged(isChanged) {
+ return {
+ type: ELECTRUM_SERVER_CHANGED,
+ eletrumServerChanged: isChanged,
+ }
+}
+
+export function toggleZcparamsFetchModal(display) {
+ return {
+ type: DISPLAY_ZCASH_PARAMS_FETCH,
+ displayZcparamsModal: display,
+ }
}
\ No newline at end of file
diff --git a/react/src/actions/actions/addCoin.js b/react/src/actions/actions/addCoin.js
index c71c6e774..75d358924 100644
--- a/react/src/actions/actions/addCoin.js
+++ b/react/src/actions/actions/addCoin.js
@@ -1,9 +1,11 @@
+import { ACTIVE_HANDLE } from '../storeType';
import { translate } from '../../translate/translate';
import Config from '../../config';
import {
triggerToaster,
toggleAddcoinModal,
getDexCoins,
+ shepherdElectrumCoins,
} from '../actionCreators';
import {
startCurrencyAssetChain,
@@ -13,9 +15,104 @@ import {
checkAC
} from '../../components/addcoin/payload';
-export function addCoin(coin, mode, syncOnly, port, startupParams) {
+function iguanaActiveHandleState(json) {
+ return {
+ type: ACTIVE_HANDLE,
+ isLoggedIn: json.status === 'unlocked' ? true : false,
+ handle: json,
+ }
+}
+
+export function activeHandle() {
return dispatch => {
- dispatch(shepherdGetConfig(coin, '-1', startupParams));
+ return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/auth/status`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'activeHandle',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ dispatch(
+ iguanaActiveHandleState(json)
+ );
+ });
+ }
+}
+
+export function shepherdElectrumAuth(seed) {
+ return dispatch => {
+ return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/login?seed=${seed}&iguana=true`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumAuth',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ dispatch(activeHandle());
+ dispatch(shepherdElectrumCoins());
+ });
+ }
+}
+
+export function shepherdElectrumAddCoin(coin) {
+ return dispatch => {
+ return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins/add?coin=${coin}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumAddCoin',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ dispatch(
+ addCoinResult(coin, '0')
+ );
+ });
+ }
+}
+
+export function addCoin(coin, mode, startupParams) {
+ if (mode === 0 ||
+ mode === '0') {
+ return dispatch => {
+ dispatch(shepherdElectrumAddCoin(coin));
+ }
+ } else {
+ return dispatch => {
+ dispatch(shepherdGetConfig(coin, '-1', startupParams));
+ }
}
}
@@ -25,7 +122,7 @@ function handleErrors(response) {
if (!response.ok) {
return null;
} else {
- _parsedResponse = response.text().then(function(text) { return text; });
+ _parsedResponse = response.text().then((text) => { return text; });
return _parsedResponse;
}
}
@@ -118,11 +215,11 @@ export function shepherdHerd(coin, mode, path, startupParams) {
'Content-Type': 'application/json',
},
body: JSON.stringify({
- 'herd': _herd,
- 'options': herdData,
+ herd: _herd,
+ options: herdData,
}),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -133,7 +230,7 @@ export function shepherdHerd(coin, mode, path, startupParams) {
);
})
.then(handleErrors)
- .then(function(json) {
+ .then((json) => {
if (json) {
dispatch(
addCoinResult(coin, mode)
@@ -155,19 +252,56 @@ export function shepherdHerd(coin, mode, path, startupParams) {
export function addCoinResult(coin, mode) {
const modeToValue = {
+ '0': 'spv',
'-1': 'native',
};
return dispatch => {
dispatch(
triggerToaster(
- `${coin} ${translate('TOASTR.STARTED_IN')} ${modeToValue[mode]} ${translate('TOASTR.MODE')}`,
+ `${coin} ${translate('TOASTR.STARTED_IN')} ${modeToValue[mode].toUpperCase()} ${translate('TOASTR.MODE')}`,
translate('TOASTR.COIN_NOTIFICATION'),
'success'
)
);
dispatch(toggleAddcoinModal(false, false));
- dispatch(getDexCoins());
+ if (Number(mode) === 0) {
+ dispatch(activeHandle());
+ dispatch(shepherdElectrumCoins());
+ dispatch(getDexCoins());
+
+ setTimeout(() => {
+ dispatch(activeHandle());
+ dispatch(shepherdElectrumCoins());
+ dispatch(getDexCoins());
+ }, 500);
+ setTimeout(() => {
+ dispatch(activeHandle());
+ dispatch(shepherdElectrumCoins());
+ dispatch(getDexCoins());
+ }, 1000);
+ setTimeout(() => {
+ dispatch(activeHandle());
+ dispatch(shepherdElectrumCoins());
+ dispatch(getDexCoins());
+ }, 2000);
+ } else {
+ dispatch(activeHandle());
+ dispatch(getDexCoins());
+
+ setTimeout(() => {
+ dispatch(activeHandle());
+ dispatch(getDexCoins());
+ }, 500);
+ setTimeout(() => {
+ dispatch(activeHandle());
+ dispatch(getDexCoins());
+ }, 1000);
+ setTimeout(() => {
+ dispatch(activeHandle());
+ dispatch(getDexCoins());
+ }, 5000);
+ }
}
}
@@ -180,7 +314,7 @@ export function _shepherdGetConfig(coin, mode, startupParams) {
},
body: JSON.stringify({ chain: 'komodod' })
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -215,7 +349,7 @@ export function shepherdGetConfig(coin, mode, startupParams) {
},
body: JSON.stringify({ chain: 'komodod' })
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -246,7 +380,7 @@ export function shepherdGetConfig(coin, mode, startupParams) {
},
body: JSON.stringify({ 'chain': coin })
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/addressBalance.js b/react/src/actions/actions/addressBalance.js
deleted file mode 100644
index ebf957370..000000000
--- a/react/src/actions/actions/addressBalance.js
+++ /dev/null
@@ -1,477 +0,0 @@
-// remove
-
-import { ACTIVE_COIN_GET_ADDRESSES } from '../storeType';
-import {
- triggerToaster,
- shepherdGroomPost,
- getPassthruAgent,
- iguanaHashHex
-} from '../actionCreators';
-import Config from '../../config';
-
-function getKMDAddressesNativeState(json) {
- return {
- type: ACTIVE_COIN_GET_ADDRESSES,
- addresses: json,
- }
-}
-
-export function getKMDAddressesNative(coin, mode, currentAddress) {
- const type = [
- 'public',
- 'private'
- ];
-
- if (mode !== 'native') {
- type.pop();
- }
-
- return dispatch => {
- Promise.all(type.map((_type, index) => {
- return new Promise((resolve, reject) => {
- let payload;
- let ajaxFunctionInput = _type === 'public' ? 'getaddressesbyaccount' : 'z_listaddresses';
- let tmplistaddrHexInput = _type === 'public' ? '222200' : '';
- let passthruAgent = getPassthruAgent(coin);
- let tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
-
- if (passthruAgent === 'iguana') {
- payload = {
- userpass: tmpIguanaRPCAuth,
- agent: passthruAgent,
- method: 'passthru',
- asset: coin,
- function: ajaxFunctionInput,
- hex: tmplistaddrHexInput,
- };
- } else {
- payload = {
- userpass: tmpIguanaRPCAuth,
- agent: passthruAgent,
- method: 'passthru',
- function: ajaxFunctionInput,
- hex: tmplistaddrHexInput,
- };
- }
-
- if (mode === 'full' ||
- mode === 'basilisk') {
- payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- coin: coin,
- agent: 'bitcoinrpc',
- method: 'getaddressesbyaccount',
- account: '*',
- };
- }
-
- if (mode === 'basilisk') {
- const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
-
- fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getKMDAddressesNative+addresslist+cache',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(function(json) {
- json = json.result.basilisk;
-
- if (json[coin].addresses) {
- resolve({ result: json[coin].addresses });
- }
- })
- } else {
- if (Config.cli.default &&
- mode === 'native') {
- payload = {
- mode: null,
- chain: coin,
- cmd: payload.function,
- params: [''],
- };
- }
-
- let _fetchConfig = {
- method: 'POST',
- body: JSON.stringify(payload),
- };
-
- if (Config.cli.default &&
- mode === 'native') {
- _fetchConfig = {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ payload: payload }),
- };
- }
-
- fetch(
- Config.cli.default && mode === 'native' ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
- _fetchConfig
- )
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getKMDAddressesNative',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- resolve(Config.cli.default && mode === 'native' ? json.result : json);
- })
- }
- });
- }))
- .then(result => {
- // TODO: split into 2 functions
- const passthruAgent = getPassthruAgent(coin);
- const tmpIguanaRPCAuth = `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
- let payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: passthruAgent,
- method: 'passthru',
- function: 'listunspent',
- hex: '',
- };
-
- if (passthruAgent === 'iguana') {
- payload.asset = coin;
- }
-
- if (mode === 'full') {
- payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- coin: coin,
- method: 'listunspent',
- params: [
- 1,
- 9999999,
- ],
- };
- }
-
- if (mode === 'basilisk') {
- payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'dex',
- method: 'listunspent',
- address: currentAddress,
- symbol: coin,
- };
- }
-
- function calcBalance(result, json, dispatch, mode) {
- if (mode === 'full' ||
- mode === 'basilisk') {
- result[0] = result[0].result;
- }
-
- if (mode !== 'basilisk' &&
- json &&
- json.length) {
- const allAddrArray = json.map(res => res.address).filter((x, i, a) => a.indexOf(x) == i);
-
- for (let a = 0; a < allAddrArray.length; a++) {
- const filteredArray = json.filter(res => res.address === allAddrArray[a]).map(res => res.amount);
-
- let isNewAddr = true;
- for (let x = 0; x < result.length && isNewAddr; x++) {
- for (let y = 0; y < result[x].length && isNewAddr; y++) {
- if (allAddrArray[a] === result[x][y]) {
- isNewAddr = false;
- }
- }
- }
-
- if (isNewAddr &&
- (allAddrArray[a].substring(0, 2) === 'zc' ||
- allAddrArray[a].substring(0, 2) === 'zt')) {
- result[1][result[1].length] = allAddrArray[a];
- } else {
- result[0][result[0].length] = allAddrArray[a];
- }
- }
- }
-
- // remove addr duplicates
- if (result[0]) {
- result[0] = result[0].filter(function(elem, pos) {
- return result[0].indexOf(elem) === pos;
- });
- }
- if (result[1]) {
- result[1] = result[1].filter(function(elem, pos) {
- return result[1].indexOf(elem) === pos;
- });
- }
-
- let newAddressArray = [];
- for (let a = 0; a < result.length; a++) {
- newAddressArray[a] = [];
-
- if (result[a]) {
- for (let b = 0; b < result[a].length; b++) {
- let filteredArray;
-
- if (mode === 'basilisk') {
- filteredArray = json.map(res => res.amount);
- } else {
- filteredArray = json.filter(res => res.address === result[a][b]).map(res => res.amount);
- }
-
- let sum = 0;
- for (let i = 0; i < filteredArray.length; i++) {
- sum += filteredArray[i];
- }
-
- newAddressArray[a][b] = {
- address: result[a][b],
- amount: currentAddress === result[a][b] || mode === 'native' ? sum : 'N/A',
- type: a === 0 ? 'public': 'private',
- };
- }
- }
- }
-
- // get zaddr balance
- if (result[1] &&
- result[1].length) {
- Promise.all(result[1].map((_address, index) => {
- return new Promise((resolve, reject) => {
- const _timestamp = Date.now();
- let ajaxDataToHex = '["' + _address + '"]';
-
- iguanaHashHex(ajaxDataToHex, dispatch)
- .then((hashHexJson) => {
- if (getPassthruAgent(coin) === 'iguana') {
- payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: getPassthruAgent(coin),
- method: 'passthru',
- asset: coin,
- function: 'z_getbalance',
- hex: hashHexJson,
- };
- } else {
- payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: getPassthruAgent(coin),
- method: 'passthru',
- function: 'z_getbalance',
- hex: hashHexJson,
- };
- }
-
- let _fetchConfig = {
- method: 'POST',
- body: JSON.stringify(payload),
- };
-
- if (Config.cli.default &&
- mode === 'native') {
- payload = {
- mode: null,
- chain: coin,
- cmd: 'z_getbalance',
- params: [
- _address
- ],
- };
-
- _fetchConfig = {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ payload: payload }),
- };
- }
-
- fetch(
- Config.cli.default && mode === 'native' ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
- _fetchConfig
- )
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getKMDAddressesNative+ZBalance',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(function(json) {
- if (json &&
- json.error) {
- resolve(0);
- dispatch(
- triggerToaster(
- 'getKMDAddressesNative+ZBalance',
- 'Error',
- 'error'
- )
- );
- } else {
- if (Config.cli.default &&
- mode === 'native') {
- json = json.result;
- }
- resolve(json);
- newAddressArray[1][index] = {
- address: _address,
- amount: json,
- type: 'private',
- };
- }
- });
- });
- });
- }))
- .then(zresult => {
- dispatch(getKMDAddressesNativeState({
- public: newAddressArray[0],
- private: newAddressArray[1],
- }));
- });
- } else {
- dispatch(getKMDAddressesNativeState({
- public: newAddressArray[0],
- private: newAddressArray[1],
- }));
- }
- }
-
- if (mode === 'basilisk') {
- const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
-
- fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getKMDAddressesNative+addresslist+cache',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(function(json) {
- let updatedCache = Object.assign({}, json.result);
- json = json.result.basilisk;
- // if listunspent is not in cache file retrieve new copy
- // otherwise read from cache data
- if (json[coin][currentAddress].refresh) {
- calcBalance(result, json[coin][currentAddress].refresh.data, dispatch, mode);
- } else {
- fetch(`http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getKMDAddressesNative+Balance',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(function(json) {
- updatedCache.basilisk[coin][currentAddress].refresh = {
- data: json,
- status: 'done',
- timestamp: Date.now(),
- };
- dispatch(shepherdGroomPost(pubkey, updatedCache));
- calcBalance(
- result,
- json,
- dispatch,
- mode
- );
- })
- }
- })
- } else {
- let _fetchConfig = {
- method: 'POST',
- body: JSON.stringify(payload),
- };
-
- if (Config.cli.default &&
- mode === 'native') {
- payload = {
- mode: null,
- chain: coin,
- cmd: payload.function,
- params: payload.params,
- };
-
- _fetchConfig = {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ payload: payload }),
- };
- }
-
- fetch(
- Config.cli.default && mode === 'native' ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${(Config.useBasiliskInstance && mode === 'basilisk' ? Config.iguanaCorePort + 1 : Config.iguanaCorePort)}`,
- _fetchConfig
- )
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getKMDAddressesNative+Balance',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(function(json) {
- if (Config.cli.default &&
- mode === 'native') {
- json = json.result;
- }
- calcBalance(
- result,
- json,
- dispatch,
- mode
- );
- })
- }
- })
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/atomic.js b/react/src/actions/actions/atomic.js
index 8618ca600..d8368a440 100644
--- a/react/src/actions/actions/atomic.js
+++ b/react/src/actions/actions/atomic.js
@@ -1,4 +1,4 @@
-// remove
+// spv v2
import { ATOMIC } from '../storeType';
import { triggerToaster } from '../actionCreators';
@@ -10,7 +10,7 @@ export function atomic(payload) {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/basiliskCache.js b/react/src/actions/actions/basiliskCache.js
deleted file mode 100644
index a6f7a2fae..000000000
--- a/react/src/actions/actions/basiliskCache.js
+++ /dev/null
@@ -1,231 +0,0 @@
-// remove
-
-import { DASHBOARD_ACTIVE_COIN_GET_CACHE } from '../storeType';
-import { triggerToaster } from '../actionCreators';
-import Config from '../../config';
-
-// TODO: rewrite cache API to use POST
-export function deleteCacheFile(_payload) {
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom`, {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ filename: _payload.pubkey }),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'deleteCacheFile',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(
- json => dispatch(
- fetchNewCacheData(_payload)
- )
- );
- }
-}
-
-export function getCacheFile(pubkey) {
- const _pubkey = pubkey || JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
-
- return new Promise((resolve, reject) => {
- fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom?filename=${_pubkey}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getCacheFile',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => resolve(json))
- })
-}
-
-export function fetchNewCacheData(_payload) {
- const _userpass = `?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
- const _pubkey = `&pubkey=${_payload.pubkey}`;
- const _route = _payload.allcoins ? 'cache-all' : 'cache-one';
- const _coin = `&coin=${_payload.coin}`;
- const _calls = `&calls=${_payload.calls}`;
- const _address = _payload.address ? (`&address=${_payload.address}`) : '';
- const _skip = _payload.skip ? (`&skip=${_payload.skip}`) : '';
- const _iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : '';
-
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_skip}${_iguanaInstancePort}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'fetchNewCacheData',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => console.log(json))
- }
-}
-
-export function getShepherdCache(pubkey, coin) {
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getShepherdCache',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(
- json => dispatch(
- getShepherdCacheState(
- json,
- pubkey,
- coin
- )
- )
- )
- }
-}
-
-function getShepherdCacheState(json, pubkey, coin) {
- if (json.result &&
- json.error &&
- json.result.indexOf('no file with handle') > -1) {
- return dispatch => {
- dispatch(fetchNewCacheData({
- pubkey: pubkey,
- allcoins: false,
- coin: coin,
- calls: 'listtransactions:getbalance',
- }));
- }
- } else {
- return {
- type: DASHBOARD_ACTIVE_COIN_GET_CACHE,
- cache: json && json.result && json.result.basilisk ? json.result.basilisk : null,
- }
- }
-}
-
-export function fetchUtxoCache(_payload) {
- const _userpass = `?userpass=tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`;
- const _pubkey = `&pubkey=${_payload.pubkey}`;
- const _route = _payload.allcoins ? 'cache-all' : 'cache-one';
- const _coin = `&coin=${_payload.coin}`;
- const _calls = `&calls=${_payload.calls}`;
- const _address = _payload.address ? (`&address=${_payload.address}`) : '';
- const _iguanaInstancePort = Config.useBasiliskInstance ? `&port=${Config.iguanaCorePort + 1}` : '';
-
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/${_route}${_userpass}${_pubkey}${_coin}${_calls}${_address}${_iguanaInstancePort}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'fetchNewCacheData',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(
- json => dispatch(
- getShepherdCache(_pubkey)
- )
- )
- }
-}
-
-export function shepherdGroomPost(_filename, _payload) {
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom/`, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- filename: _filename,
- payload: JSON.stringify(_payload),
- }),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'shepherdGroomPost',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => console.log(json))
- }
-}
-
-export function shepherdGroomPostPromise(_filename, _payload) {
- return new Promise((resolve, reject) => {
- fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/groom/`, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- filename: _filename,
- payload: JSON.stringify(_payload),
- }),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'shepherdGroomPostPromise',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => resolve(json))
- })
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/basiliskProcessAddress.js b/react/src/actions/actions/basiliskProcessAddress.js
deleted file mode 100644
index b76385f24..000000000
--- a/react/src/actions/actions/basiliskProcessAddress.js
+++ /dev/null
@@ -1,137 +0,0 @@
-// remove
-
-import { translate } from '../../translate/translate';
-import { triggerToaster } from '../actionCreators';
-import Config from '../../config';
-
-export function checkAddressBasilisk(coin, address) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'dex',
- method: 'checkaddress',
- address: address,
- symbol: coin,
- };
-
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'checkAddressBasilisk',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(checkAddressBasiliskHandle(json));
- })
- }
-}
-
-function checkAddressBasiliskHandle(json) {
- if (json &&
- json.error) {
- return dispatch => {
- dispatch(
- triggerToaster(
- json.error,
- translate('TOASTR.WALLET_NOTIFICATION'),
- 'error'
- )
- );
- }
- }
-
- if (json &&
- json.coin &&
- json.randipbits) {
- return dispatch => {
- dispatch(
- triggerToaster(
- translate('API.ADDRESS_ALREADY_REG'),
- translate('TOASTR.WALLET_NOTIFICATION'),
- 'warning'
- )
- );
- }
- }
-}
-
-export function validateAddressBasilisk(coin, address) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'dex',
- method: 'validateaddress',
- address: address,
- symbol: coin,
- };
-
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'validateAddressBasilisk',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(validateAddressBasiliskHandle(json));
- })
- }
-}
-
-function validateAddressBasiliskHandle(json) {
- return dispatch => {
- if (json.iswatchonly === true) {
- dispatch(
- triggerToaster(
- translate('TOASTR.VALIDATION_SUCCESS'),
- translate('TOASTR.BASILISK_NOTIFICATION'),
- 'error'
- )
- );
- }
- if (json.iswatchonly === false) {
- dispatch(
- triggerToaster(
- translate('TOASTR.ADDR_ISNT_REG'),
- translate('TOASTR.BASILISK_NOTIFICATION'),
- 'error'
- )
- );
- }
- if (json.iswatchonly === undefined) {
- dispatch(
- triggerToaster(
- translate('TOASTR.INVALID_QUERY_ALT'),
- translate('TOASTR.BASILISK_NOTIFICATION'),
- 'error'
- )
- );
- }
- if (json.error === 'less than required responses') {
- dispatch(
- triggerToaster(
- translate('TOASTR.LESS_RESPONSES_REQ'),
- translate('TOASTR.BASILISK_NOTIFICATION'),
- 'error'
- )
- );
- }
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/basiliskTxHistory.js b/react/src/actions/actions/basiliskTxHistory.js
deleted file mode 100644
index 024e31ed9..000000000
--- a/react/src/actions/actions/basiliskTxHistory.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// remove
-
-import {
- triggerToaster,
- getNativeTxHistoryState
-} from '../actionCreators';
-import Config from '../../config';
-
-export function getBasiliskTransactionsList(coin, address) {
- const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
-
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/cache?pubkey=${pubkey}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getBasiliskTransactionsList+cache',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(function(json) {
- if (json.result &&
- !json.result.basilisk &&
- json.result.indexOf('no file with handle') > -1) {
- console.log('new cache');
- }
-
- json = json.result.basilisk;
- if (json[coin][address].listtransactions) {
- dispatch(getNativeTxHistoryState({ result: json[coin][address].listtransactions.data }));
- }
- })
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/cli.js b/react/src/actions/actions/cli.js
index ca9844324..8432f29fc 100644
--- a/react/src/actions/actions/cli.js
+++ b/react/src/actions/actions/cli.js
@@ -17,7 +17,7 @@ export function shepherdCliPromise(mode, chain, cmd) {
},
body: JSON.stringify({ payload: _payload }),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -47,7 +47,7 @@ export function shepherdCli(mode, chain, cmd) {
},
body: JSON.stringify({ 'payload': _payload }),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/coinList.js b/react/src/actions/actions/coinList.js
index 3fa06dcab..780c888b9 100644
--- a/react/src/actions/actions/coinList.js
+++ b/react/src/actions/actions/coinList.js
@@ -9,7 +9,7 @@ export function shepherdGetCoinList() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -33,7 +33,7 @@ export function shepherdPostCoinList(data) {
},
body: JSON.stringify({ 'payload': data }),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/createWallet.js b/react/src/actions/actions/createWallet.js
deleted file mode 100644
index 154adeea2..000000000
--- a/react/src/actions/actions/createWallet.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// remove
-
-import { translate } from '../../translate/translate';
-import { triggerToaster } from '../actionCreators';
-import Config from '../../config';
-
-function createNewWalletState(json) {
- if (json &&
- json.result &&
- json.result === 'success') {
- return dispatch => {
- dispatch(
- triggerToaster(
- translate('TOASTR.WALLET_CREATED_SUCCESFULLY'),
- translate('TOASTR.ACCOUNT_NOTIFICATION'),
- 'success'
- )
- );
- }
- } else {
- return dispatch => {
- dispatch(
- triggerToaster(
- translate('API.COULDNT_CREATE_SEED'),
- translate('TOASTR.ACCOUNT_NOTIFICATION'),
- 'error'
- )
- );
- }
- }
-}
-
-export function createNewWallet(_passphrase) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'bitcoinrpc',
- method: 'encryptwallet',
- passphrase: _passphrase,
- };
-
- 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(
- 'createNewWallet',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(createNewWalletState(json));
- })
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/dexCoins.js b/react/src/actions/actions/dexCoins.js
index ef40fe822..52848b658 100644
--- a/react/src/actions/actions/dexCoins.js
+++ b/react/src/actions/actions/dexCoins.js
@@ -15,7 +15,7 @@ export function getDexCoins() {
},
},
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/edexBalance.js b/react/src/actions/actions/edexBalance.js
deleted file mode 100644
index 9d88e2d16..000000000
--- a/react/src/actions/actions/edexBalance.js
+++ /dev/null
@@ -1,80 +0,0 @@
-// remove
-
-import { DASHBOARD_ACTIVE_COIN_BALANCE } from '../storeType';
-import { triggerToaster } from '../actionCreators';
-import Config from '../../config';
-
-export function iguanaEdexBalance(coin) {
- const _payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'bitcoinrpc',
- method: 'getbalance',
- coin: coin,
- };
-
- return dispatch => {
- if (coin) {
- return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(_payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'Error iguanaEdexBalance',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => dispatch(iguanaEdexBalanceState(json)));
- }
- }
-}
-
-function iguanaEdexBalanceState(json) {
- return {
- type: DASHBOARD_ACTIVE_COIN_BALANCE,
- balance: json && json.result ? json.result : 0,
- }
-}
-
-export function getDexBalance(coin, mode, addr) {
- Promise.all(addr.map((_addr, index) => {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'dex',
- method: 'listunspent',
- address: _addr,
- symbol: coin,
- };
-
- return new Promise((resolve, reject) => {
- fetch(`http://127.0.0.1:${Config.useBasiliskInstance ? Config.iguanaCorePort + 1 : Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getDexBalance',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- console.log(json);
- })
-
- resolve(index);
- });
- }))
- .then(result => {
- console.log(result);
- });
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/edexGetTx.js b/react/src/actions/actions/edexGetTx.js
deleted file mode 100644
index afe84a968..000000000
--- a/react/src/actions/actions/edexGetTx.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// remove
-
-import { triggerToaster } from '../actionCreators';
-import Config from '../../config';
-
-export function edexGetTransaction(data, dispatch) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- symbol: data.coin,
- agent: 'dex',
- method: 'gettransaction',
- vout: 1,
- txid: data.txid
- };
-
- return new Promise((resolve, reject) => {
- fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'edexGetTransaction',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- resolve(json);
- })
- });
-}
diff --git a/react/src/actions/actions/electrum.js b/react/src/actions/actions/electrum.js
new file mode 100644
index 000000000..5a5fd2293
--- /dev/null
+++ b/react/src/actions/actions/electrum.js
@@ -0,0 +1,254 @@
+import {
+ DASHBOARD_ELECTRUM_BALANCE,
+ DASHBOARD_ELECTRUM_TRANSACTIONS,
+ DASHBOARD_ELECTRUM_COINS,
+} from '../storeType';
+import { translate } from '../../translate/translate';
+import Config from '../../config';
+import {
+ triggerToaster,
+ sendToAddressState,
+} from '../actionCreators';
+
+export function shepherdElectrumSetServer(coin, address, port) {
+ return new Promise((resolve, reject) => {
+ fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins/server/set?address=${address}&port=${port}&coin=${coin}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumSetServer',
+ 'Error',
+ 'error'
+ )
+ );
+ })
+ .then(response => response.json())
+ .then(json => {
+ resolve(json);
+ });
+ });
+}
+
+export function shepherdElectrumCheckServerConnection(address, port) {
+ return new Promise((resolve, reject) => {
+ fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/servers/test?address=${address}&port=${port}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumCheckServerConnection',
+ 'Error',
+ 'error'
+ )
+ );
+ })
+ .then(response => response.json())
+ .then(json => {
+ if (!json.result) {
+ resolve('error');
+ } else {
+ resolve(json);
+ }
+ });
+ });
+}
+
+export function shepherdElectrumKeys(seed) {
+ return new Promise((resolve, reject) => {
+ fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/keys?seed=${seed}&active=true&iguana=true`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumKeys',
+ 'Error',
+ 'error'
+ )
+ );
+ })
+ .then(response => response.json())
+ .then(json => {
+ if (!json.result) {
+ resolve('error');
+ } else {
+ resolve(json);
+ }
+ });
+ });
+}
+
+export function shepherdElectrumBalance(coin, address) {
+ return dispatch => {
+ return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/getbalance?coin=${coin}&address=${address}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumBalance',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ dispatch(shepherdElectrumBalanceState(json));
+ });
+ }
+}
+
+export function shepherdElectrumBalanceState(json) {
+ return {
+ type: DASHBOARD_ELECTRUM_BALANCE,
+ balance: json.result,
+ }
+}
+
+export function shepherdElectrumTransactions(coin, address) {
+ return dispatch => {
+ return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/listtransactions?coin=${coin}&address=${address}&full=true&maxlength=20`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumTransactions',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ dispatch(shepherdElectrumTransactionsState(json));
+ });
+ }
+}
+
+export function shepherdElectrumTransactionsState(json) {
+ json = json.result;
+
+ if (json &&
+ json.error) {
+ json = null;
+ } else if (!json || !json.length) {
+ json = 'no data';
+ }
+
+ return {
+ type: DASHBOARD_ELECTRUM_TRANSACTIONS,
+ txhistory: json,
+ }
+}
+
+export function shepherdElectrumCoins() {
+ return dispatch => {
+ return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/coins`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumCoins',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ dispatch(shepherdElectrumCoinsState(json));
+ });
+ }
+}
+
+export function shepherdElectrumCoinsState(json) {
+ return {
+ type: DASHBOARD_ELECTRUM_COINS,
+ electrumCoins: json.result,
+ }
+}
+
+// value in sats
+export function shepherdElectrumSend(coin, value, sendToAddress, changeAddress) {
+ return dispatch => {
+ return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=true&verify=true`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumSend',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ if (json.msg === 'error') {
+ dispatch(sendToAddressState(json));
+ } else {
+ dispatch(sendToAddressState(json.result));
+ }
+ });
+ }
+}
+
+export function shepherdElectrumSendPreflight(coin, value, sendToAddress, changeAddress) {
+ return new Promise((resolve, reject) => {
+ fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/createrawtx?coin=${coin}&address=${sendToAddress}&value=${value}&change=${changeAddress}&gui=true&push=false&verify=true`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ }
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'shepherdElectrumSendPreflight',
+ 'Error',
+ 'error'
+ )
+ )
+ })
+ .then(response => response.json())
+ .then(json => {
+ resolve(json);
+ });
+ });
+}
\ No newline at end of file
diff --git a/react/src/actions/actions/fullTxHistory.js b/react/src/actions/actions/fullTxHistory.js
deleted file mode 100644
index 5b7171445..000000000
--- a/react/src/actions/actions/fullTxHistory.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// remove
-
-import {
- triggerToaster,
- getNativeTxHistoryState
-} from '../actionCreators';
-import Config from '../../config';
-
-export function getFullTransactionsList(coin) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- coin: coin,
- method: 'listtransactions',
- params: [
- 0,
- 9999999,
- []
- ],
- };
-
- 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(
- 'getFullTransactionsList',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(getNativeTxHistoryState(json));
- })
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/getAddrByAccount.js b/react/src/actions/actions/getAddrByAccount.js
deleted file mode 100644
index 3d7bf5afe..000000000
--- a/react/src/actions/actions/getAddrByAccount.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// remove
-
-import { ACTIVE_COIN_GET_ADDRESSES } from '../storeType';
-import Config from '../../config';
-
-export function getAddressesByAccountState(json, coin, mode) {
- if (mode === 'full' ||
- mode === 'basilisk') {
- let publicAddressArray = [];
-
- for (let i = 0; i < json.result.length; i++) {
- publicAddressArray.push({
- address: json.result[i],
- amount: 'N/A',
- });
- }
-
- json.result = publicAddressArray;
- }
-
- return {
- type: ACTIVE_COIN_GET_ADDRESSES,
- addresses: { public: json.result },
- }
-}
-
-export function getAddressesByAccount(coin, mode) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- coin: coin,
- agent: 'bitcoinrpc',
- method: 'getaddressesbyaccount',
- account: '*',
- };
-
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(updateErrosStack('activeHandle'));
- dispatch(
- triggerToaster(
- 'getAddressesByAccount',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(
- getAddressesByAccountState(
- json,
- coin,
- mode
- )
- );
- })
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/getTxDetails.js b/react/src/actions/actions/getTxDetails.js
new file mode 100644
index 000000000..fbfd3ea27
--- /dev/null
+++ b/react/src/actions/actions/getTxDetails.js
@@ -0,0 +1,53 @@
+import {
+ triggerToaster
+} from '../actionCreators';
+import Config from '../../config';
+
+export function getTxDetails(coin, txid, type) {
+ return new Promise((resolve, reject) => {
+ let payload = {
+ mode: null,
+ chain: coin,
+ cmd: 'gettransaction',
+ params: [
+ txid
+ ],
+ };
+
+ if (type === 'raw') {
+ payload = {
+ mode: null,
+ chain: coin,
+ cmd: 'getrawtransaction',
+ params: [
+ txid,
+ 1
+ ],
+ };
+ }
+
+ fetch(
+ `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ payload: payload }),
+ },
+ )
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'getTransaction',
+ 'Error',
+ 'error'
+ )
+ );
+ })
+ .then(response => response.json())
+ .then(json => {
+ resolve(json.result ? json.result : json);
+ })
+ });
+}
\ No newline at end of file
diff --git a/react/src/actions/actions/iguanaHelpers.js b/react/src/actions/actions/iguanaHelpers.js
index fff0a3833..245492564 100644
--- a/react/src/actions/actions/iguanaHelpers.js
+++ b/react/src/actions/actions/iguanaHelpers.js
@@ -31,7 +31,7 @@ export function iguanaHashHex(data, dispatch) {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/iguanaInstance.js b/react/src/actions/actions/iguanaInstance.js
index f2b75ee44..1e2c78aa6 100644
--- a/react/src/actions/actions/iguanaInstance.js
+++ b/react/src/actions/actions/iguanaInstance.js
@@ -11,7 +11,7 @@ export function restartIguanaInstance(pmid) {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -38,7 +38,7 @@ export function startIguanaInstance(mode, coin) {
coin,
}),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -61,7 +61,7 @@ export function getIguanaInstancesList() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/interest.js b/react/src/actions/actions/interest.js
index 1db5941a6..49742c148 100644
--- a/react/src/actions/actions/interest.js
+++ b/react/src/actions/actions/interest.js
@@ -23,7 +23,7 @@ export function getListUnspent(coin) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -64,7 +64,7 @@ export function getRawTransaction(coin, txid) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/jumblr.js b/react/src/actions/actions/jumblr.js
index 8dc7a617c..46008b5a2 100644
--- a/react/src/actions/actions/jumblr.js
+++ b/react/src/actions/actions/jumblr.js
@@ -24,7 +24,7 @@ function getNewAddress(coin) { // TODO: remove(?)
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -62,7 +62,7 @@ export function setJumblrAddress(coin, type, address) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -100,7 +100,7 @@ function dumpPrivkey(coin, key) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -142,7 +142,7 @@ export function importPrivkey(coin, key, rescan = false) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/logout.js b/react/src/actions/actions/logout.js
index 3aa5b7451..57f4baf95 100644
--- a/react/src/actions/actions/logout.js
+++ b/react/src/actions/actions/logout.js
@@ -40,7 +40,7 @@ function walletLock() {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/nativeBalance.js b/react/src/actions/actions/nativeBalance.js
deleted file mode 100644
index 0b858fd1c..000000000
--- a/react/src/actions/actions/nativeBalance.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import { DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE } from '../storeType';
-import { triggerToaster } from '../actionCreators';
-import Config from '../../config';
-
-export function getKMDBalanceTotal(coin) {
- return dispatch => {
- const payload = {
- mode: null,
- chain: coin,
- cmd: 'z_gettotalbalance',
- };
- const _fetchConfig = {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ payload: payload }),
- };
-
- return fetch(
- `http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
- _fetchConfig
- )
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getKMDBalanceTotal',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(function(json) { // TODO: figure out why komodod spits out "parse error"
- if (json &&
- !json.error) {
- dispatch(getNativeBalancesState(json));
- }
- })
- }
-}
-
-export function getNativeBalancesState(json) {
- return {
- type: DASHBOARD_ACTIVE_COIN_NATIVE_BALANCE,
- balance: json && !json.error ? json.result : 0,
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/nativeDashboardUpdate.js b/react/src/actions/actions/nativeDashboardUpdate.js
index 4077fe08e..172e2fae9 100644
--- a/react/src/actions/actions/nativeDashboardUpdate.js
+++ b/react/src/actions/actions/nativeDashboardUpdate.js
@@ -16,7 +16,7 @@ export function getDashboardUpdate(coin, activeCoinProps) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/native/dashboard/update`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/nativeNewAddress.js b/react/src/actions/actions/nativeNewAddress.js
index 52dbb40dc..babab9cdb 100644
--- a/react/src/actions/actions/nativeNewAddress.js
+++ b/react/src/actions/actions/nativeNewAddress.js
@@ -25,7 +25,7 @@ export function getNewKMDAddresses(coin, pubpriv, mode) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -48,7 +48,7 @@ export function getNewKMDAddresses(coin, pubpriv, mode) {
);
dispatch(getDashboardUpdate(coin, mode));
})
- .catch(function(ex) {
+ .catch((ex) => {
dispatch(
triggerToaster(
json.result ? json.result : json,
diff --git a/react/src/actions/actions/nativeSend.js b/react/src/actions/actions/nativeSend.js
index 3f96919ad..6b2d9c0bf 100644
--- a/react/src/actions/actions/nativeSend.js
+++ b/react/src/actions/actions/nativeSend.js
@@ -61,7 +61,7 @@ export function sendNativeTx(coin, _payload) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -71,11 +71,11 @@ export function sendNativeTx(coin, _payload) {
)
);
})
- .then(function(response) {
- const _response = response.text().then(function(text) { return text; });
+ .then((response) => {
+ const _response = response.text().then((text) => { return text; });
return _response;
})
- .then(function(json) {
+ .then((json) => {
if (json.indexOf('"code":') > -1) {
const _message = json.substring(
`${json.indexOf('"message":"')}11`,
@@ -150,7 +150,7 @@ export function getKMDOPID(opid, coin) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -195,7 +195,7 @@ export function sendToAddressPromise(coin, address, amount) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/nativeSyncInfo.js b/react/src/actions/actions/nativeSyncInfo.js
index b804d1630..77ae4a5d4 100644
--- a/react/src/actions/actions/nativeSyncInfo.js
+++ b/react/src/actions/actions/nativeSyncInfo.js
@@ -8,6 +8,7 @@ import {
toggleCoindDownModal
} from '../actionCreators';
import Config from '../../config';
+import { translate } from '../../translate/translate';
export function nativeGetinfoFailureState() {
return {
@@ -15,7 +16,7 @@ export function nativeGetinfoFailureState() {
}
}
-// TODO: use debug.log instead
+// TODO: use blockchaininfo rpc
export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) {
let _json = json;
@@ -35,7 +36,7 @@ export function getSyncInfoNativeKMD(skipDebug, json, skipRemote) {
'https://kmd.explorer.supernet.org/api/status?q=getInfo', {
method: 'GET',
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
console.warn('remote kmd node fetch failed', true);
_json = _json.error;
@@ -121,8 +122,8 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) {
);
}
})
- .then(function(response) {
- const _response = response.text().then(function(text) { return text; });
+ .then((response) => {
+ const _response = response.text().then((text) => { return text; });
return _response;
})
.then(json => {
@@ -157,10 +158,10 @@ export function getSyncInfoNative(coin, skipDebug, skipRemote, suppressErrors) {
} else {
dispatch(
triggerToaster(
- 'Please make sure to run komodod manually',
- 'Connection error',
+ translate('API.KMD_PASSIVE_ERROR'),
+ translate('API.CONN_ERROR'),
'warning',
- true
+ false
)
);
}
@@ -226,7 +227,7 @@ export function getBlockTemplate(_json, coin) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -236,13 +237,12 @@ export function getBlockTemplate(_json, coin) {
)
);
})
- .then(function(response) {
- const _response = response.text().then(function(text) { return text; });
+ .then((response) => {
+ const _response = response.text().then((text) => { return text; });
return _response;
})
.then(json => {
- if (!json) {
- } else {
+ if (json) {
json = JSON.parse(json);
}
@@ -260,7 +260,8 @@ export function getBlockTemplate(_json, coin) {
)
);
} else {
- if (json.error && json.error.code === -10) {
+ if (json.error &&
+ json.error.code === -10) {
console.log('debuglog');
dispatch(
getDebugLogProgress(_json, coin)
@@ -291,7 +292,7 @@ export function getDebugLogProgress(_json, coin) {
`http://127.0.0.1:${Config.agamaPort}/shepherd/cli`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -301,17 +302,18 @@ export function getDebugLogProgress(_json, coin) {
)
);
})
- .then(function(response) {
- const _response = response.text().then(function(text) { return text; });
+ .then((response) => {
+ const _response = response.text().then((text) => { return text; });
return _response;
})
.then(json => {
- if (!json) {
- } else {
+ if (json) {
json = JSON.parse(json);
}
- if (json.result && json.result.blocks && json.result.headers) {
+ if (json.result &&
+ json.result.blocks &&
+ json.result.headers) {
_json.result.longestchain = json.result.headers;
_json.result.progress = json.result.blocks * 100 / json.result.headers;
} else if (json.result &&
diff --git a/react/src/actions/actions/nativeTxHistory.js b/react/src/actions/actions/nativeTxHistory.js
deleted file mode 100644
index 5b93896c3..000000000
--- a/react/src/actions/actions/nativeTxHistory.js
+++ /dev/null
@@ -1,73 +0,0 @@
-// remove
-
-import {
- triggerToaster,
- getPassthruAgent,
- getNativeTxHistoryState
-} from '../actionCreators';
-import Config from '../../config';
-
-export function getNativeTxHistory(coin) {
- let payload;
-
- if (getPassthruAgent(coin) === 'iguana') {
- payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'iguana',
- method: 'passthru',
- asset: coin,
- function: 'listtransactions',
- hex: '',
- };
- } else {
- payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: getPassthruAgent(coin),
- method: 'passthru',
- function: 'listtransactions',
- hex: '',
- };
- }
-
- return dispatch => {
- let _fetchConfig = {
- method: 'POST',
- body: JSON.stringify(payload),
- };
-
- if (Config.cli.default) {
- payload = {
- mode: null,
- chain: coin,
- cmd: 'listtransactions',
- };
-
- _fetchConfig = {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ payload: payload }),
- };
- }
-
- return fetch(
- Config.cli.default ? `http://127.0.0.1:${Config.agamaPort}/shepherd/cli` : `http://127.0.0.1:${Config.iguanaCorePort}`,
- _fetchConfig
- )
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getNativeTxHistory',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(getNativeTxHistoryState(json));
- })
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/openAlias.js b/react/src/actions/actions/openAlias.js
deleted file mode 100644
index c004f0d03..000000000
--- a/react/src/actions/actions/openAlias.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// remove
-
-import { triggerToaster } from '../actionCreators';
-
-export function resolveOpenAliasAddress(email) {
- const url = email.replace('@', '.');
-
- return new Promise((resolve, reject) => {
- fetch('https://dns.google.com/resolve?name=' + url + '&type=txt', {
- method: 'GET',
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'resolveOpenAliasAddress',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => resolve(json))
- });
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/pin.js b/react/src/actions/actions/pin.js
index 0d19c801c..dcc4938c3 100644
--- a/react/src/actions/actions/pin.js
+++ b/react/src/actions/actions/pin.js
@@ -21,7 +21,7 @@ export function encryptPassphrase(passphrase, key, pubKey) {
},
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -58,7 +58,7 @@ export function loginWithPin(key, pubKey) {
},
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -83,7 +83,7 @@ export function loadPinList() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/sendFullBasilisk.js b/react/src/actions/actions/sendFullBasilisk.js
deleted file mode 100644
index 1afe44674..000000000
--- a/react/src/actions/actions/sendFullBasilisk.js
+++ /dev/null
@@ -1,193 +0,0 @@
-// remove
-
-import { DASHBOARD_ACTIVE_COIN_SENDTO } from '../storeType';
-import { translate } from '../../translate/translate';
-import {
- triggerToaster,
- getDispatch
-} from '../actionCreators';
-import Config from '../../config';
-
-export function sendToAddress(coin, _payload) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- coin: coin,
- method: 'sendtoaddress',
- params: [
- _payload.sendTo,
- _payload.amount,
- 'EasyDEX',
- 'EasyDEXTransaction'
- ],
- };
-
- 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(
- 'sendToAddress',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(sendToAddressState(json, dispatch));
- })
- }
-}
-
-export function sendFromAddress(coin, _payload) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- coin: coin,
- method: 'sendfrom',
- params: [
- _payload.sendFrom,
- _payload.sendTo,
- _payload.amount,
- 'EasyDEX',
- 'EasyDEXTransaction'
- ],
- };
-
- 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(
- 'sendFromAddress',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- dispatch(sendToAddressState(json, dispatch));
- })
- }
-}
-
-export function iguanaUTXORawTX(data, dispatch) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- symbol: data.coin,
- agent: 'basilisk',
- method: 'utxorawtx',
- vals: {
- timelock: 0,
- changeaddr: data.sendfrom,
- destaddr: data.sendtoaddr,
- txfee: data.txfee,
- amount: data.amount,
- sendflag: data.sendsig,
- },
- utxos: data.utxos,
- };
-
- return new Promise((resolve, reject) => {
- fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'iguanaUTXORawTX',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => {
- resolve(json);
- })
- });
-}
-
-export function dexSendRawTX(data, dispatch) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- agent: 'dex',
- method: 'sendrawtransaction',
- signedtx: data.signedtx,
- symbol: data.coin,
- };
-
- return new Promise((resolve, reject) => {
- fetch(`http://127.0.0.1:${Config.iguanaCorePort}`, {
- method: 'POST',
- body: JSON.stringify(payload),
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'dexSendRawTX',
- 'Error',
- 'error'
- )
- );
- })
- .then(function(response) {
- const _response = response.text().then(function(text) { return text; });
-
- return _response;
- })
- .then(function(json) {
- resolve(json);
- })
- });
-}
-
-function sendToAddressState(json, dispatch) {
- if (json &&
- json.error) {
- dispatch(triggerToaster(json.error, 'Error', 'error'));
-
- return {
- type: DASHBOARD_ACTIVE_COIN_SENDTO,
- lastSendToResponse: json,
- }
- } else if (json && json.result && json.complete) {
- dispatch(
- triggerToaster(
- translate('TOASTR.TX_SENT_ALT'),
- translate('TOASTR.WALLET_NOTIFICATION'),
- 'success'
- )
- );
-
- return {
- type: DASHBOARD_ACTIVE_COIN_SENDTO,
- lastSendToResponse: json,
- }
- }
-}
-
-export function sendToAddressStateAlt(json) {
- return {
- type: DASHBOARD_ACTIVE_COIN_SENDTO,
- lastSendToResponse: json,
- }
-}
-
-export function clearLastSendToResponseState() {
- return {
- type: DASHBOARD_ACTIVE_COIN_SENDTO,
- lastSendToResponse: null,
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/settings.js b/react/src/actions/actions/settings.js
index aa5afdb9e..dfe0a429e 100644
--- a/react/src/actions/actions/settings.js
+++ b/react/src/actions/actions/settings.js
@@ -24,7 +24,7 @@ export function getAppInfo() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -58,8 +58,7 @@ function parseImportPrivKeyResponse(json, dispatch) {
)
);
}
- }
- if (json.error === 'privkey already in wallet') {
+ } else if (json.error === 'privkey already in wallet') {
return dispatch => {
dispatch(
triggerToaster(
@@ -70,6 +69,7 @@ function parseImportPrivKeyResponse(json, dispatch) {
);
}
}
+
if (json &&
json.result !== undefined &&
json.result == 'success') {
@@ -100,7 +100,7 @@ export function importPrivKey(wifKey) {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -119,7 +119,7 @@ export function importPrivKey(wifKey) {
)
);
})
- .catch(function(ex) {
+ .catch((ex) => {
dispatch(parseImportPrivKeyResponse({
error: 'privkey already in wallet',
}, dispatch));
@@ -144,7 +144,7 @@ export function getDebugLog(target, linesCount, acName) {
};
if (acName) {
- payload['ac'] = acName;
+ payload.ac = acName;
}
return dispatch => {
@@ -155,7 +155,7 @@ export function getDebugLog(target, linesCount, acName) {
},
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -183,7 +183,7 @@ export function getPeersList(coin) {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -229,8 +229,7 @@ function addPeerNodeState(json, dispatch) {
)
);
}
- }
- if (json.result === 'peer was already connected') {
+ } else if (json.result === 'peer was already connected') {
return dispatch => {
dispatch(
triggerToaster(
@@ -240,8 +239,7 @@ function addPeerNodeState(json, dispatch) {
)
);
}
- }
- if (json.result === 'addnode connection was already pending') {
+ } else if (json.result === 'addnode connection was already pending') {
return dispatch => {
dispatch(
triggerToaster(
@@ -251,8 +249,7 @@ function addPeerNodeState(json, dispatch) {
)
);
}
- }
- if (json.result === 'addnode submitted') {
+ } else if (json.result === 'addnode submitted') {
return dispatch => {
dispatch(
triggerToaster(
@@ -279,7 +276,7 @@ export function addPeerNode(coin, ip) {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -305,7 +302,7 @@ export function saveAppConfig(_payload) {
},
body: JSON.stringify({ payload: _payload }),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -344,7 +341,7 @@ export function getAppConfig() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -367,7 +364,7 @@ export function resetAppConfig() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/syncInfo.js b/react/src/actions/actions/syncInfo.js
deleted file mode 100644
index 2ef01904f..000000000
--- a/react/src/actions/actions/syncInfo.js
+++ /dev/null
@@ -1,56 +0,0 @@
-// remove
-
-import { SYNCING_FULL_MODE } from '../storeType';
-import { triggerToaster } from '../actionCreators';
-import Config from '../../config';
-
-// TODO: add custom json parser
-function getSyncInfoState(json) {
- try {
- JSON.parse(json);
- json = JSON.parse(json);
- } catch(e) {
- //
- }
-
- return {
- type: SYNCING_FULL_MODE,
- progress: json,
- }
-}
-
-export function getSyncInfo(coin) {
- const payload = {
- userpass: `tmpIgRPCUser@${sessionStorage.getItem('IguanaRPCAuth')}`,
- coin: coin,
- agent: 'bitcoinrpc',
- method: 'getinfo',
- };
-
- 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(
- 'getSyncInfo',
- 'Error',
- 'error'
- )
- );
- })
- .then(function(response) {
- const _response = response.text().then(function(text) { return text; });
-
- return _response;
- })
- .then(function(json) {
- if (json.indexOf('coin is busy processing') === -1) {
- dispatch(getSyncInfoState(json, dispatch));
- }
- })
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/syncOnly.js b/react/src/actions/actions/syncOnly.js
deleted file mode 100644
index 6389d5bfc..000000000
--- a/react/src/actions/actions/syncOnly.js
+++ /dev/null
@@ -1,77 +0,0 @@
-// remove
-
-import {
- SYNC_ONLY_MODAL_TOGGLE,
- SYNC_ONLY_DATA
-} from '../storeType';
-import { translate } from '../../translate/translate';
-import Config from '../../config';
-import { triggerToaster } from '../actionCreators';
-
-export function toggleSyncOnlyModal(display) {
- return {
- type: SYNC_ONLY_MODAL_TOGGLE,
- display,
- }
-}
-
-function getSyncOnlyForksState(json) {
- return {
- type: SYNC_ONLY_DATA,
- forks: JSON.parse(json.result),
- }
-}
-
-export function getSyncOnlyForks() {
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/info/show`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'getSyncOnlyForks',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(json => dispatch(getSyncOnlyForksState(json)))
- }
-}
-
-export function stopIguanaFork(pmid) {
- return dispatch => {
- return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/forks/stop?pmid=${pmid}`, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- .catch(function(error) {
- console.log(error);
- dispatch(
- triggerToaster(
- 'stopIguanaFork',
- 'Error',
- 'error'
- )
- );
- })
- .then(response => response.json())
- .then(
- json => dispatch(
- triggerToaster(
- translate('API.IGUANA_INSTANCE_STOP'),
- translate('TOASTR.SERVICE_NOTIFICATION'),
- 'success'
- )
- )
- )
- }
-}
\ No newline at end of file
diff --git a/react/src/actions/actions/sysInfo.js b/react/src/actions/actions/sysInfo.js
index 9a4b15b07..a15e85359 100644
--- a/react/src/actions/actions/sysInfo.js
+++ b/react/src/actions/actions/sysInfo.js
@@ -9,7 +9,7 @@ export function shepherdGetSysInfo() {
'Content-Type': 'application/json',
}
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
diff --git a/react/src/actions/actions/update.js b/react/src/actions/actions/update.js
index 4210fdc5d..3fa0f5d7a 100644
--- a/react/src/actions/actions/update.js
+++ b/react/src/actions/actions/update.js
@@ -9,7 +9,7 @@ export function checkForUpdateUIPromise() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -32,7 +32,7 @@ export function updateUIPromise() {
'Content-Type': 'application/json',
},
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -45,4 +45,27 @@ export function updateUIPromise() {
.then(response => response.json())
.then(json => resolve(json))
});
-}
\ No newline at end of file
+}
+
+export function downloadZCashParamsPromise(dloption) {
+ return new Promise((resolve, reject) => {
+ fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/zcparamsdl?dloption=${dloption}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ })
+ .catch((error) => {
+ console.log(error);
+ dispatch(
+ triggerToaster(
+ 'downloadZCashParamsPromise',
+ 'Error',
+ 'error'
+ )
+ );
+ })
+ .then(response => response.json())
+ .then(json => resolve(json))
+ });
+}
diff --git a/react/src/actions/actions/walletAuth.js b/react/src/actions/actions/walletAuth.js
index 595942034..7e8f4872b 100644
--- a/react/src/actions/actions/walletAuth.js
+++ b/react/src/actions/actions/walletAuth.js
@@ -7,7 +7,6 @@ import Config from '../../config';
import {
triggerToaster,
getMainAddressState,
- updateErrosStack
} from '../actionCreators';
export function encryptWallet(_passphrase, cb, coin) {
@@ -23,7 +22,7 @@ export function encryptWallet(_passphrase, cb, coin) {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -61,7 +60,7 @@ export function walletPassphrase(_passphrase) {
method: 'POST',
body: JSON.stringify(payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -91,7 +90,7 @@ export function iguanaWalletPassphrase(_passphrase) {
method: 'POST',
body: JSON.stringify(_payload),
})
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(
triggerToaster(
@@ -134,7 +133,7 @@ export function iguanaActiveHandle(getMainAddress) {
Config.iguanaLessMode ? `http://127.0.0.1:${Config.agamaPort}/shepherd/SuperNET/activehandle` : `http://127.0.0.1:${Config.iguanaCorePort}`,
_fetchConfig
)
- .catch(function(error) {
+ .catch((error) => {
console.log(error);
dispatch(updateErrosStack('activeHandle'));
dispatch(
diff --git a/react/src/actions/storeType.js b/react/src/actions/storeType.js
index 9d14c9156..f3860b385 100644
--- a/react/src/actions/storeType.js
+++ b/react/src/actions/storeType.js
@@ -40,4 +40,10 @@ export const DISPLAY_COIND_DOWN_MODAL = 'DISPLAY_COIND_DOWN_MODAL';
export const DISPLAY_LOGIN_SETTINGS_MODAL = 'DISPLAY_LOGIN_SETTINGS_MODAL';
export const DISPLAY_CLAIM_INTEREST_MODAL = 'DISPLAY_CLAIM_INTEREST_MODAL';
export const GET_PIN_LIST = 'GET_PIN_LIST';
-export const DISPLAY_IMPORT_KEY_MODAL = 'DISPLAY_IMPORT_KEY_MODAL';
\ No newline at end of file
+export const DISPLAY_IMPORT_KEY_MODAL = 'DISPLAY_IMPORT_KEY_MODAL';
+export const LOGIN = 'LOGIN';
+export const DASHBOARD_ELECTRUM_BALANCE = 'DASHBOARD_ELECTRUM_BALANCE';
+export const DASHBOARD_ELECTRUM_TRANSACTIONS = 'DASHBOARD_ELECTRUM_TRANSACTIONS';
+export const DASHBOARD_ELECTRUM_COINS = 'DASHBOARD_ELECTRUM_COINS';
+export const ELECTRUM_SERVER_CHANGED = 'ELECTRUM_SERVER_CHANGED';
+export const DISPLAY_ZCASH_PARAMS_FETCH = 'DISPLAY_ZCASH_PARAMS_FETCH';
\ No newline at end of file
diff --git a/react/src/assets/images/cryptologo/mnz.png b/react/src/assets/images/cryptologo/mnz.png
new file mode 100644
index 000000000..1c1a2affa
Binary files /dev/null and b/react/src/assets/images/cryptologo/mnz.png differ
diff --git a/react/src/components/addcoin/addcoin.js b/react/src/components/addcoin/addcoin.js
index 672f20447..56e9f57d3 100644
--- a/react/src/components/addcoin/addcoin.js
+++ b/react/src/components/addcoin/addcoin.js
@@ -22,6 +22,10 @@ class AddCoin extends React.Component {
coins: [],
defaultCoinState: {
selectedCoin: null,
+ spvMode: {
+ disabled: true,
+ checked: false,
+ },
nativeMode: {
disabled: true,
checked: false,
@@ -39,6 +43,7 @@ class AddCoin extends React.Component {
this.dismiss = this.dismiss.bind(this);
this.addNewItem = this.addNewItem.bind(this);
this.activateAllCoins = this.activateAllCoins.bind(this);
+ this.toggleActionsMenu = this.toggleActionsMenu.bind(this);
this.saveCoinSelection = this.saveCoinSelection.bind(this);
this.loadCoinSelection = this.loadCoinSelection.bind(this);
}
@@ -70,6 +75,18 @@ class AddCoin extends React.Component {
});
}
+ toggleSyncOnlyMode(index) {
+ let _coins = this.state.coins;
+
+ _coins[index] = Object.assign({}, _coins[index], {
+ syncOnly: !this.state.coins[index].syncOnly,
+ });
+
+ this.setState(Object.assign({}, this.state, {
+ coins: _coins,
+ }));
+ }
+
updateDaemonParam(e, index) {
let _coins = this.state.coins;
@@ -90,6 +107,16 @@ class AddCoin extends React.Component {
componentWillMount() {
this.addNewItem();
+
+ let appConfig;
+
+ try {
+ appConfig = window.require('electron').remote.getCurrentWindow().appConfig;
+ } catch (e) {}
+
+ this.setState({
+ isExperimentalOn: appConfig.experimentalFeatures,
+ });
}
componentWillReceiveProps(props) {
@@ -115,15 +142,20 @@ class AddCoin extends React.Component {
updateSelectedCoin(e, index) {
const coin = e.target.value.split('|');
- const defaultMode = 'native';
+ const defaultMode = Config.iguanaLessMode ? 'native' : coin[1];
const modeToValue = { // TODO: move to utils
- native: -1,
+ 'spv': 0,
+ 'native': -1,
};
let _coins = this.state.coins;
const _value = e.target.value;
_coins[index] = {
[e.target.name]: _value,
+ spvMode: {
+ disabled: _value.indexOf('spv') > -1 ? false : true,
+ checked: defaultMode === 'spv' ? true : false,
+ },
nativeMode: {
disabled: _value.indexOf('native') > -1 ? false : true,
checked: defaultMode === 'native' ? true : false,
@@ -142,6 +174,11 @@ class AddCoin extends React.Component {
_coins[index] = {
selectedCoin: _selectedCoin,
+
+ spvMode: {
+ disabled: _selectedCoin.indexOf('spv') > -1 ? false : true,
+ checked: _value === '0' ? true : false,
+ },
nativeMode: {
disabled: _selectedCoin.indexOf('native') > -1 ? false : true,
checked: _value === '-1' ? true : false,
@@ -172,12 +209,13 @@ class AddCoin extends React.Component {
if (!_coin.daemonParam) {
Store.dispatch(addCoin(
coin,
+ _coin.mode,
));
} else {
Store.dispatch(addCoin(
coin,
- null,
- { type: _coin.daemonParam } // TODO: custom param value
+ _coin.mode,
+ { type: _coin.daemonParam }
));
}
@@ -221,7 +259,6 @@ class AddCoin extends React.Component {
addCoin(
coin,
this.state.coins[0].mode,
- this.state.coins[0].syncOnly
)
);
}
@@ -236,7 +273,6 @@ class AddCoin extends React.Component {
addCoin(
itemCoin,
_item.mode,
- _item.syncOnly
)
);
}
@@ -284,6 +320,7 @@ class AddCoin extends React.Component {
isCoinAlreadyAdded(coin) {
const modes = [
+ 'spv',
'native'
];
@@ -318,4 +355,4 @@ const mapStateToProps = (state) => {
};
};
-export default connect(mapStateToProps)(AddCoin);
+export default connect(mapStateToProps)(AddCoin);
\ No newline at end of file
diff --git a/react/src/components/addcoin/addcoinOptionsAC.js b/react/src/components/addcoin/addcoinOptionsAC.js
index 9b02b8d97..5376a0487 100644
--- a/react/src/components/addcoin/addcoinOptionsAC.js
+++ b/react/src/components/addcoin/addcoinOptionsAC.js
@@ -15,6 +15,7 @@ class AddCoinOptionsAC extends React.Component {
'kv',
'mgw',
//'mvp',
+ 'mnz',
'pangea',
'revs',
'shark',
@@ -24,10 +25,12 @@ class AddCoinOptionsAC extends React.Component {
let _items = [];
for (let i = 0; i < _assetChains.length; i++) {
+ const availableModes = _assetChains[i] === 'revs' || _assetChains[i] === 'jumblr' || _assetChains[i] === 'wlc' || _assetChains[i] === 'mnz' ? 'native|spv' : 'native';
+
_items.push(
+ value={ `${_assetChains[i].toUpperCase()}|${availableModes}` }>{ translate(`ASSETCHAINS.${_assetChains[i].toUpperCase()}`) }
);
}
diff --git a/react/src/components/addcoin/addcoinOptionsCrypto.js b/react/src/components/addcoin/addcoinOptionsCrypto.js
index bbae18671..96aa57fc4 100644
--- a/react/src/components/addcoin/addcoinOptionsCrypto.js
+++ b/react/src/components/addcoin/addcoinOptionsCrypto.js
@@ -1,17 +1,33 @@
import React from 'react';
import { translate } from '../../translate/translate';
-import Config from '../../config';
class AddCoinOptionsCrypto extends React.Component {
constructor() {
super();
+ this.state = {
+ isExperimentalOn: false,
+ };
+ }
+
+ componentWillMount() {
+ let appConfig;
+
+ try {
+ appConfig = window.require('electron').remote.getCurrentWindow().appConfig;
+ } catch (e) {}
+
+ this.setState({
+ isExperimentalOn: appConfig.experimentalFeatures,
+ });
}
render() {
return (
);
}
diff --git a/react/src/components/addcoin/coin-selectors.render.js b/react/src/components/addcoin/coin-selectors.render.js
index cfe891d9c..8a1ab00b8 100644
--- a/react/src/components/addcoin/coin-selectors.render.js
+++ b/react/src/components/addcoin/coin-selectors.render.js
@@ -13,7 +13,7 @@ const CoinSelectorsRender = function(item, coin, i) {
className={ this.hasMoreThanOneCoin() ? 'col-sm-10' : 'col-sm-8' }
style={{ paddingLeft: !this.hasMoreThanOneCoin() ? '0' : '15px' }}>
-
+
-
+
+
+
+
+
-
+
+ { this.props.Dashboard &&
+ this.props.Dashboard.electrumCoins &&
+ this.props.Dashboard.electrumCoins[item.coin] &&
+ this.props.Dashboard.electrumCoins[item.coin].serverList &&
+ this.props.Dashboard.electrumCoins[item.coin].serverList === 'none' &&
+
+ }
);
};
diff --git a/react/src/components/dashboard/coindDownModal/coindDownModal.render.js b/react/src/components/dashboard/coindDownModal/coindDownModal.render.js
index 4b2259670..bbd5eb03b 100644
--- a/react/src/components/dashboard/coindDownModal/coindDownModal.render.js
+++ b/react/src/components/dashboard/coindDownModal/coindDownModal.render.js
@@ -2,6 +2,12 @@ import React from 'react';
import { translate } from '../../../translate/translate';
const CoindDownModalRender = function() {
+ let _debuglog = this.props.debugLog || '';
+
+ if (_debuglog.indexOf('ENOENT') > -1) {
+ _debuglog = 'Error: ' + (this.props.ActiveCoin.coin === 'KMD' ? 'Komodod' : `Komodod / ${this.props.ActiveCoin.coin}`) + translate('INDEX.COIND_DOWN_MODAL_ERROR');
+ }
+
return (
+ value={ _debuglog }>
- { this.state.passphraseAddress && this.state.passphraseWif &&
+ { this.state.passphraseAddress &&
+ this.state.passphraseWif &&
{ translate('IMPORT_KEY.ADDRESS') }: { this.state.passphraseAddress }
diff --git a/react/src/components/dashboard/invoiceModal/invoiceModal.js b/react/src/components/dashboard/invoiceModal/invoiceModal.js
index 68cdfdb9c..66a71bec3 100755
--- a/react/src/components/dashboard/invoiceModal/invoiceModal.js
+++ b/react/src/components/dashboard/invoiceModal/invoiceModal.js
@@ -35,11 +35,12 @@ class InvoiceModal extends React.Component {
saveAsImage(e) {
if (this.state.qrAddress !== '-1') {
- const qrCanvas = document.getElementById("qrCanvas");
+ const qrCanvas = document.getElementById('qrCanvas');
const canvas = qrCanvas.getElementsByTagName('canvas');
const dataURL = canvas[0].toDataURL();
const a = document.getElementById('saveImage');
const time = new Date().getTime();
+
a.href = dataURL;
a.download = this.state.qrAddress + '_' + time;
} else {
@@ -47,7 +48,7 @@ class InvoiceModal extends React.Component {
return;
}
}
-
+
updateInput(e) {
this.setState({
[e.target.name]: e.target.value,
@@ -97,7 +98,25 @@ class InvoiceModal extends React.Component {
return items;
} else {
- return null;
+ if (this.props.Dashboard.electrumCoins &&
+ type === 'public') {
+ let items = [];
+
+ items.push(
+ AddressItemRender.call(
+ this,
+ {
+ address: this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].pub,
+ amount: this.props.ActiveCoin.balance.balance
+ },
+ 'public'
+ )
+ );
+
+ return items;
+ } else {
+ return null;
+ }
}
}
@@ -123,9 +142,7 @@ const mapStateToProps = (state) => {
lastSendToResponse: state.ActiveCoin.lastSendToResponse,
addresses: state.ActiveCoin.addresses,
},
- Dashboard: {
- activeHandle: state.Dashboard.activeHandle,
- },
+ Dashboard: state.Dashboard,
};
};
diff --git a/react/src/components/dashboard/invoiceModal/invoiceModal.render.js b/react/src/components/dashboard/invoiceModal/invoiceModal.render.js
index a31ca668a..d00417b5d 100644
--- a/react/src/components/dashboard/invoiceModal/invoiceModal.render.js
+++ b/react/src/components/dashboard/invoiceModal/invoiceModal.render.js
@@ -59,8 +59,8 @@ export const InvoiceModalRender = function() {
onChange={ this.updateInput } />
-
-
@@ -228,7 +228,8 @@ export const JumblrRender = function() {
type="button"
className="btn btn-info waves-effect waves-light"
onClick={ this.generateJumblrDepositAddress }>{ translate('JUMBLR.CREATE_JUMBLR_DEPOSIT_ADDRESS') }
- { this.state.jumblrDepositAddress && this.state.jumblrDepositAddress.address &&
+ { this.state.jumblrDepositAddress &&
+ this.state.jumblrDepositAddress.address &&
{ translate('JUMBLR.YOUR_JUMBLR_DEPOSIT_ADDRESS') }:
@@ -316,7 +317,8 @@ export const JumblrRender = function() {
|