Pull parameter_types! from metadata (#1066)

* @polkadot/{extrinsics,storage} moved to @polkadot/metadata

* Fix previous commit

* Fix previous commit

* Expose parameter types using api.consts

* Grumbles; update v6 static metadata; add UncleEntryItem (fix #1067)

* Update api.query.* to api.consts.* where changed

* Update tests and stray api.query.staking.sessionsPerEra

* Grumbles

* Grumbles

* Revert updates to api-derive (taken care of by #1068)

* Grumbles; fix UncleEntryItem

* Rename "@polkadot/metadata" => "@polkadot/api-metadata"

* Skip derive test

* Grumbles

* Grumbles

* Grumbles

* Cleanup merge, ensure metadata is latest

* Move api-metadata to actual api-metadata folder

* README api-metadata description (& folder link)

* Remove stray type-extrinsics package.json
This commit is contained in:
Axel Chalon
2019-07-09 08:54:28 +02:00
committed by Jaco Greeff
parent 4984002111
commit 9abbaab991
58 changed files with 202 additions and 305 deletions
@@ -0,0 +1,19 @@
// Copyright 2017-2019 @polkadot/api-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 { Metadata, BlockNumber } from '@polkadot/types';
import json from '@polkadot/types/Metadata/v6/static';
import fromMetadata from '../fromMetadata';
// Use the pre-generated metadata
const metadata = new Metadata(json);
const consts = fromMetadata(metadata);
describe('fromMetadata', () => {
it('should return constants with the correct type and value', () => {
expect(consts.democracy.cooloffPeriod).toBeInstanceOf(BlockNumber);
expect(consts.democracy.cooloffPeriod.eq(432000)).toBeTruthy();
});
});