BlockBuilder 2/3/4 & GrandpaApi 2 runtime interface definitions (#5067)
This commit is contained in:
@@ -5,7 +5,29 @@ import type { DefinitionsCall, DefinitionsCallEntry } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
const BB_V5_TO_V6: DefinitionsCallEntry['methods'] = {
|
||||
const BB_V2_TO_V4: DefinitionsCallEntry['methods'] = {
|
||||
// this was removed after V4
|
||||
random_seed: {
|
||||
description: 'Generate a random seed.',
|
||||
params: [],
|
||||
type: 'Hash'
|
||||
}
|
||||
};
|
||||
|
||||
const BB_V2_TO_V5: DefinitionsCallEntry['methods'] = {
|
||||
apply_extrinsic: {
|
||||
description: 'Apply the given extrinsic.',
|
||||
params: [
|
||||
{
|
||||
name: 'extrinsic',
|
||||
type: 'Extrinsic'
|
||||
}
|
||||
],
|
||||
type: 'ApplyExtrinsicResultPre6'
|
||||
}
|
||||
};
|
||||
|
||||
const BB_V2_TO_V6: DefinitionsCallEntry['methods'] = {
|
||||
check_inherents: {
|
||||
description: 'Check that the inherents are valid.',
|
||||
params: [
|
||||
@@ -20,11 +42,6 @@ const BB_V5_TO_V6: DefinitionsCallEntry['methods'] = {
|
||||
],
|
||||
type: 'CheckInherentsResult'
|
||||
},
|
||||
finalize_block: {
|
||||
description: 'Finish the current block.',
|
||||
params: [],
|
||||
type: 'Header'
|
||||
},
|
||||
inherent_extrinsics: {
|
||||
description: 'Generate inherent extrinsics.',
|
||||
params: [
|
||||
@@ -37,6 +54,15 @@ const BB_V5_TO_V6: DefinitionsCallEntry['methods'] = {
|
||||
}
|
||||
};
|
||||
|
||||
const BB_V3_TO_V6: DefinitionsCallEntry['methods'] = {
|
||||
// renamed in v3 from finalize_block
|
||||
finalize_block: {
|
||||
description: 'Finish the current block.',
|
||||
params: [],
|
||||
type: 'Header'
|
||||
}
|
||||
};
|
||||
|
||||
export const runtime: DefinitionsCall = {
|
||||
BlockBuilder: [
|
||||
{
|
||||
@@ -51,23 +77,36 @@ export const runtime: DefinitionsCall = {
|
||||
],
|
||||
type: 'ApplyExtrinsicResult'
|
||||
}
|
||||
}, BB_V5_TO_V6),
|
||||
}, BB_V2_TO_V6, BB_V3_TO_V6),
|
||||
version: 6
|
||||
},
|
||||
{
|
||||
methods: objectSpread({
|
||||
apply_extrinsic: {
|
||||
description: 'Apply the given extrinsic.',
|
||||
params: [
|
||||
{
|
||||
name: 'extrinsic',
|
||||
type: 'Extrinsic'
|
||||
}
|
||||
],
|
||||
type: 'ApplyExtrinsicResultPre6'
|
||||
}
|
||||
}, BB_V5_TO_V6),
|
||||
// apply_extrinsic result changed in 6
|
||||
}, BB_V2_TO_V5, BB_V2_TO_V6, BB_V3_TO_V6),
|
||||
version: 5
|
||||
},
|
||||
{
|
||||
methods: objectSpread({
|
||||
// random_seed removed
|
||||
}, BB_V2_TO_V4, BB_V2_TO_V5, BB_V2_TO_V6, BB_V3_TO_V6),
|
||||
version: 4
|
||||
},
|
||||
{
|
||||
methods: objectSpread({
|
||||
// finalize_block renamed
|
||||
}, BB_V2_TO_V4, BB_V2_TO_V6, BB_V3_TO_V6),
|
||||
version: 3
|
||||
},
|
||||
{
|
||||
methods: objectSpread({
|
||||
finalise_block: {
|
||||
description: 'Finish the current block.',
|
||||
params: [],
|
||||
type: 'Header'
|
||||
}
|
||||
}, BB_V2_TO_V4, BB_V2_TO_V6),
|
||||
version: 2
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,52 +1,61 @@
|
||||
// Copyright 2017-2022 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { DefinitionsCall } from '../../types';
|
||||
import type { DefinitionsCall, DefinitionsCallEntry } from '../../types';
|
||||
|
||||
import { objectSpread } from '@polkadot/util';
|
||||
|
||||
const GRANDPA_V2_V3: DefinitionsCallEntry['methods'] = {
|
||||
generate_key_ownership_proof: {
|
||||
description: 'Generates a proof of key ownership for the given authority in the given set.',
|
||||
params: [
|
||||
{
|
||||
name: 'setId',
|
||||
type: 'SetId'
|
||||
},
|
||||
{
|
||||
name: 'authorityId',
|
||||
type: 'AuthorityId'
|
||||
}
|
||||
],
|
||||
type: 'Option<OpaqueKeyOwnershipProof>'
|
||||
},
|
||||
grandpa_authorities: {
|
||||
description: 'Get the current GRANDPA authorities and weights. This should not change except for when changes are scheduled and the corresponding delay has passed.',
|
||||
params: [],
|
||||
type: 'AuthorityList'
|
||||
},
|
||||
submit_report_equivocation_unsigned_extrinsic: {
|
||||
description: 'Submits an unsigned extrinsic to report an equivocation.',
|
||||
params: [
|
||||
{
|
||||
name: 'equivocationProof',
|
||||
type: 'GrandpaEquivocationProof'
|
||||
},
|
||||
{
|
||||
name: 'keyOwnerProof',
|
||||
type: 'OpaqueKeyOwnershipProof'
|
||||
}
|
||||
],
|
||||
type: 'Option<Null>'
|
||||
}
|
||||
};
|
||||
|
||||
export const runtime: DefinitionsCall = {
|
||||
GrandpaApi: [
|
||||
{
|
||||
methods: {
|
||||
methods: objectSpread({
|
||||
current_set_id: {
|
||||
description: 'Get current GRANDPA authority set id.',
|
||||
params: [],
|
||||
type: 'SetId'
|
||||
},
|
||||
generate_key_ownership_proof: {
|
||||
description: 'Generates a proof of key ownership for the given authority in the given set.',
|
||||
params: [
|
||||
{
|
||||
name: 'setId',
|
||||
type: 'SetId'
|
||||
},
|
||||
{
|
||||
name: 'authorityId',
|
||||
type: 'AuthorityId'
|
||||
}
|
||||
],
|
||||
type: 'Option<OpaqueKeyOwnershipProof>'
|
||||
},
|
||||
grandpa_authorities: {
|
||||
description: 'Get the current GRANDPA authorities and weights. This should not change except for when changes are scheduled and the corresponding delay has passed.',
|
||||
params: [],
|
||||
type: 'AuthorityList'
|
||||
},
|
||||
submit_report_equivocation_unsigned_extrinsic: {
|
||||
description: 'Submits an unsigned extrinsic to report an equivocation.',
|
||||
params: [
|
||||
{
|
||||
name: 'equivocationProof',
|
||||
type: 'GrandpaEquivocationProof'
|
||||
},
|
||||
{
|
||||
name: 'keyOwnerProof',
|
||||
type: 'OpaqueKeyOwnershipProof'
|
||||
}
|
||||
],
|
||||
type: 'Option<Null>'
|
||||
}
|
||||
},
|
||||
}, GRANDPA_V2_V3),
|
||||
version: 3
|
||||
},
|
||||
{
|
||||
methods: GRANDPA_V2_V3,
|
||||
version: 2
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user