4

Since metadata v14 and scale-info were introduced, the runtime fully specifies all runtime interfaces and types. On the RPC side however the rpc_methods only returns the list of methods exposed, without any type details for them. This basically means that a mapping from these names to actual definitions are maintained in various SDKs.

There is also a version flag in this RPC response so it must mean it is somehow upgradable.

So my question is: are there plans and/or ongoing work to make these fully described with parameters and return types ala metadata-v14-for-rpcs.

2 Answers 2

3

This is definitely a feature we have in mind, however at the moment there are no plans to implement it in the immediate future.

I have created an issue for it in Substrate: https://github.com/paritytech/substrate/issues/11181, so keep an eye on that for any updates, and add any comments/suggestions you may have.

1
  • Thank you! Will subscribe to the issue above.
    – Xiu Hung
    Apr 7, 2022 at 10:22
0

https://polkadot.js.org/docs/api/examples/promise/typegen/ might be exactly what you need to get started. Types are fully described, from the getMetadata endpoint:

js API interface: api.rpc.state.getMetadata
jsonrpc: state_getMetadata

Note the value returned by the RPC is SCALE encoded, and needs to be decoded for you use.

subxt is a good reference and for a simple CLI implementation decoding the output, subsee is great too

1
  • Thank you. However the answer misses the question - I know how this applies to the runtime itself. However, the types for the params and the results are not specified for rpc_methods which is what this question relates to. Since we have the full type mapping now for the runtime, we should have it for RPC as well. A good example is the JS API which you linked - it has to do a manual mapping of all RPCs, e.g. this is for api.rpc.chain.* in the JS API).
    – Xiu Hung
    Apr 7, 2022 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.