UNPKG

@parifi/sdk

Version:

Parifi SDK with common utility functions

110 lines 2.23 kB
// src/subgraph/orders/subgraphQueries.ts import { gql } from "graphql-request"; var fetchOrdersByUserQuery = (userAddress, count = 50, skip = 0) => gql`{ snxAccounts( first: ${count} skip: ${skip} where: { owner: "${userAddress}", type: PERP }) { id accountId owner { id } collateralDeposits { id collateralName collateralSymbol collateralDecimals collateralAddress currentDepositedAmount totalAmountDeposited totalAmountWithdrawn totalAmountLiquidated } orders { id market { id marketName marketSymbol feedId } expirationTime deltaSize executionPrice isLimitOrder status createdTimestamp txHash partnerAddress collectedFees settledTxHash settledTimestamp deltaSizeUsd acceptablePrice snapshotCollateralValueUsd settledBy { id } } } } `; var fetchSettledOrdersCountBasedOnTimeStampByUserQuery = (userAddress, count = 50, skip = 0, startTimeStamp, endTimeStamp) => gql`{ snxAccounts( first: ${count} skip: ${skip} where: { owner: "${userAddress}", type: PERP }) { id accountId owner { id } orders( where: {status: SETTLED, createdTimestamp_gt: ${startTimeStamp}, createdTimestamp_lt: ${endTimeStamp}} ) { id } } } `; var fetchOrdersByIdQuery = (orderId) => gql` { order(id: "${orderId}") { id market { id marketName marketSymbol feedId } expirationTime deltaSize executionPrice isLimitOrder status createdTimestamp txHash partnerAddress collectedFees settledTxHash settledTimestamp deltaSizeUsd acceptablePrice snapshotCollateralValueUsd settledBy { id } snxAccount { id accountId } } } `; export { fetchOrdersByIdQuery, fetchOrdersByUserQuery, fetchSettledOrdersCountBasedOnTimeStampByUserQuery }; //# sourceMappingURL=subgraphQueries.mjs.map