UNPKG

@superfluid-finance/sdk-core

Version:
47 lines 2.27 kB
import { SubgraphQueryHandler, } from "../../subgraphQueryHandler"; import { PoolsDocument, } from "./pools.generated"; export 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; }; export class PoolQueryHandler extends 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 = PoolsDocument; } } //# sourceMappingURL=pool.js.map