Cleanup module-specific type-overrides (#1756)

This commit is contained in:
Jaco Greeff
2020-01-28 16:18:40 +01:00
committed by GitHub
parent cedbd8fa06
commit 7de647ec0b
7 changed files with 34 additions and 51 deletions
@@ -10,8 +10,6 @@ const ALLOWED_BOXES = ['BTreeMap', 'BTreeSet', 'Compact', 'Linkage', 'Result', '
const mappings: Mapper[] = [
// alias <T::InherentOfflineReport as InherentOfflineReport>::Inherent -> InherentOfflineReport
_alias('<T::InherentOfflineReport as InherentOfflineReport>::Inherent', 'InherentOfflineReport'),
// alias TreasuryProposal from Proposal<T::AccountId, BalanceOf<T>>
_alias('Proposal<T::AccountId, BalanceOf<T>>', 'TreasuryProposal'),
// <T::Balance as HasCompact>
_cleanupCompact(),
// Remove all the trait prefixes
+2 -2
View File
@@ -48,6 +48,6 @@ export function getChainTypes (chainName: Text, { specName, specVersion }: Runti
// get types for specific modules (metadata override)
/** @internal */
export function getModuleTypes (section: string): OverrideModuleType[] {
return TYPES_MODULES[section] || [];
export function getModuleTypes (section: string): OverrideModuleType {
return TYPES_MODULES[section] || {};
}
+15 -18
View File
@@ -4,24 +4,21 @@
import { OverrideModuleType, OverrideVersionedType } from './types';
// type overrides for modules (where dupliacted between modules do exist)
const TYPES_MODULES: Record<string, OverrideModuleType[]> = {
identity: [
{
name: 'Judgement',
override: 'IdentityJudgement'
}
],
society: [
{
name: 'Judgement',
override: 'SocietyJudgement'
},
{
name: 'Vote',
override: 'SocietyVote'
}
]
// type overrides for modules (where duplication between modules exist)
const TYPES_MODULES: Record<string, OverrideModuleType> = {
contracts: {
StorageKey: 'ContractStorageKey'
},
identity: {
Judgement: 'IdentityJudgement'
},
society: {
Judgement: 'SocietyJudgement',
Vote: 'SocietyVote'
},
treasury: {
Proposal: 'TreasuryProposal'
}
};
// these are override types for Polkadot & Kusama chains
+1 -4
View File
@@ -9,7 +9,4 @@ export interface OverrideVersionedType {
types: RegistryTypes;
}
export interface OverrideModuleType {
name: string;
override: string;
}
export type OverrideModuleType = Record<string, string>;