diff --git a/react/src/config.js b/react/src/config.js
index 85bef3c..700a203 100644
--- a/react/src/config.js
+++ b/react/src/config.js
@@ -2,6 +2,6 @@ module.exports = {
iguanaCorePort: 7778,
basiliskPort: 7779,
agamaPort: 17777,
- enableCacheApi: false,
+ enableCacheApi: true,
useBasiliskInstance: true,
};
diff --git a/react/src/translate/en.js b/react/src/translate/en.js
index b2ee234..85f5a5f 100644
--- a/react/src/translate/en.js
+++ b/react/src/translate/en.js
@@ -81,8 +81,8 @@ export const _lang = {
'GET_NOTARY_NODES_LIST': 'Get Notary Nodes List',
'REFRESH_BASILISK_CONNECTIONS': 'Refresh Basilisk Connections',
'FETCH_WALLET_DATA': 'Fetch Wallet Data',
- 'REFETCH_WALLET_DATA': 'Reset cache data',
- 'VIEW_CACHE_DATA': 'View cache data',
+ 'REFETCH_WALLET_DATA': 'Reset Cache Data',
+ 'VIEW_CACHE_DATA': 'View Cache Data',
'TRANSACTION_HISTORY': 'Transactions History',
'DIRECTION': 'Direction',
'CONFIRMATIONS': 'Confirmations',
From ad7554b29cd01f81e0032e7f25b07976a894e948 Mon Sep 17 00:00:00 2001
From: pbca26
Date: Mon, 24 Apr 2017 11:08:36 -0700
Subject: [PATCH 05/14] sidebar overflow scroll
---
react/src/styles/index.scss | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/react/src/styles/index.scss b/react/src/styles/index.scss
index c051f74..d3ded81 100644
--- a/react/src/styles/index.scss
+++ b/react/src/styles/index.scss
@@ -149,6 +149,11 @@ body {
right: 15px;
}
+.page-aside-inner .wallet-widgets-list {
+ overflow-y: auto;
+ height: 100%;
+}
+
/*.toaster .single-toast:nth-child(0) {
bottom: 12px;
}
From 4a0a31e9a821910d0c4646d969fd8c179fd999e5 Mon Sep 17 00:00:00 2001
From: pbca26
Date: Tue, 25 Apr 2017 08:21:34 +0300
Subject: [PATCH 06/14] load coin data on tile click
---
.../src/components/dashboard/coinTileItem.js | 51 ++++++++++++-------
1 file changed, 32 insertions(+), 19 deletions(-)
diff --git a/react/src/components/dashboard/coinTileItem.js b/react/src/components/dashboard/coinTileItem.js
index 648be93..1b59b84 100644
--- a/react/src/components/dashboard/coinTileItem.js
+++ b/react/src/components/dashboard/coinTileItem.js
@@ -32,42 +32,55 @@ class CoinTileItem extends React.Component {
// 3) limit req in basilisk as much as possible incl. activehandle
// 4) add pending requests store
+ dispatchCoinActions(coin, mode) {
+ if (mode === 'native') {
+ Store.dispatch(getSyncInfoNative(coin));
+ Store.dispatch(getKMDBalanceTotal(coin));
+ Store.dispatch(getNativeTxHistory(coin));
+ Store.dispatch(getKMDAddressesNative(coin));
+ Store.dispatch(getKMDOPID(null, coin));
+ }
+ if (mode === 'full') {
+ Store.dispatch(getSyncInfo(coin));
+ Store.dispatch(iguanaEdexBalance(coin, mode));
+ Store.dispatch(getKMDAddressesNative(coin, mode)); //getAddressesByAccount(coin));
+ Store.dispatch(getFullTransactionsList(coin));
+ }
+ if (mode === 'basilisk') {
+ const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin];
+
+ if (this.props && this.props.Dashboard && this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle[coin]) {
+ Store.dispatch(getBasiliskTransactionsList(coin, useAddress));
+ Store.dispatch(getKMDAddressesNative(coin, mode, useAddress));
+ Store.dispatch(getShepherdCache(this.props.Dashboard.activeHandle.pubkey));
+ Store.dispatch(iguanaEdexBalance(coin, mode));
+ }
+ }
+ }
+
dashboardChangeActiveCoin(coin, mode) {
if (coin !== this.props.ActiveCoin.coin) {
Store.dispatch(stopInterval('sync', this.props.Interval.interval));
Store.dispatch(stopInterval('basilisk', this.props.Interval.interval));
Store.dispatch(dashboardChangeActiveCoin(coin, mode));
+ this.dispatchCoinActions(coin, mode);
if (mode === 'full') {
var _iguanaActiveHandle = setInterval(function() {
- Store.dispatch(getSyncInfo(coin));
- Store.dispatch(iguanaEdexBalance(coin, mode));
- Store.dispatch(getKMDAddressesNative(coin, mode)); //getAddressesByAccount(coin));
- Store.dispatch(getFullTransactionsList(coin));
- }, 3000);
+ this.dispatchCoinActions(coin, mode);
+ }.bind(this), 3000);
Store.dispatch(startInterval('sync', _iguanaActiveHandle));
}
if (mode === 'native') {
// TODO: add conditions to skip txhistory, balances, addresses while "activating best chain"
var _iguanaActiveHandle = setInterval(function() {
- Store.dispatch(getSyncInfoNative(coin));
- Store.dispatch(getKMDBalanceTotal(coin));
- Store.dispatch(getNativeTxHistory(coin));
- Store.dispatch(getKMDAddressesNative(coin));
- Store.dispatch(getKMDOPID(null, coin));
- }, coin === 'KMD' ? 15000 : 3000);
+ this.dispatchCoinActions(coin, mode);
+ }.bind(this), coin === 'KMD' ? 15000 : 3000);
Store.dispatch(startInterval('sync', _iguanaActiveHandle));
}
if (mode === 'basilisk') {
var _iguanaActiveHandle = setInterval(function() {
- const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin];
-
- if (this.props && this.props.Dashboard && this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle[coin]) {
- Store.dispatch(getBasiliskTransactionsList(coin, useAddress));
- Store.dispatch(getKMDAddressesNative(coin, mode, useAddress));
- Store.dispatch(getShepherdCache(this.props.Dashboard.activeHandle.pubkey));
- Store.dispatch(iguanaEdexBalance(coin, mode));
- }
+ this.dispatchCoinActions(coin, mode);
}.bind(this), 3000);
var _basiliskCache = setInterval(function() {
From d9688bc8ad5b994b9639727897e4eca141645f2a Mon Sep 17 00:00:00 2001
From: pbca26
Date: Tue, 25 Apr 2017 08:39:49 +0300
Subject: [PATCH 07/14] bugfix
---
react/src/actions/actionCreators.js | 5 ++++-
react/src/components/dashboard/coinTileItem.js | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index 812c474..e896da7 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -956,7 +956,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
};
}
- if (mode !== 'native' || mode !== 'basilisk') {
+ if (mode !== 'native' && mode !== 'basilisk') {
payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
'coin': coin,
@@ -965,6 +965,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
'account': '*'
};
}
+ console.log('pl', payload);
if (sessionStorage.getItem('useCache') && mode === 'basilisk') {
const pubkey = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey;
@@ -1053,6 +1054,8 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
result[0] = result[0].result;
}
+ console.log('calcBalance', result);
+
if (mode !== 'basilisk') {
const allAddrArray = json.map(res => res.address).filter((x, i, a) => a.indexOf(x) == i);
for (let a=0; a < allAddrArray.length; a++) {
diff --git a/react/src/components/dashboard/coinTileItem.js b/react/src/components/dashboard/coinTileItem.js
index 1b59b84..b718c19 100644
--- a/react/src/components/dashboard/coinTileItem.js
+++ b/react/src/components/dashboard/coinTileItem.js
@@ -37,7 +37,7 @@ class CoinTileItem extends React.Component {
Store.dispatch(getSyncInfoNative(coin));
Store.dispatch(getKMDBalanceTotal(coin));
Store.dispatch(getNativeTxHistory(coin));
- Store.dispatch(getKMDAddressesNative(coin));
+ Store.dispatch(getKMDAddressesNative(coin, mode));
Store.dispatch(getKMDOPID(null, coin));
}
if (mode === 'full') {
From e306aa0cf2789cd76693965235c6ea4134ce6e89 Mon Sep 17 00:00:00 2001
From: Petr Balashov
Date: Tue, 25 Apr 2017 09:05:57 +0200
Subject: [PATCH 08/14] moved activehandle interval to login component
---
react/src/components/dashboard/coinTileItem.js | 2 --
react/src/components/login/login.js | 11 ++++++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/react/src/components/dashboard/coinTileItem.js b/react/src/components/dashboard/coinTileItem.js
index b718c19..e54e382 100644
--- a/react/src/components/dashboard/coinTileItem.js
+++ b/react/src/components/dashboard/coinTileItem.js
@@ -98,8 +98,6 @@ class CoinTileItem extends React.Component {
// basilisk
}
}
-
- Store.dispatch(iguanaActiveHandle(true));
}
render() {
diff --git a/react/src/components/login/login.js b/react/src/components/login/login.js
index 03ccccd..93c645c 100644
--- a/react/src/components/login/login.js
+++ b/react/src/components/login/login.js
@@ -1,6 +1,11 @@
import React from 'react';
import { translate } from '../../translate/translate';
-import { toggleAddcoinModal, iguanaWalletPassphrase, createNewWallet } from '../../actions/actionCreators';
+import {
+ toggleAddcoinModal,
+ iguanaWalletPassphrase,
+ createNewWallet,
+ iguanaActiveHandle
+} from '../../actions/actionCreators';
import Store from '../../store';
import { PassPhraseGenerator } from '../../util/crypto/passphrasegenerator';
@@ -24,6 +29,10 @@ class Login extends React.Component {
this.handleRegisterWallet = this.handleRegisterWallet.bind(this);
}
+ componentDidMount() {
+ Store.dispatch(iguanaActiveHandle(true));
+ }
+
toggleSeedInputVisibility() {
this.setState({
seedInputVisibility: !this.state.seedInputVisibility,
From 7f8b41abb67012ced7ef236b309fc18b99cdc5d5 Mon Sep 17 00:00:00 2001
From: Petr Balashov
Date: Tue, 25 Apr 2017 17:36:13 +0200
Subject: [PATCH 09/14] bugfix basilisk
---
react/src/actions/actionCreators.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index e896da7..52bb0f2 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -956,7 +956,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
};
}
- if (mode !== 'native' && mode !== 'basilisk') {
+ if (mode === 'native' || mode === 'basilisk') {
payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
'coin': coin,
@@ -1054,7 +1054,8 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
result[0] = result[0].result;
}
- console.log('calcBalance', result);
+ console.log('calc result', result);
+ console.log('calc json', json);
if (mode !== 'basilisk') {
const allAddrArray = json.map(res => res.address).filter((x, i, a) => a.indexOf(x) == i);
From f53426cd43bfc73a1752f541080f1eeb560f2b79 Mon Sep 17 00:00:00 2001
From: pbca26
Date: Wed, 26 Apr 2017 08:41:37 +0300
Subject: [PATCH 10/14] bugfix
---
react/src/actions/actionCreators.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index 52bb0f2..42080a2 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -1050,8 +1050,12 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
}
function calcBalance(result, json, dispatch, mode) {
+ console.log('result', result);
if (mode === 'full' || mode === 'basilisk') {
result[0] = result[0].result;
+ } else {
+ result[0] = result[0].result;
+ result[1] = result[1].result;
}
console.log('calc result', result);
@@ -1095,6 +1099,8 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
} else {
filteredArray = json.filter(res => res.address === result[a][b]).map(res => res.amount);
}
+ console.log('filteredArray', filteredArray);
+ console.log('addr', result[a][b]);
let sum = 0;
From 6c96c74e04295d332b9537f9ca17811282b0949a Mon Sep 17 00:00:00 2001
From: Petr Balashov
Date: Wed, 26 Apr 2017 08:55:13 +0200
Subject: [PATCH 11/14] store useCache settings in localstorage
---
react/src/components/dashboard/walletsData.js | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js
index 07b800c..1a5b466 100644
--- a/react/src/components/dashboard/walletsData.js
+++ b/react/src/components/dashboard/walletsData.js
@@ -39,7 +39,7 @@ class WalletsData extends React.Component {
addressSelectorOpen: false,
currentStackLength: 0,
totalStackLength: 0,
- useCache: sessionStorage.getItem('useCache'),
+ useCache: sessionStorage.getItem('useCache') ? true : false,
};
this.updateInput = this.updateInput.bind(this);
this.toggleBasiliskActionsMenu = this.toggleBasiliskActionsMenu.bind(this);
@@ -54,11 +54,16 @@ class WalletsData extends React.Component {
socket.on('messages', msg => this.updateSocketsData(msg));
}
+ componentDidMount() {
+ console.log('use cache = ', this.state.useCache);
+ }
+
toggleCacheApi() {
- console.log('useCache is set to', !this.state.useCache);
- sessionStorage.setItem('useCache', !this.state.useCache);
+ const _useCache = !this.state.useCache;
+ console.log('useCache is set to', _useCache);
+ sessionStorage.setItem('useCache', _useCache);
this.setState(Object.assign({}, this.state, {
- useCache: !this.state.useCache,
+ useCache: _useCache,
}));
}
From 76cc1e4368e33a3086cc074b8e5390dbf98477ca Mon Sep 17 00:00:00 2001
From: Petr Balashov
Date: Wed, 26 Apr 2017 17:35:21 +0200
Subject: [PATCH 12/14] fetch utxo manually
---
react/src/actions/actionCreators.js | 25 +++++++++++++++++++
react/src/components/dashboard/dashboard.js | 2 +-
react/src/components/dashboard/walletsData.js | 19 +++++++++++++-
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index 42080a2..a9edf11 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -1175,6 +1175,31 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
}
}
+export function fetchUtxoCache(_payload) {
+ const _userpass = '?userpass=tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
+ _pubkey = '&pubkey=' + _payload.pubkey,
+ _route = _payload.allcoins ? 'cache-all' : 'cache-one',
+ _coin = '&coin=' + _payload.coin,
+ _calls = '&calls=' + _payload.calls,
+ _address = '&address' + _payload.address,
+ _iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + Config.basiliskPort : '';
+
+ 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(true, 'fetchNewCacheData', 'Error', 'error'));
+ })
+ .then(response => response.json())
+ .then(json => dispatch(getShepherdCache(_pubkey)))
+ }
+}
+
function getShepherdCacheState(json) {
return {
type: DASHBOARD_ACTIVE_COIN_GET_CACHE,
diff --git a/react/src/components/dashboard/dashboard.js b/react/src/components/dashboard/dashboard.js
index 1e89a36..2362f8b 100644
--- a/react/src/components/dashboard/dashboard.js
+++ b/react/src/components/dashboard/dashboard.js
@@ -36,7 +36,7 @@ class Dashboard extends React.Component {
-
+
diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js
index 1a5b466..96c9ba6 100644
--- a/react/src/components/dashboard/walletsData.js
+++ b/react/src/components/dashboard/walletsData.js
@@ -13,7 +13,8 @@ import {
deleteCacheFile,
connectNotaries,
toggleViewCacheModal,
- fetchNewCacheData
+ fetchNewCacheData,
+ fetchUtxoCache
} from '../../actions/actionCreators';
import Store from '../../store';
@@ -51,6 +52,7 @@ class WalletsData extends React.Component {
this.removeAndFetchNewCache = this.removeAndFetchNewCache.bind(this);
this._toggleViewCacheModal = this._toggleViewCacheModal.bind(this);
this.toggleCacheApi = this.toggleCacheApi.bind(this);
+ this._fetchUtxoCache = this._fetchUtxoCache.bind(this);
socket.on('messages', msg => this.updateSocketsData(msg));
}
@@ -100,6 +102,16 @@ class WalletsData extends React.Component {
}));
}
+ _fetchUtxoCache() {
+ Store.dispatch(fetchUtxoCache({
+ 'pubkey': this.props.Dashboard.activeHandle.pubkey,
+ 'allcoins': false,
+ 'coin': this.props.ActiveCoin.coin,
+ 'calls': 'refresh',
+ 'address': this.state.currentAddress,
+ }));
+ }
+
toggleBasiliskActionsMenu() {
this.setState(Object.assign({}, this.state, {
basiliskActionsMenu: !this.state.basiliskActionsMenu,
@@ -422,6 +434,11 @@ class WalletsData extends React.Component {
{translate('INDEX.REFETCH_WALLET_DATA')}
+
+
+ Update UTXO
+
+
{translate('INDEX.VIEW_CACHE_DATA')}
From 5e5497c312160a7bfb1d7923eff7febc484c4a5e Mon Sep 17 00:00:00 2001
From: pbca26
Date: Thu, 27 Apr 2017 19:20:25 +0300
Subject: [PATCH 13/14] start basilisk instance on add coin
---
react/src/actions/actionCreators.js | 40 +++++++++++++++++--
react/src/components/dashboard/walletsData.js | 6 +--
2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/react/src/actions/actionCreators.js b/react/src/actions/actionCreators.js
index a9edf11..f0ca216 100644
--- a/react/src/actions/actionCreators.js
+++ b/react/src/actions/actionCreators.js
@@ -332,7 +332,7 @@ export function addCoin(coin, mode) {
}
export function iguanaAddCoin(coin, mode, acData) {
- return dispatch => {
+ function _iguanaAddCoin(dispatch) {
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
method: 'POST',
body: JSON.stringify(acData),
@@ -344,6 +344,19 @@ export function iguanaAddCoin(coin, mode, acData) {
.then(response => response.json())
.then(json => dispatch(addCoinResult(coin, mode, acData)));
}
+
+ if (mode === 0) {
+ return dispatch => {
+ startIguanaInstance('basilisk', 'basilisk')
+ .then(function(json) {
+ _iguanaAddCoin(dispatch);
+ });
+ }
+ } else {
+ return dispatch => {
+ return _iguanaAddCoin(dispatch);
+ }
+ }
}
export function shepherdHerd(coin, mode, path) {
@@ -653,6 +666,7 @@ export function getPeersListState(json) {
}
}
+export function getFullTransactionsList(coin) {
/*params = {
'userpass': tmpIguanaRPCAuth,
'agent': 'dex',
@@ -662,8 +676,6 @@ export function getPeersListState(json) {
'skip': 0,
'symbol': coin
};*/
-
-export function getFullTransactionsList(coin) {
const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
'coin': coin,
@@ -1991,6 +2003,28 @@ function connectAllNotaryNodes(json, dispatch) {
}
}
+export function startIguanaInstance(mode, coin) {
+ console.log('startIguanaInstance', mode + ' ' + coin);
+ return new Promise((resolve, reject) => {
+ fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/forks', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({
+ mode,
+ coin
+ }),
+ })
+ .catch(function(error) {
+ console.log(error);
+ dispatch(triggerToaster(true, 'startIguanaInstance', 'Error', 'error'));
+ })
+ .then(response => response.json())
+ .then(json => resolve(json))
+ });
+}
+
export function connectNotaries() {
const payload = {
'userpass': 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js
index 96c9ba6..985e9a2 100644
--- a/react/src/components/dashboard/walletsData.js
+++ b/react/src/components/dashboard/walletsData.js
@@ -57,7 +57,7 @@ class WalletsData extends React.Component {
}
componentDidMount() {
- console.log('use cache = ', this.state.useCache);
+ console.log('use cache = ', this.state.useCache);
}
toggleCacheApi() {
@@ -109,7 +109,7 @@ class WalletsData extends React.Component {
'coin': this.props.ActiveCoin.coin,
'calls': 'refresh',
'address': this.state.currentAddress,
- }));
+ }));
}
toggleBasiliskActionsMenu() {
@@ -461,7 +461,7 @@ class WalletsData extends React.Component {