Move api-derive to correct location (#4343)

* Move api-derive to correct location

* Adjust (linting ok)

* No composite

* ApiDerive split

* Adjust

* Still WIP, getting closer

* It lints

* derive build issues sorted

* It builds :)

* Add system_health to mock

* api-augment usage

* Cleanups

* Adjust paths

* linting

* Some <'s

* Revert <>'s

* linting

* ordering

* Augmentation tweaks

* yarn.lock

* export
This commit is contained in:
Jaco
2021-12-18 09:18:55 +02:00
committed by GitHub
parent 7b8a6e89d9
commit 4913cf65fd
178 changed files with 720 additions and 685 deletions
+30
View File
@@ -0,0 +1,30 @@
// Copyright 2017-2021 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { EventRecord, Hash, SignedBlock } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import { combineLatest, map, switchMap } from 'rxjs';
import { memo } from '../util';
interface Result {
block: SignedBlock;
events: EventRecord[];
}
export function events (instanceId: string, api: DeriveApi): (at: Hash) => Observable<Result> {
return memo(instanceId, (blockHash: Hash) =>
combineLatest([
api.rpc.chain.getBlock(blockHash),
api.queryAt(blockHash).pipe(
switchMap((queryAt) =>
queryAt.system.events()
)
)
]).pipe(
map(([block, events]) => ({ block, events }))
)
);
}