import type { Fr } from '@aztec/foundation/curves/bn254'; import type { AztecAddress } from '../../aztec-address/index.js'; export class ScopedValueCache { private cache: Map = new Map(); constructor(items: T[]) { items.forEach(item => { const value = item.value.toBigInt(); const arr = this.cache.get(value) ?? []; arr.push(item); this.cache.set(value, arr); }); } public get(matcher: { value: Fr; contractAddress: AztecAddress }): T[] { return this.cache.get(matcher.value.toBigInt()) ?? []; } }