@@ -8,7 +8,7 @@ import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
import { drr, memo } from '../util';
|
||||
import { drr } from '../util';
|
||||
|
||||
/**
|
||||
* @name bestNumber
|
||||
@@ -22,10 +22,10 @@ import { drr, memo } from '../util';
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export const bestNumber = memo((api: ApiInterfaceRx): () => Observable<BlockNumber> => {
|
||||
export function bestNumber (api: ApiInterfaceRx): () => Observable<BlockNumber> {
|
||||
return (): Observable<BlockNumber> =>
|
||||
api.rpc.chain.subscribeNewHeads().pipe(
|
||||
map((header): BlockNumber => header.number.unwrap()),
|
||||
drr()
|
||||
);
|
||||
}, true);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
|
||||
import { drr, memo } from '../util';
|
||||
import { drr } from '../util';
|
||||
|
||||
/**
|
||||
* @name bestNumberFinalized
|
||||
@@ -23,10 +23,10 @@ import { drr, memo } from '../util';
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export const bestNumberFinalized = memo((api: ApiInterfaceRx): () => Observable<BlockNumber> => {
|
||||
export function bestNumberFinalized (api: ApiInterfaceRx): () => Observable<BlockNumber> {
|
||||
return (): Observable<BlockNumber> =>
|
||||
api.rpc.chain.subscribeFinalizedHeads().pipe(
|
||||
map((header): BlockNumber => header.number.unwrap()),
|
||||
drr()
|
||||
);
|
||||
}, true);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { map } from 'rxjs/operators';
|
||||
import { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
import { drr, memo } from '../util';
|
||||
import { drr } from '../util';
|
||||
import { bestNumber } from './bestNumber';
|
||||
import { bestNumberFinalized } from './bestNumberFinalized';
|
||||
|
||||
@@ -26,7 +26,7 @@ import { bestNumberFinalized } from './bestNumberFinalized';
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export const bestNumberLag = memo((api: ApiInterfaceRx): () => Observable<BlockNumber> => {
|
||||
export function bestNumberLag (api: ApiInterfaceRx): () => Observable<BlockNumber> {
|
||||
const bestNumberCall = bestNumber(api);
|
||||
const bestNumberFinalizedCall = bestNumberFinalized(api);
|
||||
|
||||
@@ -40,4 +40,4 @@ export const bestNumberLag = memo((api: ApiInterfaceRx): () => Observable<BlockN
|
||||
),
|
||||
drr()
|
||||
);
|
||||
}, true);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { catchError, map } from 'rxjs/operators';
|
||||
import { Vec } from '@polkadot/types';
|
||||
|
||||
import { HeaderExtended } from '../type';
|
||||
import { drr, memo } from '../util';
|
||||
import { drr } from '../util';
|
||||
|
||||
/**
|
||||
* @name bestNumberFinalized
|
||||
@@ -27,7 +27,7 @@ import { drr, memo } from '../util';
|
||||
* console.log(`block #${number} was authored by ${author}`);
|
||||
* ```
|
||||
*/
|
||||
export const getHeader = memo((api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<HeaderExtended | undefined> => {
|
||||
export function getHeader (api: ApiInterfaceRx): (hash: Uint8Array | string) => Observable<HeaderExtended | undefined> {
|
||||
return (hash: Uint8Array | string): Observable<HeaderExtended | undefined> =>
|
||||
combineLatest([
|
||||
api.rpc.chain.getHeader(hash),
|
||||
@@ -44,4 +44,4 @@ export const getHeader = memo((api: ApiInterfaceRx): (hash: Uint8Array | string)
|
||||
),
|
||||
drr()
|
||||
);
|
||||
}, true);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { map } from 'rxjs/operators';
|
||||
import { Vec } from '@polkadot/types';
|
||||
|
||||
import { HeaderExtended } from '../type';
|
||||
import { drr, memo } from '../util';
|
||||
import { drr } from '../util';
|
||||
|
||||
/**
|
||||
* @name subscribeNewHeads
|
||||
@@ -25,7 +25,7 @@ import { drr, memo } from '../util';
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export const subscribeNewHeads = memo((api: ApiInterfaceRx): () => Observable<HeaderExtended> => {
|
||||
export function subscribeNewHeads (api: ApiInterfaceRx): () => Observable<HeaderExtended> {
|
||||
return (): Observable<HeaderExtended> =>
|
||||
combineLatest([
|
||||
api.rpc.chain.subscribeNewHeads(),
|
||||
@@ -36,4 +36,4 @@ export const subscribeNewHeads = memo((api: ApiInterfaceRx): () => Observable<He
|
||||
),
|
||||
drr()
|
||||
);
|
||||
}, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user