All files / src/persistence/inMemoryStores inMemorySupplyDistributionStores.ts

58.33% Statements 7/12
0% Branches 0/1
33.33% Functions 1/3
55.55% Lines 5/9

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 2141x 41x       41x 41x   41x                        
import { EMPTY, combineLatest, map } from 'rxjs';
import { InMemoryDocumentStore } from './InMemoryDocumentStore';
import { StakeSummary, SupplySummary } from '@cardano-sdk/core';
import { SupplyDistributionStores } from '../types';
 
export class InMemoryStakeSummaryStore extends InMemoryDocumentStore<StakeSummary> {}
export class InMemorySupplySummaryStore extends InMemoryDocumentStore<SupplySummary> {}
 
export const createInMemorySupplyDistributionStores = (): SupplyDistributionStores => ({
  destroy() {
    Iif (!this.destroyed) {
      this.destroyed = true;
      return combineLatest([this.stake.destroy(), this.lovelaceSupply.destroy()]).pipe(map(() => void 0));
    }
    return EMPTY;
  },
  destroyed: false,
  lovelaceSupply: new InMemorySupplySummaryStore(),
  stake: new InMemoryStakeSummaryStore()
});