Update @polkadot/types (#105)

This commit is contained in:
Jaco Greeff
2018-06-26 11:11:43 +02:00
committed by GitHub
parent 243cd1bcc2
commit ae9fc0bd97
15 changed files with 113 additions and 113 deletions
+4 -4
View File
@@ -2,6 +2,7 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { Interface$Sections } from '@polkadot/jsonrpc/types';
import { ProviderInterface } from '@polkadot/api-provider/types';
import { RxApiInterface } from './types';
@@ -15,11 +16,10 @@ import createInterface from './interface';
export default function rxApi (provider: ProviderInterface = createWs(defaults.WS_URL)): RxApiInterface {
const api = createApi(provider);
const exposed = createExposed(provider);
return [...interfaces.keys()].reduce((result, type) => {
result[type] = createInterface(api, type);
return Object.keys(interfaces).reduce((result, type) => {
result[type as Interface$Sections] = createInterface(api, type as Interface$Sections);
return result;
}, exposed);
}, createExposed(provider));
}
+7 -4
View File
@@ -2,6 +2,7 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { Interfaces } from '@polkadot/jsonrpc/types';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { Interface$Sections } from '@polkadot/jsonrpc/types';
@@ -12,8 +13,10 @@ export type RxApiInterface$Section = {
[index: string]: RxApiInterface$Method
};
export type RxApiInterface = {
// @ts-ignore this is the odd one out... doesn't quite match index sig
isConnected: () => BehaviorSubject<boolean>;
[index: string]: RxApiInterface$Section;
type RxApiInterface$Keys = {
[key in keyof Interfaces]: RxApiInterface$Section;
};
export type RxApiInterface = RxApiInterface$Keys & {
isConnected: () => BehaviorSubject<boolean>
}