Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Cater for runtime Metadata_* v2
  • Loading branch information
jacogr committed Mar 15, 2023
commit e9030ff04075edd578ecaab4c1a8b53475f607a0
38 changes: 31 additions & 7 deletions packages/types/src/interfaces/metadata/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
// Copyright 2017-2023 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { DefinitionsCall } from '../../types/index.js';
import type { DefinitionsCall, DefinitionsCallEntry } from '../../types/index.js';

import { objectSpread } from '@polkadot/util';

const META_V1_TO_V2: DefinitionsCallEntry['methods'] = {
metadata: {
description: 'Returns the metadata of a runtime',
params: [],
type: 'OpaqueMetadata'
}
};

export const runtime: DefinitionsCall = {
Metadata: [
{
methods: {
metadata: {
description: 'Returns the metadata of a runtime',
methods: objectSpread({}, META_V1_TO_V2),
version: 1
},
{
methods: objectSpread({
metadata_at_version: {
description: 'Returns the metadata at a given version.',
params: [
{
name: 'version',
type: 'u32'
}
],
type: 'Option<OpaqueMetadata>'
},
metadata_versions: {
description: 'Returns the supported metadata versions.',
params: [],
type: 'OpaqueMetadata'
type: 'Vec<u32>'
}
},
version: 1
}, META_V1_TO_V2),
version: 2
}
]
};