// 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 debounce from 'debounce-promise'; import { Field, Form } from 'react-final-form'; import { Form as FetherForm, Header } from 'fether-ui'; import { inject, observer } from 'mobx-react'; import { isAddress } from '@parity/api/lib/util/address'; import { Link } from 'react-router-dom'; import { toWei } from '@parity/api/lib/util/wei'; import { withProps } from 'recompose'; import { estimateGas } from '../../utils/estimateGas'; import TokenBalance from '../../Tokens/TokensList/TokenBalance'; import withAccount from '../../utils/withAccount.js'; import withBalance, { withEthBalance } from '../../utils/withBalance'; import withTokens from '../../utils/withTokens'; const MAX_GAS_PRICE = 40; // In Gwei const MIN_GAS_PRICE = 3; // Safelow gas price from GasStation, in Gwei @inject('parityStore', 'sendStore') @withTokens @withProps(({ match: { params: { tokenAddress } }, tokens }) => ({ token: tokens[tokenAddress] })) @withAccount @withBalance // Balance of current token (can be ETH) @withEthBalance // ETH balance @observer class Send extends Component { handleSubmit = values => { const { accountAddress, history, sendStore, token } = this.props; sendStore.setTx(values); history.push(`/send/${token.address}/from/${accountAddress}/signer`); }; render () { const { accountAddress, sendStore: { tx }, token } = this.props; return (