-
Notifications
You must be signed in to change notification settings - Fork 349
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
Add decoration of runtimeApis #5845
Comments
This would actually replace |
@TarikGul Is there a way to manually add runtime API calls for now? Unable to find hints in the docs, so I tried using the import { DefinitionsCall } from "@polkadot/types/types";
import { ApiPromise, WsProvider } from "@polkadot/api";
const wsProvider = new WsProvider(`wss://...`);
export const api = await ApiPromise.create({
provider: wsProvider,
runtime: {
camelCasedPalletNameApi: [
{
version: 1,
methods: {
camelCasedRuntimeFn {
description: "This is my function",
params: [],
type: "Balance",
},
},
},
],
} as DefinitionsCall,
});
const result = await pjsApi.call.camelCasedPalletNameApi.camelCasedRuntimeFn();
console.log({result}) --- update Never mind got it to work. Seems like it's important to use camel case for the api name key and an underscored runtime call function name. Found out how to do it here: api/packages/types/src/interfaces/system/runtime.ts Lines 6 to 24 in 3b7b44f
All in all looking forward for metadata v15 support. 👍 🚀 |
this should go in V16 |
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. |
rel: #5725
The next step in getting runtimeApis from the metadata is to have them decorated at runtime via the metadata. This can be seen as similar to
decorateExtrinsics
. This should only be available for V15.Once this issue is complete we can then add it to the static typegen.
The text was updated successfully, but these errors were encountered: