-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat(common): add viem actions that work the same as the current wrappers #2347
Conversation
🦋 Changeset detectedLatest commit: dcdcdee The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great!
A few more requests:
- add
// @deprecated Use `walletClient.extend(transactionQueue())` instead.
to the top of each ofgetContract
,writeContract
,sendTransaction
wrapper functions - set up the new actions in the rest of the templates
- add a changeset (
pnpm changeset
from root, or via the link in the bot comment above)
Thanks for the reviews! I'll address these requests.
OK, I'll apply the same changes as the current react template got to other templates in this PR. |
This code is pulled out from #2309 and got some modifications.
This PR introduces viem client actions into the common library. These actions work the same as MUD's
getContract
,writeContract
, andsendTransaction
, but this enables the use of the functions through client (e.g.,client.writeContract(...)
).We've decided to include the simulation code in these overridden viem actions, so now the same code as the wrappers is used. If we decide to deprecate the wrapper functions, I can reorganize the code for these actions. (While
getContract
might be deprecated, do we want to use thewriteContract
andsendTransaction
wrappers independently?)Including simulation in transaction sending actions is especially necessary for further enhancements that require precise control over simulation.
Additionally, I've updated a template for testing/demonstration purposes, which can be removed prior to merging.