-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Description :
Actually this discussion was born from recipe where we wanted to demonstrate the flow of waiting for txnReceipt and then sending next transcation:
const handleSubmit = async e => {
e.preventDefault();
const approveHash = await approveTx?.writeAsync();
await publicClient.waitForTransactionReceipt(approveHash);
await listNftTx?.writeAsync();
};So for this demonstration we used NftMarketplace which has approval pattern which in turn will help us show the waitForTransactioReceipt flow.
Descusion point:
Since we wanted recipes to be copy pastable, and some recipes may require different contract than YourContract.sol (which already comes with SE-2) we need to find a way to distribute those contracts to user who is following recipe.
Some ideas:
-
Adding a
step 0: Set up contractwhere we tell people to copy paste the contract andyarn deployit to local before following with receipe ?.- They also need to update deploy script :(
-
Try using
YourContrac.sol(we are already using it in other recipes), I think we can construct most of the recipes usingYourContract.solonly.- It might might not make total sense in some recipes, like in above case approval pattern contract made more sense but we don't have to make sense since main goal is to demonstrate frontend part and waiting for transaction.
My Views :
I think we should go with option 2, and try to use YourContract.sol as much as possible, and in very rare case we could always switch to option 1 if needed.