refactor: Fixes #239. Rename from RxRpc to RpcRx in rpc-rx types (#240)

This commit is contained in:
Luke Schoen
2018-10-11 07:37:30 +02:00
committed by Jaco Greeff
parent 9e2962f0c5
commit 3c8c4b0baf
4 changed files with 25 additions and 25 deletions
+5 -5
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { RxRpcInterface, RxRpcInterface$Method, RxRpcInterface$Section } from '@polkadot/rpc-rx/types';
import { RpcRxInterface, RpcRxInterface$Method, RpcRxInterface$Section } from '@polkadot/rpc-rx/types';
import { RpcMethod } from '@polkadot/jsonrpc/types';
import { EMPTY, Observable, combineLatest, from } from 'rxjs';
@@ -25,13 +25,13 @@ const defaultMapFn = (result: any): any =>
// Raw base implementation for the observable API. It simply provides access to raw calls, allowing
// decendants to make direct queries to either API methods or actual storage
export default class ApiBase {
protected _api: RxRpcInterface;
protected _api: RpcRxInterface;
protected _genesisHash: Hash;
// Observable that returns the first time we are connected and loaded
whenReady: Observable<boolean>;
constructor (api: RxRpcInterface) {
constructor (api: RpcRxInterface) {
this._api = api;
this._genesisHash = new Hash();
this.whenReady = from(this.init());
@@ -91,11 +91,11 @@ export default class ApiBase {
}
rawCall = <T> ({ method, section }: RpcMethod, ...params: Array<any>): Observable<T> => {
const apiSection = this._api[section as keyof RxRpcInterface] as RxRpcInterface$Section;
const apiSection = this._api[section as keyof RpcRxInterface] as RpcRxInterface$Section;
assert(apiSection, `Unable to find 'api.${section}'`);
const fn: RxRpcInterface$Method = apiSection[method];
const fn: RpcRxInterface$Method = apiSection[method];
assert(fn, `Unable to find 'api.${section}.${method}'`);