Newer
Older
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause
import React, { Component } from 'react';
import { Card, Header } from 'fether-ui';
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { inject, observer } from 'mobx-react';
import { Link, Redirect } from 'react-router-dom';
import QrSigner from '@parity/qr-signer';
import { withProps } from 'recompose';
import RequireHealth from '../../RequireHealthOverlay';
import withAccount from '../../utils/withAccount.js';
import withTokens from '../../utils/withTokens';
@inject('sendStore')
@withAccount
@withTokens
@withProps(({ match: { params: { tokenAddress } }, tokens }) => ({
token: tokens[tokenAddress]
}))
@observer
class TxQrCode extends Component {
handleNextStep = () => {
const {
history,
token,
account: { address: accountAddress }
} = this.props;
history.push(`/send/${token.address}/from/${accountAddress}/scansignedtx`);
};
render () {
const {
account: { address },
history,
sendStore: { tx, getRlp },
token
} = this.props;
if (!Object.keys(tx).length || !token) {
return <Redirect to='/' />;
}
return (
<div>
<Header
left={
<Link to={`/tokens/${address}`} className='icon -back'>
Close
</Link>
}
title={token && <h1>Send {token.name}</h1>}
/>
<RequireHealth require='sync'>
<div className='window_content'>
<div className='box -padded'>
<Card className='-centered'>
<p>
Please scan the QR code of the transaction on Parity Signer
</p>
<br />
<QrSigner
scan={false}
onScan={() => {}}
account={address}
rlp={getRlp()}
/>
<nav className='form-nav -space-around'>
<button
onClick={history.goBack}
type='button'
>
Back
</button>
<button
className='button -submit'
onClick={this.handleNextStep}
>
Next step
</button>
</nav>
</Card>