-
Notifications
You must be signed in to change notification settings - Fork 73
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
In the useOpenAction react hook, when the user doesn't have enough funds to collect, an unhandled promise is being thrown instead of being handled by the SDK #808
Comments
Probably related to the same root issue but with the same code I get the following unhandled promise rejection when trying to collect multiple times from the same profile.
|
@pradel thank you for raising this. Indeed the first error should be returned as The second one is a different thing though. This is an API restriction that allows to use gasless collect only once for a given publication (for the same Profile). We should model this better and not throw. |
@cesarenaldi as one connected with just a wallet (no Lens profile) can collect many items I think the behavior with a Lens profile should be the same and there should be no limitations for it. |
@pradel this is absolutely true. The idea behind the error:
is that the first collect for a Profile is sponsored by the Lens API (i.e. covers tx gas costs), any subsequent must be covered with own funds (like the case of just a wallet that collects, they always have to pay for gas themselves). It's to avoid abuse more than anything else. We have intention to support this mechanics in the SDK with a specific error type so that consumers can detect this scenario and switch to self-funded collect (i.e. We just didn't get to this yet, as until now, it was deemed low priority. So to understand how urgent this is, is this a primary concern for the UX you are working on? Do you see Profiles collecting often the same exact publication? |
I don't have production results to know if many people are doing this, but it came up while doing tests on testnet. Not sure people will do it. |
That would be a good interim step we can action pretty quick. The retry with self-funded is where we need to change the underlying GQL mutation and need a little thinking on how to perform this check later at "broadcast time". Regarding the very first error:
Do you have a publication ID (and where: Testnet or Mainnet)? |
@cesarenaldi it was on testnet but it seems that the error is not happening with our production build. Pretty weird, will try again next weekend to see what's going on. |
Describe the bug
In the useOpenAction hook, the SDK does not handle properly when the user doesn't have the funds to collect.
I published a post that can be collected using 0.01 WMATIC, when a user without enough funds in his wallet, an unhandled promise is thrown instead of being handled with the result.isFailure.
To Reproduce
I am having an issue with the following code
Expected behaviuor
The error should be catched and returned by the isFailure function
If using the React bindings, what is the essence of your React app?
Version of the packages you are using
The text was updated successfully, but these errors were encountered: