Browse Source

settings bip39 user select options

v0.25
pbca26 7 years ago
parent
commit
6b561c08f3
  1. 4
      react/src/actions/actions/electrum.js
  2. 54
      react/src/components/dashboard/settings/settings.bip39KeysPanel.js
  3. 6
      react/src/components/dashboard/settings/settings.scss
  4. 2
      react/src/translate/en.js

4
react/src/actions/actions/electrum.js

@ -313,7 +313,7 @@ export function shepherdElectrumListunspent(coin, address) {
}); });
} }
export function shepherdElectrumBip39Keys(seed, match) { export function shepherdElectrumBip39Keys(seed, match, addressdepth, accounts) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/seed/bip39/match`, { fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/electrum/seed/bip39/match`, {
method: 'POST', method: 'POST',
@ -323,6 +323,8 @@ export function shepherdElectrumBip39Keys(seed, match) {
body: JSON.stringify({ body: JSON.stringify({
seed, seed,
match, match,
addressdepth,
accounts,
}), }),
}) })
.catch((error) => { .catch((error) => {

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

@ -17,6 +17,8 @@ class Bip39KeysPanel extends React.Component {
passphrase: '', passphrase: '',
seedInputVisibility: false, seedInputVisibility: false,
trimPassphraseTimer: null, trimPassphraseTimer: null,
addressdepth: 20,
accounts: 1,
}; };
this._getBip39Keys = this._getBip39Keys.bind(this); this._getBip39Keys = this._getBip39Keys.bind(this);
this.updateInput = this.updateInput.bind(this); this.updateInput = this.updateInput.bind(this);
@ -35,6 +37,9 @@ class Bip39KeysPanel extends React.Component {
passphrase: '', passphrase: '',
keys: null, keys: null,
match: null, match: null,
accounts: 1,
addressdepth: 20,
seedInputVisibility: false,
})); }));
} }
} }
@ -86,8 +91,12 @@ class Bip39KeysPanel extends React.Component {
} }
_getBip39Keys() { _getBip39Keys() {
shepherdElectrumBip39Keys(this.state.passphrase, this.state.match) shepherdElectrumBip39Keys(
.then((res) => { this.state.passphrase,
this.state.match,
this.state.addressdepth,
this.state.accounts
).then((res) => {
this.setState({ this.setState({
keys: res.result.priv ? res.result : 'empty', keys: res.result.priv ? res.result : 'empty',
}); });
@ -110,7 +119,7 @@ class Bip39KeysPanel extends React.Component {
</h4> </h4>
<div>{ translate('SETTINGS.BIP39_DESC_P1') }</div> <div>{ translate('SETTINGS.BIP39_DESC_P1') }</div>
<div>{ translate('SETTINGS.BIP39_DESC_P2') }</div> <div>{ translate('SETTINGS.BIP39_DESC_P2') }</div>
<div> <div className="bip39-search">
<div className="col-sm-12 no-padding-left margin-top-10"> <div className="col-sm-12 no-padding-left margin-top-10">
<div className="form-group form-material floating"> <div className="form-group form-material floating">
<input <input
@ -138,7 +147,7 @@ class Bip39KeysPanel extends React.Component {
htmlFor="passphrase">{ translate('INDEX.PASSPHRASE') }</label> htmlFor="passphrase">{ translate('INDEX.PASSPHRASE') }</label>
</div> </div>
</div> </div>
<div className="col-sm-4 no-padding-left text-center"> <div className="col-sm-5 no-padding-left">
<input <input
type="text" type="text"
className="form-control margin-top-10" className="form-control margin-top-10"
@ -153,6 +162,43 @@ class Bip39KeysPanel extends React.Component {
disabled={ !this.state.match || !this.state.passphrase || this.state.passphrase.length < 2 } disabled={ !this.state.match || !this.state.passphrase || this.state.passphrase.length < 2 }
onClick={ this._getBip39Keys }>Get key</button> onClick={ this._getBip39Keys }>Get key</button>
</div> </div>
<div className="col-sm-2 no-padding-left text-center margin-top-10 margin-left-50">
<select
className="form-control form-material"
name="accounts"
value={ this.state.accounts }
onChange={ (event) => this.updateInput(event) }
autoFocus>
<option value="1">1 account</option>
<option value="2">2 accounts</option>
<option value="3">3 accounts</option>
<option value="4">4 accounts</option>
<option value="5">5 accounts</option>
<option value="6">6 accounts</option>
<option value="7">7 accounts</option>
<option value="8">8 accounts</option>
<option value="9">9 accounts</option>
<option value="10">10 accounts</option>
</select>
</div>
<div className="col-sm-2 no-padding-left text-center margin-top-10">
<select
className="form-control form-material"
name="addressdepth"
value={ this.state.addressdepth }
onChange={ (event) => this.updateInput(event) }
autoFocus>
<option value="20">20 addresses</option>
<option value="30">30 addresses</option>
<option value="40">40 addresses</option>
<option value="50">50 addresses</option>
<option value="60">60 addresses</option>
<option value="70">70 addresses</option>
<option value="80">80 addresses</option>
<option value="90">90 addresses</option>
<option value="100">100 addresses</option>
</select>
</div>
</div> </div>
</div> </div>
{ this.state.keys && { this.state.keys &&

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

@ -143,4 +143,10 @@
100% { 100% {
max-height: none; max-height: none;
} }
}
.bip39-search,
.bip39-search input,
.bip39-search textarea {
color: #757575 !important;
} }

2
react/src/translate/en.js

@ -605,7 +605,7 @@ export const _lang = {
}, },
'SETTINGS': { 'SETTINGS': {
'BIP39_DISC': 'Hardware wallets disclaimer: by using this form you\'re acknowledging risks of exposing your seed', 'BIP39_DISC': 'Hardware wallets disclaimer: by using this form you\'re acknowledging risks of exposing your seed',
'BIP39_DESC_P1': 'Description: the form below is going to search for a pub key in a range of 20 accounts with 50 addresses depth each (1000 keys).', 'BIP39_DESC_P1': 'Description: the form below is going to search for a pub key depending on a range of key path combinations is chosen (No of accounts * account address path depth).',
'BIP39_DESC_P2': 'The app might temporary freeze for several seconds during search procedure.', 'BIP39_DESC_P2': 'The app might temporary freeze for several seconds during search procedure.',
'SHOW_APP_RUNTIME_LOG': 'Show app runtime log', 'SHOW_APP_RUNTIME_LOG': 'Show app runtime log',
'WRONG_PASSPHRASE': 'Wrong passphrase!', 'WRONG_PASSPHRASE': 'Wrong passphrase!',

Loading…
Cancel
Save