import { Counter, Gauge, Histogram } from 'prom-client'; import { Logger, Address, Metrics, Eventual } from '@graphprotocol/common-ts'; import { Allocation, AllocationReceipt, QueryFeeModels, TransactionManager, specification as spec, SubgraphClient } from '..'; import { DHeap } from '@thi.ng/heaps'; import { BigNumber, Contract } from 'ethers'; interface AllocationReceiptsBatch { receipts: AllocationReceipt[]; timeout: number; } export interface PartialVoucher { allocation: string; fees: string; signature: string; receipt_id_min: string; receipt_id_max: string; } interface ReceiptMetrics { receiptsToCollect: Gauge; failedReceipts: Counter; partialVouchersToExchange: Gauge; receiptsCollectDuration: Histogram; vouchers: Counter; successVoucherRedeems: Counter; invalidVoucherRedeems: Counter; failedVoucherRedeems: Counter; vouchersRedeemDuration: Histogram; vouchersBatchRedeemSize: Gauge; voucherCollectedFees: Gauge; } export interface AllocationPartialVouchers { allocation: string; partialVouchers: PartialVoucher[]; } export interface AllocationReceiptCollectorOptions { logger: Logger; metrics: Metrics; transactionManager: TransactionManager; allocationExchange: Contract; allocations: Eventual; models: QueryFeeModels; networkSpecification: spec.NetworkSpecification; networkSubgraph: SubgraphClient; } export interface ReceiptCollector { rememberAllocations(actionID: number, allocationIDs: Address[]): Promise; collectReceipts(actionID: number, allocation: Allocation): Promise; } export declare class AllocationReceiptCollector implements ReceiptCollector { logger: Logger; metrics: ReceiptMetrics; models: QueryFeeModels; transactionManager: TransactionManager; allocationExchange: Contract; allocations: Eventual; collectEndpoint: URL; partialVoucherEndpoint: URL; voucherEndpoint: URL; receiptsToCollect: DHeap; voucherRedemptionThreshold: BigNumber; voucherRedemptionBatchThreshold: BigNumber; voucherRedemptionMaxBatchSize: number; protocolNetwork: string; networkSubgraph: SubgraphClient; private constructor(); static create({ logger, metrics, transactionManager, models, allocationExchange, allocations, networkSpecification, networkSubgraph, }: AllocationReceiptCollectorOptions): Promise; rememberAllocations(actionID: number, allocationIDs: Address[]): Promise; collectReceipts(actionID: number, allocation: Allocation): Promise; private startReceiptCollecting; private startVoucherProcessing; private pendingVouchers; private encodeReceiptBatch; private obtainReceiptsVoucher; private submitVouchers; queuePendingReceiptsFromDatabase(): Promise; } export declare function encodePartialVouchers(partialVouchers: PartialVoucher[]): AllocationPartialVouchers; export {};