Convert RPC classes to primitive classes or /srml types (#1192)

* Convert RPC classes to primitive classes or /srml types

* Lint passes... lokking at tests next.

* Tests pass.

* Types with basic docs (lots of work here)

* Update StorageKey.spec.ts

* Add injector to metadata doc generation

* Fix import
This commit is contained in:
Jaco Greeff
2019-07-26 10:23:37 +02:00
committed by GitHub
parent 83515fc0a2
commit 478f54c703
144 changed files with 1824 additions and 2224 deletions
+4 -4
View File
@@ -3,6 +3,7 @@
// 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 { ProviderInterface, ProviderInterfaceEmitted, ProviderInterfaceEmitCb } from '../types';
import { MockStateSubscriptions, MockStateSubscriptionCallback, MockStateDb } from './types';
@@ -11,10 +12,9 @@ import EventEmitter from 'eventemitter3';
import interfaces from '@polkadot/jsonrpc';
import testKeyring from '@polkadot/keyring/testing';
import storage from '@polkadot/api-metadata/storage/static';
import { Codec } from '@polkadot/types/types';
import rpcMetadata from '@polkadot/types/Metadata/static';
import rpcSignedBlock from '@polkadot/types/json/SignedBlock.004.immortal.json';
import { Header, RuntimeVersion, SignedBlock } from '@polkadot/types';
import { createType, Header } from '@polkadot/types';
import { bnToU8a, logger, u8aToHex } from '@polkadot/util';
import { randomAsU8a } from '@polkadot/util-crypto';
@@ -48,10 +48,10 @@ export default class Mock implements ProviderInterface {
private requests: Record<string, (...params: any[]) => string> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
chain_getBlock: (hash: string): any => new SignedBlock(rpcSignedBlock.result).toJSON(),
chain_getBlock: (hash: string): any => createType('SignedBlock', rpcSignedBlock.result).toJSON(),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
chain_getBlockHash: (blockNumber: number): string => '0x1234',
chain_getRuntimeVersion: (): string => new RuntimeVersion().toHex(),
chain_getRuntimeVersion: (): string => createType('RuntimeVersion').toHex(),
state_getStorage: (storage: MockStateDb, params: any[]): string => {
return u8aToHex(
storage[(params[0] as string)]