Newer
Older
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
import React, { Component } from 'react';
import { Field, Form } from 'react-final-form';
import { Form as FetherForm, Header } from 'fether-ui';
import { inject, observer } from 'mobx-react';
import { Link, Redirect } from 'react-router-dom';
import { withProps } from 'recompose';
import i18n, { packageNS } from '../../i18n';
Luke Schoen
committed
import RequireHealthOverlay from '../../RequireHealthOverlay';
import TokenAddress from '../../Tokens/TokensList/TokenAddress';
import withAccount from '../../utils/withAccount.js';
import withTokens from '../../utils/withTokens';
@withProps(({ match: { params: { tokenAddress } }, tokens }) => ({
token: tokens[tokenAddress]
const {
account: { address },
history,
sendStore,
token
} = this.props;
.send(values.password)
.then(() => history.push(`/send/${token.address}/from/${address}/sent`))
password:
error.text === 'Method not found'
? "Please enable the 'personal' api in the --ws-apis launch flag of Parity Ethereum."
: error.text
<Link to={`/tokens/${address}`} className='icon -back'>
{i18n.t(`${packageNS}:navigation.close`)}
title={
token && (
<h1>
{i18n.t(`${packageNS}:tx.header_send_prefix`, {
token: token.name
})}
</h1>
)
}
Luke Schoen
committed
<RequireHealthOverlay require='sync'>
<div className='window_content'>
<div className='box -padded'>
<TokenAddress
Luke Schoen
committed
copyAddress
drawers={[
<div key='txForm'>
<FetherForm.Field
className='form_field_value'
disabled
label={i18n.t(`${packageNS}:tx.form.field.to`)}
<FetherForm.Field
className='form_field_value'
disabled
defaultValue={`${tx.amount} ${token.symbol}`}
label={i18n.t(`${packageNS}:tx.form.field.amount`)}
/>
</div>,
<Form
key='signerForm'
onSubmit={this.handleAccept}
render={({ handleSubmit, pristine, submitting }) => (
<form noValidate onSubmit={handleSubmit}>
<p>{i18n.t(`${packageNS}:tx.form.label_unlock`)}</p>
label={i18n.t(`${packageNS}:tx.form.field.password`)}
name='password'
render={FetherForm.Field}
required
type='password'
/>
<nav className='form-nav -binary'>
<button
onClick={history.goBack}
type='button'
>
{i18n.t(`${packageNS}:navigation.back`)}
<button
className='button -submit'
disabled={pristine || submitting}
>
{i18n.t(`${packageNS}:tx.form.button_confirm_tx`)}
</button>
</nav>
</form>
)}
/>
]}
Luke Schoen
committed
shortAddress={false}
Luke Schoen
committed
</RequireHealthOverlay>