Browse Source

experimental dex iguana instance code

all-modes
pbca26 8 years ago
parent
commit
18161b14d2
  1. 20
      react/src/actions/actionCreators.js
  2. 17
      react/src/components/dashboard/walletsData.js
  3. 2
      react/src/config.js

20
react/src/actions/actionCreators.js

@ -701,7 +701,7 @@ export function getBasiliskTransactionsList(coin, address) {
};
return dispatch => {
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.basiliskPort : Config.iguanaCorePort), {
method: 'POST',
body: JSON.stringify(payload),
})
@ -1002,7 +1002,7 @@ export function getKMDAddressesNative(coin, mode, currentAddress) {
};
}
fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance && mode === 'basilisk' ? Config.basiliskPort : Config.iguanaCorePort), {
method: 'POST',
body: JSON.stringify(payload),
})
@ -1272,7 +1272,7 @@ export function getDexBalance(coin, addr) {
};
console.log('addr', _addr);
return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.basiliskPort : Config.iguanaCorePort), {
method: 'POST',
body: JSON.stringify(payload),
})
@ -1640,7 +1640,7 @@ export function checkAddressBasilisk(coin, address) {
};
return dispatch => {
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.basiliskPort : Config.iguanaCorePort), {
method: 'POST',
body: JSON.stringify(payload),
})
@ -1680,7 +1680,7 @@ export function validateAddressBasilisk(coin, address) {
};
return dispatch => {
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.basiliskPort : Config.iguanaCorePort), {
method: 'POST',
body: JSON.stringify(payload),
})
@ -1715,7 +1715,7 @@ export function getDexNotaries(coin) {
};
return dispatch => {
return fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
return fetch('http://127.0.0.1:' + (Config.useBasiliskInstance ? Config.basiliskPort : Config.iguanaCorePort), {
method: 'POST',
body: JSON.stringify(payload),
})
@ -1785,10 +1785,12 @@ export function fetchNewCacheData(_payload) {
_pubkey = '&pubkey=' + _payload.pubkey,
_route = _payload.allcoins ? 'cache-all' : 'cache-one',
_coin = '&coin=' + _payload.coin,
_calls = '&calls=' + _payload.calls;
_calls = '&calls=' + _payload.calls,
_iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + Config.basiliskPort : '';
console.log('fetchNewCacheData', 'http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls + _iguanaInstancePort);
return dispatch => {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls, {
return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/' + _route + _userpass + _pubkey + _coin + _calls + _iguanaInstancePort, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
@ -1814,7 +1816,7 @@ function initNotaryNodesConSequence(nodes) {
};
return new Promise((resolve, reject) => {
fetch('http://127.0.0.1:' + Config.iguanaCorePort, {
fetch('http://127.0.0.1:' + Config.useBasiliskInstance ? Config.basiliskPort : Config.iguanaCorePort, {
method: 'POST',
body: JSON.stringify(payload),
})

17
react/src/components/dashboard/walletsData.js

@ -12,7 +12,8 @@ import {
displayNotariesModal,
deleteCacheFile,
connectNotaries,
toggleViewCacheModal
toggleViewCacheModal,
fetchNewCacheData
} from '../../actions/actionCreators';
import Store from '../../store';
@ -91,9 +92,15 @@ class WalletsData extends React.Component {
}
basiliskRefreshAction() {
if (this.props.Dashboard) {
/*if (this.props.Dashboard) {
Store.dispatch(basiliskRefresh(!this.props.Dashboard.basiliskRefresh));
}
}*/
Store.dispatch(fetchNewCacheData({
'pubkey': this.props.Dashboard.activeHandle.pubkey,
'allcoins': false,
'coin': this.props.ActiveCoin.coin,
'calls': 'listtransactions:getbalance',
}));
}
basiliskConnectionAction() {
@ -392,12 +399,12 @@ class WalletsData extends React.Component {
</li>
<li data-edexcoin="COIN" role="presentation">
<a className="btn_edexcoin_dashboard_fetchdata" data-edexcoin="COIN" id="btn_edexcoin_dashboard_fetchdata" role="menuitem" onClick={this.basiliskRefreshAction}>
<i className="icon fa-cloud-download" aria-hidden="true"></i> {translate('INDEX.FETCH_WALLET_DATA')}
<i className="icon fa-cloud-download" aria-hidden="true"></i> {translate('INDEX.FETCH_WALLET_DATA')}
</a>
</li>
<li data-edexcoin="COIN" role="presentation">
<a className="btn_edexcoin_dashboard_refetchdata" data-edexcoin="COIN" id="btn_edexcoin_dashboard_refetchdata" role="menuitem" onClick={this.removeAndFetchNewCache}>
<i className="icon fa-cloud-download" aria-hidden="true"></i> {translate('INDEX.REFETCH_WALLET_DATA')}
<i className="icon fa-history" aria-hidden="true"></i> {translate('INDEX.REFETCH_WALLET_DATA')}
</a>
</li>
<li data-edexcoin="COIN" role="presentation">

2
react/src/config.js

@ -1,5 +1,7 @@
module.exports = {
iguanaCorePort: 7778,
basiliskPort: 7779,
agamaPort: 17777,
enableCacheApi: false,
useBasiliskInstance: true,
};

Loading…
Cancel
Save