import React from 'react' import { FixedLimitDeposit} from './action' import GetContractArgs from '../../constants' class Save extends React.Component { constructor(props) { super(props); this.state = { amount: '', address: '', msg:'', error:'' }; this.handleInputChange = this.handleInputChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } componentDidMount() { if ( window.bytom && window.bytom.defaultAccount ) { this.setState({ account: window.bytom.defaultAccount }) } } handleInputChange(event) { const target = event.target; const value = target.value; const name = target.name; this.setState({ [name]: value }); } handleSubmit(event) { event.preventDefault(); const amount = Number(event.target.amount.value) const account = this.state.account const address = account.address FixedLimitDeposit(amount, address) .then(()=> { this.setState({ error:'', msg:`Submit success!!! you spent ${amount} deposite asset,and gain ${amount} bill asset.` }) }).catch(err => { this.setState({ error:err, msg: '' }) }) } render() { return (

Deposit

Deposit should happen under the block height {GetContractArgs().dueBlockHeight}.

Spend {this.state.amount} Deposit Asset from your current chrome extension account {this.state.account&&this.state.account.alias} and you will get the relevant {this.state.amount} Bill Asset.

Please make sure that your account has enough Deposit Asset.

Fee: {GetContractArgs().gas} BTM

{this.state.msg &&
{this.state.msg}
} {this.state.error &&
{this.state.error}
}
) } } export default Save