fix usage with typescript (#405)
* fix usage with typescript - export Base within codec - Codec is not generic - use wildcard import for json rpc types * remove unsued generic + remove unsued import * import Codec instead of Base * use correct import for codec type * replace Base by Codec import and usage * remove unsued import
This commit is contained in:
committed by
Amaury Martiny
parent
7fc67826d7
commit
141f761063
Vendored
+3
-3
@@ -7,7 +7,7 @@ import { ApiBaseInterface } from '../types';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ExtrinsicFunction } from '@polkadot/extrinsics/types';
|
||||
import Rpc from '@polkadot/rpc-core/index';
|
||||
import { Base } from '@polkadot/types/codec';
|
||||
import { Codec } from '@polkadot/types/types';
|
||||
import { Hash, RuntimeVersion } from '@polkadot/types/index';
|
||||
import RuntimeMetadata, { FunctionMetadata } from '@polkadot/types/Metadata';
|
||||
import { StorageFunction } from '@polkadot/types/StorageKey';
|
||||
@@ -15,7 +15,7 @@ import { StorageFunction } from '@polkadot/types/StorageKey';
|
||||
import SubmittableExtrinsic from './SubmittableExtrinsic';
|
||||
|
||||
export interface QueryableStorageFunction extends StorageFunction {
|
||||
(arg?: any): Promise<Base | null | undefined>;
|
||||
(arg?: any): Promise<Codec | null | undefined>;
|
||||
}
|
||||
|
||||
export interface QueryableModuleStorage {
|
||||
@@ -38,6 +38,6 @@ export interface SubmittableExtrinsics {
|
||||
[index: string]: SubmittableModuleExtrinsics;
|
||||
}
|
||||
|
||||
export interface ApiPromiseInterface extends ApiBaseInterface<Rpc, QueryableStorage, SubmittableExtrinsics> {
|
||||
export interface ApiPromiseInterface extends ApiBaseInterface<Rpc, QueryableStorage, SubmittableExtrinsics> {
|
||||
readonly isReady: Promise<ApiPromiseInterface>;
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -7,7 +7,7 @@ import { ApiBaseInterface } from '../types';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ExtrinsicFunction } from '@polkadot/extrinsics/types';
|
||||
import RpcRx from '@polkadot/rpc-rx/index';
|
||||
import { Base } from '@polkadot/types/codec';
|
||||
import { Codec } from '@polkadot/types/types';
|
||||
import { Hash, RuntimeVersion } from '@polkadot/types/index';
|
||||
import RuntimeMetadata, { FunctionMetadata } from '@polkadot/types/Metadata';
|
||||
import { StorageFunction } from '@polkadot/types/StorageKey';
|
||||
@@ -15,7 +15,7 @@ import { StorageFunction } from '@polkadot/types/StorageKey';
|
||||
import SubmittableExtrinsic from './SubmittableExtrinsic';
|
||||
|
||||
export interface QueryableStorageFunction extends StorageFunction {
|
||||
(arg?: any): Observable<Base | null | undefined>;
|
||||
(arg?: any): Observable<Codec | null | undefined>;
|
||||
}
|
||||
|
||||
export interface QueryableModuleStorage {
|
||||
@@ -38,7 +38,7 @@ export interface SubmittableExtrinsics {
|
||||
[index: string]: SubmittableModuleExtrinsics;
|
||||
}
|
||||
|
||||
export interface ApiRxInterface extends ApiBaseInterface<RpcRx, QueryableStorage, SubmittableExtrinsics> {
|
||||
export interface ApiRxInterface extends ApiBaseInterface<RpcRx, QueryableStorage, SubmittableExtrinsics> {
|
||||
readonly isConnected: Observable<boolean>;
|
||||
readonly isReady: Observable<ApiRxInterface>;
|
||||
}
|
||||
|
||||
Vendored
+1
-2
@@ -4,7 +4,6 @@
|
||||
|
||||
import RpcRx from '@polkadot/rpc-rx/index';
|
||||
import { RpcRxInterface$Events } from '@polkadot/rpc-rx/types';
|
||||
import { Base } from '@polkadot/types/codec';
|
||||
import { Hash, RuntimeVersion } from '@polkadot/types/index';
|
||||
import RuntimeMetadata, { FunctionMetadata } from '@polkadot/types/Metadata';
|
||||
import { ExtrinsicFunction } from '@polkadot/extrinsics/types';
|
||||
@@ -12,7 +11,7 @@ import { StorageFunction } from '@polkadot/types/StorageKey';
|
||||
|
||||
export type ApiInterface$Events = RpcRxInterface$Events | 'ready';
|
||||
|
||||
export interface ApiBaseInterface <R, S, E> {
|
||||
export interface ApiBaseInterface<R, S, E> {
|
||||
readonly genesisHash: Hash;
|
||||
readonly runtimeMetadata: RuntimeMetadata;
|
||||
readonly runtimeVersion: RuntimeVersion;
|
||||
|
||||
Vendored
-1
@@ -3,7 +3,6 @@
|
||||
// of the ISC license. See the LICENSE file for details.
|
||||
|
||||
import { ReplaySubject, Observable } from 'rxjs';
|
||||
import interfaces from '@polkadot/jsonrpc/types';
|
||||
|
||||
export type RpcRxInterface$Method = (...params: Array<any>) => Observable<any> | ReplaySubject<any>;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -29,4 +29,4 @@ export type Constructor<T = Codec> = { new(value?: any): T };
|
||||
|
||||
export type ConstructorDef<T = Codec> = { [index: string]: Constructor<T> };
|
||||
|
||||
export type TypeDef<T = Codec> = { [index: string]: Codec<T> };
|
||||
export type TypeDef = { [index: string]: Codec };
|
||||
|
||||
Reference in New Issue
Block a user