Dedupe staking derive caches (#4301)

* Dedupe staking derive caches

* Dedupe

* Adjust

* Adjust

* typing

* lintin

* Adjust
This commit is contained in:
Jaco
2021-12-08 17:17:38 +02:00
committed by GitHub
parent 4a7bfe96e1
commit 9a2cd1c446
13 changed files with 100 additions and 111 deletions
+3 -3
View File
@@ -39,12 +39,12 @@ export { lazyDeriveSection };
export const derive = { accounts, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
type DeriveSection<Section> = {
[Method in keyof Section]: Section[Method] extends AnyFunction
? ReturnType<Section[Method]> // ReturnType<Section[Method]> will be the inner function, i.e. without (api) argument
[M in keyof Section]: Section[M] extends AnyFunction
? ReturnType<Section[M]> // ReturnType<Section[Method]> will be the inner function, i.e. without (api) argument
: never;
};
type DeriveAllSections<AllSections> = {
[Section in keyof AllSections]: DeriveSection<AllSections[Section]>
[S in keyof AllSections]: DeriveSection<AllSections[S]>
};
type DeriveCreator = (instanceId: string, api: ApiInterfaceRx) => (...args: unknown[]) => Observable<any>;