Align costs typing with queries (#2564)

* Align costs typing with queries

* better...

* ... and better

* ... progress

* better, down to 8

* ... down to 3

* ... 2

* Down to 1

* It builds.

* ... it really builds
This commit is contained in:
Jaco Greeff
2020-09-02 12:19:09 +02:00
committed by GitHub
parent 1214572f02
commit eb6b3c5bd4
15 changed files with 238 additions and 206 deletions
@@ -1,18 +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 { Codec } from '@polkadot/types/types';
import { ModuleConstantMetadataLatest } from '@polkadot/types/interfaces';
export type AugmentedConst<T extends Codec> = T & ConstantCodec;
export type ModuleConstants = Record<string, Codec>;
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Constants {}
export interface ConstantCodec extends Codec {
meta: ModuleConstantMetadataLatest;
}
+10 -4
View File
@@ -2,15 +2,21 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AugmentedConst, QueryableConsts, QueryableModuleConsts } from '@polkadot/api/types/consts';
import { Codec } from '@polkadot/types/types';
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
export * from './consts/types';
export interface ModuleStorage {
[key: string]: StorageEntry;
}
export type Constants = QueryableConsts<'rxjs'>;
export type ConstantCodec = Codec & AugmentedConst<'rxjs'>;
export type ModuleConstants = QueryableModuleConsts;
export interface Storage {
[key: string]: ModuleStorage; // Will hold modules returned by state_getMetadata
substrate: { [key: string]: StorageEntry };
[key: string]: ModuleStorage;
substrate: ModuleStorage;
}