import * as React from "react"; import * as Strings from "~/common/strings"; import * as Constants from "~/common/constants"; import * as System from "~/components/system"; import * as Events from "~/common/custom-events"; import { css } from "@emotion/react"; const STYLES_FOCUS = css` font-size: ${Constants.typescale.lvl1}; font-family: ${Constants.font.medium}; overflow-wrap: break-word; width: 100%; strong { font-family: ${Constants.font.semiBold}; font-weight: 400; } `; const STYLES_SUBTEXT = css` margin-top: 8px; font-size: 12px; `; const STYLES_ITEM = css` margin-top: 16px; `; export default class SidebarWalletSendFunds extends React.Component { state = { address: "", amount: "", }; _handleSubmit = async () => { this.setState({ loading: true }); let addresses = {}; this.props.viewer.addresses.forEach((a) => { addresses[a.value] = a; }); const currentAddress = addresses[this.props.selected.address]; if (currentAddress.address === this.state.address) { Events.dispatchMessage({ message: "You cannot send funds from an address to itself. Please enter a different address", }); this.setState({ loading: false }); return; } await Actions.sendFilecoin({ source: currentAddress.address, target: this.state.address, amount: this.state.amount, }); this.props.onCancel(); this.setState({ loading: false }); }; _handleCancel = () => { this.props.onCancel(); }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); }; render() { return ( Send Filecoin
0 FIL
Transaction Fee
{Strings.formatNumber(this.state.amount)}
Total Filecoin
Send Cancel
); } }