import { aggregatePublicKeys } from "@chainsafe/blst";
import { SignatureSetType } from "@lodestar/state-transition";
export function getAggregatedPubkey(signatureSet, metrics = null) {
    switch (signatureSet.type) {
        case SignatureSetType.single:
            return signatureSet.pubkey;
        case SignatureSetType.aggregate: {
            const timer = metrics?.blsThreadPool.pubkeysAggregationMainThreadDuration.startTimer();
            const pubkeys = aggregatePublicKeys(signatureSet.pubkeys);
            timer?.();
            return pubkeys;
        }
        default:
            throw Error("Unknown signature set type");
    }
}
export function getAggregatedPubkeysCount(signatureSets) {
    let pubkeysConut = 0;
    for (const set of signatureSets) {
        if (set.type === SignatureSetType.aggregate) {
            pubkeysConut += set.pubkeys.length;
        }
    }
    return pubkeysConut;
}
//# sourceMappingURL=utils.js.map