Some minor cleanups (#1966)

* Some minor cleanups

* Small additions

* Cleanup ExtrinsicEra decoding

* Minor adjustments

* Remove support for metadata v0 parsing

* Adjust refCountDelay

* refCountDelay comments

* Adjust Metadata tests

* Metadata default creation

* Funky lines

* Cleanup as AccountIdAndIndex

* Some derive returns

* Try and cleanup info extraction
This commit is contained in:
Jaco Greeff
2020-02-27 15:01:20 +01:00
committed by GitHub
parent efd6c5331d
commit 4e756704ea
28 changed files with 194 additions and 247 deletions
@@ -1,33 +0,0 @@
// Copyright 2017-2020 @polkadot/metadata authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { TypeRegistry } from '@polkadot/types/create';
import Metadata from '../';
import latestSubstrateV0 from './static-substrate.json';
import rpcData from './static';
import { defaultValues, toLatest } from '../util/testUtil';
describe('Metadata', (): void => {
const registry = new TypeRegistry();
it('decodes into latest substrate', (): void => {
const metadata = new Metadata(registry, rpcData);
const json = metadata.asV0.toJSON();
try {
expect(metadata.version).toBe(0);
expect(metadata.asV0.modules.length).not.toBe(0);
expect(json).toEqual(latestSubstrateV0);
} catch (error) {
console.error(JSON.stringify(json));
throw error;
}
});
toLatest(registry, 0, rpcData, false);
defaultValues(registry, rpcData, false);
});