Additional derive cleanups (#4307)
* Additional derive cleanups * Adjust * Multi cache set * Adjust mapping
This commit is contained in:
@@ -8,7 +8,7 @@ import type { DeriveEraValidatorExposure, DeriveStakerExposure } from '../types'
|
||||
|
||||
import { map, switchMap } from 'rxjs';
|
||||
|
||||
import { memo } from '../util';
|
||||
import { firstObservable, memo } from '../util';
|
||||
|
||||
export function _stakerExposures (instanceId: string, api: ApiInterfaceRx): (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerExposure[][]> {
|
||||
return memo(instanceId, (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive: boolean): Observable<DeriveStakerExposure[][]> => {
|
||||
@@ -48,8 +48,6 @@ export function stakerExposures (instanceId: string, api: ApiInterfaceRx): (acco
|
||||
|
||||
export function stakerExposure (instanceId: string, api: ApiInterfaceRx): (accountId: Uint8Array | string, withActive?: boolean) => Observable<DeriveStakerExposure[]> {
|
||||
return memo(instanceId, (accountId: Uint8Array | string, withActive = false): Observable<DeriveStakerExposure[]> =>
|
||||
api.derive.staking.stakerExposures([accountId], withActive).pipe(
|
||||
map(([first]) => first)
|
||||
)
|
||||
firstObservable(api.derive.staking.stakerExposures([accountId], withActive))
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user