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

Increase fallback coverage for mint character #119

Merged
merged 8 commits into from
Mar 6, 2024

Conversation

carlos-kryha
Copy link
Contributor

@carlos-kryha carlos-kryha commented Mar 1, 2024

Description

Review frontend error handling for the mint flow and ensure the frontend does not get "stuck" when minting a character

Validation and error handling

The mint flow starts with the "Create character" input form, which takes a string as input (to pick a character name) and performs the following validation (showing errors when present):

  1. Name adheres to the guidelines set on contract (special characters, length requirements, etc)
  2. Name is unique
  3. User has enough IST available to mint

If no validation errors are present, the mint button is enabled. Pressing mint will form the mint proposal based on the input and trigger Agoric's addOffer method, which also accepts a callback set up to track offer updates.

Should anything error out in the process of forming and executing addOffer the error will be caught and a generic error will be displayed to the user.

If addOffer is triggered correctly, the following offerStatus updates are handled:

  1. seated: indicates the offer was successfully parsed by the contract? (I couldn't find documentation around this, so this definition is from experience). We start a timer which will display an error to the user in case no further offer updates are received within 30s (typically the mint offer returns the "success" status within 10s of it being seated)
  2. error: indicates an error occurred while minting. A generic error is displayed prompting the user to try again
  3. accepted: indicates mint call was successful. We clear the timer set to error if the call takes too long. We do not yet give the user confirmation, as we want to wait until the new character is accessible from the user's wallet

Finally, we have a useEffect in the create-character component that listens for updates in the user's wallet and shows confirmation to the user once the newly minted character is correctly parsed by KREAd's frontend

@carlos-kryha carlos-kryha merged commit d6982ec into develop Mar 6, 2024
3 checks passed
@carlos-kryha carlos-kryha deleted the fix/frontend-offer-callback branch March 6, 2024 14:36
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.

2 participants