-
Notifications
You must be signed in to change notification settings - Fork 197
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(create-mud): new react template with stash/entrykit #3439
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: d4caba1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 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 |
e827539
to
22fb651
Compare
"overrides": { | ||
"@tanstack/react-query": "link:../../packages/entrykit/node_modules/@tanstack/react-query", | ||
"@types/react": "link:../../packages/entrykit/node_modules/@types/react", | ||
"wagmi": "link:../../packages/entrykit/node_modules/wagmi" | ||
} |
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.
This is how we work around the linking issue where different instances of Wagmi exist inside the dependency tree (even if pinned to the same version), which leads to things like Rainbowkit inside EntryKit not being able to find the Wagmi config provided the template's app.
The downside is that we need to keep versions aligned in the template + EntryKit to not have failing tests or weird edge cases. But that seems like a reasonable trade-off for having a working local environment for templates.
Some potential solutions we can look into in the future:
- move templates into the monorepo root workspace (would mean "flattening" the templates to not use workspaces) so the templates can share common pnpm dependencies with MUD packages
- replace Rainbowkit in EntryKit with our own wallet connection UI (the underlying error seems to be related to transitive deps across linked deps in pnpm workspace)
const sync = useSync(); | ||
const worldContract = useWorldContract(); | ||
const onMove = useMemo( | ||
() => | ||
sync.data && worldContract | ||
? async (direction: Direction) => { | ||
const tx = await worldContract.write.app__move([mudConfig.enums.Direction.indexOf(direction)]); | ||
await sync.data.waitForTransaction(tx); | ||
} | ||
: undefined, | ||
[sync.data, worldContract], | ||
); |
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.
This still feels a little clunky to me. I tried to streamline this by doing the sync data check inside useWorldContract
so that we could have one hook to return both worldContract
and waitForTransaction
(since you're often doing these together), but I was constantly battling TS depth issues where editing anything in useWorldContract
caused it to spin due to the huge world ABI.
A potential next step to improve this would be better utils to call individual systems via their individual ABIs rather than a monolithic world contract, but wagmi doesn't make it easy to call using a separate client (session client, in our case).
TODO
mud
to MUD packages