1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-30 20:28:09 +00:00

Pass path properly

This commit is contained in:
Vladimir Volek 2018-10-17 16:54:27 +02:00
parent ca460859ac
commit 78d2b411fb

View File

@ -65,10 +65,12 @@ class SignVerify extends Component {
};
}
getPath() {
return this.props.selectedAccount.account.addressPath;
}
handleSignInput = (e) => {
console.log('aaa', e.target);
this.setState({ sign: { [e.target.name]: e.target.value } });
console.log(this.state);
}
handleVerifyInput = (e) => {
@ -96,50 +98,93 @@ class SignVerify extends Component {
});
}
getPath() {
const { account } = this.props;
return account.addressPath;
}
render() {
const { signVerifyActions } = this.props;
return (
<Content>
<Title>Sign & Verify</Title>{this.state.sign.message || 'no message'}
<Title>Sign & Verify</Title>
<Wrapper>
<Sign>
<Row>
<Label>Address</Label>
<Input name="address" value={this.state.sign.address} onChange={this.handleSignInput} height={50} type="text" disabled />
<Input
name="address"
value={this.state.sign.address}
onChange={this.handleSignInput}
height={50}
type="text"
disabled
/>
</Row>
<Row>
<Label>Message</Label>
<Textarea name="message" value={this.state.sign.message} onChange={this.handleSignInput} rows="2" maxLength="255" />
<Textarea
name="message"
value={this.state.sign.message}
onChange={this.handleSignInput}
rows="2"
maxLength="255"
/>
</Row>
<Row>
<Label>Signature</Label>
<Textarea name="signature" value={this.state.sign.signature} onChange={this.handleSign} rows="2" maxLength="255" disabled />
<Textarea
name="signature"
value={this.state.sign.signature}
onChange={this.handleSign}
rows="2"
maxLength="255"
disabled
/>
</Row>
<RowButtons>
<Button onClick={this.clearVerify} isWhite>Clear</Button>
<StyledButton onClick={() => signVerifyActions.sign(this.getPath(), this.state.sign.message)}>Sign</StyledButton>
<Button
onClick={this.clearVerify}
isWhite
>Clear
</Button>
<StyledButton
onClick={() => signVerifyActions.sign(this.getPath(), this.state.sign.message)}
>Sign
</StyledButton>
</RowButtons>
</Sign>
<Verify>
<Row>
<Label>Address</Label>
<Input name="address" value={this.state.verify.address} onChange={this.handleVerifyInput} type="text" />
<Input
name="address"
value={this.state.verify.address}
onChange={this.handleVerifyInput}
type="text"
/>
</Row>
<Row>
<Label>Message</Label>
<Textarea name="message" value={this.state.verify.message} onChange={this.handleVerifyInput} rows="4" maxLength="255" />
<Textarea
name="message"
value={this.state.verify.message}
onChange={this.handleVerifyInput}
rows="4"
maxLength="255"
/>
</Row>
<Row>
<Label>Signature</Label>
<Textarea name="signature" value={this.state.verify.signature} onChange={this.handleVerifyInput} rows="4" maxLength="255" />
<Textarea
name="signature"
value={this.state.verify.signature}
onChange={this.handleVerifyInput}
rows="4"
maxLength="255"
/>
</Row>
<RowButtons>
<Button onClick={this.clearSign} isWhite>Clear</Button>
<Button
onClick={this.clearSign}
isWhite
>Clear
</Button>
<StyledButton>Verify</StyledButton>
</RowButtons>
</Verify>