* Revert "[CI Skip] release/beta 2.4.2-10" This reverts commit5cb1c2d33a. * Revert "Use asLatest in metadata extraction (#2800)" This reverts commit600666de1c. * Bumps * Expansion * Flatten * Metadata class imports * Cleanup Decorate exports * Move Metadata to top-level * Swap logger on ABI * Adjust imports * Cleanups * Updates
23 lines
683 B
TypeScript
23 lines
683 B
TypeScript
// Copyright 2017-2020 @polkadot/metadata authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import { AnyNumber, Registry } from '@polkadot/types/types';
|
|
|
|
import { assert } from '@polkadot/util';
|
|
|
|
import U32 from '@polkadot/types/primitive/U32';
|
|
|
|
export const MAGIC_NUMBER = 0x6174656d; // `meta`, reversed for Little Endian encoding
|
|
|
|
export default class MagicNumber extends U32 {
|
|
constructor (registry: Registry, value?: AnyNumber) {
|
|
super(registry, value);
|
|
|
|
if (!this.isEmpty) {
|
|
const magic = registry.createType('u32', MAGIC_NUMBER);
|
|
|
|
assert(this.eq(magic), `MagicNumber mismatch: expected ${magic.toHex()}, found ${this.toHex()}`);
|
|
}
|
|
}
|
|
}
|