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

Recipes needing different contract than YourContract.sol #47

Open
technophile-04 opened this issue Dec 21, 2023 · 1 comment
Open

Recipes needing different contract than YourContract.sol #47

technophile-04 opened this issue Dec 21, 2023 · 1 comment

Comments

@technophile-04
Copy link
Collaborator

technophile-04 commented Dec 21, 2023

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:

  1. Adding a step 0: Set up contract where we tell people to copy paste the contract and yarn deploy it to local before following with receipe ?.

    • They also need to update deploy script :(
  2. Try using YourContrac.sol (we are already using it in other recipes), I think we can construct most of the recipes using YourContract.sol only.

    • 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.

@technophile-04 technophile-04 mentioned this issue Dec 21, 2023
6 tasks
@carletex
Copy link
Member

carletex commented Jan 2, 2024

I agree!

I also think we shouldn't overthink it too much. Yes, we want the recipes to be copy/pastable, but no big deal if they don't work with the default contract. I think people are used to that when reading doc.

In any case, let's do 2 and we could try doing what you suggest at 1 (or even just having some contract code for the front-end code to work) in the cases where the default contract doesn't work.

Thanks for bringing this up, Shiv!

@scaffold-eth scaffold-eth deleted a comment from CindaiMKR Nov 22, 2024
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

No branches or pull requests

2 participants