@@ -13,7 +13,7 @@ import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
1313import { isFunction } from '@polkadot/util' ;
1414
1515import { memo } from '../util' ;
16- import { withSection } from './helpers' ;
16+ import { callMethod , withSection } from './helpers' ;
1717
1818// We are re-exporting these from here to ensure that *.d.ts generation is correct
1919export type { ApiInterfaceRx } from '@polkadot/api/types' ;
@@ -72,26 +72,6 @@ export function hasProposals (_section: Collective): (instanceId: string, api: A
7272 ) ;
7373}
7474
75- export function proposalCount ( _section : Collective ) : ( instanceId : string , api : ApiInterfaceRx ) => ( ) => Observable < u32 | null > {
76- return withSection ( _section , ( section , instanceId , api ) =>
77- memo ( instanceId , ( ) : Observable < u32 | null > =>
78- isFunction ( api . query [ section ] . proposalCount )
79- ? api . query [ section as 'council' ] . proposalCount ( )
80- : of ( null )
81- )
82- ) ;
83- }
84-
85- export function proposalHashes ( _section : Collective ) : ( instanceId : string , api : ApiInterfaceRx ) => ( ) => Observable < Hash [ ] > {
86- return withSection ( _section , ( section , instanceId , api ) =>
87- memo ( instanceId , ( ) : Observable < Hash [ ] > =>
88- isFunction ( api . query [ section ] ?. proposals )
89- ? api . query [ section as 'council' ] . proposals ( )
90- : of ( [ ] )
91- )
92- ) ;
93- }
94-
9575export function proposals ( _section : Collective ) : ( instanceId : string , api : ApiInterfaceRx ) => ( ) => Observable < DeriveCollectiveProposal [ ] > {
9676 return withProposals ( _section , ( section , instanceId , api , proposalsFrom ) =>
9777 memo ( instanceId , ( ) : Observable < DeriveCollectiveProposal [ ] > =>
@@ -113,3 +93,6 @@ export function proposal (_section: Collective): (instanceId: string, api: ApiIn
11393 )
11494 ) ;
11595}
96+
97+ export const proposalCount = callMethod < u32 | null > ( 'proposalCount' , null ) ;
98+ export const proposalHashes = callMethod < Hash [ ] > ( 'proposals' , [ ] ) ;
0 commit comments