You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 9, 2024. It is now read-only.
Define a good design pattern to handle status messages then create helper functions to make it easy.
const tx = useContractTx(...) sets a variable that can use a signAndSend() functions to initiate a wallet signature and contract transaction like this tx.signAndSend(...args).
We can then track the status with tx.status, which will change from 'NONE', to 'PENDING_SIGNATURE', to 'IN_BLOCK', etc. It is very common to set a button to disabled and change the title if a transaction status is not 'NONE' or 'FINALIZED'.
Suggestion
We should create a helper function that returns a formatted string. e.g.
where toStatusName(flipTx) will return "Please sign the transaction to flip!"` for 'PENDING_SIGNATURE', then "Flipping..." when the status is 'IN_BLOCK', etc. Messages should be customizable and allow for 18n.
Do we provide defaults? Can a user define generic ones such as "Pending signature" for 'PENDING_SIGNATURE' status?