Content
@
https://warpcast.com/~/channel/frames-devs
0 reply
0 recast
0 reaction
Greg
@greg
how are frame devs doing ERC20 approval flows?
7 replies
0 recast
42 reactions
Matthew Fox π
@matthewfox
Like this Both actions same screen, approve loops back on route and mint proceeds to a watch tx stage *I should have made he button actions change to highlight actions better https://mint.enjoyment.network
1 reply
0 recast
1 reaction
Greg
@greg
what if the user approved once and then tries to mint again? have you figured out a way to check for approvals or you just make the user do it every time?
4 replies
0 recast
0 reaction
Mark Carey π©π«
@markcarey
I do this in my /toka frame. Before rendering the "Approve" button, my code checks the allowance of the user's verified address: const allowance = await degen.allowance(userAddress, spenderAddress); Then if the allowance is sufficient, I skip the "Approve" button and go straight to the Mint button.
1 reply
0 recast
0 reaction
vrypan |--o--|
@vrypan.eth
Can't you check allowance() to see if you have enough approved?
1 reply
0 recast
0 reaction
Matthew Fox π
@matthewfox
they would go back to the start of the flow after a successful mint so yeah they would approve again on the way in approve the correct amount spend the correct amount but I like the idea of checking for the approval so users wouldn't have to provided they had a high enough approval already
0 reply
0 recast
2 reactions
K
@kijijij
This can be done @greg , when User clicks txn button, backend will receive connected address, you can check if connected address has enough allowance to transfer the funds. ERC20.allowance() should help checking the allowance.
0 reply
0 recast
0 reaction