Open efstajas opened 3 months ago
Summary for claiming gaslessly on FVM with rate limiting:
PendingMetadata
. Again with a reasonable timeout, descriptive error if exceeded.Claimed
and sends user to success screen.On networks where we don't sponsor both transactions (e.g. mainnet) OR if the user is using a Safe, everything is the same as above, except for that the 2nd transaction is proposed to the user's wallet instead of being relayed gaslessly.
Depends on #1182
Gas on FVM is extremely cheap, and Gelato Relay will be available (projected by end of August). We can easily cover costs for claiming projects and collecting tokens, which makes those flows entirely gasless, and makes it possible for people to move earned tokens on Drips to their wallet without needing to acquire any FIL.
What we need
1182, in order to properly display & propose gasless transactions using the new Transact step
Caller
with the user's wallet (details TBD with Igor). We already have a gasless transaction, requestUpdateOwner, today, but it's anonymous and doesn't get signed by the user./api/gasless
endpoints for 1) submitting the 2nd transaction in the project claim flow (set metadata and splits), and 2) collecting tokens. These endpoints should validate input data thoroughly so that they can not be used to dispatch arbitrary transaction payloads not generated by the Drips app to Gelato. Important: They need to check whether the app instance is actually configured to sponsor the respective transaction for the current network and throw an error if not.UX Outline
Claiming project
Below is for the case when the app instance is configured to sponsor all claim & collect transactions on the given network. If it's not, things are generally the same, except the user needs to execute the 2nd transaction rather than it being gasless.
requestUpdateOwner
transaction silently in the background through Gelato (as it already does today) only if it's not.api/gasless/track
endpoint with thetaskId
of therequestOwnerUpdate
TX sent to Gelato earlier. Once it reports the TX as done, the app starts polling the API and waits for it to return thePendingMetadata
state for the project.PendingMetadata
is received, the app triggers the signature request for the 2nd transaction. Once the user signs, the payload is sent to Gelato and the app again waits for the task to resolve on Gelato, and then waits for the state of the project to update toClaimed
.Collecting
Failure cases
(All errors below must be sent to Sentry in addition to being caught)
api/gasless/track
to check on the state of a gasless TX and sees that the transaction failed for whatever reason. In this case, the app should halt the process and display an inline error on the Transact step that says something like "The gasless transaction failed. Please try again in a few hours or reach out to us on Discord."username/project-name
not in expected statestate
after 5 minutes. Please try again in a few hours or reach out to us on Discord."