Increase fallback coverage for mint character #119
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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):
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'saddOffer
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: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)error
: indicates an error occurred while minting. A generic error is displayed prompting the user to try againaccepted
: 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 walletFinally, 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