diff --git a/src/common/subgraphMapper.ts b/src/common/subgraphMapper.ts index 0dfd3dc..e8feef7 100644 --- a/src/common/subgraphMapper.ts +++ b/src/common/subgraphMapper.ts @@ -1,4 +1,13 @@ -import { Account, Market, Order, Position, PriceFeedSnapshot, PythData, Token } from '../interfaces/subgraphTypes'; +import { + Account, + Market, + Order, + Position, + PriceFeedSnapshot, + PythData, + Token, + Vault, +} from '../interfaces/subgraphTypes'; //////////////////////////////////////////////////////////////// ////////////////////// ACCOUNT //////////////////////////// @@ -240,3 +249,45 @@ export const mapSubgraphResponseToPythDataInterface = (response: any): PythData throw error; } }; + +//////////////////////////////////////////////////////////////// +////////////////////// VAULTS //////////////////////////// +//////////////////////////////////////////////////////////////// + +export const mapSingleVaultToInterface = (response: any): Vault | undefined => { + try { + return { + id: response.id, + vaultName: response.vaultName, + vaultSymbol: response.vaultSymbol, + vaultDecimals: response.vaultDecimals, + depositToken: response.depositToken ? mapSubgraphResponseToTokenInterface(response.depositToken) : undefined, + isPaused: response.isPaused, + feeManagerAddress: response.feeManagerAddress, + totalAssets: response.totalAssets, + totalShares: response.totalShares, + assetsPerShare: response.assetsPerShare, + assetsPerShareDec: response.assetsPerShareDec, + sharesPerAsset: response.sharesPerAsset, + withdrawalFee: response.withdrawalFee, + profitFromTraderLosses: response.profitFromTraderLosses, + lossFromTraderProfits: response.lossFromTraderProfits, + cooldownPeriod: response.cooldownPeriod, + withdrawalWindow: response.withdrawalWindow, + }; + } catch (error) { + console.log('Error while mapping data', error); + throw error; + } +}; + +export const mapVaultsArrayToInterface = (response: any): Vault[] | undefined => { + try { + return response.vaults.map((vault: Vault) => { + return mapSingleVaultToInterface(vault); + }); + } catch (error) { + console.log('Error while mapping data', error); + throw error; + } +}; diff --git a/src/interfaces/subgraphTypes.ts b/src/interfaces/subgraphTypes.ts index ec9acbb..7352e99 100644 --- a/src/interfaces/subgraphTypes.ts +++ b/src/interfaces/subgraphTypes.ts @@ -2,23 +2,23 @@ //////////////////// ENUMS ////////////////////////////// //////////////////////////////////////////////////////////////// export enum OrderType { - OPEN_NEW_POSITION, - CLOSE_POSITION, - INCREASE_POSITION, - DECREASE_POSITION, - CANCEL_ORDER, + OPEN_NEW_POSITION, + CLOSE_POSITION, + INCREASE_POSITION, + DECREASE_POSITION, + CANCEL_ORDER, } export enum OrderStatus { - PENDING, - CANCELLED, - SETTLED, + PENDING, + CANCELLED, + SETTLED, } export enum PositionStatus { - OPEN, - CLOSED, - LIQUIDATED, + OPEN, + CLOSED, + LIQUIDATED, } //////////////////////////////////////////////////////////////// @@ -26,29 +26,29 @@ export enum PositionStatus { //////////////////////////////////////////////////////////////// export interface Account { - // " User address " - id?: string + // " User address " + id?: string; - // @note The below commented code is not required as they can be fetched - // separately with another query. The code is kept commented here - // to match the original subgraph schema - // " User positions " - // positions?: [Position] + // @note The below commented code is not required as they can be fetched + // separately with another query. The code is kept commented here + // to match the original subgraph schema + // " User positions " + // positions?: [Position] - // " User orders " - // orders?: [Order] + // " User orders " + // orders?: [Order] - // " Total count of orders " - totalOrdersCount?: string + // " Total count of orders " + totalOrdersCount?: string; - // " Total count of open user positions " - openPositionsCount?: string + // " Total count of open user positions " + openPositionsCount?: string; - // " Total count of positions created by user - open and closed positions " - totalPositionsCount?: string + // " Total count of positions created by user - open and closed positions " + totalPositionsCount?: string; - // " Referral Fees claimed by partner/referrer in USD " - referralFeesInUsd?: string + // " Referral Fees claimed by partner/referrer in USD " + referralFeesInUsd?: string; } //////////////////////////////////////////////////////////////// @@ -56,390 +56,447 @@ export interface Account { //////////////////////////////////////////////////////////////// export interface Market { - // " Market ID " - id?: string + // " Market ID " + id?: string; - // " Vault Address " - vaultAddress?: string + // " Vault Address " + vaultAddress?: string; - // " Deposit token (collateral token) " - depositToken?: Token + // " Deposit token (collateral token) " + depositToken?: Token; - // " Market status - true if active " - isLive?: boolean + // " Market status - true if active " + isLive?: boolean; - // " Market Decimals " - marketDecimals?: string + // " Market Decimals " + marketDecimals?: string; - // " Liquidation threshold " - liquidationThreshold?: string + // " Liquidation threshold " + liquidationThreshold?: string; - // " Minimum collateral required to open position " - minCollateral?: string + // " Minimum collateral required to open position " + minCollateral?: string; - // " Maximum leverage - 1e4 = 1x leverage " - maxLeverage?: string + // " Maximum leverage - 1e4 = 1x leverage " + maxLeverage?: string; - // " Opening fee in basis points " - openingFee?: string + // " Opening fee in basis points " + openingFee?: string; - // " Closing fee in basis points " - closingFee?: string + // " Closing fee in basis points " + closingFee?: string; - // " Liquidation fee (penalty) in basis points " - liquidationFee?: string + // " Liquidation fee (penalty) in basis points " + liquidationFee?: string; - // " Price deviation after which orders cannot be executed " - maxPriceDeviation?: string + // " Price deviation after which orders cannot be executed " + maxPriceDeviation?: string; - // " Market creation timestamp " - createdTimestamp?: string + // " Market creation timestamp " + createdTimestamp?: string; - // " Last updated at " - lastUpdated?: string + // " Last updated at " + lastUpdated?: string; - // " Maximum Open Interest " - maxOpenInterest?: string + // " Maximum Open Interest " + maxOpenInterest?: string; - // " Total Longs " - totalLongs?: string + // " Total Longs " + totalLongs?: string; - // " Total Value of Longs in USD " - avgPriceLongs?: string + // " Total Value of Longs in USD " + avgPriceLongs?: string; - // " Net PnL for Longs in USD " - pnlLongs?: string + // " Net PnL for Longs in USD " + pnlLongs?: string; - // " Total Shorts " - totalShorts?: string + // " Total Shorts " + totalShorts?: string; - // " Total Shorts in USD " - avgPriceShorts?: string + // " Total Shorts in USD " + avgPriceShorts?: string; - // " Net PnL for Shorts in USD " - pnlShorts?: string + // " Net PnL for Shorts in USD " + pnlShorts?: string; - // " Net PnL of the market in USD " - netPnl?: string + // " Net PnL of the market in USD " + netPnl?: string; - // " Net PnL of the market in USD (decimal) " - netPnlDec?: string + // " Net PnL of the market in USD (decimal) " + netPnlDec?: string; - // " Total Open Interest in USD (decimal) " - totalOI?: string + // " Total Open Interest in USD (decimal) " + totalOI?: string; - // " Total Open Interest (assets) " - totalOIAssets?: string + // " Total Open Interest (assets) " + totalOIAssets?: string; - // " If closeOnlyMode is true, no new positions can be opened. Only existing position can be closed " - closeOnlyMode?: boolean + // " If closeOnlyMode is true, no new positions can be opened. Only existing position can be closed " + closeOnlyMode?: boolean; - // " Timestamp when the cumulative fees were last updated " - feeLastUpdatedTimestamp?: string + // " Timestamp when the cumulative fees were last updated " + feeLastUpdatedTimestamp?: string; - // " Price deviation for Longs " - priceDeviationLongs?: string + // " Price deviation for Longs " + priceDeviationLongs?: string; - // " Price deviation for Shorts " - priceDeviationShorts?: string + // " Price deviation for Shorts " + priceDeviationShorts?: string; - // " Market utilization for Longs " - utilizationLongs?: string + // " Market utilization for Longs " + utilizationLongs?: string; - // " Market utilization for Shorts " - utilizationShorts?: string + // " Market utilization for Shorts " + utilizationShorts?: string; - // " Market skew for Longs " - marketSkew?: string + // " Market skew for Longs " + marketSkew?: string; - // " Cumulative Base Fees for Longs " - baseFeeCumulativeLongs?: string + // " Cumulative Base Fees for Longs " + baseFeeCumulativeLongs?: string; - // " Cumulative Base Fees for Shorts " - baseFeeCumulativeShorts?: string + // " Cumulative Base Fees for Shorts " + baseFeeCumulativeShorts?: string; - // " Cumulative Dynamic Fees for Long " - dynamicFeeCumulativeLongs?: string + // " Cumulative Dynamic Fees for Long " + dynamicFeeCumulativeLongs?: string; - // " Cumulative Dynamic Fees for Shorts " - dynamicFeeCumulativeShorts?: string + // " Cumulative Dynamic Fees for Shorts " + dynamicFeeCumulativeShorts?: string; - // " Deviation Coefficient for liquidity curve " - deviationCoeff?: string + // " Deviation Coefficient for liquidity curve " + deviationCoeff?: string; - // " Deviation constant for liquidity curve " - deviationConst?: string + // " Deviation constant for liquidity curve " + deviationConst?: string; - // " Base coefficient for base borrowing fees " - baseCoeff?: string + // " Base coefficient for base borrowing fees " + baseCoeff?: string; - // " Base constant for base borrowing fees " - baseConst?: string + // " Base constant for base borrowing fees " + baseConst?: string; - // " Maximum Dynamic borrowing fees " - maxDynamicBorrowFee?: string + // " Maximum Dynamic borrowing fees " + maxDynamicBorrowFee?: string; - // " Dynamic coefficient for Dynamic borrowing fees " - dynamicCoeff?: string + // " Dynamic coefficient for Dynamic borrowing fees " + dynamicCoeff?: string; - // " Market transaction creation hash " - transactionHash?: string + // " Market transaction creation hash " + transactionHash?: string; - // " Address of market creator " - senderAddress?: string + // " Address of market creator " + senderAddress?: string; - // " Pyth Price Id " - pyth?: PythData + // " Pyth Price Id " + pyth?: PythData; } - //////////////////////////////////////////////////////////////// ////////////////////// ORDERS //////////////////////////// //////////////////////////////////////////////////////////////// export interface Order { - // " Order ID " - id?: string + // " Order ID " + id?: string; - // " Market details for the created order " - market?: Market + // " Market details for the created order " + market?: Market; - // " Account/Address of the order " - user?: Account + // " Account/Address of the order " + user?: Account; - // " 0 => OPEN, 1 => CLOSE, 2 => INCREASE, 3 => DECREASE " - orderType?: OrderType + // " 0 => OPEN, 1 => CLOSE, 2 => INCREASE, 3 => DECREASE " + orderType?: OrderType; - // " True if LONG order " - isLong?: boolean + // " True if LONG order " + isLong?: boolean; - // " True if it is a limit order " - isLimitOrder?: boolean + // " True if it is a limit order " + isLimitOrder?: boolean; - // " Used to indicate if the order should be triggered above or below the expectedPrice " - triggerAbove?: boolean + // " Used to indicate if the order should be triggered above or below the expectedPrice " + triggerAbove?: boolean; - // " Timestamp after which order cannot be executed, 0 in case of no deadline " - deadline?: string + // " Timestamp after which order cannot be executed, 0 in case of no deadline " + deadline?: string; - // " Timestamp after which order cannot be executed in string " - deadlineISO?: string + // " Timestamp after which order cannot be executed in string " + deadlineISO?: string; - // " Delta Collateral amount to create/increase/decrease position " - deltaCollateral?: string + // " Delta Collateral amount to create/increase/decrease position " + deltaCollateral?: string; - // " Delta position size to create/increase/decrease position " - deltaSize?: string + // " Delta position size to create/increase/decrease position " + deltaSize?: string; - // " Delta position size to create/increase/decrease position in USD " - deltaSizeUsd?: string + // " Delta position size to create/increase/decrease position in USD " + deltaSizeUsd?: string; - // " Desired Value for order execution " - expectedPrice?: string + // " Desired Value for order execution " + expectedPrice?: string; - // "Maximum allowed slippage in executionPrice from expectedPrice (in basis points)" - maxSlippage?: string + // "Maximum allowed slippage in executionPrice from expectedPrice (in basis points)" + maxSlippage?: string; - // " Partner address that referred the order " - partnerAddress?: string + // " Partner address that referred the order " + partnerAddress?: string; - // " Execution Fee " - executionFee?: string + // " Execution Fee " + executionFee?: string; - // " Transaction hash for order creation " - txHash?: string + // " Transaction hash for order creation " + txHash?: string; - // " Order creation timestamp " - createdTimestamp?: string + // " Order creation timestamp " + createdTimestamp?: string; - // " Status of the order (pending, cancelled, settled) " - status?: OrderStatus + // " Status of the order (pending, cancelled, settled) " + status?: OrderStatus; - // " Order settlement tx hash " - settledTxHash?: string + // " Order settlement tx hash " + settledTxHash?: string; - // " Order settlement timestamp " - settledTimestamp?: string + // " Order settlement timestamp " + settledTimestamp?: string; - // " Order settlement timestamp in ISO string " - settledTimestampISO?: string + // " Order settlement timestamp in ISO string " + settledTimestampISO?: string; - // " Order Execution Price during settlement " - executionPrice?: string + // " Order Execution Price during settlement " + executionPrice?: string; - // " Order settled by " - settledBy?: Account + // " Order settled by " + settledBy?: Account; - // " Order cancellation tx hash " - cancellationTxHash?: string + // " Order cancellation tx hash " + cancellationTxHash?: string; - // " Related Position ID " - positionId?: Position + // " Related Position ID " + positionId?: Position; } - //////////////////////////////////////////////////////////////// ////////////////////// POSITION ////////////////////////// //////////////////////////////////////////////////////////////// export interface Position { - // " Position ID " - id?: string + // " Position ID " + id?: string; - // " Market details for the position " - market?: Market + // " Market details for the position " + market?: Market; - // " User address " - user?: Account + // " User address " + user?: Account; - // " True if it is a LONG position " - isLong?: boolean + // " True if it is a LONG position " + isLong?: boolean; - // " Collateral amount deposited backing this position " - positionCollateral?: string + // " Collateral amount deposited backing this position " + positionCollateral?: string; - // " Size of the position " - positionSize?: string + // " Size of the position " + positionSize?: string; - // " Average price of the position " - avgPrice?: string + // " Average price of the position " + avgPrice?: string; - // " Average price of the position in decimals " - avgPriceDec?: string + // " Average price of the position in decimals " + avgPriceDec?: string; - // " Last cumulative fee that was charged " - lastCumulativeFee?: string + // " Last cumulative fee that was charged " + lastCumulativeFee?: string; - // @note The below commented code is not required as they can be fetched - // separately with another query. The code is kept commented here - // to match the original subgraph schema - // " Orders related to this position " - // orders?: [Order] + // @note The below commented code is not required as they can be fetched + // separately with another query. The code is kept commented here + // to match the original subgraph schema + // " Orders related to this position " + // orders?: [Order] - // " Position status " - status?: PositionStatus + // " Position status " + status?: PositionStatus; - // " Creation tx hash " - txHash?: string + // " Creation tx hash " + txHash?: string; - // " Liquidation tx hash " - liquidationTxHash?: string + // " Liquidation tx hash " + liquidationTxHash?: string; - // " Closing Price of the position. In case of liquidation, this is the liquidation price " - closingPrice?: string + // " Closing Price of the position. In case of liquidation, this is the liquidation price " + closingPrice?: string; - // " Realized PNL in USD (decimals) " - realizedPnl?: string + // " Realized PNL in USD (decimals) " + realizedPnl?: string; - // " Realized PNL in collateral" - realizedPnlCollateral?: string + // " Realized PNL in collateral" + realizedPnlCollateral?: string; - // " Amount of opening, closing, liquidation and borrow fees paid in USD (decimals)" - realizedFee?: string + // " Amount of opening, closing, liquidation and borrow fees paid in USD (decimals)" + realizedFee?: string; - // " Amount of opening, closing, liquidation and borrow fees paid in collateral" - realizedFeeCollateral?: string + // " Amount of opening, closing, liquidation and borrow fees paid in collateral" + realizedFeeCollateral?: string; - // " Net Realized PNL in usd (decimal) " - netRealizedPnl?: string + // " Net Realized PNL in usd (decimal) " + netRealizedPnl?: string; - // //" Timestamp when position was created " - createdTimestamp?: string + // //" Timestamp when position was created " + createdTimestamp?: string; - // //" Last position updated timestamp " - lastRefresh?: string + // //" Last position updated timestamp " + lastRefresh?: string; - // " Last position updated timestamp in string " - lastRefreshISO?: string + // " Last position updated timestamp in string " + lastRefreshISO?: string; } //////////////////////////////////////////////////////////////// ////////////////////// TOKEN ///////////////////////////// //////////////////////////////////////////////////////////////// export interface Token { - // //" Smart contract address of the token " - id?: string + // //" Smart contract address of the token " + id?: string; - // //" Token name " - name?: string + // //" Token name " + name?: string; - // //" Token Symbol " - symbol?: string + // //" Token Symbol " + symbol?: string; - // //" The number of decimal places for token " - decimals?: string + // //" The number of decimal places for token " + decimals?: string; - // //" Reference to Pyth and price data " - pyth?: PythData + // //" Reference to Pyth and price data " + pyth?: PythData; - // //" To store price snapshots of the token on price updates from Pyth " - lastPriceUSD?: string + // //" To store price snapshots of the token on price updates from Pyth " + lastPriceUSD?: string; - // //" Timestamp of lastPriceUsd " - lastPriceTimestamp?: string + // //" Timestamp of lastPriceUsd " + lastPriceTimestamp?: string; } - //////////////////////////////////////////////////////////////// //////////////////////// PYTH //////////////////////////// //////////////////////////////////////////////////////////////// - // Pyth price data interface for prices received from Pyth export interface PythPrice { - price: string + price: string; - conf: string + conf: string; - expo: number + expo: number; - publish_time: number + publish_time: number; } // Interface for response received for Pyth Price data export interface PythPriceResponse { - // Pyth Price ID - id? :string + // Pyth Price ID + id?: string; - price: PythPrice - - ema_price: PythPrice + price: PythPrice; + + ema_price: PythPrice; } export interface PriceFeedSnapshot { - //" Price ID + Timestamp " - id?: string + //" Price ID + Timestamp " + id?: string; - //" Pyth network price ID " - priceId?: string + //" Pyth network price ID " + priceId?: string; - //" Publish Timestamp " - publishTime?: string + //" Publish Timestamp " + publishTime?: string; - //" Price " - price?: string + //" Price " + price?: string; - //" Price confidence " - confidence?: string + //" Price confidence " + confidence?: string; } export interface PythData { - // " Pyth Price ID for market/token " - id?: string + // " Pyth Price ID for market/token " + id?: string; - // " Market ID " - marketId?: string + // " Market ID " + marketId?: string; - // " Token Address " - tokenAddress?: string + // " Token Address " + tokenAddress?: string; - // " Price " - price?: string + // " Price " + price?: string; - // " Last updated timestamp " - lastUpdatedTimestamp?: string + // " Last updated timestamp " + lastUpdatedTimestamp?: string; } export interface BatchExecute { - id: string; - priceUpdateData: string[]; -} \ No newline at end of file + id: string; + priceUpdateData: string[]; +} + +//////////////////////////////////////////////////////////////// +////////////////////// VAULTS //////////////////////////// +//////////////////////////////////////////////////////////////// + +export interface Vault { + // " ID - Address of the Vault contract " + id?: string; + + // " Vault Name " + vaultName?: string; + + // " Vault Symbol (e.g pfWETH, pfUSDC, etc.)" + vaultSymbol?: string; + + // "Vault decimals " + vaultDecimals?: number; + + // " Deposit token " + depositToken?: Token; + + // " Vault Status - To indicate if deposits & withdrawals are enabled/disabled using pause/unpause" + isPaused?: boolean; + + // " Fee Manager Address " + feeManagerAddress?: string; + + // " Total assets currently deposited " + totalAssets?: string; + + // " Total shares minted (i.e total supply of the shares token)" + totalShares?: string; + + // " Assets received when 1 share token (with decimals) is redeemed for asset " + assetsPerShare?: string; + + // " Assets received when 1 share token (with decimals) is redeemed for asset (in decimals)" + assetsPerShareDec?: string; + + // " Shares received when 1 asset token (with decimals) is deposited to the vault " + sharesPerAsset?: string; + + // " Withdrawal fee in basis points " + withdrawalFee?: string; + + // " Fees received from Trader losses " + profitFromTraderLosses?: string; + + // " Loss from Trader profits " + lossFromTraderProfits?: string; + + // " Cooldown Period in seconds " + cooldownPeriod?: string; + + // " Withdrawal Window in seconds" + withdrawalWindow?: string; + + // Vault PNL info can be fetched using a separate query + // to avoid nested data structure + // vaultPnl?: [VaultPnl] +} diff --git a/src/subgraph/index.ts b/src/subgraph/index.ts index 19d7a17..6b58a2a 100644 --- a/src/subgraph/index.ts +++ b/src/subgraph/index.ts @@ -2,10 +2,11 @@ import { getAllOrdersByUserAddress, getAllPendingOrders, getOrderById, getPythPr import { RpcConfig, SubgraphConfig } from '../interfaces/classConfigs'; import { getAllPositionsByUserAddress, getPositionById } from './positions'; import { getAllMarketsFromSubgraph, getMarketById } from './markets'; -import { Market, Order, Position } from '../interfaces/subgraphTypes'; +import { Market, Order, Position, Vault } from '../interfaces/subgraphTypes'; import { Chain } from '@parifi/references'; import { GraphQLClient } from 'graphql-request'; import { getPublicSubgraphEndpoint } from './common'; +import { getAllVaults } from './vaults'; export * from './common'; export * from './markets'; @@ -88,4 +89,13 @@ export class Subgraph { const subgraphEndpoint = this.getSubgraphEndpoint(this.rpcConfig.chainId); return getMarketById(subgraphEndpoint, marketId); } + + //////////////////////////////////////////////////////////////// + ////////////////////// VAULTS //////////////////////////// + //////////////////////////////////////////////////////////////// + + public async getAllVaults(): Promise { + const subgraphEndpoint = this.getSubgraphEndpoint(this.rpcConfig.chainId); + return getAllVaults(subgraphEndpoint); + } } diff --git a/src/subgraph/vaults/index.ts b/src/subgraph/vaults/index.ts new file mode 100644 index 0000000..7f730fc --- /dev/null +++ b/src/subgraph/vaults/index.ts @@ -0,0 +1,19 @@ +import { request } from 'graphql-request'; +import { Vault } from '../../interfaces'; +import { fetchAllVaultsQuery } from './subgraphQueries'; +import { mapVaultsArrayToInterface } from '../../common/subgraphMapper'; +import { NotFoundError } from '../../error/not-found.error'; + +// Get all vaults from subgraph +export const getAllVaults = async (subgraphEndpoint: string): Promise => { + try { + let subgraphResponse: any = await request(subgraphEndpoint, fetchAllVaultsQuery()); + const vaults = mapVaultsArrayToInterface(subgraphResponse); + if (vaults && vaults?.length != 0) { + return vaults; + } + throw new NotFoundError('Vaults not found'); + } catch (error) { + throw error; + } +}; diff --git a/src/subgraph/vaults/subgraphQueries.ts b/src/subgraph/vaults/subgraphQueries.ts new file mode 100644 index 0000000..e50dcc2 --- /dev/null +++ b/src/subgraph/vaults/subgraphQueries.ts @@ -0,0 +1,35 @@ +import { gql } from 'graphql-request'; + +// Currently only two vaults exists, and in the future the vaults will be limited to +// prevent liquidity fragmentation. Hence, the query avoids passing the count and skip filters +// and returns all the available vaults +export const fetchAllVaultsQuery = () => gql` + { + vaults(first: 100) { + id + vaultName + vaultSymbol + vaultDecimals + depositToken { + id + name + symbol + decimals + lastPriceUSD + lastPriceTimestamp + } + isPaused + feeManagerAddress + totalAssets + totalShares + assetsPerShare + assetsPerShareDec + sharesPerAsset + withdrawalFee + profitFromTraderLosses + lossFromTraderProfits + cooldownPeriod + withdrawalWindow + } + } +`; diff --git a/test/subgraph-tests/vaults.test.ts b/test/subgraph-tests/vaults.test.ts new file mode 100644 index 0000000..e3cb9aa --- /dev/null +++ b/test/subgraph-tests/vaults.test.ts @@ -0,0 +1,18 @@ +import { Chain } from '@parifi/references'; +import { ParifiSdk } from '../../src'; +import { RpcConfig } from '../../src/interfaces/classConfigs'; + +const rpcConfig: RpcConfig = { + chainId: Chain.ARBITRUM_SEPOLIA, +}; + +const parifiSdk = new ParifiSdk(rpcConfig, {}, {}, {}); + +describe('Vault fetching logic from subgraph', () => { + it('should return correct vault details', async () => { + await parifiSdk.init(); + + const vaults = await parifiSdk.subgraph.getAllVaults(); + console.log('vaults', vaults); + }); +});