add log to approval set
This commit is contained in:
parent
9a56838ad8
commit
832fa1bcc7
|
@ -43,14 +43,18 @@ class TokenHandle extends PureComponent {
|
|||
const { approved } = this.state;
|
||||
const { methods: { approve }, spender } = this.props;
|
||||
const isApproved = !!Number(approved);
|
||||
let amountToApprove = isApproved ? 0 : unlimitedAllowance;
|
||||
console.log("approve(\""+spender+"\",\"" +amountToApprove +"\")")
|
||||
approve(
|
||||
spender,
|
||||
isApproved ? 0 : unlimitedAllowance
|
||||
amountToApprove
|
||||
)
|
||||
.send()
|
||||
.then(approval => {
|
||||
const { events: { Approval: { returnValues: { _value } } } } = approval
|
||||
this.setState({ ...this.state, approved: _value })
|
||||
}).catch(err => {
|
||||
console.log("Approve failed: " + err);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue