UNPKG

@superfluid-finance/sdk-core

Version:
32 lines 1.41 kB
import { SubgraphQueryHandler, } from "../../subgraphQueryHandler"; import { IndexSubscriptionsDocument, } from "./indexSubscriptions.generated"; export class IndexSubscriptionQueryHandler extends SubgraphQueryHandler { constructor() { super(...arguments); this.getAddressFieldKeysFromFilter = () => ({ accountKeys: ["subscriber"], tokenKeys: [], }); this.getRelevantAddressesFromResultCore = (result) => ({ tokens: [result.token], accounts: [result.subscriber, result.publisher], }); this.mapFromSubgraphResponse = (response) => response.indexSubscriptions.map((x) => ({ ...x, subscriber: x.subscriber.id, createdAtTimestamp: Number(x.createdAtTimestamp), createdAtBlockNumber: Number(x.createdAtBlockNumber), updatedAtTimestamp: Number(x.updatedAtTimestamp), updatedAtBlockNumber: Number(x.updatedAtBlockNumber), index: x.index.id, indexId: x.index.indexId, indexValueCurrent: x.index.indexValue, indexTotalUnits: x.index.totalUnits, token: x.index.token.id, tokenSymbol: x.index.token.symbol, publisher: x.index.publisher.id, })); this.requestDocument = IndexSubscriptionsDocument; } } //# sourceMappingURL=indexSubscription.js.map