"use strict";
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseGraphQLEpochs = exports.allocationRewardsPool = exports.parseGraphQLAllocation = exports.AllocationStatus = void 0;
const common_ts_1 = require("@graphprotocol/common-ts");
const ethers_1 = require("ethers");
var AllocationStatus;
(function (AllocationStatus) {
    AllocationStatus[AllocationStatus["Null"] = 0] = "Null";
    AllocationStatus[AllocationStatus["Active"] = 1] = "Active";
    AllocationStatus[AllocationStatus["Closed"] = 2] = "Closed";
    AllocationStatus[AllocationStatus["Finalized"] = 3] = "Finalized";
    AllocationStatus[AllocationStatus["Claimed"] = 4] = "Claimed";
})(AllocationStatus = exports.AllocationStatus || (exports.AllocationStatus = {}));
/* eslint-disable @typescript-eslint/no-explicit-any */
exports.parseGraphQLAllocation = (allocation) => ({
    // Ensure the allocation ID (an address) is checksummed
    id: common_ts_1.toAddress(allocation.id),
    subgraphDeployment: {
        id: new common_ts_1.SubgraphDeploymentID(allocation.subgraphDeployment.id),
        stakedTokens: ethers_1.BigNumber.from(allocation.subgraphDeployment.stakedTokens),
        signalAmount: ethers_1.BigNumber.from(allocation.subgraphDeployment.signalAmount),
    },
    indexer: common_ts_1.toAddress(allocation.indexer.id),
    allocatedTokens: ethers_1.BigNumber.from(allocation.allocatedTokens),
    createdAtBlockHash: allocation.createdAtBlockHash,
    createdAtEpoch: allocation.createdAtEpoch,
    closedAtEpoch: allocation.closedAtEpoch,
    closedAtEpochStartBlockHash: undefined,
    previousEpochStartBlockHash: undefined,
    closedAtBlockHash: allocation.closedAtBlockHash,
    poi: allocation.poi,
});
exports.allocationRewardsPool = (allocation) => ({
    subgraphDeployment: allocation.subgraphDeployment.id,
    allocationIndexer: allocation.indexer,
    allocationCreatedAtBlockHash: allocation.createdAtBlockHash,
    closedAtEpoch: allocation.closedAtEpoch,
    closedAtEpochStartBlockHash: allocation.closedAtEpochStartBlockHash,
    closedAtEpochStartBlockNumber: undefined,
    previousEpochStartBlockHash: allocation.previousEpochStartBlockHash,
    previousEpochStartBlockNumber: undefined,
    referencePOI: undefined,
    referencePreviousPOI: undefined,
});
/* eslint-disable @typescript-eslint/no-explicit-any */
exports.parseGraphQLEpochs = (epoch) => ({
    id: epoch.id,
    startBlock: epoch.startBlock,
    startBlockHash: undefined,
    endBlock: epoch.endBlock,
    signalledTokens: epoch.signalledTokens,
    stakeDeposited: epoch.stakeDeposited,
    queryFeeRebates: epoch.queryFeeRebates,
    totalRewards: epoch.totalRewards,
    totalIndexerRewards: epoch.totalIndexerRewards,
    totalDelegatorRewards: epoch.totalDelegatorRewards,
});
//# sourceMappingURL=types.js.map