Skip to content

Commit

Permalink
Update v14 types (#3771)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr authored Jul 14, 2021
1 parent 82fc468 commit 3ea7cb4
Show file tree
Hide file tree
Showing 7 changed files with 76,350 additions and 41,205 deletions.
3 changes: 2 additions & 1 deletion packages/types/src/interfaces/metadata/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export default {
V10: 'MetadataV10',
V11: 'MetadataV11',
V12: 'MetadataV12',
V13: 'MetadataV13'
V13: 'MetadataV13',
V14: 'MetadataV14'
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/interfaces/metadata/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export interface MetadataAll extends Enum {
readonly asV12: MetadataV12;
readonly isV13: boolean;
readonly asV13: MetadataV13;
readonly isV14: boolean;
readonly asV14: MetadataV14;
}

/** @name MetadataLatest */
Expand Down Expand Up @@ -326,6 +328,7 @@ export interface SignedExtensionMetadataLatest extends SignedExtensionMetadataV1
export interface SignedExtensionMetadataV14 extends Struct {
readonly identifier: Text;
readonly type: SiLookupTypeId;
readonly additionalSigned: SiLookupTypeId;
}

/** @name StorageEntryMetadataLatest */
Expand Down
3 changes: 2 additions & 1 deletion packages/types/src/interfaces/metadata/v14.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const v14: DefinitionsTypes = {
},
SignedExtensionMetadataV14: {
identifier: 'Text',
type: 'SiLookupTypeId'
type: 'SiLookupTypeId',
additionalSigned: 'SiLookupTypeId'
},
StorageEntryMetadataV14: {
name: 'Text',
Expand Down
26 changes: 26 additions & 0 deletions packages/types/src/metadata/v14/Metadata.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0

import type { MetadataAll } from '../../interfaces/metadata';

import { TypeRegistry } from '../../create';
import { Metadata } from '../Metadata';
import substrateData from './static';

describe('MetadataV14 (substrate)', (): void => {
it('parses', (): void => {
const registry = new TypeRegistry();
const metadata = new Metadata(registry, substrateData);
const all = metadata.get('metadata') as MetadataAll;

expect(all).toBeDefined();

// console.log(JSON.stringify(all.toJSON()));
console.log(JSON.stringify(
all.asV14.types.types.map((t, __INDEX) => ({
__INDEX,
...t.toJSON()
}))
));
});
});
Loading

0 comments on commit 3ea7cb4

Please sign in to comment.