UNPKG

@superfluid-finance/sdk-core

Version:
52 lines 2.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PoolQueryHandler = exports.mapSubgraphGDAPool = void 0; const subgraphQueryHandler_1 = require("../../subgraphQueryHandler"); const pools_generated_1 = require("./pools.generated"); const mapSubgraphGDAPool = (x) => { const mappedPool = { ...x, createdAtTimestamp: Number(x.createdAtTimestamp), createdAtBlockNumber: Number(x.createdAtBlockNumber), updatedAtTimestamp: Number(x.updatedAtTimestamp), updatedAtBlockNumber: Number(x.updatedAtBlockNumber), totalAmountInstantlyDistributedUntilUpdatedAt: x.totalAmountInstantlyDistributedUntilUpdatedAt, totalAmountFlowedDistributedUntilUpdatedAt: x.totalAmountFlowedDistributedUntilUpdatedAt, totalAmountDistributedUntilUpdatedAt: x.totalAmountDistributedUntilUpdatedAt, admin: x.admin.id, token: x.token.id, }; return mappedPool; }; exports.mapSubgraphGDAPool = mapSubgraphGDAPool; class PoolQueryHandler extends subgraphQueryHandler_1.SubgraphQueryHandler { constructor() { super(...arguments); this.getAddressFieldKeysFromFilter = () => ({ accountKeys: ["admin", "id"], tokenKeys: ["token"], }); this.getRelevantAddressesFromResultCore = (result) => ({ tokens: [result.token], accounts: [result.admin, result.id], }); this.mapFromSubgraphResponse = (response) => response.pools.map((x) => ({ ...x, createdAtTimestamp: Number(x.createdAtTimestamp), createdAtBlockNumber: Number(x.createdAtBlockNumber), updatedAtTimestamp: Number(x.updatedAtTimestamp), updatedAtBlockNumber: Number(x.updatedAtBlockNumber), totalAmountInstantlyDistributedUntilUpdatedAt: x.totalAmountInstantlyDistributedUntilUpdatedAt, totalAmountFlowedDistributedUntilUpdatedAt: x.totalAmountFlowedDistributedUntilUpdatedAt, totalAmountDistributedUntilUpdatedAt: x.totalAmountDistributedUntilUpdatedAt, totalFlowAdjustmentAmountDistributedUntilUpdatedAt: x.totalFlowAdjustmentAmountDistributedUntilUpdatedAt, perUnitFlowRate: x.perUnitFlowRate, perUnitSettledValue: x.perUnitSettledValue, admin: x.admin.id, token: x.token.id, })); this.requestDocument = pools_generated_1.PoolsDocument; } } exports.PoolQueryHandler = PoolQueryHandler; //# sourceMappingURL=pool.js.map