Update to Metadata v5 (#991)

* add v5 folder

* Fixed typo in README

* Updated tests to v5

* added v5 methods to MetadataVersioned

* Added toV5 conversion file to v4 folder

* change from v4 to v5

* Bump up version

* Update imports in type-storage package

* Switch to v5 imports in type-extrinsics, rpc-core and rpc-provider

* 0.81.0 => 0.82.0

* Updating dependencies to 0.82.0

* update comments

* Undo version bump

* Remove release notes

* v4 to v5 conversion

* WIP tests

* Addresses Amaurys comments

* re-added conversion function

* removed unused imports

* Re-add string to HasherInput type

* addresses failing derive tests

* Fixed broken derive e2e tests

* v5 tests

* Update packages/types/src/Metadata/MetadataVersioned.ts

Co-Authored-By: Amaury Martiny <amaury.martiny@protonmail.com>

* v3->v4

* trigger hung up travis build
This commit is contained in:
Stefanie Doll
2019-06-13 14:42:44 +02:00
committed by GitHub
co-authored by Amaury Martiny
parent 7bd2fcd7f9
commit e4a97d4efd
39 changed files with 3208 additions and 100 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/v4/Calls';
import { FunctionMetadata } from '@polkadot/types/Metadata/v5/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/v4/static';
import json from '@polkadot/types/Metadata/v5/static';
import fromV4 from '.';
import fromV5 from '.';
// Use the pre-generated metadata
const metadata = new Metadata(json);
const newExtrinsics = fromV4(metadata);
const newExtrinsics = fromV5(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/v4/Metadata';
import { ModuleMetadata } from '@polkadot/types/Metadata/v5/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.asV4.modules
return metadata.asV5.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/v4/static';
import metadataRpc from '@polkadot/types/Metadata/v5/static';
import { ModulesWithMethods } from '@polkadot/types/primitive/Method';
import fromMetadata from './fromMetadata';