You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
^-- Arrays of arguments, which may be undefined or contain undefined elements, can be provided. All those network calls all go out as a single multicall
^-- similar to wagmi native useContractWrite, tx.write is missing if it can't be executed. But it also is missing if contractAddress or someArg is missing, or if false is provided
...Anyway, it's by no means fully featured (and it's somewhat hacky)... But I'd love to see these features make it into the wagmi project. I'm sure it won't look like this - it's just illustrating usefulness... I hope :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
https://github.com/joshlang/wagmi-chill
Here's a code extract from a live project, which handles both read aggregation and optional args
It's quite opinionated, so I didn't want to turn it into an npm project. But maybe it's useful, so here ya go
...
^-- if
contractAddress
oraddress
is undefined, no network call is made andbalance = undefined
. Makes it easy to chain calls one after another.^-- Arrays of arguments, which may be undefined or contain undefined elements, can be provided. All those network calls all go out as a single
multicall
^-- same idea
^-- similar to wagmi native
useContractWrite
,tx.write
is missing if it can't be executed. But it also is missing ifcontractAddress
orsomeArg
is missing, or iffalse
is provided...Anyway, it's by no means fully featured (and it's somewhat hacky)... But I'd love to see these features make it into the wagmi project. I'm sure it won't look like this - it's just illustrating usefulness... I hope :)
Beta Was this translation helpful? Give feedback.
All reactions