Cleanups for bestNumber derives (#4318)

* Cleanups for bestNumber derives

* Unused imports

* Re-exports of types for *.d.ts outputs
This commit is contained in:
Jaco
2021-12-11 09:35:52 +02:00
committed by GitHub
parent c32953b2ea
commit 63a55d2f8a
14 changed files with 73 additions and 105 deletions
@@ -4,6 +4,9 @@
import type { ApiInterfaceRx } from '@polkadot/api/types';
import type { Collective } from './types';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { ApiInterfaceRx } from '@polkadot/api/types';
export function getInstance (api: ApiInterfaceRx, section: string): string {
const instances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), section);
@@ -13,6 +13,10 @@ import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { withSection } from './helpers';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { ApiInterfaceRx } from '@polkadot/api/types';
export type { AccountId } from '@polkadot/types/interfaces';
export function members (_section: Collective): (instanceId: string, api: ApiInterfaceRx) => () => Observable<AccountId[]> {
return withSection(_section, (section, instanceId, api) =>
memo(instanceId, (): Observable<AccountId[]> =>
@@ -14,6 +14,10 @@ import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { withSection } from './helpers';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { ApiInterfaceRx } from '@polkadot/api/types';
export type { AccountId } from '@polkadot/types/interfaces';
export function prime (_section: Collective): (instanceId: string, api: ApiInterfaceRx) => () => Observable<AccountId | null> {
return withSection(_section, (section, instanceId, api) =>
memo(instanceId, (): Observable<AccountId | null> =>
@@ -15,6 +15,11 @@ import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { withSection } from './helpers';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { ApiInterfaceRx } from '@polkadot/api/types';
export type { Option, u32 } from '@polkadot/types';
export type { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
function parse (api: ApiInterfaceRx, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {