@superfluid-finance/sdk-core
Version:
SDK Core for building with Superfluid Protocol
47 lines • 2.27 kB
JavaScript
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