* session api.queryMulti * Make a single subscription to retrieve all session info * Adjustments * WIP * Seems mostly comprehensive, need to full test e2e * e2e tests for operations * Allow "create from empty" * skip * Remove comment * Remove ancient ?'s * Update types.ts
20 lines
583 B
TypeScript
20 lines
583 B
TypeScript
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
|
|
|
import BN from 'bn.js';
|
|
import { Observable } from 'rxjs';
|
|
import { map } from 'rxjs/operators';
|
|
import { ApiInterface$Rx } from '@polkadot/api/types';
|
|
|
|
import { drr } from '../util/drr';
|
|
import { info } from './info';
|
|
|
|
export function eraLength (api: ApiInterface$Rx) {
|
|
return (): Observable<BN> =>
|
|
info(api)().pipe(
|
|
map(({ eraLength }) => eraLength),
|
|
drr()
|
|
);
|
|
}
|