{"version":3,"sources":["../../../src/subgraph/positions/index.ts","../../../src/subgraph/positions/subgraphQueries.ts","../../../src/error/not-found.error.ts","../../../src/common/subgraphMapper.ts"],"sourcesContent":["import { request } from 'graphql-request';\nimport {\n  fetchAllOpenPositionsWithTime,\n  fetchAllPositionHistoryWithTime,\n  fetchLiquidatedPositionsBySnxAccount,\n  fetchOpenPositionsByUser,\n  fetchPositionByIdQuery,\n  fetchPositionsByUserQuery,\n  fetchPositionsByUserQueryAndStatus,\n  fetchUserOpenPositionsWithTime,\n  fetchUserPositionHistory,\n  fetchUserPositionHistoryWithTime,\n} from './subgraphQueries';\n\nimport { NotFoundError } from '../../error/not-found.error';\nimport { Position, SnxAccount } from '../../interfaces/sdkTypes';\nimport {\n  mapResponseToPosition,\n  mapResponseToSnxAccount,\n  mapResponseToSnxAccountArray,\n} from '../../common/subgraphMapper';\n\n// Get all positions by user address\nexport const getAllPositionsByUserAddress = async (\n  subgraphEndpoint: string,\n  userAddress: string,\n  count: number = 10,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(subgraphEndpoint, fetchPositionsByUserQuery(userAddress, count, skip));\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get open positions by user address\nexport const getOpenPositionsByUserAddress = async (\n  subgraphEndpoint: string,\n  userAddress: string,\n  count: number = 10,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(subgraphEndpoint, fetchOpenPositionsByUser(userAddress, count, skip));\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get open positions by user address\nexport const getClosedPositionsByUserAddress = async (\n  subgraphEndpoint: string,\n  userAddress: string,\n  count: number = 10,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(\n      subgraphEndpoint,\n      fetchPositionsByUserQueryAndStatus(userAddress, 'CLOSED', count, skip),\n    );\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get LIQUIDATED positions by user address\nexport const getLiquidatedPositionsByUserAddress = async (\n  subgraphEndpoint: string,\n  userAddress: string,\n  count: number = 10,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(\n      subgraphEndpoint,\n      fetchPositionsByUserQueryAndStatus(userAddress, 'LIQUIDATED', count, skip),\n    );\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get position from subgraph by position ID\nexport const getPositionById = async (subgraphEndpoint: string, positionId: string): Promise<Position> => {\n  try {\n    let subgraphResponse: any = await request(subgraphEndpoint, fetchPositionByIdQuery(positionId));\n\n    console.log('subgraph response:', subgraphResponse);\n    const position = mapResponseToPosition(subgraphResponse?.position);\n    if (position) return position;\n    throw new NotFoundError('Position id not found');\n  } catch (error) {\n    console.error('Error fetching position:', error);\n    throw new NotFoundError('Position id not found');\n  }\n};\n\n// Get all positions by user address\nexport const getUserPositionsHistory = async (\n  subgraphEndpoint: string,\n  userAddress: string,\n  count: number = 100,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(subgraphEndpoint, fetchUserPositionHistory(userAddress, count, skip));\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get positions history by user address\nexport const getUserPositionHistoryWithTime = async (\n  subgraphEndpoint: string,\n  userAddress: string,\n  startTime: number,\n  endTime: number,\n  count: number = 100,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(\n      subgraphEndpoint,\n      fetchUserPositionHistoryWithTime(userAddress, startTime, endTime, count, skip),\n    );\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get all open positions by user address\nexport const getUserOpenPositionsWithTime = async (\n  subgraphEndpoint: string,\n  userAddress: string,\n  startTime: number,\n  endTime: number,\n  count: number = 10,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(\n      subgraphEndpoint,\n      fetchUserOpenPositionsWithTime(userAddress, startTime, endTime, count, skip),\n    );\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get positions by SNX Account id\nexport const getUserLiquidatedPositionsBySnxAccount = async (\n  subgraphEndpoint: string,\n  snxAccountId: string,\n  lastRefresh: number,\n): Promise<SnxAccount | undefined> => {\n  let formattedSnxAccountId = snxAccountId;\n  try {\n    if (!snxAccountId.includes('PERP')) {\n      formattedSnxAccountId = 'PERP-'.concat(snxAccountId);\n    }\n    const subgraphResponse: any = await request(\n      subgraphEndpoint,\n      fetchLiquidatedPositionsBySnxAccount(formattedSnxAccountId, lastRefresh),\n    );\n    const snxAccount = mapResponseToSnxAccount(subgraphResponse?.snxAccount);\n    return snxAccount;\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return undefined;\n  }\n};\n\n// Get all open positions for all users\nexport const getAllOpenPositionsWithTime = async (\n  subgraphEndpoint: string,\n  startTime: number,\n  endTime: number,\n  count: number = 10,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(\n      subgraphEndpoint,\n      fetchAllOpenPositionsWithTime(startTime, endTime, count, skip),\n    );\n    console.log('subgraphresponse', subgraphResponse);\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n\n// Get positions history by user address\nexport const getAllPositionHistoryWithTime = async (\n  subgraphEndpoint: string,\n  startTime: number,\n  endTime: number,\n  count: number = 100,\n  skip: number = 0,\n): Promise<SnxAccount[]> => {\n  try {\n    const subgraphResponse: any = await request(\n      subgraphEndpoint,\n      fetchAllPositionHistoryWithTime(startTime, endTime, count, skip),\n    );\n    const snxAccounts = mapResponseToSnxAccountArray(subgraphResponse?.snxAccounts);\n    return snxAccounts ?? [];\n  } catch (error) {\n    console.error('Error fetching positions:', error);\n    return [];\n  }\n};\n","import { gql } from 'graphql-request';\n\n// Fetches all positions by a user (Both open and closed)\nexport const fetchPositionsByUserQuery = (userAddress: string, count: number = 20, skip: number = 0) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: { owner: \"${userAddress}\", type: PERP }) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions(where: {status_in: [OPEN, CLOSED, LIQUIDATED]}) {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n\n// Fetches positions for a user address by status\nexport const fetchPositionsByUserQueryAndStatus = (\n  userAddress: string,\n  status: string,\n  count: number = 20,\n  skip: number = 0,\n) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: { owner: \"${userAddress}\", type: PERP }\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions(where: {status: ${status} }) {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n\n// Fetches open positions for a user address\nexport const fetchOpenPositionsByUser = (userAddress: string, count: number = 20, skip: number = 0) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: {\n        owner: \"${userAddress}\",\n        type: PERP,\n        openPositionCount_gt: 0\n      }\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions(where: {status: OPEN }) {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n      }\n    }\n  }`;\n\n// Fetches positions for a user address by status\nexport const fetchUserPositionHistory = (userAddress: string, count: number = 20, skip: number = 0) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: { owner: \"${userAddress}\", type: PERP }\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions(where: {status_in: [CLOSED, LIQUIDATED]}) {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n\nexport const fetchPositionByIdQuery = (positionId: string) =>\n  gql`\n    {\n        position(\n            id: \"${positionId}\"\n        ) {\n            id\n            market {\n              id,\n              marketName,\n              marketSymbol,\n              feedId \n            }\n            snxAccount{\n              id\n              accountId\n            }\n            isLong\n            positionSize\n            avgPrice\n            avgPriceDec\n            status\n            txHash\n            liquidationTxHash\n            closingPrice\n            realizedPositionPnl\n            realizedPnlAfterFees\n            totalFeesPaid\n            createdTimestamp\n            lastRefresh\n            lastRefreshISO\n            canBeLiquidated\n            snapshotCollateralValueUsd\n        }\n    }`;\n\nexport const fetchPositionsToLiquidateQuery = (count: number) => gql`\n  {\n    positions(where: { status: OPEN, canBeLiquidated: true }, first: ${count}, orderBy: positionSize, orderDirection: desc) {\n      id\n    }\n  }\n`;\n\n// Fetches positions for a user address by status\nexport const fetchUserPositionHistoryWithTime = (\n  userAddress: string,\n  startTimestamp: number,\n  endTimestamp: number,\n  count: number = 20,\n  skip: number = 0,\n) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: {\n        owner: \"${userAddress}\",\n        type: PERP\n      }\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions( where: {\n          status_in: [CLOSED, LIQUIDATED],\n          createdTimestamp_gte: ${startTimestamp}\n          createdTimestamp_lte: ${endTimestamp}\n      }) {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        positionCollateral\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n\n// Fetches positions for a user address by status\nexport const fetchUserOpenPositionsWithTime = (\n  userAddress: string,\n  startTimestamp: number,\n  endTimestamp: number,\n  count: number = 20,\n  skip: number = 0,\n) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: {\n        owner: \"${userAddress}\",\n        type: PERP,\n        positions_: {\n          status: OPEN,\n          createdTimestamp_gte: ${startTimestamp}\n          createdTimestamp_lte: ${endTimestamp}\n          }\n      }\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n\nexport const fetchLiquidatedPositionsBySnxAccount = (snxAccountId: string, lastRefresh: number) =>\n  gql`\n    {\n    snxAccount(id: \"${snxAccountId}\"\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions(where: { status: LIQUIDATED, lastRefresh_gt: ${lastRefresh} }) {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n\nexport const fetchCrossMarginPositionsBySnxAccount = (snxAccountId: string, lastRefresh: number) => gql`\n  {\n    snxAccount(id: \"${snxAccountId}\") {\n      accountId\n      collateralDeposits {\n        totalAmountLiquidated\n      }\n      positions(where: { status: LIQUIDATED, lastRefresh_gt: ${lastRefresh} }) {\n        lastRefresh\n      }\n    }\n  }\n`;\n\n// Fetches positions for a user address by status\nexport const fetchAllOpenPositionsWithTime = (\n  startTimestamp: number,\n  endTimestamp: number,\n  count: number = 20,\n  skip: number = 0,\n) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: { \n      type: PERP\n      openPositionCount_gt:0\n      }\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions(where: {\n          status: OPEN,\n          createdTimestamp_gte: ${startTimestamp}\n          createdTimestamp_lte: ${endTimestamp}\n          }) \n      {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n\n// Fetches positions for a user address by status\nexport const fetchAllPositionHistoryWithTime = (\n  startTimestamp: number,\n  endTimestamp: number,\n  count: number = 20,\n  skip: number = 0,\n) =>\n  gql`\n    {\n    snxAccounts(\n      first: ${count}\n      skip: ${skip}\n      where: {\n        type: PERP\n        totalPositionsCount_gt :0\n      }\n    ) {\n      id\n      accountId\n      owner {\n        id\n      }\n      collateralDeposits {\n        id\n        collateralName\n        collateralSymbol\n        collateralDecimals\n        collateralAddress\n        currentDepositedAmount\n        totalAmountDeposited\n        totalAmountWithdrawn\n        totalAmountLiquidated\n      }\n      positions(where: {\n          status_in: [CLOSED, LIQUIDATED],\n          createdTimestamp_gte: ${startTimestamp}\n          createdTimestamp_lte: ${endTimestamp}\n      }) {\n        id\n        market {\n          id\n          marketName\n          marketSymbol\n          feedId\n        }\n        positionSize\n        avgPrice\n        avgPriceDec\n        isLong\n        createdTimestamp\n        status\n        txHash\n        liquidationTxHash\n        closingPrice\n        realizedPositionPnl\n        realizedPnlAfterFees\n        totalFeesPaid\n        createdTimestamp\n        lastRefresh\n        lastRefreshISO\n        canBeLiquidated\n        snapshotCollateralValueUsd\n    }\n    }\n  }`;\n","export class NotFoundError extends Error {\n  constructor(message: string) {\n    super(message);\n    this.name = this.constructor.name;\n  }\n}","import { PriceFeedSnapshot, PythData } from '../interfaces/subgraphTypes';\nimport { CollateralDeposit, Market, Order, Position, SnxAccount, Token, Wallet } from '../interfaces/sdkTypes';\n\n////////////////////////////////////////////////////////////////\n//////////////////////    Wallet   ////////////////////////////\n////////////////////////////////////////////////////////////////\n\nexport const mapResponseToWallet = (response: any): Wallet | undefined => {\n  if (!response) return undefined;\n  try {\n    return {\n      id: response?.id,\n      // snxAccounts: mapSnxAccountsArray(response.snxAccounts)\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\nexport const mapResponseToWalletArray = (response: any): Wallet[] | undefined => {\n  if (!response) return undefined;\n  try {\n    return response.map((account: any) => {\n      return mapResponseToWallet(account);\n    });\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\n////////////////////////////////////////////////////////////////\n//////////////////////    SNX Account   ////////////////////////\n////////////////////////////////////////////////////////////////\n\nexport const mapResponseToSnxAccount = (response: any): SnxAccount | undefined => {\n  if (!response) return undefined;\n\n  try {\n    return {\n      id: response?.id,\n      type: response?.type,\n      accountId: response?.accountId,\n      owner: response?.owner ?? mapResponseToWallet(response?.owner),\n      totalOrdersCount: response?.totalOrdersCount,\n      totalPositionsCount: response?.totalPositionsCount,\n      openPositionCount: response?.openPositionCount,\n      countProfitablePositions: response?.countProfitablePositions,\n      countLossPositions: response?.countLossPositions,\n      countLiquidatedPositions: response?.countLiquidatedPositions,\n      realizedPnlFromPositions: response?.realizedPnlFromPositions,\n      totalFeesPaid: response?.totalFeesPaid,\n      finalPnlAfterFees: response?.finalPnlAfterFees,\n      totalVolumeInUsd: response?.totalVolumeInUsd,\n      totalAccruedBorrowingFeesInUsd: response?.totalAccruedBorrowingFeesInUsd,\n      integratorFeesGenerated: response?.integratorFeesGenerated,\n      orders: response?.orders ? mapResponseToOrderArray(response?.orders) : [],\n      positions: response?.positions ? mapResponseToPositionArray(response?.positions) : [],\n      collateralDeposits: response?.collateralDeposits\n        ? mapResponseToCollateralDepositArray(response?.collateralDeposits)\n        : [],\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\nexport const mapResponseToSnxAccountArray = (response: any): SnxAccount[] | undefined => {\n  if (!response) return undefined;\n  try {\n    return response.map((snxAccount: any) => {\n      return mapResponseToSnxAccount(snxAccount);\n    });\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\n////////////////////////////////////////////////////////////////\n//////////////////////    MARKET    ////////////////////////////\n////////////////////////////////////////////////////////////////\n\nexport const mapResponseToMarket = (response: any): Market | undefined => {\n  if (!response) return undefined;\n  if (response?.marketName === '' || response?.marketSymbol === '') return undefined;\n  try {\n    return {\n      id: response?.id ?? '',\n      marketName: response?.marketName ?? '',\n      marketSymbol: response?.marketSymbol ?? '',\n      feedId: response?.feedId ?? '',\n      skew: response?.skew ?? '0',\n      size: response?.size ?? '0',\n      maxOpenInterest: response?.maxOpenInterest ?? '0',\n      interestRate: response?.interestRate ?? '0',\n      currentFundingRate: response?.currentFundingRate ?? '0',\n      currentFundingVelocity: response?.currentFundingVelocity ?? '0',\n      indexPrice: response?.indexPrice ?? '0',\n      skewScale: response?.skewScale ?? '0',\n      maxFundingVelocity: response?.maxFundingVelocity ?? '0',\n      makerFee: response?.makerFee ?? '0',\n      takerFee: response?.takerFee ?? '0',\n      maxMarketValue: response?.maxMarketValue ?? '0',\n      maxMarketSize: response?.maxMarketSize ?? '0',\n      marketPrice: response?.marketPrice ?? '0',\n      initialMarginRatioD18: response?.initialMarginRatioD18 ?? '0',\n      maintenanceMarginRatioD18: response?.maintenanceMarginRatioD18 ?? '0',\n      minimumInitialMarginRatioD18: response?.minimumInitialMarginRatioD18 ?? '0',\n      flagRewardRatioD18: response?.flagRewardRatioD18 ?? '0',\n      minimumPositionMargin: response?.minimumPositionMargin ?? '0',\n      openInterestUsd: response?.openInterestUsd ?? '0',\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\nexport const mapResponseToMarketArray = (response: any): (Market | undefined)[] | undefined => {\n  if (!response) return undefined;\n  try {\n    return response.map((market: any) => {\n      return mapResponseToMarket(market);\n    });\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\n////////////////////////////////////////////////////////////////\n//////////////////////    ORDERS    ////////////////////////////\n////////////////////////////////////////////////////////////////\n\nexport const mapResponseToOrder = (response: any): Order | undefined => {\n  if (!response) return undefined;\n  try {\n    return {\n      id: response?.id,\n      market: response?.market ?? mapResponseToMarket(response?.market),\n      snxAccountId: response?.snxAccount?.id,\n      isLimitOrder: response?.isLimitOrder,\n      acceptablePrice: response?.acceptablePrice,\n      commitmentTime: response?.commitmentTime,\n      expectedPriceTime: response?.expectedPriceTime,\n      settlementTime: response?.settlementTime,\n      expirationTime: response?.expirationTime,\n      trackingCode: response?.trackingCode,\n      deltaSize: response?.deltaSize,\n      deltaSizeUsd: response?.deltaSizeUsd,\n      executionPrice: response?.executionPrice,\n      collectedFees: response?.collectedFees,\n      settlementReward: response?.settlementReward,\n      referralFees: response?.referralFees,\n      partnerAddress: response?.partnerAddress,\n      txHash: response?.txHash,\n      createdTimestamp: response?.createdTimestamp,\n      status: response?.status,\n      settledTxHash: response?.settledTxHash,\n      cancellationTxHash: response?.cancellationTxHash,\n      settledTimestamp: response?.settledTimestamp,\n      settledTimestampISO: response?.settledTimestampISO,\n      settledBy: response?.settledBy ?? mapResponseToWallet(response?.settledBy),\n      snapshotCollateralValueUsd: response?.snapshotCollateralValueUsd,\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\nexport const mapResponseToOrderArray = (response: any): Order[] | undefined => {\n  if (!response) return undefined;\n  try {\n    return response.map((order: any) => {\n      return mapResponseToOrder(order);\n    });\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\n////////////////////////////////////////////////////////////////\n////////////////////    Collaterals   //////////////////////////\n////////////////////////////////////////////////////////////////\n\nfunction mapResponseToCollateralDeposit(response: any): CollateralDeposit | undefined {\n  if (!response) return undefined;\n  try {\n    return {\n      id: response?.id,\n      snxAccountId: response?.snxAccountId,\n      collateralId: response?.collateralId,\n      collateralName: response?.collateralName,\n      collateralSymbol: response?.collateralSymbol,\n      collateralDecimals: response?.collateralDecimals,\n      collateralAddress: response?.collateralAddress,\n      currentDepositedAmount: response?.currentDepositedAmount,\n      totalAmountDeposited: response?.totalAmountDeposited,\n      totalAmountWithdrawn: response?.totalAmountWithdrawn,\n      totalAmountLiquidated: response?.totalAmountLiquidated,\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n}\n\nexport const mapResponseToCollateralDepositArray = (response: any): CollateralDeposit[] | undefined => {\n  if (!response) return undefined;\n  try {\n    return response.map((deposit: any) => {\n      return mapResponseToCollateralDeposit(deposit);\n    });\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\n////////////////////////////////////////////////////////////////\n//////////////////////    POSITION    //////////////////////////\n////////////////////////////////////////////////////////////////\n\nexport const mapResponseToPosition = (response: any): Position | undefined => {\n  if (!response) return undefined;\n  try {\n    return {\n      id: response?.id,\n      market: response?.market ?? mapResponseToMarket(response?.market),\n      snxAccountId: response?.snxAccountId,\n      isLong: response?.isLong,\n      positionSize: response?.positionSize,\n      avgPrice: response?.avgPrice,\n      avgPriceDec: response?.avgPriceDec,\n      status: response?.status,\n      txHash: response?.txHash,\n      liquidationTxHash: response?.liquidationTxHash,\n      closingPrice: response?.closingPrice,\n      realizedPositionPnl: response?.realizedPositionPnl,\n      totalFeesPaid: response?.totalFeesPaid,\n      realizedPnlAfterFees: response?.realizedPnlAfterFees,\n      createdTimestamp: response?.createdTimestamp,\n      lastRefresh: response?.lastRefresh,\n      lastRefreshISO: response?.lastRefreshISO,\n      accruedBorrowingFees: response?.accruedBorrowingFees,\n      canBeLiquidated: response?.canBeLiquidated,\n      snapshotCollateralValueUsd: response?.snapshotCollateralValueUsd,\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\nexport const mapResponseToPositionArray = (response: any): Position[] | undefined => {\n  if (!response) return undefined;\n\n  try {\n    return response.map((position: any) => {\n      return mapResponseToPosition(position);\n    });\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\n////////////////////////////////////////////////////////////////\n//////////////////////    TOKEN    /////////////////////////////\n////////////////////////////////////////////////////////////////\n\nexport const mapResponseToToken = (response: any): Token | undefined => {\n  if (!response) return undefined;\n\n  try {\n    return {\n      id: response?.id,\n      name: response?.name,\n      symbol: response?.symbol,\n      decimals: response?.decimals,\n      lastPriceUSD: response?.lastPriceUSD,\n      lastPriceTimestamp: response?.lastPriceTimestamp,\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\n////////////////////////////////////////////////////////////////\n////////////////////////    PYTH    ////////////////////////////\n////////////////////////////////////////////////////////////////\n\nexport const mapResponseToPriceFeedSnapshot = (response: any): PriceFeedSnapshot | undefined => {\n  if (!response) return undefined;\n\n  try {\n    return {\n      id: response?.id,\n      priceId: response?.priceId,\n      publishTime: response?.publishTime,\n      price: response?.price,\n      confidence: response?.confidence,\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n\nexport const mapResponseToPythData = (response: any): PythData | undefined => {\n  if (!response) return undefined;\n\n  try {\n    return {\n      id: response?.id,\n      marketId: response?.marketId,\n      tokenAddress: response?.tokenAddress,\n      price: response?.price,\n      lastUpdatedTimestamp: response?.lastUpdatedTimestamp,\n    };\n  } catch (error) {\n    console.log('Error while mapping data', error);\n    return undefined;\n  }\n};\n"],"mappings":";AAAA,SAAS,eAAe;;;ACAxB,SAAS,WAAW;AAGb,IAAM,4BAA4B,CAAC,aAAqB,QAAgB,IAAI,OAAe,MAChG;AAAA;AAAA;AAAA,eAGa,KAAK;AAAA,cACN,IAAI;AAAA,yBACO,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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