# All files / dist/allocations types.js

81.25% Statements 13/16
100% Branches 2/2
25% Functions 1/4
100% Lines 13/13

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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59

    3x
    3x
    3x
    3x

    3x
    3x
    3x
    3x
    3x
    3x

    3x

    3x

    3x

     "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