Browse Source

send coin pub validation; tools pub addr check

v0.25
pbca26 7 years ago
parent
commit
a41ea626f1
  1. 29
      react/src/components/dashboard/sendCoin/sendCoin.js
  2. 34
      react/src/components/dashboard/tools/tools.js
  3. 10
      react/src/components/dashboard/tools/tools.scss
  4. 74
      react/src/components/dashboard/tools/toolsPubCheck.js
  5. 19
      react/src/components/dex/table/dexSwapsTable.js
  6. 4
      react/src/components/overrides.scss

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

@ -541,15 +541,26 @@ class SendCoin extends React.Component {
}
if (!this.state.sendTo ||
this.state.sendTo.length < 34) {
Store.dispatch(
triggerToaster(
translate('SEND.SEND_TO_ADDRESS_MIN_LENGTH'),
translate('TOASTR.WALLET_NOTIFICATION'),
'error'
)
);
valid = false;
(this.state.sendTo && this.state.sendTo.substring(0, 2) !== 'zc')) {
const _validateAddress = mainWindow.addressVersionCheck(this.props.ActiveCoin.coin, this.state.sendTo);
let _msg;
if (_validateAddress === 'Invalid pub address') {
_msg = _validateAddress;
} else if (!_validateAddress) {
_msg = `${this.state.sendTo} is not a valid ${this.props.ActiveCoin.coin} pub address`;
}
if (_msg) {
Store.dispatch(
triggerToaster(
_msg,
translate('TOASTR.WALLET_NOTIFICATION'),
'error'
)
);
valid = false;
}
}
if (!isPositiveNumber(this.state.amount)) {

34
react/src/components/dashboard/tools/tools.js

@ -7,6 +7,7 @@ import ToolsOfflineSigCreate from './toolsOfflineSigCreate';
import ToolsOfflineSigScan from './toolsOfflineSigScan';
import ToolsSeedToWif from './toolsSeedToWif';
import ToolsWifToWif from './toolsWifToWif';
import ToolsPubCheck from './toolsPubCheck';
import ToolsStringToQr from './toolsStringToQr';
import ToolsMergeUTXO from './toolsMergeUtxo';
import ToolsSplitUTXO from './toolsSplitUtxo';
@ -25,6 +26,10 @@ class Tools extends React.Component {
});
}
/*renderButtons() {
Offline signing scan
}*/
render() {
return (
<div className="page margin-left-0">
@ -32,7 +37,7 @@ class Tools extends React.Component {
<div className="row">
<div className="col-sm-12 no-padding-left">
<h2>Tools</h2>
<div className="margin-top-20">
<div className="margin-top-20 tools-btn-block">
<button
type="button"
className="btn btn-default"
@ -41,53 +46,59 @@ class Tools extends React.Component {
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('offlinesig-scan') }>
Offline signing scan
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('string2qr') }>
String to QR
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('seed2kp') }>
Seed to key pair
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('wif2wif') }>
WIF to WIF
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('pubcheck') }>
Address version check
</button>
<button
type="button"
className="btn btn-default"
onClick={ () => this.setActiveSection('balance') }>
Balance *
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('utxo') }>
UTXO *
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('utxo-split') }>
Split UTXO **
</button>
<button
type="button"
className="btn btn-default margin-left-20"
className="btn btn-default"
onClick={ () => this.setActiveSection('utxo-merge') }>
Merge UTXO **
</button>
<div className="margin-top-10">* Electrum, ** Native</div>
<div className="margin-top-10 margin-left-20">* Electrum, ** Native</div>
</div>
<hr />
{ this.state.activeSection === 'offlinesig-create' &&
@ -108,6 +119,9 @@ class Tools extends React.Component {
{ this.state.activeSection === 'wif2wif' &&
<ToolsWifToWif />
}
{ this.state.activeSection === 'pubcheck' &&
<ToolsPubCheck />
}
{ this.state.activeSection === 'seed2kp' &&
<ToolsSeedToWif />
}

10
react/src/components/dashboard/tools/tools.scss

@ -36,4 +36,14 @@
top: -6px;
left: 18px;
}
.tools-btn-block {
position: relative;
left: -20px;
.btn {
margin-bottom: 20px;
margin-left: 20px;
}
}
}

74
react/src/components/dashboard/tools/toolsPubCheck.js

@ -0,0 +1,74 @@
import React from 'react';
import { translate } from '../../../translate/translate';
import mainWindow from '../../../util/mainWindow';
class ToolsPubCheck extends React.Component {
constructor() {
super();
this.state = {
pub: '',
pubResult: null,
};
this.updateInput = this.updateInput.bind(this);
this.pubCheck = this.pubCheck.bind(this);
}
pubCheck() {
this.setState({
pubResult: mainWindow.getCoinByPub(this.state.pub),
});
}
updateInput(e) {
this.setState({
[e.target.name]: e.target.value,
});
}
render() {
return (
<div className="row margin-left-10">
<div className="col-xlg-12 form-group form-material no-padding-left padding-bottom-10">
<h4>Pub address version check</h4>
</div>
<div className="col-sm-12 form-group form-material no-padding-left padding-top-10 padding-bottom-20">
<label
className="control-label col-sm-1 no-padding-left"
htmlFor="kmdWalletSendTo">Pub address</label>
<input
type="text"
className="form-control col-sm-3"
name="pub"
onChange={ this.updateInput }
value={ this.state.pub }
placeholder="Enter a pub address"
autoComplete="off"
required />
</div>
<div className="col-sm-12 form-group form-material no-padding-left margin-top-10 padding-bottom-10">
<button
type="button"
className="btn btn-info col-sm-2"
onClick={ this.pubCheck }>
Check version
</button>
</div>
{ this.state.pubResult &&
<div className="col-sm-12 form-group form-material no-padding-left margin-top-10">
{ this.state.pubResult.coin &&
<div>
<div>Coin(s): { this.state.pubResult.coin.map((item) => { return(<div key={ `tools-pub-check-${item}` }>{ item }</div>); }) }</div>
<div className="margin-top-10">Version: { this.state.pubResult.version }</div>
</div>
}
{ !this.state.pubResult.coin &&
<div>{ this.state.pubResult }</div>
}
</div>
}
</div>
);
}
}
export default ToolsPubCheck;

19
react/src/components/dex/table/dexSwapsTable.js

@ -123,14 +123,17 @@ class DexSwapsTable extends React.Component {
}
componentWillMount() {
const _swaps = this.props.Dex.swaps.swaps.filter(swap => swap.alice && swap.finishtime);
this.setState({
itemsList: _swaps,
filteredItemsList: this.filterData(_swaps, this.state.searchTerm),
showPagination: _swaps && _swaps.length >= this.state.defaultPageSize,
itemsListColumns: this.generateItemsListColumns(_swaps.length),
});
if (this.props.Dex.swaps &&
this.props.Dex.swaps.swaps) {
const _swaps = this.props.Dex.swaps.swaps.filter(swap => swap.alice && swap.finishtime);
this.setState({
itemsList: _swaps,
filteredItemsList: this.filterData(_swaps, this.state.searchTerm),
showPagination: _swaps && _swaps.length >= this.state.defaultPageSize,
itemsListColumns: this.generateItemsListColumns(_swaps.length),
});
}
}
componentWillReceiveProps(props) {

4
react/src/components/overrides.scss

@ -288,6 +288,10 @@ select{
cursor: pointer;
text-align: left;
img {
border-radius: 50%;
}
* { color: #757575 !important; }
.Select-clear {

Loading…
Cancel
Save