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

refactor(common): move createContract's internal write logic to writeContract #1693

Merged
merged 8 commits into from
Oct 3, 2023

Conversation

holic
Copy link
Member

@holic holic commented Oct 3, 2023

closes #1554

This matches how viem abstracts this behavior and lets us use writeContract without having to create a contract instance via createContract (planning to use this in #1625)

@changeset-bot
Copy link

changeset-bot bot commented Oct 3, 2023

🦋 Changeset detected

Latest commit: 66c4e4b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@latticexyz/common Major
@latticexyz/block-logs-stream Major
@latticexyz/cli Major
@latticexyz/config Major
@latticexyz/dev-tools Major
@latticexyz/protocol-parser Major
@latticexyz/store-indexer Major
@latticexyz/store-sync Major
@latticexyz/store Major
@latticexyz/world-modules Major
@latticexyz/world Major
@latticexyz/react Major
@latticexyz/abi-ts Major
create-mud Major
@latticexyz/ecs-browser Major
@latticexyz/faucet Major
@latticexyz/gas-report Major
@latticexyz/network Major
@latticexyz/noise Major
@latticexyz/phaserx Major
@latticexyz/recs Major
@latticexyz/schema-type Major
@latticexyz/services Major
@latticexyz/solecs Major
solhint-config-mud Major
solhint-plugin-mud Major
@latticexyz/std-client Major
@latticexyz/std-contracts Major
@latticexyz/store-cache Major
@latticexyz/utils Major

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

@vercel
Copy link

vercel bot commented Oct 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mud-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 3:46pm

@holic holic marked this pull request as ready for review October 3, 2023 15:46
@holic holic requested a review from alvrs as a code owner October 3, 2023 15:46
return contract as unknown as GetContractReturnType<TAbi, TPublicClient, TWalletClient, TAddress>;
}
/** @deprecated use `getContract` instead */
export const createContract = getContract;
Copy link
Member Author

@holic holic Oct 3, 2023

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.

Copy link
Member

@alvrs alvrs left a 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?

@holic
Copy link
Member Author

holic commented Oct 3, 2023

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)

@holic holic merged commit d075f82 into main Oct 3, 2023
@holic holic deleted the holic/writeContract branch October 3, 2023 17:04
@github-actions github-actions bot mentioned this pull request Oct 3, 2023
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

Successfully merging this pull request may close these issues.

refactor createContract, move out writeContract
2 participants