Add chainProperties call to api-observable (#472)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { defaultIfEmpty, map } from 'rxjs/operators';
|
||||
import { BlockNumber, Extrinsic, ExtrinsicStatus, Hash, Header, SignedBlock } from '@polkadot/types/index';
|
||||
import { BlockNumber, ChainProperties, Extrinsic, ExtrinsicStatus, Hash, Header, SignedBlock } from '@polkadot/types/index';
|
||||
|
||||
import ApiQueries from './Queries';
|
||||
|
||||
@@ -26,6 +26,18 @@ export default class ApiCalls extends ApiQueries {
|
||||
return this._api.system.chain();
|
||||
}
|
||||
|
||||
chainProperties = (): Observable<ChainProperties> => {
|
||||
return this._api.system
|
||||
.properties()
|
||||
.pipe(
|
||||
map((properties?: ChainProperties | null): ChainProperties =>
|
||||
properties
|
||||
? properties
|
||||
: new ChainProperties()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
getBlock = (hash: Uint8Array): Observable<SignedBlock | undefined> => {
|
||||
return this._api.chain.getBlock(hash);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user