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

Question: Runtime Calls included in Metadata #5083

Closed
NachoPal opened this issue Jul 18, 2022 · 4 comments
Closed

Question: Runtime Calls included in Metadata #5083

NachoPal opened this issue Jul 18, 2022 · 4 comments
Labels

Comments

@NachoPal
Copy link

Are Runtime Calls (https://polkadot.js.org/apps/#/runtime) part of the Metadata? I was checking the documentation and it looks they are not. Is it correct? In that case, are all those Runtime Calls types hardcoded in polkadot-js?

I was wondering if it would be possible to add also the Runtime Calls types to the Metadata. In that way, in some cases developers could build a custom Runtime API instead of a custom RPCs, with the benefit of not having to generate the custom types.

@jacogr
Copy link
Member

jacogr commented Jul 18, 2022

At this point they are hardcoded - there is an issue logged on Substrate to make this available in the metadata.

For type generation, there is a new key in the definitions that pull in these - so you can add them to your definitions and typegen will spit out the correct values. This is also how the ones inside the API are generated, some examples -

export const runtime: DefinitionsCall = {
AuraApi: [
{
methods: {
authorities: {
description: 'Return the current set of authorities.',
params: [],
type: 'Vec<AuthorityId>'
},
slot_duration: {
description: 'Returns the slot duration for Aura.',
params: [],
type: 'SlotDuration'
}
},
version: 1
}
]
};

Which is in turn exposed here on the definition -

So you can add the exact same to your definitions and it will be part of the runtime injection as well as the typegen. (It basically acts the same way as RPC definitions - so they need to be provided in the API constructor - that is until we have these in metadata and all this extra definition steps can be dropped)

@jacogr jacogr added the support label Jul 18, 2022
@NachoPal
Copy link
Author

Thanks Jaco, I guess you are referring to this Issue: paritytech/substrate#11648

@jacogr jacogr closed this as completed Jul 18, 2022
@jacogr jacogr reopened this Jul 18, 2022
@jacogr
Copy link
Member

jacogr commented Jul 18, 2022

Sorry, fat fingers. Yes, the linked issue is the one.

@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jul 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants