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
After #368, contract ABI is exported as a static member on the contract's factory. However, because _abi that's defined in generated code is not marked with const assertion, ABI type definition is very simplified, as almost every field will be marked as string instead of string literal that narrows down possible values.
This is problematic because it won't allow some tools to take ABI from generated typechain bindings and extract rich data from it. For example, with release 0.7, wagmi library added support for type-safe contract calls, as long as abi passed is const asserted, allowing TS compiler to infer contract args, etc. You can find more info here: https://wagmi.sh/docs/typescript#type-inference
I propose as const is added to generated _abi code so that more type info can be extracted from bindings
The text was updated successfully, but these errors were encountered:
Hey, thanks for this awesome library!
After #368, contract ABI is exported as a static member on the contract's factory. However, because
_abi
that's defined in generated code is not marked withconst
assertion, ABI type definition is very simplified, as almost every field will be marked asstring
instead of string literal that narrows down possible values.This is problematic because it won't allow some tools to take ABI from generated typechain bindings and extract rich data from it. For example, with release 0.7,
wagmi
library added support for type-safe contract calls, as long asabi
passed isconst
asserted, allowing TS compiler to infer contract args, etc. You can find more info here: https://wagmi.sh/docs/typescript#type-inferenceI propose
as const
is added to generated_abi
code so that more type info can be extracted from bindingsThe text was updated successfully, but these errors were encountered: