Some minor cleanups (#1966)
* Some minor cleanups * Small additions * Cleanup ExtrinsicEra decoding * Minor adjustments * Remove support for metadata v0 parsing * Adjust refCountDelay * refCountDelay comments * Adjust Metadata tests * Metadata default creation * Funky lines * Cleanup as AccountIdAndIndex * Some derive returns * Try and cleanup info extraction
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { BlockNumber, Header } from '@polkadot/types/interfaces';
|
||||
import { BlockNumber } from '@polkadot/types/interfaces';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
@@ -25,6 +25,6 @@ import { memo } from '../util';
|
||||
export function bestNumber (api: ApiInterfaceRx): () => Observable<BlockNumber> {
|
||||
return memo((): Observable<BlockNumber> =>
|
||||
api.derive.chain.subscribeNewHeads().pipe(
|
||||
map((header: Header): BlockNumber => header.number.unwrap())
|
||||
map((header) => header.number.unwrap())
|
||||
));
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ import { memo } from '../util';
|
||||
export function bestNumberFinalized (api: ApiInterfaceRx): () => Observable<BlockNumber> {
|
||||
return memo((): Observable<BlockNumber> =>
|
||||
api.rpc.chain.subscribeFinalizedHeads().pipe(
|
||||
map((header): BlockNumber => header.number.unwrap())
|
||||
map((header) => header.number.unwrap())
|
||||
));
|
||||
}
|
||||
|
||||
@@ -2,14 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
import { Observable, combineLatest, of } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
|
||||
import { Vec } from '@polkadot/types';
|
||||
|
||||
import { HeaderExtended } from '../type';
|
||||
import { memo } from '../util';
|
||||
|
||||
@@ -32,7 +29,7 @@ export function getHeader (api: ApiInterfaceRx): (hash: Uint8Array | string) =>
|
||||
combineLatest([
|
||||
api.rpc.chain.getHeader(hash),
|
||||
api.query.session
|
||||
? api.query.session.validators.at(hash) as Observable<Vec<AccountId>>
|
||||
? api.query.session.validators.at(hash)
|
||||
: of([])
|
||||
]).pipe(
|
||||
map(([header, validators]): HeaderExtended =>
|
||||
|
||||
Reference in New Issue
Block a user