Wait for approval tx confirmation when paying for subscription

This commit is contained in:
silverpill 2022-02-06 15:07:53 +00:00
parent 67cd088ffa
commit b52a2f947c

View file

@ -66,7 +66,9 @@ export async function makeSubscriptionPayment(
subscription.address, subscription.address,
) )
if (allowance.lt(amount)) { if (allowance.lt(amount)) {
await token.approve(subscription.address, amount) const approved = await token.approve(subscription.address, amount)
// Wait for confirmation
await approved.wait()
} }
const transaction = await subscription.send( const transaction = await subscription.send(
recipientAddress, recipientAddress,