"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompoundClaimableContractPositionFetcher = void 0;
const image_present_1 = require("../../../app-toolkit/helpers/presentation/image.present");
const position_interface_1 = require("../../../position/position.interface");
const contract_position_template_position_fetcher_1 = require("../../../position/template/contract-position.template.position-fetcher");
class CompoundClaimableContractPositionFetcher extends contract_position_template_position_fetcher_1.ContractPositionTemplatePositionFetcher {
    getContract(address) {
        return this.getCompoundComptrollerContract(address);
    }
    getDefinitions() {
        return __awaiter(this, void 0, void 0, function* () {
            return [{ address: this.comptrollerAddress }];
        });
    }
    getTokenDefinitions(_opts) {
        return __awaiter(this, void 0, void 0, function* () {
            return [
                {
                    metaType: position_interface_1.MetaType.CLAIMABLE,
                    address: this.rewardTokenAddress,
                    network: this.network,
                },
            ];
        });
    }
    getLabel({ contractPosition }) {
        return __awaiter(this, void 0, void 0, function* () {
            const rewardToken = contractPosition.tokens[0];
            return `Claimable ${(0, image_present_1.getLabelFromToken)(rewardToken)}`;
        });
    }
    getDataProps(_params) {
        return __awaiter(this, void 0, void 0, function* () {
            return {
                lensAddress: this.lensAddress,
            };
        });
    }
    getTokenBalancesPerPosition({ address, contractPosition, }) {
        return __awaiter(this, void 0, void 0, function* () {
            const { dataProps: { lensAddress }, } = contractPosition;
            const lensContract = this.getCompoundLensContract(lensAddress);
            const claimableBalance = yield this.getClaimableBalance(address, { contract: lensContract, contractPosition });
            return [claimableBalance];
        });
    }
}
exports.CompoundClaimableContractPositionFetcher = CompoundClaimableContractPositionFetcher;
//# sourceMappingURL=compound.claimable.contract-position-fetcher.js.map