// Copyright 2015-2018 Parity Technologies (UK) Ltd. // This file is part of Parity. // // SPDX-License-Identifier: MIT import React, { PureComponent } from 'react'; import { defaultAccount$, myBalance$ } from '@parity/light.js'; import { map } from 'rxjs/operators'; import { fromWei, toWei } from '@parity/api/lib/util/wei'; import light from 'light-hoc'; import { Link } from 'react-router-dom'; import ethereumIcon from '../assets/img/tokens/ethereum.png'; @light({ balance: () => myBalance$().pipe(map(value => +fromWei(value))), me: defaultAccount$ }) class Send extends PureComponent { state = { amount: 0.01, // In Ether gas: 21000, to: '0x00Ae02834e91810B223E54ce3f9B7875258a1747' }; handleChangeAmount = ({ target: { value } }) => this.setState({ amount: value }); handleChangeGas = ({ target: { value } }) => this.setState({ gas: value }); handleChangeTo = ({ target: { value } }) => this.setState({ to: value }); handleSubmit = e => { e.preventDefault(); const { history, me } = this.props; const { amount, gas, to } = this.state; const tx = { from: me, gas, to, value: toWei(amount) }; history.push(`/signer`, tx); }; render () { const { balance } = this.props; const { amount, gas, to } = this.state; return (
ethereum
Ethereum
{balance} ETH