Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check against allowance on create stream #88

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

alexisnsns
Copy link
Contributor

@alexisnsns alexisnsns commented Dec 19, 2023

Using a Wagmi hook (useContractRead), check if the user allowance has been fully utilized.

If there is some allowance left, don't make him do another approval transaction before creating a stream.

I want to create a stream which spends more than my previously set allowance (here 2 CHAOS), or this is my first interaction with the contract, I need to do an approval transaction:

Screenshot 2023-12-20 at 10 28 52

But if I want to create a stream which spends less than my previously set allowance, I can directly create the stream:

Screenshot 2023-12-20 at 10 28 25

The same logic has been added to the update stream component.

Also, as it can be seen on the above screenshots, I added productName as an optional props to make sure the components can be used for any payment interface, not showing the word 'stream' anymore

@alexisnsns alexisnsns linked an issue Dec 20, 2023 that may be closed by this pull request
@alexisnsns alexisnsns marked this pull request as ready for review December 20, 2023 15:15
@alexisnsns alexisnsns enabled auto-merge (squash) January 17, 2024 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't check for allowance if user already approved [SBK-380]
2 participants