-
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
refactor(common): move createContract
's internal write logic to writeContract
#1693
Conversation
🦋 Changeset detectedLatest commit: 66c4e4b 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
78c68cc
to
2013116
Compare
return contract as unknown as GetContractReturnType<TAbi, TPublicClient, TWalletClient, TAddress>; | ||
} | ||
/** @deprecated use `getContract` instead */ | ||
export const createContract = getContract; |
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.
Slightly different approach to what we've been doing in the past to avoid a breaking change. We can just remove this in a future version as a breaking change, potentially batching with other breaking changes.
I kinda like the deprecate-then-break pattern so playing with it here.
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.
i like the new more modular approach. For context, was there something in the previous createContract
approach that was blocking using it in #1625?
not necessarily blocking, just feels a bit cleaner, esp if we eventually have to write to multiple contracts and ultimately trying to move our code to the more modular/tree-shakeable approach that viem suggests (#1307) |
closes #1554
This matches how viem abstracts this behavior and lets us use
writeContract
without having to create a contract instance viacreateContract
(planning to use this in #1625)