feat: Metadata V6 with module constants (#1059)

* feat: metadata v6, minus static and test

* fix: update v5 to v6 everywhere

* fix: lint and testUtil

* fix typo

* fix: match final metadata. constants no longer optional, StorageFunctionMetadata renamed to StorageEntryMetadata.

* fix: constants constructor

* fix: unit tests pass

* fix: linting and renaming, make tests pass

* fix: skip e2e

remove console log

* fix: formatting test

* fix api e2e tests

* fix: put the skip back

* feat: yarn test:skip-e2e

* fix: grumbles, add fresh flipper wasm

* fix: grumbles, add fresh flipper wasm

* fix: changelog

* fix ci
This commit is contained in:
YJ
2019-07-02 11:48:40 +02:00
committed by Amaury Martiny
parent 2e890b6908
commit 7229a5fdfb
52 changed files with 4309 additions and 299 deletions
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { FunctionMetadata } from '@polkadot/types/Metadata/v5/Calls';
import { FunctionMetadata } from '@polkadot/types/Metadata/v6/Calls';
import { MethodFunction } from '@polkadot/types/primitive/Method';
import { Method } from '@polkadot/types';
import { assert, stringCamelCase } from '@polkadot/util';
@@ -3,13 +3,13 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { Extrinsic, Metadata } from '@polkadot/types';
import json from '@polkadot/types/Metadata/v5/static';
import json from '@polkadot/types/Metadata/v6/static';
import fromV5 from '.';
import fromV6 from '.';
// Use the pre-generated metadata
const metadata = new Metadata(json);
const newExtrinsics = fromV5(metadata);
const newExtrinsics = fromV6(metadata);
describe('fromMetadata', () => {
it('should throw if an incorrect number of args is supplied', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { ModuleMetadata } from '@polkadot/types/Metadata/v5/Metadata';
import { ModuleMetadata } from '@polkadot/types/Metadata/v6/Metadata';
import { Methods, ModulesWithMethods } from '@polkadot/types/primitive/Method';
import Metadata from '@polkadot/types/Metadata';
import { stringCamelCase } from '@polkadot/util';
@@ -18,7 +18,7 @@ import createUnchecked from './createUnchecked';
* @param metadata - The metadata to extend the storage object against.
*/
export default function fromMetadata (metadata: Metadata): ModulesWithMethods {
return metadata.asV5.modules
return metadata.asV6.modules
.filter((modul) => modul.calls.isSome)
.reduce((result, modul: ModuleMetadata, sectionIndex) => {
const section = stringCamelCase(modul.name.toString());
+1 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { Metadata } from '@polkadot/types';
import metadataRpc from '@polkadot/types/Metadata/v5/static';
import metadataRpc from '@polkadot/types/Metadata/v6/static';
import { ModulesWithMethods } from '@polkadot/types/primitive/Method';
import fromMetadata from './fromMetadata';