Refactor api-promise/rx (#566)

* Use a generic abstract OnCall

* Add OnCall for Promise

* First run at fixing extrinsics

* Fix types

* Make submittable extrinsic work

* Move file

* Make derive work

* Fix types

* Only call metadata once

* Make tests pass

* Put event emitter in apirx

* Fix small bugs

* Fix tests

* Fix bug decorateStorage

* Make tests pass for tx

* Move rpc base to apirx

* Fix lint

* Fix small bugs

* Fix bug with isSubscription

* Fix codeclimate

* Revert

* Add tslint disable line

* Fix lint

* Skip e2e

* Typo

* Lint

* Re-add combinator back

* Add ._rx in Base

* Make extrinsics work

* Update derivex

* Fix bug lint

* Fix circular dep

* Fix bug e2e

* Remove useless check

* Add description comment

* Clean stuff

* Move assert to Base

* Bump version, update CHANGELOG

* Make _rx private

* Private emit
This commit is contained in:
Amaury Martiny
2019-01-16 15:42:59 +01:00
committed by Jaco Greeff
parent 38d2d06772
commit d07ed8ac38
49 changed files with 523 additions and 617 deletions
+2 -2
View File
@@ -5,12 +5,12 @@
import BN from 'bn.js';
import { combineLatest, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import ApiRx from '@polkadot/api/rx';
import { ApiInterface$Rx } from '@polkadot/api/types';
import { BlockNumber } from '@polkadot/types/index';
import { drr } from '../util/drr';
export function eraLength (api: ApiRx) {
export function eraLength (api: ApiInterface$Rx) {
return (): Observable<BN> =>
(combineLatest(
api.query.session.sessionLength(),
@@ -5,13 +5,13 @@
import BN from 'bn.js';
import { combineLatest, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import ApiRx from '@polkadot/api/rx';
import { ApiInterface$Rx } from '@polkadot/api/types';
import { BlockNumber } from '@polkadot/types/index';
import { sessionProgress } from './sessionProgress';
import { drr } from '../util/drr';
export function eraProgress (api: ApiRx) {
export function eraProgress (api: ApiInterface$Rx) {
return (): Observable<BN> =>
(combineLatest(
sessionProgress(api)(),
@@ -5,13 +5,13 @@
import BN from 'bn.js';
import { combineLatest, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import ApiRx from '@polkadot/api/rx';
import { ApiInterface$Rx } from '@polkadot/api/types';
import { BlockNumber } from '@polkadot/types/index';
import { bestNumber } from '../chain';
import { drr } from '../util/drr';
export function sessionProgress (api: ApiRx) {
export function sessionProgress (api: ApiInterface$Rx) {
return (): Observable<BN> =>
combineLatest(
bestNumber(api)(),