Browse Source

start basilisk instance on add coin

all-modes
pbca26 8 years ago
parent
commit
5e5497c312
  1. 40
      react/src/actions/actionCreators.js
  2. 6
      react/src/components/dashboard/walletsData.js

40
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'),

6
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 {
<label className="padding-top-3" htmlFor="edexcoin_cache_api" onClick={this.toggleCacheApi}>Use cache</label>
</div>
</div>
<div className="row">
<div className="row" style={{padding: '20px 0 10px 0'}}>
<div className="col-sm-6">
{this.renderPaginationItemsPerPageSelector()}
</div>

Loading…
Cancel
Save