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
{{ message }}
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
The idea is that the types within a given Config will inform the rest of Capi usage. While the narrow typing is worthwhile, the current execution is overly-complex: Config is somewhere in between static and dynamic; it has one foot in both worlds, but fits into neither. Yes, we can generate Configs with FRAME-specific types, but no, this does not result in the optimal static DX.
The one notable advantage to this experience is that it is consistent; if the chain is not known ahead of time, one can apply any to the config's type params. However, I'd argue that the static use case (where target chain is known ahead of time) is far more common. If we optimize for this use case, the experience can be dramatically simplified.
Note: config creation could be much simpler without the need for a named signature containing RPC, error and FRAME types.
In addition to offering simpler DX, a key benefit of this approach is the ease of adjusting to runtime upgrades. Simply regenerate the bindings and fix type errors.
deno run -A -r https://deno.land/x/capi/codegen.ts \
--out="polkadot.ts" \
--src="wss://rpc.polkadot.io"
The text was updated successfully, but these errors were encountered:
The following proposal describes a would-be critical shift in the Capi DX. Feedback would be greatly appreciated.
Currently, Capi utilizes
Config
s for its discovery values and typings. This is true of both the static and dynamic DXs.The idea is that the types within a given
Config
will inform the rest of Capi usage. While the narrow typing is worthwhile, the current execution is overly-complex:Config
is somewhere in between static and dynamic; it has one foot in both worlds, but fits into neither. Yes, we can generateConfig
s with FRAME-specific types, but no, this does not result in the optimal static DX.The one notable advantage to this experience is that it is consistent; if the chain is not known ahead of time, one can apply
any
to the config's type params. However, I'd argue that the static use case (where target chain is known ahead of time) is far more common. If we optimize for this use case, the experience can be dramatically simplified.Meanwhile, the dynamic use case can be satisfied via direct usage of std effects.
In addition to offering simpler DX, a key benefit of this approach is the ease of adjusting to runtime upgrades. Simply regenerate the bindings and fix type errors.
The text was updated successfully, but these errors were encountered: