Skip to content
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

Update v14 types #3771

Merged
merged 1 commit into from
Jul 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
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