Skip to content
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

Generate the client from the metadata #97

Closed
Demi-Marie opened this issue Apr 29, 2020 · 4 comments · Fixed by #294
Closed

Generate the client from the metadata #97

Demi-Marie opened this issue Apr 29, 2020 · 4 comments · Fixed by #294

Comments

@Demi-Marie
Copy link
Contributor

Currently, all client implementations are written by hand. This works, but is very tedious and won’t scale to large runtimes.

A better option is to generate the client. This is already done by the TypeScript client implementation, so it should be quite doable for the Rust one.

@jiyilanzhou
Copy link

Currently, all client implementations are written by hand. This works, but is very tedious and won’t scale to large runtimes.

If I want send a pallet method transaction, How can I accomplish this.

@gregdhill
Copy link
Contributor

I've been working on subxt-gen to do exactly this, but it's still very much a work-in-progress (constructed from parts of subsee and substrate-subxt/proc-macro). @ascjones would you be interested in integrating this upstream (alongside proc-macro)? My goal is to provide a builder similar to how tonic uses prost for generating code from protobuf so that a client library only needs to download the encoded metadata.

@ascjones
Copy link
Contributor

Yes indeed @gregdhill, that has always been the long term goal, the main issue being the lack of rich type metadata. However I am making steady progress on that front, I have just been able to produce v13 metadata for the whole substrate node-runtime (calls and events only for now). See paritytech/substrate#8370 (comment).

Some work I have done a long time ago on consuming that metadata and generating types can be found here https://github.com/ascjones/chameleon. It's purely proof of concept atm but could eventually be used as part of the API generation from the metadata.

@olanod
Copy link

olanod commented Oct 20, 2021

For dynamic clients like sube(no code generation) another approach is to use scales that can be used to serialize the storage items directly to JSON(or other formats) or some JSON input try to coerce it to the correct SCALE format following the specified type info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants