Browse Source

temp

all-modes
pbca26 8 years ago
parent
commit
d521b6e319
  1. 9
      react/src/actions/actionCreators.js
  2. 95
      react/src/components/dashboard/loginModal.js
  3. 22
      react/src/components/dashboard/sendCoin.js
  4. 3
      react/src/config.js

9
react/src/actions/actionCreators.js

@ -1270,7 +1270,7 @@ export function fetchUtxoCache(_payload) {
_route = _payload.allcoins ? 'cache-all' : 'cache-one',
_coin = '&coin=' + _payload.coin,
_calls = '&calls=' + _payload.calls,
_address = '&address' + _payload.address,
_address = '&address=' + _payload.address,
_iguanaInstancePort = Config.useBasiliskInstance ? '&port=' + Config.basiliskPort : '';
return dispatch => {
@ -1829,6 +1829,13 @@ function sendToAddressState(json, dispatch) {
}
}
export function sendToAddressStateAlt(json) {
return {
type: DASHBOARD_ACTIVE_COIN_SENDTO,
lastSendToResponse: json,
}
}
export function clearLastSendToResponseState() {
return {
type: DASHBOARD_ACTIVE_COIN_SENDTO,

95
react/src/components/dashboard/loginModal.js

@ -0,0 +1,95 @@
import React from 'react';
import { translate } from '../../translate/translate';
import {
toggleAddcoinModal,
iguanaWalletPassphrase,
iguanaActiveHandle
} from '../../actions/actionCreators';
import Store from '../../store';
class LoginModal extends React.Component {
constructor(props) {
super(props);
this.state = {
display: false,
activeLoginSection: 'activateCoin',
loginPassphrase: null,
seedInputVisibility: false,
};
/*this.toggleActivateCoinForm = this.toggleActivateCoinForm.bind(this);
this.updateInput = this.updateInput.bind(this);
this.loginSeed = this.loginSeed.bind(this);
this.toggleSeedInputVisibility = this.toggleSeedInputVisibility.bind(this);
this.handleRegisterWallet = this.handleRegisterWallet.bind(this);*/
}
toggleSeedInputVisibility() {
this.setState({
seedInputVisibility: !this.state.seedInputVisibility,
});
}
toggleActivateCoinForm() {
Store.dispatch(toggleAddcoinModal(true, false));
}
updateInput(e) {
this.setState({
[e.target.name]: e.target.value,
isSeedConfirmError: false,
});
}
loginSeed() {
Store.dispatch(iguanaWalletPassphrase(this.state.loginPassphrase));
}
render() {
if (this.props.Dashboard.activateLoginModal) {
return (
<div>
<div className={'modal modal-3d-sign add-coin-modal ' + (this.state.display ? 'show in' : 'fade hide')} id="AddCoinDilogModel-login" aria-hidden="true" aria-labelledby="AddCoinDilogModel-login" role="dialog" tabIndex="-1">
<div className="modal-dialog modal-center modal-lg">
<div className="modal-content">
<div className="modal-header bg-orange-a400 wallet-send-header">
<button type="button" className="close white" data-dismiss="modal" aria-label="Close" onClick={this.dismiss}>
<span aria-hidden="true">×</span>
</button>
<h4 className="modal-title white">{translate('INDEX.SELECT_A_COIN')}</h4>
</div>
<div className="modal-body">
<div id="wallet-login">
<div className="page animsition vertical-align text-center fade-in" data-animsition-in="fade-in" data-animsition-out="fade-out">
<div className="page-content vertical-align-middle">
<div className="brand">
<img className="brand-img" src="assets/images/easydex-logo-big.png" alt="SuperNET Iguana" />
</div>
<div id="section-login" className={this.state.activeLoginSection === 'login' ? 'show' : 'hide'}>
<h4 style={{ color: '#fff' }} id="login-welcome">{translate('INDEX.WELCOME_LOGIN')}</h4>
<div className="login-form">
<div className="form-group form-material floating">
<input type={this.state.seedInputVisibility ? 'text' : 'password'} className="form-control" name="loginPassphrase" id="password" onChange={this.updateInput} />
<i className={this.state.seedInputVisibility ? 'seed-toggle fa fa-eye-slash' : 'seed-toggle fa fa-eye'} onClick={this.toggleSeedInputVisibility}></i>
<label className="floating-label" htmlFor="inputPassword">{translate('INDEX.WALLET_SEED')}</label>
</div>
<button type="button" className="btn btn-primary btn-block" id="loginbtn" onClick={this.loginSeed} disabled={!this.state.loginPassphrase || !this.state.loginPassphrase.length}>{translate('INDEX.SIGN_IN')}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
} else {
return null;
}
}
}
export default LoginModal;

22
react/src/components/dashboard/sendCoin.js

@ -9,7 +9,8 @@ import {
resolveOpenAliasAddress,
triggerToaster,
iguanaUTXORawTX,
clearLastSendToResponseState
clearLastSendToResponseState,
sendToAddressStateAlt
} from '../../actions/actionCreators';
import Store from '../../store';
@ -139,7 +140,7 @@ class SendCoin extends React.Component {
if (step === 2) {
if (!this.state.sendApiType && this.props.ActiveCoin.mode === 'basilisk') {
handleBasiliskSend();
this.handleBasiliskSend();
} else {
Store.dispatch(sendToAddress(this.props.ActiveCoin.coin, this.state));
}
@ -166,7 +167,9 @@ class SendCoin extends React.Component {
}
handleBasiliskSend() {
const utxoSet = this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.state.sendFrom].refresh;
const refreshData = this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.state.sendFrom].refresh;
const listunspentData = this.props.ActiveCoin.cache[this.props.ActiveCoin.coin][this.state.sendFrom].listunspent;
const utxoSet = refreshData && refreshData.data || listunspentData && listunspentData.data;
const sendData = {
'coin': this.props.ActiveCoin.coin,
'sendfrom': this.state.sendFrom,
@ -181,15 +184,20 @@ class SendCoin extends React.Component {
console.log('sendData', sendData);
console.log('iguanaUTXORawTXJSON', json);
if (json.result === 'success' && json.completed === true) {
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_GENERATED') + '.', translate('TOASTR.WALLET_NOTIFICATION')));
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_GENERATED') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
Store.dispatch(sendToAddressStateAlt(json));
if (sendData.sendsig === 1) {
Store.dispatch(triggerToaster(true, translate('TOASTR.SENDING_TX') + '.', translate('TOASTR.WALLET_NOTIFICATION')));
ajax_data_dexrawtx = {
//Store.dispatch(triggerToaster(true, translate('TOASTR.SENDING_TX') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'success'));
/*ajax_data_dexrawtx = {
'signedtx': json.signedtx,
'coin': sendData.coin
};
};*/
} else {
Store.dispatch(sendToAddressStateAlt(json));
}
} else {
Store.dispatch(triggerToaster(true, translate('TOASTR.SIGNED_TX_GENERATED_FAIL') + '.', translate('TOASTR.WALLET_NOTIFICATION'), 'error'));
}
console.log(json);
});

3
react/src/config.js

@ -4,6 +4,7 @@ module.exports = {
agamaPort: 17777,
enableCacheApi: true,
useBasiliskInstance: true,
openAlias: true,
useForksAll: true,
openAlias: false,
debug: true,
};

Loading…
Cancel
Save