Browse Source

Merge pull request #29 from SuperNETorg/v0.25

V0.25
v0.25
pbca26 7 years ago
committed by GitHub
parent
commit
e3a238e90d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      react/src/assets/images/cryptologo/coqui.png
  2. 23
      react/src/components/dashboard/importKeyModal/importKeyModal.js
  3. 10
      react/src/components/dashboard/importKeyModal/importKeyModal.render.js
  4. 6
      react/src/components/dashboard/importKeyModal/importKeyModal.scss
  5. 3
      react/src/components/dashboard/navbar/navbar.render.js
  6. 11
      react/src/components/dashboard/sendCoin/sendCoin.js
  7. 20
      react/src/components/dashboard/sendCoin/sendCoin.render.js
  8. 40
      react/src/components/dashboard/settings/settings.bip39KeysPanel.js
  9. 34
      react/src/components/dashboard/settings/settings.exportKeysPanel.js
  10. 6
      react/src/components/dashboard/settings/settings.scss
  11. 21
      react/src/components/login/login.js
  12. 10
      react/src/components/login/login.render.js
  13. 7
      react/src/components/login/login.scss

BIN
react/src/assets/images/cryptologo/coqui.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

23
react/src/components/dashboard/importKeyModal/importKeyModal.js

@ -15,6 +15,8 @@ import {
ImportKeyModalRender, ImportKeyModalRender,
} from './importKeyModal.render'; } from './importKeyModal.render';
const SEED_TRIM_TIMEOUT = 5000;
// import gen komodo keys utils // import gen komodo keys utils
import '../../../util/crypto/gen/array.map.js'; import '../../../util/crypto/gen/array.map.js';
import '../../../util/crypto/gen/cryptojs.js'; import '../../../util/crypto/gen/cryptojs.js';
@ -44,6 +46,7 @@ class ImportKeyModal extends React.Component {
seedInputVisibility: false, seedInputVisibility: false,
wifInputVisibility: false, wifInputVisibility: false,
trimPassphraseTimer: null, trimPassphraseTimer: null,
seedExtraSpaces: false,
}; };
this.generateKeysFromPassphrase = this.generateKeysFromPassphrase.bind(this); this.generateKeysFromPassphrase = this.generateKeysFromPassphrase.bind(this);
this.toggleImportWithRescan = this.toggleImportWithRescan.bind(this); this.toggleImportWithRescan = this.toggleImportWithRescan.bind(this);
@ -62,18 +65,24 @@ class ImportKeyModal extends React.Component {
} }
updateInput(e) { updateInput(e) {
if (e.target.name === 'wifkeysPassphrase') { const newValue = e.target.value;
// remove any empty chars from the start/end of the string
const newValue = e.target.value;
clearTimeout(this.state.trimPassphraseTimer); clearTimeout(this.state.trimPassphraseTimer);
const _trimPassphraseTimer = setTimeout(() => { const _trimPassphraseTimer = setTimeout(() => {
if (newValue[0] === ' ' ||
newValue[newValue.length - 1] === ' ') {
this.setState({ this.setState({
wifkeysPassphrase: newValue ? newValue.trim() : '', // hardcoded field name seedExtraSpaces: true,
}); });
}, 2000); } else {
this.setState({
seedExtraSpaces: false,
});
}
}, SEED_TRIM_TIMEOUT);
if (e.target.name === 'wifkeysPassphrase') {
this.resizeLoginTextarea(); this.resizeLoginTextarea();
this.setState({ this.setState({

10
react/src/components/dashboard/importKeyModal/importKeyModal.render.js

@ -64,6 +64,16 @@ export const ImportKeyModalRender = function() {
<label <label
className="floating-label" className="floating-label"
htmlFor="wifkeysPassphrase">{ translate('INDEX.PASSPHRASE') }</label> htmlFor="wifkeysPassphrase">{ translate('INDEX.PASSPHRASE') }</label>
{ this.state.seedExtraSpaces &&
<span>
<i className="icon fa-warning seed-extra-spaces-warning"
data-tip="Your seed contains leading/trailing space characters"
data-html={ true }></i>
<ReactTooltip
effect="solid"
className="text-left" />
</span>
}
</div> </div>
<div className="text-align-center"> <div className="text-align-center">
<button <button

6
react/src/components/dashboard/importKeyModal/importKeyModal.scss

@ -33,4 +33,10 @@
top: -4px; top: -4px;
} }
} }
.seed-extra-spaces-warning {
position: absolute;
right: -3px;
font-size: 20px;
color: rgb(255, 75, 0);
}
} }

3
react/src/components/dashboard/navbar/navbar.render.js

@ -69,8 +69,7 @@ const NavbarRender = function() {
</a> </a>
</li> </li>
} }
{ this.props.ActiveCoin.coin !== 'CHIPS' && { this.props.ActiveCoin.mode !== 'spv' &&
this.props.ActiveCoin.mode !== 'spv' &&
<li className="nav-top-menu"> <li className="nav-top-menu">
<a onClick={ this.openImportKeyModal }> <a onClick={ this.openImportKeyModal }>
<i className="site-menu-icon"></i> { translate('IMPORT_KEY.IMPORT_KEY') } <i className="site-menu-icon"></i> { translate('IMPORT_KEY.IMPORT_KEY') }

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

@ -60,7 +60,7 @@ class SendCoin extends React.Component {
btcFeesAdvancedStep: 9, btcFeesAdvancedStep: 9,
btcFeesSize: 0, btcFeesSize: 0,
btcFeesTimeBasedStep: 1, btcFeesTimeBasedStep: 1,
btcPreflightRes: null, spvPreflightRes: null,
}; };
this.defaultState = JSON.parse(JSON.stringify(this.state)); this.defaultState = JSON.parse(JSON.stringify(this.state));
this.updateInput = this.updateInput.bind(this); this.updateInput = this.updateInput.bind(this);
@ -262,7 +262,7 @@ class SendCoin extends React.Component {
if (_coinAddresses && if (_coinAddresses &&
_coinAddresses[type] && _coinAddresses[type] &&
_coinAddresses[type].length) { _coinAddresses[type].length) {
_coinAddresses[type].map((address) => { _coinAddresses[type].map((address) => {
if (address.amount > 0 && if (address.amount > 0 &&
(type !== 'public' || (address.canspend && type === 'public'))) { (type !== 'public' || (address.canspend && type === 'public'))) {
_items.push( _items.push(
@ -486,7 +486,12 @@ class SendCoin extends React.Component {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
spvVerificationWarning: !sendPreflight.result.utxoVerified, spvVerificationWarning: !sendPreflight.result.utxoVerified,
spvPreflightSendInProgress: false, spvPreflightSendInProgress: false,
btcPreflightRes: this.props.ActiveCoin.coin === 'BTC' ? { fee: sendPreflight.result.fee, value: sendPreflight.result.value, change: sendPreflight.result.change } : null, spvPreflightRes: {
fee: sendPreflight.result.fee,
value: sendPreflight.result.value,
change: sendPreflight.result.change,
estimatedFee: sendPreflight.result.estimatedFee,
},
})); }));
} else { } else {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {

20
react/src/components/dashboard/sendCoin/sendCoin.render.js

@ -244,17 +244,17 @@ export const SendRender = function() {
</div> </div>
</div> </div>
} }
{ this.state.btcPreflightRes && { this.state.spvPreflightRes &&
<div className="row padding-top-20"> <div className="row padding-top-20">
<div className="col-xs-12"> <div className="col-xs-12">
<strong>Fee</strong> <strong>Fee</strong>
</div> </div>
<div className="col-lg-12 col-sm-12 col-xs-12">{ formatValue(this.state.btcPreflightRes.fee * 0.00000001) } ({ this.state.btcPreflightRes.fee } sats)</div> <div className="col-lg-12 col-sm-12 col-xs-12">{ formatValue(this.state.spvPreflightRes.fee * 0.00000001) } ({ this.state.spvPreflightRes.fee } sats)</div>
</div> </div>
} }
{ this.state.btcPreflightRes && { this.state.spvPreflightRes &&
<div className="row padding-top-20"> <div className="row padding-top-20">
{ this.state.btcPreflightRes.change === 0 && { this.state.spvPreflightRes.change === 0 &&
<div className="col-lg-12 col-sm-12 col-xs-12"> <div className="col-lg-12 col-sm-12 col-xs-12">
<strong>Adjusted amount</strong> <strong>Adjusted amount</strong>
<span> <span>
@ -265,13 +265,19 @@ export const SendRender = function() {
effect="solid" effect="solid"
className="text-left" /> className="text-left" />
</span> </span>
&nbsp;{ formatValue((this.state.btcPreflightRes.value * 0.00000001) - (this.state.btcPreflightRes.fee * 0.00000001)) } &nbsp;{ formatValue((this.state.spvPreflightRes.value * 0.00000001) - (this.state.spvPreflightRes.fee * 0.00000001)) }
</div> </div>
} }
{ this.state.btcPreflightRes.change > 0 && { this.state.spvPreflightRes.estimatedFee < 0 &&
<div className="col-lg-12 col-sm-12 col-xs-12 padding-bottom-20">
<strong>KMD interest</strong>&nbsp;
{ Math.abs(formatValue(this.state.spvPreflightRes.estimatedFee * 0.00000001)) } to { this.props.Dashboard.electrumCoins[this.props.ActiveCoin.coin].pub }
</div>
}
{ this.state.spvPreflightRes.change > 0 &&
<div className="col-lg-12 col-sm-12 col-xs-12"> <div className="col-lg-12 col-sm-12 col-xs-12">
<strong>Total (amount + transaction fee)</strong>&nbsp; <strong>Total (amount + transaction fee)</strong>&nbsp;
{ formatValue((this.state.btcPreflightRes.value * 0.00000001) + (this.state.btcPreflightRes.fee * 0.00000001)) } { formatValue((this.state.spvPreflightRes.value * 0.00000001) + (this.state.spvPreflightRes.fee * 0.00000001)) }
</div> </div>
} }
</div> </div>

40
react/src/components/dashboard/settings/settings.bip39KeysPanel.js

@ -7,6 +7,9 @@ import {
triggerToaster, triggerToaster,
} from '../../../actions/actionCreators'; } from '../../../actions/actionCreators';
import Store from '../../../store'; import Store from '../../../store';
import ReactTooltip from 'react-tooltip';
const SEED_TRIM_TIMEOUT = 5000;
class Bip39KeysPanel extends React.Component { class Bip39KeysPanel extends React.Component {
constructor() { constructor() {
@ -15,6 +18,7 @@ class Bip39KeysPanel extends React.Component {
keys: null, keys: null,
match: '', match: '',
passphrase: '', passphrase: '',
seedExtraSpaces: false,
seedInputVisibility: false, seedInputVisibility: false,
trimPassphraseTimer: null, trimPassphraseTimer: null,
addressdepth: 20, addressdepth: 20,
@ -51,18 +55,24 @@ class Bip39KeysPanel extends React.Component {
} }
updateInput(e) { updateInput(e) {
if (e.target.name === 'passphrase') { const newValue = e.target.value;
// remove any empty chars from the start/end of the string
const newValue = e.target.value;
clearTimeout(this.state.trimPassphraseTimer); clearTimeout(this.state.trimPassphraseTimer);
const _trimPassphraseTimer = setTimeout(() => { const _trimPassphraseTimer = setTimeout(() => {
if (newValue[0] === ' ' ||
newValue[newValue.length - 1] === ' ') {
this.setState({
seedExtraSpaces: true,
});
} else {
this.setState({ this.setState({
passphrase: newValue ? newValue.trim() : '', // hardcoded field name seedExtraSpaces: false,
}); });
}, 2000); }
}, SEED_TRIM_TIMEOUT);
if (e.target.name === 'passphrase') {
this.resizeLoginTextarea(); this.resizeLoginTextarea();
this.setState({ this.setState({
@ -103,12 +113,6 @@ class Bip39KeysPanel extends React.Component {
}); });
} }
updateInput(e) {
this.setState({
[e.target.name]: e.target.value,
});
}
render() { render() {
return ( return (
<div> <div>
@ -145,6 +149,16 @@ class Bip39KeysPanel extends React.Component {
<label <label
className="floating-label" className="floating-label"
htmlFor="passphrase">{ translate('INDEX.PASSPHRASE') }</label> htmlFor="passphrase">{ translate('INDEX.PASSPHRASE') }</label>
{ this.state.seedExtraSpaces &&
<span>
<i className="icon fa-warning seed-extra-spaces-warning"
data-tip="Your seed contains leading/trailing space characters"
data-html={ true }></i>
<ReactTooltip
effect="solid"
className="text-left" />
</span>
}
</div> </div>
</div> </div>
<div className="col-sm-5 no-padding-left"> <div className="col-sm-5 no-padding-left">

34
react/src/components/dashboard/settings/settings.exportKeysPanel.js

@ -7,6 +7,9 @@ import {
triggerToaster, triggerToaster,
} from '../../../actions/actionCreators'; } from '../../../actions/actionCreators';
import Store from '../../../store'; import Store from '../../../store';
import ReactTooltip from 'react-tooltip';
const SEED_TRIM_TIMEOUT = 5000;
class ExportKeysPanel extends React.Component { class ExportKeysPanel extends React.Component {
constructor() { constructor() {
@ -16,6 +19,7 @@ class ExportKeysPanel extends React.Component {
trimPassphraseTimer: null, trimPassphraseTimer: null,
wifkeysPassphrase: '', wifkeysPassphrase: '',
keys: null, keys: null,
seedExtraSpaces: false,
}; };
this.exportWifKeys = this.exportWifKeys.bind(this); this.exportWifKeys = this.exportWifKeys.bind(this);
this.toggleSeedInputVisibility = this.toggleSeedInputVisibility.bind(this); this.toggleSeedInputVisibility = this.toggleSeedInputVisibility.bind(this);
@ -109,18 +113,24 @@ class ExportKeysPanel extends React.Component {
} }
updateInput(e) { updateInput(e) {
if (e.target.name === 'wifkeysPassphrase') { const newValue = e.target.value;
// remove any empty chars from the start/end of the string
const newValue = e.target.value;
clearTimeout(this.state.trimPassphraseTimer); clearTimeout(this.state.trimPassphraseTimer);
const _trimPassphraseTimer = setTimeout(() => { const _trimPassphraseTimer = setTimeout(() => {
if (newValue[0] === ' ' ||
newValue[newValue.length - 1] === ' ') {
this.setState({ this.setState({
wifkeysPassphrase: newValue ? newValue.trim() : '', // hardcoded field name seedExtraSpaces: true,
}); });
}, 2000); } else {
this.setState({
seedExtraSpaces: false,
});
}
}, SEED_TRIM_TIMEOUT);
if (e.target.name === 'wifkeysPassphrase') {
this.resizeLoginTextarea(); this.resizeLoginTextarea();
this.setState({ this.setState({
@ -198,6 +208,16 @@ class ExportKeysPanel extends React.Component {
<label <label
className="floating-label" className="floating-label"
htmlFor="wifkeysPassphrase">{ translate('INDEX.PASSPHRASE') } / WIF</label> htmlFor="wifkeysPassphrase">{ translate('INDEX.PASSPHRASE') } / WIF</label>
{ this.state.seedExtraSpaces &&
<span>
<i className="icon fa-warning seed-extra-spaces-warning"
data-tip="Your seed contains leading/trailing space characters"
data-html={ true }></i>
<ReactTooltip
effect="solid"
className="text-left" />
</span>
}
</div> </div>
<div className="col-sm-12 col-xs-12 text-align-center"> <div className="col-sm-12 col-xs-12 text-align-center">
<button <button

6
react/src/components/dashboard/settings/settings.scss

@ -130,6 +130,12 @@
content: '\F273'; content: '\F273';
} }
} }
.seed-extra-spaces-warning {
position: absolute;
right: -3px;
font-size: 20px;
color: rgb(255, 75, 0);
}
} }
@keyframes max-height { @keyframes max-height {

21
react/src/components/login/login.js

@ -31,6 +31,7 @@ import { md5 } from '../../util/crypto/md5';
const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000; const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000;
const IGUNA_ACTIVE_COINS_TIMEOUT = 10000; const IGUNA_ACTIVE_COINS_TIMEOUT = 10000;
const SEED_TRIM_TIMEOUT = 5000;
// TODO: remove duplicate activehandle and activecoins calls // TODO: remove duplicate activehandle and activecoins calls
@ -64,6 +65,7 @@ class Login extends React.Component {
enableEncryptSeed: false, enableEncryptSeed: false,
selectedShortcutNative: '', selectedShortcutNative: '',
selectedShortcutSPV: '', selectedShortcutSPV: '',
seedExtraSpaces: false,
}; };
this.defaultState = JSON.parse(JSON.stringify(this.state)); this.defaultState = JSON.parse(JSON.stringify(this.state));
this.toggleActivateCoinForm = this.toggleActivateCoinForm.bind(this); this.toggleActivateCoinForm = this.toggleActivateCoinForm.bind(this);
@ -290,22 +292,27 @@ class Login extends React.Component {
} }
updateLoginPassPhraseInput(e) { updateLoginPassPhraseInput(e) {
// remove any empty chars from the start/end of the string
const newValue = e.target.value; const newValue = e.target.value;
clearTimeout(this.state.trimPassphraseTimer); clearTimeout(this.state.trimPassphraseTimer);
const _trimPassphraseTimer = setTimeout(() => { const _trimPassphraseTimer = setTimeout(() => {
this.setState({ if (newValue[0] === ' ' ||
loginPassphrase: newValue ? newValue.trim() : '', // hardcoded field name newValue[newValue.length - 1] === ' ') {
loginPassPhraseSeedType: this.getLoginPassPhraseSeedType(newValue), this.setState({
}); seedExtraSpaces: true,
}, 2000); });
} else {
this.setState({
seedExtraSpaces: false,
});
}
}, SEED_TRIM_TIMEOUT);
this.resizeLoginTextarea(); this.resizeLoginTextarea();
this.setState({ this.setState({
trimPassphraseTimer: _trimPassphraseTimer, // trimPassphraseTimer: _trimPassphraseTimer,
[e.target.name === 'loginPassphraseTextarea' ? 'loginPassphrase' : e.target.name]: newValue, [e.target.name === 'loginPassphraseTextarea' ? 'loginPassphrase' : e.target.name]: newValue,
loginPassPhraseSeedType: this.getLoginPassPhraseSeedType(newValue), loginPassPhraseSeedType: this.getLoginPassPhraseSeedType(newValue),
}); });

10
react/src/components/login/login.render.js

@ -102,6 +102,16 @@ const LoginRender = function() {
<div className="placeholder-label">{ this.state.loginPassPhraseSeedType }</div> <div className="placeholder-label">{ this.state.loginPassPhraseSeedType }</div>
</div> </div>
} }
{ this.state.seedExtraSpaces &&
<span>
<i className="icon fa-warning seed-extra-spaces-warning"
data-tip="Your seed contains leading/trailing space characters"
data-html={ true }></i>
<ReactTooltip
effect="solid"
className="text-left" />
</span>
}
{ this.state.loginPassphrase && { this.state.loginPassphrase &&
this.state.enableEncryptSeed && this.state.enableEncryptSeed &&
<div className="row"> <div className="row">

7
react/src/components/login/login.scss

@ -187,6 +187,13 @@ option.login-option {
} }
.page-login { .page-login {
.seed-extra-spaces-warning {
position: absolute;
right: -30px;
margin-top: 54px;
font-size: 20px;
color: rgb(255, 75, 0);
}
.addcoin-shortcut { .addcoin-shortcut {
display: inline-block; display: inline-block;
width: 46%; width: 46%;

Loading…
Cancel
Save