Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 42x 42x 42x 131x 131x 131x 117x 117x 117x 42x 131x 131x 131x 131x 197x 197x 131x | import { BehaviorSubject } from 'rxjs';
import { CLEAN_FN_STATS, ProviderFnStats, ProviderTracker } from './ProviderTracker';
import { RewardAccountInfoProvider } from '@cardano-sdk/core';
export class RewardAccountInfoProviderStats {
readonly healthCheck$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS);
readonly rewardAccountInfo$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS);
readonly delegationPortfolio$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS);
shutdown() {
this.healthCheck$.complete();
this.rewardAccountInfo$.complete();
this.delegationPortfolio$.complete();
}
reset() {
this.healthCheck$.next(CLEAN_FN_STATS);
this.rewardAccountInfo$.next(CLEAN_FN_STATS);
this.delegationPortfolio$.next(CLEAN_FN_STATS);
}
}
/** Wraps a RewardAccountInfoProvider, tracking # of calls of each function */
export class TrackedRewardAccountInfoProvider extends ProviderTracker implements RewardAccountInfoProvider {
readonly stats = new RewardAccountInfoProviderStats();
readonly healthCheck: RewardAccountInfoProvider['healthCheck'];
readonly rewardAccountInfo: RewardAccountInfoProvider['rewardAccountInfo'];
readonly delegationPortfolio: RewardAccountInfoProvider['delegationPortfolio'];
constructor(rewardAccountInfoProvider: RewardAccountInfoProvider) {
super();
this.healthCheck = () => this.trackedCall(() => rewardAccountInfoProvider.healthCheck(), this.stats.healthCheck$);
this.rewardAccountInfo = (rewardAccount, localEpoch) =>
this.trackedCall(
() => rewardAccountInfoProvider.rewardAccountInfo(rewardAccount, localEpoch),
this.stats.rewardAccountInfo$
);
this.delegationPortfolio = (rewardAccount) =>
this.trackedCall(
() => rewardAccountInfoProvider.delegationPortfolio(rewardAccount),
this.stats.delegationPortfolio$
);
}
}
|