1 import React from 'react'
2 import { FixedLimitDeposit} from './action'
3 import { dueBlockHeight, gas } from '../../constants'
5 class Save extends React.Component {
16 this.handleInputChange = this.handleInputChange.bind(this);
17 this.handleSubmit = this.handleSubmit.bind(this);
23 && window.bytom.defaultAccount
25 this.setState({ account: window.bytom.defaultAccount })
29 handleInputChange(event) {
30 const target = event.target;
31 const value = target.value;
32 const name = target.name;
40 event.preventDefault();
42 const amount = Number(event.target.amount.value)
43 const account = this.state.account
44 const address = account.address
46 FixedLimitDeposit(account, amount, address)
50 msg:`Submit success!!! you spent ${amount} deposite asset,and gain ${amount} bill asset.`
64 <div className="mt-3 mb-4">
65 <p className='lead'>Deposit should happen under the block height {dueBlockHeight}.</p>
66 <p className='lead' >Spend {this.state.amount} Deposit Asset from your current chrome extension account <b className="font-weight-bolder text-uppercase">{this.state.account&&this.state.account.alias}</b> and you will get the relevant {this.state.amount} Bill Asset.</p>
67 <p>Please make sure that your account has enough Deposit Asset.</p>
69 <form onSubmit={this.handleSubmit}>
70 <div className="form-group">
71 <label>Deposit Asset Amount</label>
74 className="form-control"
75 placeholder="Amount Saving"
77 value={this.state.amount}
78 onChange={this.handleInputChange} />
81 <button type="submit" className="btn btn-primary">Spend Asset</button>
83 {this.state.msg && <div className="alert alert-success mt-4" role="alert">
86 {this.state.error && <div className="alert alert-danger mt-4" role="alert">