https://graz.sh/docs/hooks/useBalance
Take a look at useBalance
hook. It requires a denom
to be defined, but what the denom
isn't statically available and it's a subject of a fetch? In other words, how do I use the hook if denom
isn't yet defined?
Turns out graz
doesn't support undefined arguments, so ALL the queries that depend on statically known arguments are not usable in such cases.
...
wagmi
supports undefined arguments in queries as they have a common query hook input interface of {args:Something[] | undefined}
.
However, an array is used in their case as they dynamically retrieve the type of the query from ABI, which is not the case for graz.
As an opposite, for such hooks, graz has to either support undefineable arguments { something: Type | undefined }
to enforce a user to pass some value which might be undefined as opposed to passing { something?: Type }
which would make an argument partial and would confuse the developer wether he has passed sufficient input or not.
Therefore queries have to check for the input to be sufficient, and unless it is, return undefined and never enable the query.
Another approach could involve a breaking change and defining a common interface of { args: Input | undefined }
that could simplify the input checking for graz developers, but that is probably would not be considered.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too