-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
refactor: create actions #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
Conversation
|
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/zoo/wagmi/7Qeb6uMt1nPQf2MxhjhgCHsg3e8J |
df14a9d to
4c343ea
Compare
1f1016b to
4c8338b
Compare
|
@bpierre curious what you think of this. anything you would change or do differently? |
4c8338b to
9e20054
Compare
Sorry for replying so late. It’s really cool, I like how we can now test these functions independently! A few thoughts: I was wondering if it could be a better idea to pick names like But thinking more about it, these functions won’t be easy to use anyway, since they don’t carry any context and it (chain, provider) needs to be setup, so it’s probably not going to be an issue. And we could always add a class in the future, to keep the context around: import { Wagmi } from 'wagmi-core'
// The Wagmi constructor would take the same options than the Provider
const wagmi = new Wagmi({ connectors: /* … */, autoConnect: true })
// Note 1: The Wagmi method names could follow the hooks, without the use- prefix.
// Note 2: The context is saved by Wagmi, no need to pass it to methods.
const balance = await wagmi.balance({ addressOrName: '0x…', token: '0x…' })About the erronous state issue described in #140, I don’t really see a way to fix this without breaking compatibility:
But with the React Query refactor, @tmm @jxom I was wondering if we shouldn’t simply remove Migrating to the new version of wagmi would require consumers to either:
|
|
Yo @bpierre, Yeah, I added getter fns (e.g. |
|
Good points! Let's remove this from the new version. |
Starting to separate hook logic into core actions.
Related