@nadohq/indexer-client 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -355,7 +355,10 @@ function mapIndexerV2Symbols(symbol) {
355
355
  exchangeRate: symbol.exchange_rate_x18 ? (0, import_shared.removeDecimals)(symbol.exchange_rate_x18) : null,
356
356
  tradingStatus: symbol.trading_status,
357
357
  isolatedOnly: symbol.isolated_only,
358
- marketHours: symbol.market_hours ? mapIndexerV2MarketHours(symbol.market_hours) : null
358
+ marketHours: symbol.market_hours ? mapIndexerV2MarketHours(symbol.market_hours) : null,
359
+ boostType: symbol.boost_type ?? null,
360
+ takerMultiplier: symbol.taker_multiplier ?? null,
361
+ makerMultiplier: symbol.maker_multiplier ?? null
359
362
  };
360
363
  }
361
364
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n getRecvTimeFromOrderNonce,\n mapValues,\n Market,\n PerpMarket,\n ProductEngineType,\n removeDecimals,\n SpotMarket,\n subaccountFromHex,\n toBigNumber,\n toIntegerString,\n unpackOrderAppendix,\n} from '@nadohq/shared';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\n IndexerNlpSnapshot,\n IndexerOrder,\n IndexerPerpBalance,\n IndexerPerpPrices,\n IndexerProductPayment,\n IndexerServerBalance,\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerFundingRate,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMatchEventBalances,\n IndexerServerNlpSnapshot,\n IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerV2MarketHours,\n IndexerServerV2Symbol,\n IndexerServerV2TickerResponse,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerV2MarketHours,\n IndexerV2Symbol,\n IndexerV2TickerResponse,\n IndexerV2TradingStatus,\n} from './types';\n\nexport function mapSnapshotsIntervalToServerParams(\n params: IndexerSnapshotsIntervalParams,\n): IndexerServerSnapshotsInterval {\n return {\n count: params.limit,\n max_time: params.maxTimeInclusive\n ? toIntegerString(params.maxTimeInclusive)\n : undefined,\n granularity: params.granularity,\n };\n}\n\nexport function mapIndexerServerProduct(product: IndexerServerProduct): Market {\n if ('spot' in product) {\n return mapEngineServerSpotProduct(product.spot);\n }\n return mapEngineServerPerpProduct(product.perp);\n}\n\nexport function mapIndexerServerBalance(\n balance: IndexerServerBalance,\n): IndexerSpotBalance | IndexerPerpBalance {\n if ('spot' in balance) {\n return {\n amount: toBigNumber(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigNumber(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigNumber(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const appendix = unpackOrderAppendix(order.appendix);\n return {\n amount: toBigNumber(order.amount),\n digest: order.digest,\n expiration: Number(order.expiration),\n appendix,\n nonce: toBigNumber(order.nonce),\n isolated: order.isolated,\n recvTimeSeconds: getRecvTimeFromOrderNonce(order.nonce) / 1000,\n price: removeDecimals(order.price_x18),\n productId: order.product_id,\n subaccount: order.subaccount,\n submissionIndex: order.submission_idx,\n lastFillSubmissionIndex: order.last_fill_submission_idx,\n baseFilled: toBigNumber(order.base_filled),\n quoteFilled: toBigNumber(order.quote_filled),\n totalFee: toBigNumber(order.fee),\n builderFee: toBigNumber(order.builder_fee),\n realizedPnl: toBigNumber(order.realized_pnl),\n closedAmount: toBigNumber(order.closed_amount),\n closedNetEntry: toBigNumber(order.closed_net_entry),\n preCloseMargin: order.closed_margin\n ? toBigNumber(order.closed_margin)\n : null,\n firstFillTimestamp: toBigNumber(order.first_fill_timestamp),\n lastFillTimestamp: toBigNumber(order.last_fill_timestamp),\n preBalances: mapIndexerMatchEventBalances(order.pre_balance),\n postBalances: mapIndexerMatchEventBalances(order.post_balance),\n };\n}\n\nexport function mapIndexerEvent(event: IndexerServerEvent): IndexerEvent {\n const eventState: IndexerEvent['state'] = (() => {\n // Assume backend data is consistent\n if ('spot' in event.pre_balance) {\n return {\n type: ProductEngineType.SPOT,\n market: mapIndexerServerProduct(event.product) as SpotMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerSpotBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerSpotBalance,\n };\n }\n return {\n type: ProductEngineType.PERP,\n market: mapIndexerServerProduct(event.product) as PerpMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerPerpBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerPerpBalance,\n };\n })();\n\n return {\n eventType: event.event_type,\n productId: event.product_id,\n isolated: event.isolated,\n isolatedProductId: event.isolated_product_id,\n state: eventState,\n subaccount: event.subaccount,\n submissionIndex: event.submission_idx,\n trackedVars: {\n netEntryCumulative: toBigNumber(event.net_entry_cumulative),\n netEntryUnrealized: toBigNumber(event.net_entry_unrealized),\n netFundingCumulative: toBigNumber(event.net_funding_cumulative),\n netFundingUnrealized: toBigNumber(event.net_funding_unrealized),\n netInterestCumulative: toBigNumber(event.net_interest_cumulative),\n netInterestUnrealized: toBigNumber(event.net_interest_unrealized),\n quoteVolumeCumulative: toBigNumber(event.quote_volume_cumulative),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigNumber(tx.timestamp),\n tx: tx.tx,\n ...mapIndexerEvent(event),\n };\n}\n\nexport function mapIndexerMatchEventBalances(\n eventBalances: IndexerServerMatchEventBalances,\n): IndexerMatchEventBalances {\n return {\n base: mapIndexerServerBalance(eventBalances.base),\n quote: eventBalances.quote\n ? (mapIndexerServerBalance(eventBalances.quote) as IndexerSpotBalance)\n : undefined,\n };\n}\n\nexport function mapIndexerProductPayment(\n payment: IndexerServerProductPayment,\n): IndexerProductPayment {\n return {\n submissionIndex: payment.idx,\n timestamp: toBigNumber(payment.timestamp),\n paymentAmount: toBigNumber(payment.amount),\n balanceAmount: toBigNumber(payment.balance_amount),\n annualPaymentRate: removeDecimals(payment.rate_x18),\n oraclePrice: removeDecimals(payment.oracle_price_x18),\n isolated: payment.isolated,\n productId: payment.product_id,\n isolatedProductId: payment.isolated_product_id,\n };\n}\n\nexport function mapIndexerPerpPrices(\n perpPrices: IndexerServerPerpPrices,\n): IndexerPerpPrices {\n return {\n indexPrice: removeDecimals(perpPrices.index_price_x18),\n markPrice: removeDecimals(perpPrices.mark_price_x18),\n updateTime: toBigNumber(perpPrices.update_time),\n productId: perpPrices.product_id,\n };\n}\n\nexport function mapIndexerFundingRate(\n fundingRate: IndexerServerFundingRate,\n): IndexerFundingRate {\n return {\n fundingRate: removeDecimals(fundingRate.funding_rate_x18),\n updateTime: toBigNumber(fundingRate.update_time),\n productId: fundingRate.product_id,\n };\n}\n\nexport function mapIndexerMakerStatistics(\n maker: IndexerServerMaker,\n): IndexerMaker {\n return {\n address: maker.address,\n snapshots: maker.data.map((makerData) => {\n return {\n timestamp: toBigNumber(makerData.timestamp),\n makerFee: toBigNumber(makerData.maker_fee),\n uptime: toBigNumber(makerData.uptime),\n sumQMin: toBigNumber(makerData.sum_q_min),\n qScore: toBigNumber(makerData.q_score),\n makerShare: toBigNumber(makerData.maker_share),\n expectedMakerReward: toBigNumber(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n const tracks = mapValues(position.tracks, (trackData) => ({\n value: toBigNumber(trackData.value),\n rank: toBigNumber(trackData.rank),\n qualificationStatus: trackData.qualification_status,\n }));\n\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n accountValue: toBigNumber(position.account_value),\n updateTime: toBigNumber(position.update_time),\n tracks,\n socialAccounts: position.social_accounts.map((account) => ({\n provider: account.provider,\n username: account.username,\n displayName: account.display_name,\n profileImageUrl: account.profile_image_url,\n })),\n };\n}\n\nexport function mapIndexerLeaderboardRegistration(\n registration: IndexerServerLeaderboardRegistration,\n): IndexerLeaderboardRegistration {\n return {\n subaccount: subaccountFromHex(registration.subaccount),\n contestId: registration.contest_id,\n updateTime: toBigNumber(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n const startTime = toBigNumber(contest.start_time);\n const endTime = toBigNumber(contest.end_time);\n\n return {\n contestId: contest.contest_id,\n startTime,\n endTime,\n totalParticipants: toBigNumber(contest.count),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigNumber(contest.last_updated),\n title: contest.title,\n description: contest.description,\n tracks: contest.tracks.map((track) => ({\n trackId: track.track_id,\n rankType: track.rank_type,\n sortOrder: track.sort_order,\n minRequiredAccountValue: toBigNumber(track.threshold),\n })),\n };\n}\n\nexport function mapIndexerCandlesticks(\n candlestick: IndexerServerCandlestick,\n): Candlestick {\n return {\n close: removeDecimals(candlestick.close_x18),\n high: removeDecimals(candlestick.high_x18),\n low: removeDecimals(candlestick.low_x18),\n open: removeDecimals(candlestick.open_x18),\n time: toBigNumber(candlestick.timestamp),\n volume: toBigNumber(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeUsers: toBigNumber(snapshot.cumulative_users),\n dailyActiveUsers: toBigNumber(snapshot.daily_active_users),\n tvl: toBigNumber(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigNumber,\n ),\n cumulativeMakerFees: mapValues(snapshot.cumulative_maker_fees, toBigNumber),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigNumber,\n ),\n cumulativeTakerFees: mapValues(snapshot.cumulative_taker_fees, toBigNumber),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigNumber),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigNumber),\n depositRates: mapValues(snapshot.deposit_rates, (value) =>\n removeDecimals(value),\n ),\n fundingRates: mapValues(snapshot.funding_rates, (value) =>\n removeDecimals(value),\n ),\n openInterestsQuote: mapValues(snapshot.open_interests, toBigNumber),\n totalBorrows: mapValues(snapshot.total_borrows, toBigNumber),\n totalDeposits: mapValues(snapshot.total_deposits, toBigNumber),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigNumber,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigNumber),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigNumber),\n oraclePrices: mapValues(snapshot.oracle_prices, (value) =>\n removeDecimals(value),\n ),\n };\n}\n\nexport function mapIndexerNlpSnapshot(\n snapshot: IndexerServerNlpSnapshot,\n): IndexerNlpSnapshot {\n return {\n submissionIndex: snapshot.submission_idx,\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeBurnAmountQuote: toBigNumber(snapshot.cumulative_burn_quote),\n cumulativeMintAmountQuote: toBigNumber(snapshot.cumulative_mint_quote),\n cumulativePnl: toBigNumber(snapshot.cumulative_pnl),\n cumulativeTrades: toBigNumber(snapshot.cumulative_trades),\n cumulativeVolume: toBigNumber(snapshot.cumulative_volume),\n depositors: toBigNumber(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigNumber(snapshot.tvl),\n };\n}\n\nexport function mapIndexerV2Ticker(\n ticker: IndexerServerV2TickerResponse,\n): IndexerV2TickerResponse {\n return {\n productId: ticker.product_id,\n tickerId: ticker.ticker_id,\n baseCurrency: ticker.base_currency,\n quoteCurrency: ticker.quote_currency,\n lastPrice: ticker.last_price,\n baseVolume: ticker.base_volume,\n quoteVolume: ticker.quote_volume,\n priceChangePercent24h: ticker.price_change_percent_24h,\n };\n}\n\nexport function mapIndexerV2MarketHours(\n hours: IndexerServerV2MarketHours,\n): IndexerV2MarketHours {\n return {\n isOpen: hours.is_open,\n reason: hours.reason,\n nextClose: hours.next_close,\n nextOpen: hours.next_open,\n };\n}\n\nexport function mapIndexerV2Symbols(\n symbol: IndexerServerV2Symbol,\n): IndexerV2Symbol {\n return {\n type: symbol.type,\n productId: symbol.product_id,\n symbol: symbol.symbol,\n priceIncrement: removeDecimals(symbol.price_increment_x18),\n sizeIncrement: symbol.size_increment,\n minSize: symbol.min_size,\n makerFeeRate: removeDecimals(symbol.maker_fee_rate_x18),\n takerFeeRate: removeDecimals(symbol.taker_fee_rate_x18),\n longWeightInitial: removeDecimals(symbol.long_weight_initial_x18),\n longWeightMaintenance: removeDecimals(symbol.long_weight_maintenance_x18),\n maxOpenInterest: symbol.max_open_interest_x18\n ? removeDecimals(symbol.max_open_interest_x18)\n : null,\n exchangeRate: symbol.exchange_rate_x18\n ? removeDecimals(symbol.exchange_rate_x18)\n : null,\n tradingStatus: symbol.trading_status as IndexerV2TradingStatus,\n isolatedOnly: symbol.isolated_only,\n marketHours: symbol.market_hours\n ? mapIndexerV2MarketHours(symbol.market_hours)\n : null,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;A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,QACyB;AACzB,SAAO;AAAA,IACL,WAAW,OAAO;AAAA,IAClB,UAAU,OAAO;AAAA,IACjB,cAAc,OAAO;AAAA,IACrB,eAAe,OAAO;AAAA,IACtB,WAAW,OAAO;AAAA,IAClB,YAAY,OAAO;AAAA,IACnB,aAAa,OAAO;AAAA,IACpB,uBAAuB,OAAO;AAAA,EAChC;AACF;AAEO,SAAS,wBACd,OACsB;AACtB,SAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,IACd,WAAW,MAAM;AAAA,IACjB,UAAU,MAAM;AAAA,EAClB;AACF;AAEO,SAAS,oBACd,QACiB;AACjB,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,WAAW,OAAO;AAAA,IAClB,QAAQ,OAAO;AAAA,IACf,oBAAgB,8BAAe,OAAO,mBAAmB;AAAA,IACzD,eAAe,OAAO;AAAA,IACtB,SAAS,OAAO;AAAA,IAChB,kBAAc,8BAAe,OAAO,kBAAkB;AAAA,IACtD,kBAAc,8BAAe,OAAO,kBAAkB;AAAA,IACtD,uBAAmB,8BAAe,OAAO,uBAAuB;AAAA,IAChE,2BAAuB,8BAAe,OAAO,2BAA2B;AAAA,IACxE,iBAAiB,OAAO,4BACpB,8BAAe,OAAO,qBAAqB,IAC3C;AAAA,IACJ,cAAc,OAAO,wBACjB,8BAAe,OAAO,iBAAiB,IACvC;AAAA,IACJ,eAAe,OAAO;AAAA,IACtB,cAAc,OAAO;AAAA,IACrB,aAAa,OAAO,eAChB,wBAAwB,OAAO,YAAY,IAC3C;AAAA,EACN;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n getRecvTimeFromOrderNonce,\n mapValues,\n Market,\n PerpMarket,\n ProductEngineType,\n removeDecimals,\n SpotMarket,\n subaccountFromHex,\n toBigNumber,\n toIntegerString,\n unpackOrderAppendix,\n} from '@nadohq/shared';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\n IndexerNlpSnapshot,\n IndexerOrder,\n IndexerPerpBalance,\n IndexerPerpPrices,\n IndexerProductPayment,\n IndexerServerBalance,\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerFundingRate,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMatchEventBalances,\n IndexerServerNlpSnapshot,\n IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerV2MarketHours,\n IndexerServerV2Symbol,\n IndexerServerV2TickerResponse,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerV2MarketHours,\n IndexerV2Symbol,\n IndexerV2TickerResponse,\n IndexerV2TradingStatus,\n} from './types';\n\nexport function mapSnapshotsIntervalToServerParams(\n params: IndexerSnapshotsIntervalParams,\n): IndexerServerSnapshotsInterval {\n return {\n count: params.limit,\n max_time: params.maxTimeInclusive\n ? toIntegerString(params.maxTimeInclusive)\n : undefined,\n granularity: params.granularity,\n };\n}\n\nexport function mapIndexerServerProduct(product: IndexerServerProduct): Market {\n if ('spot' in product) {\n return mapEngineServerSpotProduct(product.spot);\n }\n return mapEngineServerPerpProduct(product.perp);\n}\n\nexport function mapIndexerServerBalance(\n balance: IndexerServerBalance,\n): IndexerSpotBalance | IndexerPerpBalance {\n if ('spot' in balance) {\n return {\n amount: toBigNumber(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigNumber(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigNumber(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const appendix = unpackOrderAppendix(order.appendix);\n return {\n amount: toBigNumber(order.amount),\n digest: order.digest,\n expiration: Number(order.expiration),\n appendix,\n nonce: toBigNumber(order.nonce),\n isolated: order.isolated,\n recvTimeSeconds: getRecvTimeFromOrderNonce(order.nonce) / 1000,\n price: removeDecimals(order.price_x18),\n productId: order.product_id,\n subaccount: order.subaccount,\n submissionIndex: order.submission_idx,\n lastFillSubmissionIndex: order.last_fill_submission_idx,\n baseFilled: toBigNumber(order.base_filled),\n quoteFilled: toBigNumber(order.quote_filled),\n totalFee: toBigNumber(order.fee),\n builderFee: toBigNumber(order.builder_fee),\n realizedPnl: toBigNumber(order.realized_pnl),\n closedAmount: toBigNumber(order.closed_amount),\n closedNetEntry: toBigNumber(order.closed_net_entry),\n preCloseMargin: order.closed_margin\n ? toBigNumber(order.closed_margin)\n : null,\n firstFillTimestamp: toBigNumber(order.first_fill_timestamp),\n lastFillTimestamp: toBigNumber(order.last_fill_timestamp),\n preBalances: mapIndexerMatchEventBalances(order.pre_balance),\n postBalances: mapIndexerMatchEventBalances(order.post_balance),\n };\n}\n\nexport function mapIndexerEvent(event: IndexerServerEvent): IndexerEvent {\n const eventState: IndexerEvent['state'] = (() => {\n // Assume backend data is consistent\n if ('spot' in event.pre_balance) {\n return {\n type: ProductEngineType.SPOT,\n market: mapIndexerServerProduct(event.product) as SpotMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerSpotBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerSpotBalance,\n };\n }\n return {\n type: ProductEngineType.PERP,\n market: mapIndexerServerProduct(event.product) as PerpMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerPerpBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerPerpBalance,\n };\n })();\n\n return {\n eventType: event.event_type,\n productId: event.product_id,\n isolated: event.isolated,\n isolatedProductId: event.isolated_product_id,\n state: eventState,\n subaccount: event.subaccount,\n submissionIndex: event.submission_idx,\n trackedVars: {\n netEntryCumulative: toBigNumber(event.net_entry_cumulative),\n netEntryUnrealized: toBigNumber(event.net_entry_unrealized),\n netFundingCumulative: toBigNumber(event.net_funding_cumulative),\n netFundingUnrealized: toBigNumber(event.net_funding_unrealized),\n netInterestCumulative: toBigNumber(event.net_interest_cumulative),\n netInterestUnrealized: toBigNumber(event.net_interest_unrealized),\n quoteVolumeCumulative: toBigNumber(event.quote_volume_cumulative),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigNumber(tx.timestamp),\n tx: tx.tx,\n ...mapIndexerEvent(event),\n };\n}\n\nexport function mapIndexerMatchEventBalances(\n eventBalances: IndexerServerMatchEventBalances,\n): IndexerMatchEventBalances {\n return {\n base: mapIndexerServerBalance(eventBalances.base),\n quote: eventBalances.quote\n ? (mapIndexerServerBalance(eventBalances.quote) as IndexerSpotBalance)\n : undefined,\n };\n}\n\nexport function mapIndexerProductPayment(\n payment: IndexerServerProductPayment,\n): IndexerProductPayment {\n return {\n submissionIndex: payment.idx,\n timestamp: toBigNumber(payment.timestamp),\n paymentAmount: toBigNumber(payment.amount),\n balanceAmount: toBigNumber(payment.balance_amount),\n annualPaymentRate: removeDecimals(payment.rate_x18),\n oraclePrice: removeDecimals(payment.oracle_price_x18),\n isolated: payment.isolated,\n productId: payment.product_id,\n isolatedProductId: payment.isolated_product_id,\n };\n}\n\nexport function mapIndexerPerpPrices(\n perpPrices: IndexerServerPerpPrices,\n): IndexerPerpPrices {\n return {\n indexPrice: removeDecimals(perpPrices.index_price_x18),\n markPrice: removeDecimals(perpPrices.mark_price_x18),\n updateTime: toBigNumber(perpPrices.update_time),\n productId: perpPrices.product_id,\n };\n}\n\nexport function mapIndexerFundingRate(\n fundingRate: IndexerServerFundingRate,\n): IndexerFundingRate {\n return {\n fundingRate: removeDecimals(fundingRate.funding_rate_x18),\n updateTime: toBigNumber(fundingRate.update_time),\n productId: fundingRate.product_id,\n };\n}\n\nexport function mapIndexerMakerStatistics(\n maker: IndexerServerMaker,\n): IndexerMaker {\n return {\n address: maker.address,\n snapshots: maker.data.map((makerData) => {\n return {\n timestamp: toBigNumber(makerData.timestamp),\n makerFee: toBigNumber(makerData.maker_fee),\n uptime: toBigNumber(makerData.uptime),\n sumQMin: toBigNumber(makerData.sum_q_min),\n qScore: toBigNumber(makerData.q_score),\n makerShare: toBigNumber(makerData.maker_share),\n expectedMakerReward: toBigNumber(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n const tracks = mapValues(position.tracks, (trackData) => ({\n value: toBigNumber(trackData.value),\n rank: toBigNumber(trackData.rank),\n qualificationStatus: trackData.qualification_status,\n }));\n\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n accountValue: toBigNumber(position.account_value),\n updateTime: toBigNumber(position.update_time),\n tracks,\n socialAccounts: position.social_accounts.map((account) => ({\n provider: account.provider,\n username: account.username,\n displayName: account.display_name,\n profileImageUrl: account.profile_image_url,\n })),\n };\n}\n\nexport function mapIndexerLeaderboardRegistration(\n registration: IndexerServerLeaderboardRegistration,\n): IndexerLeaderboardRegistration {\n return {\n subaccount: subaccountFromHex(registration.subaccount),\n contestId: registration.contest_id,\n updateTime: toBigNumber(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n const startTime = toBigNumber(contest.start_time);\n const endTime = toBigNumber(contest.end_time);\n\n return {\n contestId: contest.contest_id,\n startTime,\n endTime,\n totalParticipants: toBigNumber(contest.count),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigNumber(contest.last_updated),\n title: contest.title,\n description: contest.description,\n tracks: contest.tracks.map((track) => ({\n trackId: track.track_id,\n rankType: track.rank_type,\n sortOrder: track.sort_order,\n minRequiredAccountValue: toBigNumber(track.threshold),\n })),\n };\n}\n\nexport function mapIndexerCandlesticks(\n candlestick: IndexerServerCandlestick,\n): Candlestick {\n return {\n close: removeDecimals(candlestick.close_x18),\n high: removeDecimals(candlestick.high_x18),\n low: removeDecimals(candlestick.low_x18),\n open: removeDecimals(candlestick.open_x18),\n time: toBigNumber(candlestick.timestamp),\n volume: toBigNumber(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeUsers: toBigNumber(snapshot.cumulative_users),\n dailyActiveUsers: toBigNumber(snapshot.daily_active_users),\n tvl: toBigNumber(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigNumber,\n ),\n cumulativeMakerFees: mapValues(snapshot.cumulative_maker_fees, toBigNumber),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigNumber,\n ),\n cumulativeTakerFees: mapValues(snapshot.cumulative_taker_fees, toBigNumber),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigNumber),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigNumber),\n depositRates: mapValues(snapshot.deposit_rates, (value) =>\n removeDecimals(value),\n ),\n fundingRates: mapValues(snapshot.funding_rates, (value) =>\n removeDecimals(value),\n ),\n openInterestsQuote: mapValues(snapshot.open_interests, toBigNumber),\n totalBorrows: mapValues(snapshot.total_borrows, toBigNumber),\n totalDeposits: mapValues(snapshot.total_deposits, toBigNumber),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigNumber,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigNumber),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigNumber),\n oraclePrices: mapValues(snapshot.oracle_prices, (value) =>\n removeDecimals(value),\n ),\n };\n}\n\nexport function mapIndexerNlpSnapshot(\n snapshot: IndexerServerNlpSnapshot,\n): IndexerNlpSnapshot {\n return {\n submissionIndex: snapshot.submission_idx,\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeBurnAmountQuote: toBigNumber(snapshot.cumulative_burn_quote),\n cumulativeMintAmountQuote: toBigNumber(snapshot.cumulative_mint_quote),\n cumulativePnl: toBigNumber(snapshot.cumulative_pnl),\n cumulativeTrades: toBigNumber(snapshot.cumulative_trades),\n cumulativeVolume: toBigNumber(snapshot.cumulative_volume),\n depositors: toBigNumber(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigNumber(snapshot.tvl),\n };\n}\n\nexport function mapIndexerV2Ticker(\n ticker: IndexerServerV2TickerResponse,\n): IndexerV2TickerResponse {\n return {\n productId: ticker.product_id,\n tickerId: ticker.ticker_id,\n baseCurrency: ticker.base_currency,\n quoteCurrency: ticker.quote_currency,\n lastPrice: ticker.last_price,\n baseVolume: ticker.base_volume,\n quoteVolume: ticker.quote_volume,\n priceChangePercent24h: ticker.price_change_percent_24h,\n };\n}\n\nexport function mapIndexerV2MarketHours(\n hours: IndexerServerV2MarketHours,\n): IndexerV2MarketHours {\n return {\n isOpen: hours.is_open,\n reason: hours.reason,\n nextClose: hours.next_close,\n nextOpen: hours.next_open,\n };\n}\n\nexport function mapIndexerV2Symbols(\n symbol: IndexerServerV2Symbol,\n): IndexerV2Symbol {\n return {\n type: symbol.type,\n productId: symbol.product_id,\n symbol: symbol.symbol,\n priceIncrement: removeDecimals(symbol.price_increment_x18),\n sizeIncrement: symbol.size_increment,\n minSize: symbol.min_size,\n makerFeeRate: removeDecimals(symbol.maker_fee_rate_x18),\n takerFeeRate: removeDecimals(symbol.taker_fee_rate_x18),\n longWeightInitial: removeDecimals(symbol.long_weight_initial_x18),\n longWeightMaintenance: removeDecimals(symbol.long_weight_maintenance_x18),\n maxOpenInterest: symbol.max_open_interest_x18\n ? removeDecimals(symbol.max_open_interest_x18)\n : null,\n exchangeRate: symbol.exchange_rate_x18\n ? removeDecimals(symbol.exchange_rate_x18)\n : null,\n tradingStatus: symbol.trading_status as IndexerV2TradingStatus,\n isolatedOnly: symbol.isolated_only,\n marketHours: symbol.market_hours\n ? mapIndexerV2MarketHours(symbol.market_hours)\n : null,\n boostType: symbol.boost_type ?? null,\n takerMultiplier: symbol.taker_multiplier ?? null,\n makerMultiplier: symbol.maker_multiplier ?? null,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAGO;AACP,oBAYO;AA6CA,SAAS,mCACd,QACgC;AAChC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,UAAU,OAAO,uBACb,+BAAgB,OAAO,gBAAgB,IACvC;AAAA,IACJ,aAAa,OAAO;AAAA,EACtB;AACF;AAEO,SAAS,wBAAwB,SAAuC;AAC7E,MAAI,UAAU,SAAS;AACrB,eAAO,iDAA2B,QAAQ,IAAI;AAAA,EAChD;AACA,aAAO,iDAA2B,QAAQ,IAAI;AAChD;AAEO,SAAS,wBACd,SACyC;AACzC,MAAI,UAAU,SAAS;AACrB,WAAO;AAAA,MACL,YAAQ,2BAAY,QAAQ,KAAK,QAAQ,MAAM;AAAA,MAC/C,WAAW,QAAQ,KAAK;AAAA,MACxB,MAAM,gCAAkB;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AAAA,IACL,YAAQ,2BAAY,QAAQ,KAAK,QAAQ,MAAM;AAAA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,2BAAuB,8BAAe,OAAO,2BAA2B;AAAA,IACxE,iBAAiB,OAAO,4BACpB,8BAAe,OAAO,qBAAqB,IAC3C;AAAA,IACJ,cAAc,OAAO,wBACjB,8BAAe,OAAO,iBAAiB,IACvC;AAAA,IACJ,eAAe,OAAO;AAAA,IACtB,cAAc,OAAO;AAAA,IACrB,aAAa,OAAO,eAChB,wBAAwB,OAAO,YAAY,IAC3C;AAAA,IACJ,WAAW,OAAO,cAAc;AAAA,IAChC,iBAAiB,OAAO,oBAAoB;AAAA,IAC5C,iBAAiB,OAAO,oBAAoB;AAAA,EAC9C;AACF;","names":[]}
@@ -324,7 +324,10 @@ function mapIndexerV2Symbols(symbol) {
324
324
  exchangeRate: symbol.exchange_rate_x18 ? removeDecimals(symbol.exchange_rate_x18) : null,
325
325
  tradingStatus: symbol.trading_status,
326
326
  isolatedOnly: symbol.isolated_only,
327
- marketHours: symbol.market_hours ? mapIndexerV2MarketHours(symbol.market_hours) : null
327
+ marketHours: symbol.market_hours ? mapIndexerV2MarketHours(symbol.market_hours) : null,
328
+ boostType: symbol.boost_type ?? null,
329
+ takerMultiplier: symbol.taker_multiplier ?? null,
330
+ makerMultiplier: symbol.maker_multiplier ?? null
328
331
  };
329
332
  }
330
333
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n getRecvTimeFromOrderNonce,\n mapValues,\n Market,\n PerpMarket,\n ProductEngineType,\n removeDecimals,\n SpotMarket,\n subaccountFromHex,\n toBigNumber,\n toIntegerString,\n unpackOrderAppendix,\n} from '@nadohq/shared';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\n IndexerNlpSnapshot,\n IndexerOrder,\n IndexerPerpBalance,\n IndexerPerpPrices,\n IndexerProductPayment,\n IndexerServerBalance,\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerFundingRate,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMatchEventBalances,\n IndexerServerNlpSnapshot,\n IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerV2MarketHours,\n IndexerServerV2Symbol,\n IndexerServerV2TickerResponse,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerV2MarketHours,\n IndexerV2Symbol,\n IndexerV2TickerResponse,\n IndexerV2TradingStatus,\n} from './types';\n\nexport function mapSnapshotsIntervalToServerParams(\n params: IndexerSnapshotsIntervalParams,\n): IndexerServerSnapshotsInterval {\n return {\n count: params.limit,\n max_time: params.maxTimeInclusive\n ? toIntegerString(params.maxTimeInclusive)\n : undefined,\n granularity: params.granularity,\n };\n}\n\nexport function mapIndexerServerProduct(product: IndexerServerProduct): Market {\n if ('spot' in product) {\n return mapEngineServerSpotProduct(product.spot);\n }\n return mapEngineServerPerpProduct(product.perp);\n}\n\nexport function mapIndexerServerBalance(\n balance: IndexerServerBalance,\n): IndexerSpotBalance | IndexerPerpBalance {\n if ('spot' in balance) {\n return {\n amount: toBigNumber(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigNumber(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigNumber(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const appendix = unpackOrderAppendix(order.appendix);\n return {\n amount: toBigNumber(order.amount),\n digest: order.digest,\n expiration: Number(order.expiration),\n appendix,\n nonce: toBigNumber(order.nonce),\n isolated: order.isolated,\n recvTimeSeconds: getRecvTimeFromOrderNonce(order.nonce) / 1000,\n price: removeDecimals(order.price_x18),\n productId: order.product_id,\n subaccount: order.subaccount,\n submissionIndex: order.submission_idx,\n lastFillSubmissionIndex: order.last_fill_submission_idx,\n baseFilled: toBigNumber(order.base_filled),\n quoteFilled: toBigNumber(order.quote_filled),\n totalFee: toBigNumber(order.fee),\n builderFee: toBigNumber(order.builder_fee),\n realizedPnl: toBigNumber(order.realized_pnl),\n closedAmount: toBigNumber(order.closed_amount),\n closedNetEntry: toBigNumber(order.closed_net_entry),\n preCloseMargin: order.closed_margin\n ? toBigNumber(order.closed_margin)\n : null,\n firstFillTimestamp: toBigNumber(order.first_fill_timestamp),\n lastFillTimestamp: toBigNumber(order.last_fill_timestamp),\n preBalances: mapIndexerMatchEventBalances(order.pre_balance),\n postBalances: mapIndexerMatchEventBalances(order.post_balance),\n };\n}\n\nexport function mapIndexerEvent(event: IndexerServerEvent): IndexerEvent {\n const eventState: IndexerEvent['state'] = (() => {\n // Assume backend data is consistent\n if ('spot' in event.pre_balance) {\n return {\n type: ProductEngineType.SPOT,\n market: mapIndexerServerProduct(event.product) as SpotMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerSpotBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerSpotBalance,\n };\n }\n return {\n type: ProductEngineType.PERP,\n market: mapIndexerServerProduct(event.product) as PerpMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerPerpBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerPerpBalance,\n };\n })();\n\n return {\n eventType: event.event_type,\n productId: event.product_id,\n isolated: event.isolated,\n isolatedProductId: event.isolated_product_id,\n state: eventState,\n subaccount: event.subaccount,\n submissionIndex: event.submission_idx,\n trackedVars: {\n netEntryCumulative: toBigNumber(event.net_entry_cumulative),\n netEntryUnrealized: toBigNumber(event.net_entry_unrealized),\n netFundingCumulative: toBigNumber(event.net_funding_cumulative),\n netFundingUnrealized: toBigNumber(event.net_funding_unrealized),\n netInterestCumulative: toBigNumber(event.net_interest_cumulative),\n netInterestUnrealized: toBigNumber(event.net_interest_unrealized),\n quoteVolumeCumulative: toBigNumber(event.quote_volume_cumulative),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigNumber(tx.timestamp),\n tx: tx.tx,\n ...mapIndexerEvent(event),\n };\n}\n\nexport function mapIndexerMatchEventBalances(\n eventBalances: IndexerServerMatchEventBalances,\n): IndexerMatchEventBalances {\n return {\n base: mapIndexerServerBalance(eventBalances.base),\n quote: eventBalances.quote\n ? (mapIndexerServerBalance(eventBalances.quote) as IndexerSpotBalance)\n : undefined,\n };\n}\n\nexport function mapIndexerProductPayment(\n payment: IndexerServerProductPayment,\n): IndexerProductPayment {\n return {\n submissionIndex: payment.idx,\n timestamp: toBigNumber(payment.timestamp),\n paymentAmount: toBigNumber(payment.amount),\n balanceAmount: toBigNumber(payment.balance_amount),\n annualPaymentRate: removeDecimals(payment.rate_x18),\n oraclePrice: removeDecimals(payment.oracle_price_x18),\n isolated: payment.isolated,\n productId: payment.product_id,\n isolatedProductId: payment.isolated_product_id,\n };\n}\n\nexport function mapIndexerPerpPrices(\n perpPrices: IndexerServerPerpPrices,\n): IndexerPerpPrices {\n return {\n indexPrice: removeDecimals(perpPrices.index_price_x18),\n markPrice: removeDecimals(perpPrices.mark_price_x18),\n updateTime: toBigNumber(perpPrices.update_time),\n productId: perpPrices.product_id,\n };\n}\n\nexport function mapIndexerFundingRate(\n fundingRate: IndexerServerFundingRate,\n): IndexerFundingRate {\n return {\n fundingRate: removeDecimals(fundingRate.funding_rate_x18),\n updateTime: toBigNumber(fundingRate.update_time),\n productId: fundingRate.product_id,\n };\n}\n\nexport function mapIndexerMakerStatistics(\n maker: IndexerServerMaker,\n): IndexerMaker {\n return {\n address: maker.address,\n snapshots: maker.data.map((makerData) => {\n return {\n timestamp: toBigNumber(makerData.timestamp),\n makerFee: toBigNumber(makerData.maker_fee),\n uptime: toBigNumber(makerData.uptime),\n sumQMin: toBigNumber(makerData.sum_q_min),\n qScore: toBigNumber(makerData.q_score),\n makerShare: toBigNumber(makerData.maker_share),\n expectedMakerReward: toBigNumber(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n const tracks = mapValues(position.tracks, (trackData) => ({\n value: toBigNumber(trackData.value),\n rank: toBigNumber(trackData.rank),\n qualificationStatus: trackData.qualification_status,\n }));\n\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n accountValue: toBigNumber(position.account_value),\n updateTime: toBigNumber(position.update_time),\n tracks,\n socialAccounts: position.social_accounts.map((account) => ({\n provider: account.provider,\n username: account.username,\n displayName: account.display_name,\n profileImageUrl: account.profile_image_url,\n })),\n };\n}\n\nexport function mapIndexerLeaderboardRegistration(\n registration: IndexerServerLeaderboardRegistration,\n): IndexerLeaderboardRegistration {\n return {\n subaccount: subaccountFromHex(registration.subaccount),\n contestId: registration.contest_id,\n updateTime: toBigNumber(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n const startTime = toBigNumber(contest.start_time);\n const endTime = toBigNumber(contest.end_time);\n\n return {\n contestId: contest.contest_id,\n startTime,\n endTime,\n totalParticipants: toBigNumber(contest.count),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigNumber(contest.last_updated),\n title: contest.title,\n description: contest.description,\n tracks: contest.tracks.map((track) => ({\n trackId: track.track_id,\n rankType: track.rank_type,\n sortOrder: track.sort_order,\n minRequiredAccountValue: toBigNumber(track.threshold),\n })),\n };\n}\n\nexport function mapIndexerCandlesticks(\n candlestick: IndexerServerCandlestick,\n): Candlestick {\n return {\n close: removeDecimals(candlestick.close_x18),\n high: removeDecimals(candlestick.high_x18),\n low: removeDecimals(candlestick.low_x18),\n open: removeDecimals(candlestick.open_x18),\n time: toBigNumber(candlestick.timestamp),\n volume: toBigNumber(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeUsers: toBigNumber(snapshot.cumulative_users),\n dailyActiveUsers: toBigNumber(snapshot.daily_active_users),\n tvl: toBigNumber(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigNumber,\n ),\n cumulativeMakerFees: mapValues(snapshot.cumulative_maker_fees, toBigNumber),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigNumber,\n ),\n cumulativeTakerFees: mapValues(snapshot.cumulative_taker_fees, toBigNumber),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigNumber),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigNumber),\n depositRates: mapValues(snapshot.deposit_rates, (value) =>\n removeDecimals(value),\n ),\n fundingRates: mapValues(snapshot.funding_rates, (value) =>\n removeDecimals(value),\n ),\n openInterestsQuote: mapValues(snapshot.open_interests, toBigNumber),\n totalBorrows: mapValues(snapshot.total_borrows, toBigNumber),\n totalDeposits: mapValues(snapshot.total_deposits, toBigNumber),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigNumber,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigNumber),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigNumber),\n oraclePrices: mapValues(snapshot.oracle_prices, (value) =>\n removeDecimals(value),\n ),\n };\n}\n\nexport function mapIndexerNlpSnapshot(\n snapshot: IndexerServerNlpSnapshot,\n): IndexerNlpSnapshot {\n return {\n submissionIndex: snapshot.submission_idx,\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeBurnAmountQuote: toBigNumber(snapshot.cumulative_burn_quote),\n cumulativeMintAmountQuote: toBigNumber(snapshot.cumulative_mint_quote),\n cumulativePnl: toBigNumber(snapshot.cumulative_pnl),\n cumulativeTrades: toBigNumber(snapshot.cumulative_trades),\n cumulativeVolume: toBigNumber(snapshot.cumulative_volume),\n depositors: toBigNumber(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigNumber(snapshot.tvl),\n };\n}\n\nexport function mapIndexerV2Ticker(\n ticker: IndexerServerV2TickerResponse,\n): IndexerV2TickerResponse {\n return {\n productId: ticker.product_id,\n tickerId: ticker.ticker_id,\n baseCurrency: ticker.base_currency,\n quoteCurrency: ticker.quote_currency,\n lastPrice: ticker.last_price,\n baseVolume: ticker.base_volume,\n quoteVolume: ticker.quote_volume,\n priceChangePercent24h: ticker.price_change_percent_24h,\n };\n}\n\nexport function mapIndexerV2MarketHours(\n hours: IndexerServerV2MarketHours,\n): IndexerV2MarketHours {\n return {\n isOpen: hours.is_open,\n reason: hours.reason,\n nextClose: hours.next_close,\n nextOpen: hours.next_open,\n };\n}\n\nexport function mapIndexerV2Symbols(\n symbol: IndexerServerV2Symbol,\n): IndexerV2Symbol {\n return {\n type: symbol.type,\n productId: symbol.product_id,\n symbol: symbol.symbol,\n priceIncrement: removeDecimals(symbol.price_increment_x18),\n sizeIncrement: symbol.size_increment,\n minSize: symbol.min_size,\n makerFeeRate: removeDecimals(symbol.maker_fee_rate_x18),\n takerFeeRate: removeDecimals(symbol.taker_fee_rate_x18),\n longWeightInitial: removeDecimals(symbol.long_weight_initial_x18),\n longWeightMaintenance: removeDecimals(symbol.long_weight_maintenance_x18),\n maxOpenInterest: symbol.max_open_interest_x18\n ? removeDecimals(symbol.max_open_interest_x18)\n : null,\n exchangeRate: symbol.exchange_rate_x18\n ? removeDecimals(symbol.exchange_rate_x18)\n : null,\n tradingStatus: symbol.trading_status as IndexerV2TradingStatus,\n isolatedOnly: symbol.isolated_only,\n marketHours: symbol.market_hours\n ? mapIndexerV2MarketHours(symbol.market_hours)\n : null,\n };\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6CA,SAAS,mCACd,QACgC;AAChC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,UAAU,OAAO,mBACb,gBAAgB,OAAO,gBAAgB,IACvC;AAAA,IACJ,aAAa,OAAO;AAAA,EACtB;AACF;AAEO,SAAS,wBAAwB,SAAuC;AAC7E,MAAI,UAAU,SAAS;AACrB,WAAO,2BAA2B,QAAQ,IAAI;AAAA,EAChD;AACA,SAAO,2BAA2B,QAAQ,IAAI;AAChD;AAEO,SAAS,wBACd,SACyC;AACzC,MAAI,UAAU,SAAS;AACrB,WAAO;AAAA,MACL,QAAQ,YAAY,QAAQ,KAAK,QAAQ,MAAM;AAAA,MAC/C,WAAW,QAAQ,KAAK;AAAA,MACxB,MAAM,kBAAkB;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ,YAAY,QAAQ,KAAK,QAAQ,MAAM;AAAA,IAC/C,WAAW,QAAQ,KAAK;AAAA,IACxB,MAAM,kBAAkB;AAAA,IACxB,eAAe,YAAY,QAAQ,KAAK,QAAQ,eAAe;AAAA,EACjE;AACF;AAEO,SAAS,gBAAgB,OAAyC;AACvE,QAAM,WAAW,oBAAoB,MAAM,QAAQ;AACnD,SAAO;AAAA,IACL,QAAQ,YAAY,MAAM,MAAM;AAAA,IAChC,QAAQ,MAAM;AAAA,IACd,YAAY,OAAO,MAAM,UAAU;AAAA,IACnC;AAAA,IACA,OAAO,YAAY,MAAM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GAAG;AAAA,EAC/B;AACF;AAEO,SAAS,mBACd,QACyB;AACzB,SAAO;AAAA,IACL,WAAW,OAAO;AAAA,IAClB,UAAU,OAAO;AAAA,IACjB,cAAc,OAAO;AAAA,IACrB,eAAe,OAAO;AAAA,IACtB,WAAW,OAAO;AAAA,IAClB,YAAY,OAAO;AAAA,IACnB,aAAa,OAAO;AAAA,IACpB,uBAAuB,OAAO;AAAA,EAChC;AACF;AAEO,SAAS,wBACd,OACsB;AACtB,SAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,QAAQ,MAAM;AAAA,IACd,WAAW,MAAM;AAAA,IACjB,UAAU,MAAM;AAAA,EAClB;AACF;AAEO,SAAS,oBACd,QACiB;AACjB,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,WAAW,OAAO;AAAA,IAClB,QAAQ,OAAO;AAAA,IACf,gBAAgB,eAAe,OAAO,mBAAmB;AAAA,IACzD,eAAe,OAAO;AAAA,IACtB,SAAS,OAAO;AAAA,IAChB,cAAc,eAAe,OAAO,kBAAkB;AAAA,IACtD,cAAc,eAAe,OAAO,kBAAkB;AAAA,IACtD,mBAAmB,eAAe,OAAO,uBAAuB;AAAA,IAChE,uBAAuB,eAAe,OAAO,2BAA2B;AAAA,IACxE,iBAAiB,OAAO,wBACpB,eAAe,OAAO,qBAAqB,IAC3C;AAAA,IACJ,cAAc,OAAO,oBACjB,eAAe,OAAO,iBAAiB,IACvC;AAAA,IACJ,eAAe,OAAO;AAAA,IACtB,cAAc,OAAO;AAAA,IACrB,aAAa,OAAO,eAChB,wBAAwB,OAAO,YAAY,IAC3C;AAAA,EACN;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n getRecvTimeFromOrderNonce,\n mapValues,\n Market,\n PerpMarket,\n ProductEngineType,\n removeDecimals,\n SpotMarket,\n subaccountFromHex,\n toBigNumber,\n toIntegerString,\n unpackOrderAppendix,\n} from '@nadohq/shared';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\n IndexerNlpSnapshot,\n IndexerOrder,\n IndexerPerpBalance,\n IndexerPerpPrices,\n IndexerProductPayment,\n IndexerServerBalance,\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerFundingRate,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMatchEventBalances,\n IndexerServerNlpSnapshot,\n IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerV2MarketHours,\n IndexerServerV2Symbol,\n IndexerServerV2TickerResponse,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerV2MarketHours,\n IndexerV2Symbol,\n IndexerV2TickerResponse,\n IndexerV2TradingStatus,\n} from './types';\n\nexport function mapSnapshotsIntervalToServerParams(\n params: IndexerSnapshotsIntervalParams,\n): IndexerServerSnapshotsInterval {\n return {\n count: params.limit,\n max_time: params.maxTimeInclusive\n ? toIntegerString(params.maxTimeInclusive)\n : undefined,\n granularity: params.granularity,\n };\n}\n\nexport function mapIndexerServerProduct(product: IndexerServerProduct): Market {\n if ('spot' in product) {\n return mapEngineServerSpotProduct(product.spot);\n }\n return mapEngineServerPerpProduct(product.perp);\n}\n\nexport function mapIndexerServerBalance(\n balance: IndexerServerBalance,\n): IndexerSpotBalance | IndexerPerpBalance {\n if ('spot' in balance) {\n return {\n amount: toBigNumber(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigNumber(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigNumber(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const appendix = unpackOrderAppendix(order.appendix);\n return {\n amount: toBigNumber(order.amount),\n digest: order.digest,\n expiration: Number(order.expiration),\n appendix,\n nonce: toBigNumber(order.nonce),\n isolated: order.isolated,\n recvTimeSeconds: getRecvTimeFromOrderNonce(order.nonce) / 1000,\n price: removeDecimals(order.price_x18),\n productId: order.product_id,\n subaccount: order.subaccount,\n submissionIndex: order.submission_idx,\n lastFillSubmissionIndex: order.last_fill_submission_idx,\n baseFilled: toBigNumber(order.base_filled),\n quoteFilled: toBigNumber(order.quote_filled),\n totalFee: toBigNumber(order.fee),\n builderFee: toBigNumber(order.builder_fee),\n realizedPnl: toBigNumber(order.realized_pnl),\n closedAmount: toBigNumber(order.closed_amount),\n closedNetEntry: toBigNumber(order.closed_net_entry),\n preCloseMargin: order.closed_margin\n ? toBigNumber(order.closed_margin)\n : null,\n firstFillTimestamp: toBigNumber(order.first_fill_timestamp),\n lastFillTimestamp: toBigNumber(order.last_fill_timestamp),\n preBalances: mapIndexerMatchEventBalances(order.pre_balance),\n postBalances: mapIndexerMatchEventBalances(order.post_balance),\n };\n}\n\nexport function mapIndexerEvent(event: IndexerServerEvent): IndexerEvent {\n const eventState: IndexerEvent['state'] = (() => {\n // Assume backend data is consistent\n if ('spot' in event.pre_balance) {\n return {\n type: ProductEngineType.SPOT,\n market: mapIndexerServerProduct(event.product) as SpotMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerSpotBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerSpotBalance,\n };\n }\n return {\n type: ProductEngineType.PERP,\n market: mapIndexerServerProduct(event.product) as PerpMarket,\n preBalance: mapIndexerServerBalance(\n event.pre_balance,\n ) as IndexerPerpBalance,\n postBalance: mapIndexerServerBalance(\n event.post_balance,\n ) as IndexerPerpBalance,\n };\n })();\n\n return {\n eventType: event.event_type,\n productId: event.product_id,\n isolated: event.isolated,\n isolatedProductId: event.isolated_product_id,\n state: eventState,\n subaccount: event.subaccount,\n submissionIndex: event.submission_idx,\n trackedVars: {\n netEntryCumulative: toBigNumber(event.net_entry_cumulative),\n netEntryUnrealized: toBigNumber(event.net_entry_unrealized),\n netFundingCumulative: toBigNumber(event.net_funding_cumulative),\n netFundingUnrealized: toBigNumber(event.net_funding_unrealized),\n netInterestCumulative: toBigNumber(event.net_interest_cumulative),\n netInterestUnrealized: toBigNumber(event.net_interest_unrealized),\n quoteVolumeCumulative: toBigNumber(event.quote_volume_cumulative),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigNumber(tx.timestamp),\n tx: tx.tx,\n ...mapIndexerEvent(event),\n };\n}\n\nexport function mapIndexerMatchEventBalances(\n eventBalances: IndexerServerMatchEventBalances,\n): IndexerMatchEventBalances {\n return {\n base: mapIndexerServerBalance(eventBalances.base),\n quote: eventBalances.quote\n ? (mapIndexerServerBalance(eventBalances.quote) as IndexerSpotBalance)\n : undefined,\n };\n}\n\nexport function mapIndexerProductPayment(\n payment: IndexerServerProductPayment,\n): IndexerProductPayment {\n return {\n submissionIndex: payment.idx,\n timestamp: toBigNumber(payment.timestamp),\n paymentAmount: toBigNumber(payment.amount),\n balanceAmount: toBigNumber(payment.balance_amount),\n annualPaymentRate: removeDecimals(payment.rate_x18),\n oraclePrice: removeDecimals(payment.oracle_price_x18),\n isolated: payment.isolated,\n productId: payment.product_id,\n isolatedProductId: payment.isolated_product_id,\n };\n}\n\nexport function mapIndexerPerpPrices(\n perpPrices: IndexerServerPerpPrices,\n): IndexerPerpPrices {\n return {\n indexPrice: removeDecimals(perpPrices.index_price_x18),\n markPrice: removeDecimals(perpPrices.mark_price_x18),\n updateTime: toBigNumber(perpPrices.update_time),\n productId: perpPrices.product_id,\n };\n}\n\nexport function mapIndexerFundingRate(\n fundingRate: IndexerServerFundingRate,\n): IndexerFundingRate {\n return {\n fundingRate: removeDecimals(fundingRate.funding_rate_x18),\n updateTime: toBigNumber(fundingRate.update_time),\n productId: fundingRate.product_id,\n };\n}\n\nexport function mapIndexerMakerStatistics(\n maker: IndexerServerMaker,\n): IndexerMaker {\n return {\n address: maker.address,\n snapshots: maker.data.map((makerData) => {\n return {\n timestamp: toBigNumber(makerData.timestamp),\n makerFee: toBigNumber(makerData.maker_fee),\n uptime: toBigNumber(makerData.uptime),\n sumQMin: toBigNumber(makerData.sum_q_min),\n qScore: toBigNumber(makerData.q_score),\n makerShare: toBigNumber(makerData.maker_share),\n expectedMakerReward: toBigNumber(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n const tracks = mapValues(position.tracks, (trackData) => ({\n value: toBigNumber(trackData.value),\n rank: toBigNumber(trackData.rank),\n qualificationStatus: trackData.qualification_status,\n }));\n\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n accountValue: toBigNumber(position.account_value),\n updateTime: toBigNumber(position.update_time),\n tracks,\n socialAccounts: position.social_accounts.map((account) => ({\n provider: account.provider,\n username: account.username,\n displayName: account.display_name,\n profileImageUrl: account.profile_image_url,\n })),\n };\n}\n\nexport function mapIndexerLeaderboardRegistration(\n registration: IndexerServerLeaderboardRegistration,\n): IndexerLeaderboardRegistration {\n return {\n subaccount: subaccountFromHex(registration.subaccount),\n contestId: registration.contest_id,\n updateTime: toBigNumber(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n const startTime = toBigNumber(contest.start_time);\n const endTime = toBigNumber(contest.end_time);\n\n return {\n contestId: contest.contest_id,\n startTime,\n endTime,\n totalParticipants: toBigNumber(contest.count),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigNumber(contest.last_updated),\n title: contest.title,\n description: contest.description,\n tracks: contest.tracks.map((track) => ({\n trackId: track.track_id,\n rankType: track.rank_type,\n sortOrder: track.sort_order,\n minRequiredAccountValue: toBigNumber(track.threshold),\n })),\n };\n}\n\nexport function mapIndexerCandlesticks(\n candlestick: IndexerServerCandlestick,\n): Candlestick {\n return {\n close: removeDecimals(candlestick.close_x18),\n high: removeDecimals(candlestick.high_x18),\n low: removeDecimals(candlestick.low_x18),\n open: removeDecimals(candlestick.open_x18),\n time: toBigNumber(candlestick.timestamp),\n volume: toBigNumber(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeUsers: toBigNumber(snapshot.cumulative_users),\n dailyActiveUsers: toBigNumber(snapshot.daily_active_users),\n tvl: toBigNumber(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigNumber,\n ),\n cumulativeMakerFees: mapValues(snapshot.cumulative_maker_fees, toBigNumber),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigNumber,\n ),\n cumulativeTakerFees: mapValues(snapshot.cumulative_taker_fees, toBigNumber),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigNumber),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigNumber),\n depositRates: mapValues(snapshot.deposit_rates, (value) =>\n removeDecimals(value),\n ),\n fundingRates: mapValues(snapshot.funding_rates, (value) =>\n removeDecimals(value),\n ),\n openInterestsQuote: mapValues(snapshot.open_interests, toBigNumber),\n totalBorrows: mapValues(snapshot.total_borrows, toBigNumber),\n totalDeposits: mapValues(snapshot.total_deposits, toBigNumber),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigNumber,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigNumber),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigNumber),\n oraclePrices: mapValues(snapshot.oracle_prices, (value) =>\n removeDecimals(value),\n ),\n };\n}\n\nexport function mapIndexerNlpSnapshot(\n snapshot: IndexerServerNlpSnapshot,\n): IndexerNlpSnapshot {\n return {\n submissionIndex: snapshot.submission_idx,\n timestamp: toBigNumber(snapshot.timestamp),\n cumulativeBurnAmountQuote: toBigNumber(snapshot.cumulative_burn_quote),\n cumulativeMintAmountQuote: toBigNumber(snapshot.cumulative_mint_quote),\n cumulativePnl: toBigNumber(snapshot.cumulative_pnl),\n cumulativeTrades: toBigNumber(snapshot.cumulative_trades),\n cumulativeVolume: toBigNumber(snapshot.cumulative_volume),\n depositors: toBigNumber(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigNumber(snapshot.tvl),\n };\n}\n\nexport function mapIndexerV2Ticker(\n ticker: IndexerServerV2TickerResponse,\n): IndexerV2TickerResponse {\n return {\n productId: ticker.product_id,\n tickerId: ticker.ticker_id,\n baseCurrency: ticker.base_currency,\n quoteCurrency: ticker.quote_currency,\n lastPrice: ticker.last_price,\n baseVolume: ticker.base_volume,\n quoteVolume: ticker.quote_volume,\n priceChangePercent24h: ticker.price_change_percent_24h,\n };\n}\n\nexport function mapIndexerV2MarketHours(\n hours: IndexerServerV2MarketHours,\n): IndexerV2MarketHours {\n return {\n isOpen: hours.is_open,\n reason: hours.reason,\n nextClose: hours.next_close,\n nextOpen: hours.next_open,\n };\n}\n\nexport function mapIndexerV2Symbols(\n symbol: IndexerServerV2Symbol,\n): IndexerV2Symbol {\n return {\n type: symbol.type,\n productId: symbol.product_id,\n symbol: symbol.symbol,\n priceIncrement: removeDecimals(symbol.price_increment_x18),\n sizeIncrement: symbol.size_increment,\n minSize: symbol.min_size,\n makerFeeRate: removeDecimals(symbol.maker_fee_rate_x18),\n takerFeeRate: removeDecimals(symbol.taker_fee_rate_x18),\n longWeightInitial: removeDecimals(symbol.long_weight_initial_x18),\n longWeightMaintenance: removeDecimals(symbol.long_weight_maintenance_x18),\n maxOpenInterest: symbol.max_open_interest_x18\n ? removeDecimals(symbol.max_open_interest_x18)\n : null,\n exchangeRate: symbol.exchange_rate_x18\n ? removeDecimals(symbol.exchange_rate_x18)\n : null,\n tradingStatus: symbol.trading_status as IndexerV2TradingStatus,\n isolatedOnly: symbol.isolated_only,\n marketHours: symbol.market_hours\n ? mapIndexerV2MarketHours(symbol.market_hours)\n : null,\n boostType: symbol.boost_type ?? null,\n takerMultiplier: symbol.taker_multiplier ?? null,\n makerMultiplier: symbol.maker_multiplier ?? null,\n };\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA6CA,SAAS,mCACd,QACgC;AAChC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,UAAU,OAAO,mBACb,gBAAgB,OAAO,gBAAgB,IACvC;AAAA,IACJ,aAAa,OAAO;AAAA,EACtB;AACF;AAEO,SAAS,wBAAwB,SAAuC;AAC7E,MAAI,UAAU,SAAS;AACrB,WAAO,2BAA2B,QAAQ,IAAI;AAAA,EAChD;AACA,SAAO,2BAA2B,QAAQ,IAAI;AAChD;AAEO,SAAS,wBACd,SACyC;AACzC,MAAI,UAAU,SAAS;AACrB,WAAO;AAAA,MACL,QAAQ,YAAY,QAAQ,KAAK,QAAQ,MAAM;AAAA,MAC/C,WAAW,QAAQ,KAAK;AAAA,MACxB,MAAM,kBAAkB;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ,YAAY,QAAQ,KAAK,QAAQ,MAAM;AAAA,IAC/C,WAAW,QAAQ,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AAA,IACtB,cAAc,OAAO;AAAA,IACrB,aAAa,OAAO,eAChB,wBAAwB,OAAO,YAAY,IAC3C;AAAA,IACJ,WAAW,OAAO,cAAc;AAAA,IAChC,iBAAiB,OAAO,oBAAoB;AAAA,IAC5C,iBAAiB,OAAO,oBAAoB;AAAA,EAC9C;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/clientTypes.ts"],"sourcesContent":["import {\n EIP712OrderValues,\n Market,\n OrderAppendix,\n PerpBalance,\n PerpMarket,\n ProductEngineType,\n SpotBalance,\n SpotMarket,\n Subaccount,\n} from '@nadohq/shared';\nimport BigNumber from 'bignumber.js';\nimport { Address, Hex } from 'viem';\nimport { CandlestickPeriod } from './CandlestickPeriod';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoTx, NadoWithdrawCollateralTx } from './NadoTx';\nimport {\n IndexerServerFastWithdrawalSignatureParams,\n IndexerServerListSubaccountsParams,\n IndexerServerTriggerTypeFilter,\n} from './serverTypes';\n\n/**\n * Base types\n */\n\nexport type IndexerSpotBalance = Omit<SpotBalance, 'healthContributions'>;\n\nexport type IndexerPerpBalance = Omit<PerpBalance, 'healthContributions'>;\n\nexport interface IndexerEventSpotStateSnapshot {\n type: ProductEngineType.SPOT;\n preBalance: IndexerSpotBalance;\n postBalance: IndexerSpotBalance;\n market: SpotMarket;\n}\n\nexport interface IndexerEventPerpStateSnapshot {\n type: ProductEngineType.PERP;\n preBalance: IndexerPerpBalance;\n postBalance: IndexerPerpBalance;\n market: PerpMarket;\n}\n\nexport type IndexerEventBalanceStateSnapshot =\n | IndexerEventSpotStateSnapshot\n | IndexerEventPerpStateSnapshot;\n\nexport interface IndexerBalanceTrackedVars {\n netInterestUnrealized: BigNumber;\n netInterestCumulative: BigNumber;\n netFundingUnrealized: BigNumber;\n netFundingCumulative: BigNumber;\n netEntryUnrealized: BigNumber;\n netEntryCumulative: BigNumber;\n quoteVolumeCumulative: BigNumber;\n}\n\nexport interface IndexerEvent<\n TStateType extends IndexerEventBalanceStateSnapshot =\n IndexerEventBalanceStateSnapshot,\n> {\n subaccount: string;\n isolated: boolean;\n // The product ID associated with the isolated perp market. This is only used when productId === QUOTE_PRODUCT_ID and isolated === true\n isolatedProductId: number | null;\n productId: number;\n submissionIndex: string;\n eventType: IndexerEventType;\n state: TStateType;\n trackedVars: IndexerBalanceTrackedVars;\n}\n\nexport interface IndexerEventWithTx<\n TStateType extends IndexerEventBalanceStateSnapshot =\n IndexerEventBalanceStateSnapshot,\n> extends IndexerEvent<TStateType> {\n timestamp: BigNumber;\n tx: NadoTx;\n}\n\n/**\n * List subaccounts\n */\n\nexport type ListIndexerSubaccountsParams = IndexerServerListSubaccountsParams;\n\nexport type ListIndexerSubaccountsResponse = ({\n hexId: string;\n // Unix timestamp in seconds\n createdAt: number;\n isolated: boolean;\n} & Subaccount)[];\n\n/**\n * Subaccount snapshots\n */\n\nexport interface GetIndexerMultiSubaccountSnapshotsParams {\n subaccounts: Subaccount[];\n // A series of timestamps for which to return a summary of each subaccount\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport type IndexerSnapshotBalance<\n TStateType extends IndexerEventBalanceStateSnapshot =\n IndexerEventBalanceStateSnapshot,\n> = IndexerEvent<TStateType>;\n\nexport interface IndexerSubaccountSnapshot {\n timestamp: BigNumber;\n balances: IndexerSnapshotBalance[];\n}\n\nexport interface GetIndexerMultiSubaccountSnapshotsResponse {\n // Utility for retrieving a subaccount's hex ID, in the same order as the request params\n subaccountHexIds: string[];\n // Map of subaccount hex -> timestamp requested -> summary for that time\n snapshots: Record<string, Record<string, IndexerSubaccountSnapshot>>;\n}\n\n/**\n * Perp prices\n */\n\nexport interface GetIndexerPerpPricesParams {\n productId: number;\n}\n\nexport interface IndexerPerpPrices {\n productId: number;\n indexPrice: BigNumber;\n markPrice: BigNumber;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport type GetIndexerPerpPricesResponse = IndexerPerpPrices;\n\nexport interface GetIndexerMultiProductPerpPricesParams {\n productIds: number[];\n}\n\n// Map of productId -> IndexerPerpPrices\nexport type GetIndexerMultiProductPerpPricesResponse = Record<\n number,\n IndexerPerpPrices\n>;\n\n/**\n * Oracle prices\n */\n\nexport interface GetIndexerOraclePricesParams {\n productIds: number[];\n}\n\nexport interface IndexerOraclePrice {\n productId: number;\n oraclePrice: BigNumber;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport type GetIndexerOraclePricesResponse = IndexerOraclePrice[];\n\n/**\n * Funding rates\n */\n\nexport interface GetIndexerFundingRateParams {\n productId: number;\n}\n\nexport interface IndexerFundingRate {\n productId: number;\n fundingRate: BigNumber;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport type GetIndexerFundingRateResponse = IndexerFundingRate;\n\nexport interface GetIndexerMultiProductFundingRatesParams {\n productIds: number[];\n}\n\n// Map of productId -> IndexerFundingRate\nexport type GetIndexerMultiProductFundingRatesResponse = Record<\n number,\n IndexerFundingRate\n>;\n\n/**\n * Candlesticks\n */\n\nexport interface GetIndexerCandlesticksParams {\n productId: number;\n period: CandlestickPeriod;\n // Seconds\n maxTimeInclusive?: number;\n limit: number;\n}\n\n// Semi-Tradingview compatible bars\nexport interface Candlestick {\n // In SECONDS, for TV compat, this needs to be in millis\n time: BigNumber;\n open: BigNumber;\n high: BigNumber;\n low: BigNumber;\n close: BigNumber;\n volume: BigNumber;\n}\n\nexport type GetIndexerCandlesticksResponse = Candlestick[];\n\nexport type GetIndexerEdgeCandlesticksResponse = GetIndexerCandlesticksResponse;\n\nexport type GetIndexerEdgeCandlesticksParams = GetIndexerCandlesticksParams;\n\n/**\n * Product snapshots\n */\n\nexport interface GetIndexerProductSnapshotsParams {\n // Max submission index, inclusive\n startCursor?: string;\n productId: number;\n maxTimestampInclusive?: number;\n limit: number;\n}\n\nexport interface IndexerProductSnapshot extends Market {\n submissionIndex: string;\n}\n\nexport type GetIndexerProductSnapshotsResponse = IndexerProductSnapshot[];\n\nexport interface GetIndexerMultiProductSnapshotsParams {\n productIds: number[];\n maxTimestampInclusive?: number[];\n}\n\n// Map of timestamp -> (productId -> IndexerProductSnapshot)\nexport type GetIndexerMultiProductSnapshotsResponse = Record<\n string,\n Record<number, IndexerProductSnapshot>\n>;\n\nexport interface IndexerSnapshotsIntervalParams {\n /** Currently accepts all integers, in seconds */\n granularity: number;\n /**\n * Optional upper bound for snapshot timestamps (in seconds).\n * Without this, snapshots will default to align with last UTC midnight,\n * which can make \"Last 24h\" metrics inaccurate.\n */\n maxTimeInclusive?: number;\n limit: number;\n}\n\n/**\n * Market snapshots\n */\n\nexport interface GetIndexerMarketSnapshotsParams extends IndexerSnapshotsIntervalParams {\n // Defaults to all\n productIds?: number[];\n}\n\nexport interface IndexerMarketSnapshot {\n timestamp: BigNumber;\n cumulativeUsers: BigNumber;\n dailyActiveUsers: BigNumber;\n tvl: BigNumber;\n cumulativeVolumes: Record<number, BigNumber>;\n cumulativeTakerFees: Record<number, BigNumber>;\n cumulativeSequencerFees: Record<number, BigNumber>;\n cumulativeMakerFees: Record<number, BigNumber>;\n cumulativeTrades: Record<number, BigNumber>;\n cumulativeLiquidationAmounts: Record<number, BigNumber>;\n openInterestsQuote: Record<number, BigNumber>;\n totalDeposits: Record<number, BigNumber>;\n totalBorrows: Record<number, BigNumber>;\n fundingRates: Record<number, BigNumber>;\n depositRates: Record<number, BigNumber>;\n borrowRates: Record<number, BigNumber>;\n cumulativeTradeSizes: Record<number, BigNumber>;\n cumulativeInflows: Record<number, BigNumber>;\n cumulativeOutflows: Record<number, BigNumber>;\n oraclePrices: Record<number, BigNumber>;\n}\n\nexport type GetIndexerMarketSnapshotsResponse = IndexerMarketSnapshot[];\n\nexport type GetIndexerEdgeMarketSnapshotsParams =\n IndexerSnapshotsIntervalParams;\n\n// Map of chain id -> IndexerMarketSnapshot[]\nexport type GetIndexerEdgeMarketSnapshotResponse = Record<\n number,\n IndexerMarketSnapshot[]\n>;\n\n/**\n * Events\n */\n\n// There can be multiple events per tx, this allows a limit depending on usecase\nexport type GetIndexerEventsLimitType = 'events' | 'txs';\n\nexport interface GetIndexerEventsParams {\n // Max submission index, inclusive\n startCursor?: string;\n subaccounts?: Subaccount[];\n productIds?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n eventTypes?: IndexerEventType[];\n maxTimestampInclusive?: number;\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n limit?: {\n type: GetIndexerEventsLimitType;\n value: number;\n };\n}\n\nexport type GetIndexerEventsResponse = IndexerEventWithTx[];\n\n/**\n * Historical orders\n */\n\nexport interface GetIndexerOrdersParams {\n // Max submission index, inclusive\n startCursor?: string;\n subaccounts?: Subaccount[];\n minTimestampInclusive?: number;\n maxTimestampInclusive?: number;\n limit?: number;\n productIds?: number[];\n triggerTypes?: IndexerServerTriggerTypeFilter[];\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n digests?: string[];\n}\n\nexport interface IndexerOrder {\n digest: string;\n subaccount: string;\n productId: number;\n submissionIndex: string;\n lastFillSubmissionIndex: string;\n amount: BigNumber;\n price: BigNumber;\n expiration: number;\n // Order metadata from appendix\n appendix: OrderAppendix;\n nonce: BigNumber;\n isolated: boolean;\n // Derived from the nonce\n recvTimeSeconds: number;\n // Fill amounts\n baseFilled: BigNumber;\n // Includes fee\n quoteFilled: BigNumber;\n // Includes sequencer fee\n totalFee: BigNumber;\n builderFee: BigNumber;\n realizedPnl: BigNumber;\n // Signed closed amount (positive for longs, negative for shorts)\n closedAmount: BigNumber;\n // Cumulative realized entry price for the closed amount on an order\n closedNetEntry: BigNumber;\n // Total isolated margin on the position before the close. Only present for isolated margin orders; null for cross-margin orders\n preCloseMargin: BigNumber | null;\n // Unix timestamp (seconds) of the first fill on the order\n firstFillTimestamp: BigNumber;\n // Unix timestamp (seconds) of the last fill on the order\n lastFillTimestamp: BigNumber;\n /** Balances before the order was filled */\n preBalances: IndexerMatchEventBalances;\n /** Balances after the order was filled */\n postBalances: IndexerMatchEventBalances;\n}\n\nexport type GetIndexerOrdersResponse = IndexerOrder[];\n\n/**\n * Match events\n */\n\nexport interface GetIndexerMatchEventsParams {\n // When not given, will return all maker events\n subaccounts?: Subaccount[];\n productIds?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n maxTimestampInclusive?: number;\n limit: number;\n // Max submission index, inclusive\n startCursor?: string;\n}\n\n// There are 2 balance states per match event if the match is in a spot market, but only one if the match is in a perp market\nexport interface IndexerMatchEventBalances {\n base: IndexerSpotBalance | IndexerPerpBalance;\n quote?: IndexerSpotBalance;\n}\n\nexport interface IndexerMatchEvent extends Subaccount {\n productId: number;\n digest: string;\n isolated: boolean;\n order: EIP712OrderValues;\n baseFilled: BigNumber;\n quoteFilled: BigNumber;\n // Includes sequencer fee\n totalFee: BigNumber;\n sequencerFee: BigNumber;\n builderFee: BigNumber;\n cumulativeBaseFilled: BigNumber;\n cumulativeQuoteFilled: BigNumber;\n cumulativeFee: BigNumber;\n submissionIndex: string;\n timestamp: BigNumber;\n isTaker: boolean;\n // Tracked vars for the balance BEFORE this match event occurred\n preEventTrackedVars: Pick<\n IndexerBalanceTrackedVars,\n 'netEntryCumulative' | 'netEntryUnrealized'\n >;\n preBalances: IndexerMatchEventBalances;\n postBalances: IndexerMatchEventBalances;\n tx: NadoTx;\n realizedPnl: BigNumber;\n // Signed closed amount (positive for longs, negative for shorts)\n closedAmount: BigNumber;\n // Realized entry price for the closed amount on this match (x18). Represents the total quote value at which the closed portion of the position was originally entered.\n closedNetEntry: BigNumber;\n // Margin allocated to the closed amount on this match (x18). Only present for isolated margin orders; null for cross-margin orders.\n margin: BigNumber | null;\n}\n\nexport type GetIndexerMatchEventsResponse = IndexerMatchEvent[];\n\n/**\n * Quote price\n */\n\nexport interface GetIndexerQuotePriceResponse {\n price: BigNumber;\n}\n\n/**\n * Linked Signer\n */\n\nexport interface GetIndexerLinkedSignerParams {\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerLinkedSignerResponse {\n totalTxLimit: BigNumber;\n remainingTxs: BigNumber;\n // If remainingTxs is 0, this is the time until the next link signer tx can be sent\n waitTimeUntilNextTx: BigNumber;\n // If zero address, none is configured\n signer: string;\n}\n\n/**\n * Interest / funding payments\n */\n\nexport interface GetIndexerInterestFundingPaymentsParams {\n subaccount: Subaccount;\n productIds: number[];\n maxTimestampInclusive?: number;\n limit: number;\n // Max submission index, inclusive\n startCursor?: string;\n}\n\nexport interface IndexerProductPayment {\n productId: number;\n submissionIndex: string;\n timestamp: BigNumber;\n paymentAmount: BigNumber;\n // For spots: previous spot balance at the moment of payment (exclusive of `paymentAmount`).\n // For perps: previous perp balance at the moment of payment + amount of perps locked in LPs (exclusive of `paymentAmount`).\n balanceAmount: BigNumber;\n // Represents the annually interest rate for spots and annually funding rate for perps.\n annualPaymentRate: BigNumber;\n oraclePrice: BigNumber;\n isolated: boolean;\n // The product ID associated with the isolated perp market. This is only used when product_id === QUOTE_PRODUCT_ID and isolated === true\n isolatedProductId: number | null;\n}\n\nexport interface GetIndexerInterestFundingPaymentsResponse {\n interestPayments: IndexerProductPayment[];\n fundingPayments: IndexerProductPayment[];\n nextCursor: string | null;\n}\n\n/**\n * Referral code\n */\n\nexport interface GetIndexerReferralCodeParams {\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerReferralCodeResponse {\n referralCode: string | null;\n}\n\n/**\n * Maker stats\n */\n\nexport interface GetIndexerMakerStatisticsParams {\n productId: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerMakerSnapshot {\n timestamp: BigNumber;\n makerFee: BigNumber;\n uptime: BigNumber;\n sumQMin: BigNumber;\n qScore: BigNumber;\n makerShare: BigNumber;\n expectedMakerReward: BigNumber;\n}\n\nexport interface IndexerMaker {\n address: string;\n snapshots: IndexerMakerSnapshot[];\n}\n\nexport interface GetIndexerMakerStatisticsResponse {\n rewardCoefficient: BigNumber;\n makers: IndexerMaker[];\n}\n\n/**\n * Leaderboards\n */\n\nexport interface GetIndexerLeaderboardParams {\n contestId: number;\n /**\n * The ranking metric to query by.\n * Optional for single-track contests (auto-selects the only track).\n * Required for multi-track contests — omitting it returns an error.\n */\n rankType?: IndexerLeaderboardRankType;\n // Min rank inclusive\n startCursor?: string;\n limit?: number;\n /** Sort order. Defaults to `'DESC'`. */\n order?: 'ASC' | 'DESC';\n}\n\nexport interface IndexerSocialAccountInfo {\n provider: 'twitter';\n username: string;\n displayName: string;\n profileImageUrl: string;\n}\n\nexport interface IndexerLeaderboardTrackPosition {\n value: BigNumber;\n rank: BigNumber;\n qualificationStatus: 'qualified' | 'insufficient_account_value';\n}\n\nexport interface IndexerLeaderboardParticipant {\n subaccount: Subaccount;\n contestId: number;\n // Float indicating the ending account value at the time the snapshot was taken i.e: at updateTime\n accountValue: BigNumber;\n // Seconds\n updateTime: BigNumber;\n tracks: Partial<\n Record<IndexerLeaderboardRankType, IndexerLeaderboardTrackPosition>\n >;\n socialAccounts: IndexerSocialAccountInfo[];\n}\n\nexport interface GetIndexerLeaderboardResponse {\n participants: IndexerLeaderboardParticipant[];\n}\n\nexport interface GetIndexerLeaderboardParticipantParams {\n contestIds: number[];\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerLeaderboardParticipantResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerLeaderboardParticipant\n participant: Record<string, IndexerLeaderboardParticipant>;\n}\n\ninterface SignatureParams {\n verifyingAddr: string;\n chainId: number;\n}\n\nexport interface GetIndexerLeaderboardRegistrationsParams {\n subaccount: Subaccount;\n /** Filter by contest IDs. Omit to return all. */\n contestIds?: number[];\n /** Filter by contest active status. `true` = active only, `false` = inactive only, omit for all. */\n active?: boolean;\n}\n\nexport interface RegisterLeaderboardParams extends Subaccount, SignatureParams {\n contestIds: number[];\n /** In millis, defaults to 90s in the future. */\n recvTime?: BigNumber;\n}\n\nexport interface IndexerLeaderboardRegistration {\n subaccount: Subaccount;\n contestId: number;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport interface GetIndexerLeaderboardRegistrationsResponse {\n registrations: IndexerLeaderboardRegistration[];\n}\n\nexport type RegisterLeaderboardResponse =\n GetIndexerLeaderboardRegistrationsResponse;\n\nexport interface GetIndexerLeaderboardContestsParams {\n /** Filter by contest IDs. Omit to return all. */\n contestIds?: number[];\n /** Filter by contest active status. `true` = active only, `false` = inactive only, omit for all. */\n active?: boolean;\n}\n\nexport interface IndexerLeaderboardContestTrack {\n trackId: number;\n rankType: IndexerLeaderboardRankType;\n sortOrder: 'ASC' | 'DESC';\n // Float indicating the min account value required to qualify for this track e.g: 250.0\n minRequiredAccountValue: BigNumber;\n}\n\nexport interface IndexerLeaderboardContest {\n contestId: number;\n // Start time in seconds\n startTime: BigNumber;\n // End time in seconds\n endTime: BigNumber;\n // Last updated time in seconds\n lastUpdated: BigNumber;\n totalParticipants: BigNumber;\n // For market-specific contests, only the volume from these products will be counted.\n requiredProductIds: number[];\n active: boolean;\n title: string;\n description: string;\n tracks: IndexerLeaderboardContestTrack[];\n}\n\nexport interface GetIndexerLeaderboardContestsResponse {\n contests: IndexerLeaderboardContest[];\n}\n\n/**\n * Social Accounts\n */\n\nexport interface ConnectSocialAccountParams\n extends Subaccount, SignatureParams {\n provider: 'twitter';\n /** In millis, defaults to 90s in the future. */\n recvTime?: BigNumber;\n}\n\nexport interface ConnectSocialAccountResponse {\n url: string;\n}\n\nexport interface ListIndexerSocialAccountsParams {\n address: Address;\n}\n\nexport interface ListIndexerSocialAccountsResponse {\n accounts: IndexerSocialAccountInfo[];\n}\n\nexport type RevokeSocialAccountParams = ConnectSocialAccountParams;\nexport type RevokeSocialAccountResponse = ListIndexerSocialAccountsResponse;\n\nexport type GetIndexerFastWithdrawalSignatureParams =\n IndexerServerFastWithdrawalSignatureParams;\n\nexport interface GetIndexerFastWithdrawalSignatureResponse {\n idx: bigint;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n txBytes: Hex;\n signatures: Hex[];\n}\n\n/**\n * NLP\n */\n\nexport type GetIndexerNlpSnapshotsParams = IndexerSnapshotsIntervalParams;\n\nexport interface IndexerNlpSnapshot {\n submissionIndex: string;\n timestamp: BigNumber;\n // Total volume traded by the NLP, in terms of the primary quote\n cumulativeVolume: BigNumber;\n cumulativeTrades: BigNumber;\n cumulativeMintAmountQuote: BigNumber;\n cumulativeBurnAmountQuote: BigNumber;\n cumulativePnl: BigNumber;\n tvl: BigNumber;\n oraclePrice: BigNumber;\n depositors: BigNumber;\n}\n\nexport interface GetIndexerNlpSnapshotsResponse {\n snapshots: IndexerNlpSnapshot[];\n}\n\nexport interface GetIndexerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n totalTxs: BigNumber;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n totalSubmissions: BigNumber;\n // Number of unprocessed transactions (totalTxs - totalSubmissions)\n backlogSize: BigNumber;\n // UNIX timestamp (in seconds) of when the data was last updated\n updatedAt: BigNumber;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlogEtaInSeconds: BigNumber | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txsPerSecond: BigNumber | null;\n}\n\nexport interface GetIndexerSubaccountDDAParams {\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerSubaccountDDAResponse {\n address: Address;\n}\n\n/**\n * Private Alpha Choice\n */\n\nexport interface GetIndexerPrivateAlphaChoiceParams {\n address: Address;\n}\n\nexport interface GetIndexerPrivateAlphaChoiceResponse {\n points: BigNumber;\n feeRefund: BigNumber;\n nftEligibility: boolean;\n}\n\n/**\n * Nado Points\n */\n\nexport interface GetIndexerPointsParams {\n address: Address;\n}\n\nexport interface IndexerPointsEpoch {\n epoch: number;\n description: string;\n /** Unix timestamp in seconds */\n startTime: BigNumber;\n /** Unix timestamp in seconds */\n endTime: BigNumber;\n totalPoints: BigNumber;\n points: BigNumber;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerAllTimePoints {\n points: BigNumber;\n rank: number;\n tier: number;\n}\n\nexport interface GetIndexerPointsResponse {\n pointsPerEpoch: IndexerPointsEpoch[];\n allTimePoints: IndexerAllTimePoints;\n}\n\n/**\n * V2 Tickers\n */\n\n/**\n * Market type for ticker filtering\n */\nexport type TickerMarketType = 'spot' | 'perp';\n\n/**\n * Parameters for querying v2 tickers endpoint\n */\nexport interface GetIndexerV2TickersParams {\n /**\n * Filter tickers by market type (spot or perp)\n * @example 'spot'\n * @example 'perp'\n */\n market?: TickerMarketType;\n /**\n * Whether to include edge products\n * @default false\n */\n edge?: boolean;\n}\n\n/**\n * Individual ticker data from v2 endpoint\n */\nexport interface IndexerV2TickerResponse {\n /** Unique product identifier */\n productId: number;\n /** Unique ticker identifier */\n tickerId: string;\n /** Base currency symbol */\n baseCurrency: string;\n /** Quote currency symbol */\n quoteCurrency: string;\n /** Last traded price */\n lastPrice: number;\n /** 24h trading volume in base currency */\n baseVolume: number;\n /** 24h trading volume in quote currency */\n quoteVolume: number;\n /** 24h price change percentage */\n priceChangePercent24h: number;\n}\n\n/**\n * Response from v2 tickers endpoint\n * Maps ticker IDs to their respective ticker data\n */\nexport type GetIndexerV2TickersResponse = Record<\n string,\n IndexerV2TickerResponse\n>;\n\n/**\n * Parameters for querying v2 symbols endpoint\n */\nexport interface GetIndexerV2SymbolsParams {\n /**\n * Filter by product type\n * @example 'spot'\n * @example 'perp'\n */\n productType?: 'spot' | 'perp';\n /**\n * Comma-separated list of product IDs to filter by\n * @example '2,4,42'\n */\n productIds?: string;\n}\n\n/**\n * Market hours information for a product\n */\nexport interface IndexerV2MarketHours {\n /** Whether the market is currently in its regular trading session */\n isOpen: boolean;\n /** Why the market is closed: \"weekend\" or \"holiday\". Null when open. */\n reason: string | null;\n /** ISO 8601 UTC timestamp of the next session close. Null when closed. */\n nextClose: string | null;\n /** ISO 8601 UTC timestamp of the next session open. Null when no upcoming open. */\n nextOpen: string | null;\n}\n\nexport type IndexerV2TradingStatus =\n // Normal trading, all order types accepted\n | 'live'\n // Only post-only orders accepted (taker orders rejected)\n | 'post_only'\n // Only reduce-only orders accepted; used when a market is being delisted\n | 'reduce_only'\n // No new positions can be opened; only orders that reduce existing positions are accepted. Used during periods of low activity (e.g. weekends, holidays)\n | 'soft_reduce_only'\n // No orders accepted\n | 'not_tradable';\n\n/**\n * Individual symbol data from v2 endpoint\n */\nexport interface IndexerV2Symbol {\n /** Product type: \"spot\" or \"perp\" */\n type: string;\n /** Unique product identifier */\n productId: number;\n /** Trading symbol (e.g., \"BTC-PERP\", \"WETH\") */\n symbol: string;\n /** Minimum price increment */\n priceIncrement: BigNumber;\n /** Minimum order size increment (base denominated) */\n sizeIncrement: string;\n /** Minimum order size (USDT0 denominated) */\n minSize: string;\n /** Default maker fee rate (negative = rebate) */\n makerFeeRate: BigNumber;\n /** Default taker fee rate */\n takerFeeRate: BigNumber;\n /** Initial margin weight for long positions */\n longWeightInitial: BigNumber;\n /** Maintenance margin weight for long positions */\n longWeightMaintenance: BigNumber;\n /** Maximum open interest cap. Null if uncapped. */\n maxOpenInterest: BigNumber | null;\n /**\n * Exchange rate for xStocks. Null if not applicable.\n */\n exchangeRate: BigNumber | null;\n /** Current trading status */\n tradingStatus: IndexerV2TradingStatus;\n /** Whether the market only accepts isolated margin orders */\n isolatedOnly: boolean;\n /** Market hours information. Null for 24/7 markets. */\n marketHours: IndexerV2MarketHours | null;\n}\n\n/**\n * Response from v2 symbols endpoint\n * Maps symbols to their respective data\n */\nexport type GetIndexerV2SymbolsResponse = Record<string, IndexerV2Symbol>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/clientTypes.ts"],"sourcesContent":["import {\n EIP712OrderValues,\n Market,\n OrderAppendix,\n PerpBalance,\n PerpMarket,\n ProductEngineType,\n SpotBalance,\n SpotMarket,\n Subaccount,\n} from '@nadohq/shared';\nimport BigNumber from 'bignumber.js';\nimport { Address, Hex } from 'viem';\nimport { CandlestickPeriod } from './CandlestickPeriod';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoTx, NadoWithdrawCollateralTx } from './NadoTx';\nimport {\n IndexerServerFastWithdrawalSignatureParams,\n IndexerServerListSubaccountsParams,\n IndexerServerTriggerTypeFilter,\n} from './serverTypes';\n\n/**\n * Base types\n */\n\nexport type IndexerSpotBalance = Omit<SpotBalance, 'healthContributions'>;\n\nexport type IndexerPerpBalance = Omit<PerpBalance, 'healthContributions'>;\n\nexport interface IndexerEventSpotStateSnapshot {\n type: ProductEngineType.SPOT;\n preBalance: IndexerSpotBalance;\n postBalance: IndexerSpotBalance;\n market: SpotMarket;\n}\n\nexport interface IndexerEventPerpStateSnapshot {\n type: ProductEngineType.PERP;\n preBalance: IndexerPerpBalance;\n postBalance: IndexerPerpBalance;\n market: PerpMarket;\n}\n\nexport type IndexerEventBalanceStateSnapshot =\n | IndexerEventSpotStateSnapshot\n | IndexerEventPerpStateSnapshot;\n\nexport interface IndexerBalanceTrackedVars {\n netInterestUnrealized: BigNumber;\n netInterestCumulative: BigNumber;\n netFundingUnrealized: BigNumber;\n netFundingCumulative: BigNumber;\n netEntryUnrealized: BigNumber;\n netEntryCumulative: BigNumber;\n quoteVolumeCumulative: BigNumber;\n}\n\nexport interface IndexerEvent<\n TStateType extends IndexerEventBalanceStateSnapshot =\n IndexerEventBalanceStateSnapshot,\n> {\n subaccount: string;\n isolated: boolean;\n // The product ID associated with the isolated perp market. This is only used when productId === QUOTE_PRODUCT_ID and isolated === true\n isolatedProductId: number | null;\n productId: number;\n submissionIndex: string;\n eventType: IndexerEventType;\n state: TStateType;\n trackedVars: IndexerBalanceTrackedVars;\n}\n\nexport interface IndexerEventWithTx<\n TStateType extends IndexerEventBalanceStateSnapshot =\n IndexerEventBalanceStateSnapshot,\n> extends IndexerEvent<TStateType> {\n timestamp: BigNumber;\n tx: NadoTx;\n}\n\n/**\n * List subaccounts\n */\n\nexport type ListIndexerSubaccountsParams = IndexerServerListSubaccountsParams;\n\nexport type ListIndexerSubaccountsResponse = ({\n hexId: string;\n // Unix timestamp in seconds\n createdAt: number;\n isolated: boolean;\n} & Subaccount)[];\n\n/**\n * Subaccount snapshots\n */\n\nexport interface GetIndexerMultiSubaccountSnapshotsParams {\n subaccounts: Subaccount[];\n // A series of timestamps for which to return a summary of each subaccount\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport type IndexerSnapshotBalance<\n TStateType extends IndexerEventBalanceStateSnapshot =\n IndexerEventBalanceStateSnapshot,\n> = IndexerEvent<TStateType>;\n\nexport interface IndexerSubaccountSnapshot {\n timestamp: BigNumber;\n balances: IndexerSnapshotBalance[];\n}\n\nexport interface GetIndexerMultiSubaccountSnapshotsResponse {\n // Utility for retrieving a subaccount's hex ID, in the same order as the request params\n subaccountHexIds: string[];\n // Map of subaccount hex -> timestamp requested -> summary for that time\n snapshots: Record<string, Record<string, IndexerSubaccountSnapshot>>;\n}\n\n/**\n * Perp prices\n */\n\nexport interface GetIndexerPerpPricesParams {\n productId: number;\n}\n\nexport interface IndexerPerpPrices {\n productId: number;\n indexPrice: BigNumber;\n markPrice: BigNumber;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport type GetIndexerPerpPricesResponse = IndexerPerpPrices;\n\nexport interface GetIndexerMultiProductPerpPricesParams {\n productIds: number[];\n}\n\n// Map of productId -> IndexerPerpPrices\nexport type GetIndexerMultiProductPerpPricesResponse = Record<\n number,\n IndexerPerpPrices\n>;\n\n/**\n * Oracle prices\n */\n\nexport interface GetIndexerOraclePricesParams {\n productIds: number[];\n}\n\nexport interface IndexerOraclePrice {\n productId: number;\n oraclePrice: BigNumber;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport type GetIndexerOraclePricesResponse = IndexerOraclePrice[];\n\n/**\n * Funding rates\n */\n\nexport interface GetIndexerFundingRateParams {\n productId: number;\n}\n\nexport interface IndexerFundingRate {\n productId: number;\n fundingRate: BigNumber;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport type GetIndexerFundingRateResponse = IndexerFundingRate;\n\nexport interface GetIndexerMultiProductFundingRatesParams {\n productIds: number[];\n}\n\n// Map of productId -> IndexerFundingRate\nexport type GetIndexerMultiProductFundingRatesResponse = Record<\n number,\n IndexerFundingRate\n>;\n\n/**\n * Candlesticks\n */\n\nexport interface GetIndexerCandlesticksParams {\n productId: number;\n period: CandlestickPeriod;\n // Seconds\n maxTimeInclusive?: number;\n limit: number;\n}\n\n// Semi-Tradingview compatible bars\nexport interface Candlestick {\n // In SECONDS, for TV compat, this needs to be in millis\n time: BigNumber;\n open: BigNumber;\n high: BigNumber;\n low: BigNumber;\n close: BigNumber;\n volume: BigNumber;\n}\n\nexport type GetIndexerCandlesticksResponse = Candlestick[];\n\nexport type GetIndexerEdgeCandlesticksResponse = GetIndexerCandlesticksResponse;\n\nexport type GetIndexerEdgeCandlesticksParams = GetIndexerCandlesticksParams;\n\n/**\n * Product snapshots\n */\n\nexport interface GetIndexerProductSnapshotsParams {\n // Max submission index, inclusive\n startCursor?: string;\n productId: number;\n maxTimestampInclusive?: number;\n limit: number;\n}\n\nexport interface IndexerProductSnapshot extends Market {\n submissionIndex: string;\n}\n\nexport type GetIndexerProductSnapshotsResponse = IndexerProductSnapshot[];\n\nexport interface GetIndexerMultiProductSnapshotsParams {\n productIds: number[];\n maxTimestampInclusive?: number[];\n}\n\n// Map of timestamp -> (productId -> IndexerProductSnapshot)\nexport type GetIndexerMultiProductSnapshotsResponse = Record<\n string,\n Record<number, IndexerProductSnapshot>\n>;\n\nexport interface IndexerSnapshotsIntervalParams {\n /** Currently accepts all integers, in seconds */\n granularity: number;\n /**\n * Optional upper bound for snapshot timestamps (in seconds).\n * Without this, snapshots will default to align with last UTC midnight,\n * which can make \"Last 24h\" metrics inaccurate.\n */\n maxTimeInclusive?: number;\n limit: number;\n}\n\n/**\n * Market snapshots\n */\n\nexport interface GetIndexerMarketSnapshotsParams extends IndexerSnapshotsIntervalParams {\n // Defaults to all\n productIds?: number[];\n}\n\nexport interface IndexerMarketSnapshot {\n timestamp: BigNumber;\n cumulativeUsers: BigNumber;\n dailyActiveUsers: BigNumber;\n tvl: BigNumber;\n cumulativeVolumes: Record<number, BigNumber>;\n cumulativeTakerFees: Record<number, BigNumber>;\n cumulativeSequencerFees: Record<number, BigNumber>;\n cumulativeMakerFees: Record<number, BigNumber>;\n cumulativeTrades: Record<number, BigNumber>;\n cumulativeLiquidationAmounts: Record<number, BigNumber>;\n openInterestsQuote: Record<number, BigNumber>;\n totalDeposits: Record<number, BigNumber>;\n totalBorrows: Record<number, BigNumber>;\n fundingRates: Record<number, BigNumber>;\n depositRates: Record<number, BigNumber>;\n borrowRates: Record<number, BigNumber>;\n cumulativeTradeSizes: Record<number, BigNumber>;\n cumulativeInflows: Record<number, BigNumber>;\n cumulativeOutflows: Record<number, BigNumber>;\n oraclePrices: Record<number, BigNumber>;\n}\n\nexport type GetIndexerMarketSnapshotsResponse = IndexerMarketSnapshot[];\n\nexport type GetIndexerEdgeMarketSnapshotsParams =\n IndexerSnapshotsIntervalParams;\n\n// Map of chain id -> IndexerMarketSnapshot[]\nexport type GetIndexerEdgeMarketSnapshotResponse = Record<\n number,\n IndexerMarketSnapshot[]\n>;\n\n/**\n * Events\n */\n\n// There can be multiple events per tx, this allows a limit depending on usecase\nexport type GetIndexerEventsLimitType = 'events' | 'txs';\n\nexport interface GetIndexerEventsParams {\n // Max submission index, inclusive\n startCursor?: string;\n subaccounts?: Subaccount[];\n productIds?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n eventTypes?: IndexerEventType[];\n maxTimestampInclusive?: number;\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n limit?: {\n type: GetIndexerEventsLimitType;\n value: number;\n };\n}\n\nexport type GetIndexerEventsResponse = IndexerEventWithTx[];\n\n/**\n * Historical orders\n */\n\nexport interface GetIndexerOrdersParams {\n // Max submission index, inclusive\n startCursor?: string;\n subaccounts?: Subaccount[];\n minTimestampInclusive?: number;\n maxTimestampInclusive?: number;\n limit?: number;\n productIds?: number[];\n triggerTypes?: IndexerServerTriggerTypeFilter[];\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n digests?: string[];\n}\n\nexport interface IndexerOrder {\n digest: string;\n subaccount: string;\n productId: number;\n submissionIndex: string;\n lastFillSubmissionIndex: string;\n amount: BigNumber;\n price: BigNumber;\n expiration: number;\n // Order metadata from appendix\n appendix: OrderAppendix;\n nonce: BigNumber;\n isolated: boolean;\n // Derived from the nonce\n recvTimeSeconds: number;\n // Fill amounts\n baseFilled: BigNumber;\n // Includes fee\n quoteFilled: BigNumber;\n // Includes sequencer fee\n totalFee: BigNumber;\n builderFee: BigNumber;\n realizedPnl: BigNumber;\n // Signed closed amount (positive for longs, negative for shorts)\n closedAmount: BigNumber;\n // Cumulative realized entry price for the closed amount on an order\n closedNetEntry: BigNumber;\n // Total isolated margin on the position before the close. Only present for isolated margin orders; null for cross-margin orders\n preCloseMargin: BigNumber | null;\n // Unix timestamp (seconds) of the first fill on the order\n firstFillTimestamp: BigNumber;\n // Unix timestamp (seconds) of the last fill on the order\n lastFillTimestamp: BigNumber;\n /** Balances before the order was filled */\n preBalances: IndexerMatchEventBalances;\n /** Balances after the order was filled */\n postBalances: IndexerMatchEventBalances;\n}\n\nexport type GetIndexerOrdersResponse = IndexerOrder[];\n\n/**\n * Match events\n */\n\nexport interface GetIndexerMatchEventsParams {\n // When not given, will return all maker events\n subaccounts?: Subaccount[];\n productIds?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n maxTimestampInclusive?: number;\n limit: number;\n // Max submission index, inclusive\n startCursor?: string;\n}\n\n// There are 2 balance states per match event if the match is in a spot market, but only one if the match is in a perp market\nexport interface IndexerMatchEventBalances {\n base: IndexerSpotBalance | IndexerPerpBalance;\n quote?: IndexerSpotBalance;\n}\n\nexport interface IndexerMatchEvent extends Subaccount {\n productId: number;\n digest: string;\n isolated: boolean;\n order: EIP712OrderValues;\n baseFilled: BigNumber;\n quoteFilled: BigNumber;\n // Includes sequencer fee\n totalFee: BigNumber;\n sequencerFee: BigNumber;\n builderFee: BigNumber;\n cumulativeBaseFilled: BigNumber;\n cumulativeQuoteFilled: BigNumber;\n cumulativeFee: BigNumber;\n submissionIndex: string;\n timestamp: BigNumber;\n isTaker: boolean;\n // Tracked vars for the balance BEFORE this match event occurred\n preEventTrackedVars: Pick<\n IndexerBalanceTrackedVars,\n 'netEntryCumulative' | 'netEntryUnrealized'\n >;\n preBalances: IndexerMatchEventBalances;\n postBalances: IndexerMatchEventBalances;\n tx: NadoTx;\n realizedPnl: BigNumber;\n // Signed closed amount (positive for longs, negative for shorts)\n closedAmount: BigNumber;\n // Realized entry price for the closed amount on this match (x18). Represents the total quote value at which the closed portion of the position was originally entered.\n closedNetEntry: BigNumber;\n // Margin allocated to the closed amount on this match (x18). Only present for isolated margin orders; null for cross-margin orders.\n margin: BigNumber | null;\n}\n\nexport type GetIndexerMatchEventsResponse = IndexerMatchEvent[];\n\n/**\n * Quote price\n */\n\nexport interface GetIndexerQuotePriceResponse {\n price: BigNumber;\n}\n\n/**\n * Linked Signer\n */\n\nexport interface GetIndexerLinkedSignerParams {\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerLinkedSignerResponse {\n totalTxLimit: BigNumber;\n remainingTxs: BigNumber;\n // If remainingTxs is 0, this is the time until the next link signer tx can be sent\n waitTimeUntilNextTx: BigNumber;\n // If zero address, none is configured\n signer: string;\n}\n\n/**\n * Interest / funding payments\n */\n\nexport interface GetIndexerInterestFundingPaymentsParams {\n subaccount: Subaccount;\n productIds: number[];\n maxTimestampInclusive?: number;\n limit: number;\n // Max submission index, inclusive\n startCursor?: string;\n}\n\nexport interface IndexerProductPayment {\n productId: number;\n submissionIndex: string;\n timestamp: BigNumber;\n paymentAmount: BigNumber;\n // For spots: previous spot balance at the moment of payment (exclusive of `paymentAmount`).\n // For perps: previous perp balance at the moment of payment + amount of perps locked in LPs (exclusive of `paymentAmount`).\n balanceAmount: BigNumber;\n // Represents the annually interest rate for spots and annually funding rate for perps.\n annualPaymentRate: BigNumber;\n oraclePrice: BigNumber;\n isolated: boolean;\n // The product ID associated with the isolated perp market. This is only used when product_id === QUOTE_PRODUCT_ID and isolated === true\n isolatedProductId: number | null;\n}\n\nexport interface GetIndexerInterestFundingPaymentsResponse {\n interestPayments: IndexerProductPayment[];\n fundingPayments: IndexerProductPayment[];\n nextCursor: string | null;\n}\n\n/**\n * Referral code\n */\n\nexport interface GetIndexerReferralCodeParams {\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerReferralCodeResponse {\n referralCode: string | null;\n}\n\n/**\n * Maker stats\n */\n\nexport interface GetIndexerMakerStatisticsParams {\n productId: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerMakerSnapshot {\n timestamp: BigNumber;\n makerFee: BigNumber;\n uptime: BigNumber;\n sumQMin: BigNumber;\n qScore: BigNumber;\n makerShare: BigNumber;\n expectedMakerReward: BigNumber;\n}\n\nexport interface IndexerMaker {\n address: string;\n snapshots: IndexerMakerSnapshot[];\n}\n\nexport interface GetIndexerMakerStatisticsResponse {\n rewardCoefficient: BigNumber;\n makers: IndexerMaker[];\n}\n\n/**\n * Leaderboards\n */\n\nexport interface GetIndexerLeaderboardParams {\n contestId: number;\n /**\n * The ranking metric to query by.\n * Optional for single-track contests (auto-selects the only track).\n * Required for multi-track contests — omitting it returns an error.\n */\n rankType?: IndexerLeaderboardRankType;\n // Min rank inclusive\n startCursor?: string;\n limit?: number;\n /** Sort order. Defaults to `'DESC'`. */\n order?: 'ASC' | 'DESC';\n}\n\nexport interface IndexerSocialAccountInfo {\n provider: 'twitter';\n username: string;\n displayName: string;\n profileImageUrl: string;\n}\n\nexport interface IndexerLeaderboardTrackPosition {\n value: BigNumber;\n rank: BigNumber;\n qualificationStatus: 'qualified' | 'insufficient_account_value';\n}\n\nexport interface IndexerLeaderboardParticipant {\n subaccount: Subaccount;\n contestId: number;\n // Float indicating the ending account value at the time the snapshot was taken i.e: at updateTime\n accountValue: BigNumber;\n // Seconds\n updateTime: BigNumber;\n tracks: Partial<\n Record<IndexerLeaderboardRankType, IndexerLeaderboardTrackPosition>\n >;\n socialAccounts: IndexerSocialAccountInfo[];\n}\n\nexport interface GetIndexerLeaderboardResponse {\n participants: IndexerLeaderboardParticipant[];\n}\n\nexport interface GetIndexerLeaderboardParticipantParams {\n contestIds: number[];\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerLeaderboardParticipantResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerLeaderboardParticipant\n participant: Record<string, IndexerLeaderboardParticipant>;\n}\n\ninterface SignatureParams {\n verifyingAddr: string;\n chainId: number;\n}\n\nexport interface GetIndexerLeaderboardRegistrationsParams {\n subaccount: Subaccount;\n /** Filter by contest IDs. Omit to return all. */\n contestIds?: number[];\n /** Filter by contest active status. `true` = active only, `false` = inactive only, omit for all. */\n active?: boolean;\n}\n\nexport interface RegisterLeaderboardParams extends Subaccount, SignatureParams {\n contestIds: number[];\n /** In millis, defaults to 90s in the future. */\n recvTime?: BigNumber;\n}\n\nexport interface IndexerLeaderboardRegistration {\n subaccount: Subaccount;\n contestId: number;\n // Seconds\n updateTime: BigNumber;\n}\n\nexport interface GetIndexerLeaderboardRegistrationsResponse {\n registrations: IndexerLeaderboardRegistration[];\n}\n\nexport type RegisterLeaderboardResponse =\n GetIndexerLeaderboardRegistrationsResponse;\n\nexport interface GetIndexerLeaderboardContestsParams {\n /** Filter by contest IDs. Omit to return all. */\n contestIds?: number[];\n /** Filter by contest active status. `true` = active only, `false` = inactive only, omit for all. */\n active?: boolean;\n}\n\nexport interface IndexerLeaderboardContestTrack {\n trackId: number;\n rankType: IndexerLeaderboardRankType;\n sortOrder: 'ASC' | 'DESC';\n // Float indicating the min account value required to qualify for this track e.g: 250.0\n minRequiredAccountValue: BigNumber;\n}\n\nexport interface IndexerLeaderboardContest {\n contestId: number;\n // Start time in seconds\n startTime: BigNumber;\n // End time in seconds\n endTime: BigNumber;\n // Last updated time in seconds\n lastUpdated: BigNumber;\n totalParticipants: BigNumber;\n // For market-specific contests, only the volume from these products will be counted.\n requiredProductIds: number[];\n active: boolean;\n title: string;\n description: string;\n tracks: IndexerLeaderboardContestTrack[];\n}\n\nexport interface GetIndexerLeaderboardContestsResponse {\n contests: IndexerLeaderboardContest[];\n}\n\n/**\n * Social Accounts\n */\n\nexport interface ConnectSocialAccountParams\n extends Subaccount, SignatureParams {\n provider: 'twitter';\n /** In millis, defaults to 90s in the future. */\n recvTime?: BigNumber;\n}\n\nexport interface ConnectSocialAccountResponse {\n url: string;\n}\n\nexport interface ListIndexerSocialAccountsParams {\n address: Address;\n}\n\nexport interface ListIndexerSocialAccountsResponse {\n accounts: IndexerSocialAccountInfo[];\n}\n\nexport type RevokeSocialAccountParams = ConnectSocialAccountParams;\nexport type RevokeSocialAccountResponse = ListIndexerSocialAccountsResponse;\n\nexport type GetIndexerFastWithdrawalSignatureParams =\n IndexerServerFastWithdrawalSignatureParams;\n\nexport interface GetIndexerFastWithdrawalSignatureResponse {\n idx: bigint;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n txBytes: Hex;\n signatures: Hex[];\n}\n\n/**\n * NLP\n */\n\nexport type GetIndexerNlpSnapshotsParams = IndexerSnapshotsIntervalParams;\n\nexport interface IndexerNlpSnapshot {\n submissionIndex: string;\n timestamp: BigNumber;\n // Total volume traded by the NLP, in terms of the primary quote\n cumulativeVolume: BigNumber;\n cumulativeTrades: BigNumber;\n cumulativeMintAmountQuote: BigNumber;\n cumulativeBurnAmountQuote: BigNumber;\n cumulativePnl: BigNumber;\n tvl: BigNumber;\n oraclePrice: BigNumber;\n depositors: BigNumber;\n}\n\nexport interface GetIndexerNlpSnapshotsResponse {\n snapshots: IndexerNlpSnapshot[];\n}\n\nexport interface GetIndexerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n totalTxs: BigNumber;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n totalSubmissions: BigNumber;\n // Number of unprocessed transactions (totalTxs - totalSubmissions)\n backlogSize: BigNumber;\n // UNIX timestamp (in seconds) of when the data was last updated\n updatedAt: BigNumber;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlogEtaInSeconds: BigNumber | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txsPerSecond: BigNumber | null;\n}\n\nexport interface GetIndexerSubaccountDDAParams {\n subaccount: Subaccount;\n}\n\nexport interface GetIndexerSubaccountDDAResponse {\n address: Address;\n}\n\n/**\n * Private Alpha Choice\n */\n\nexport interface GetIndexerPrivateAlphaChoiceParams {\n address: Address;\n}\n\nexport interface GetIndexerPrivateAlphaChoiceResponse {\n points: BigNumber;\n feeRefund: BigNumber;\n nftEligibility: boolean;\n}\n\n/**\n * Nado Points\n */\n\nexport interface GetIndexerPointsParams {\n address: Address;\n}\n\nexport interface IndexerPointsEpoch {\n epoch: number;\n description: string;\n /** Unix timestamp in seconds */\n startTime: BigNumber;\n /** Unix timestamp in seconds */\n endTime: BigNumber;\n totalPoints: BigNumber;\n points: BigNumber;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerAllTimePoints {\n points: BigNumber;\n rank: number;\n tier: number;\n}\n\nexport interface GetIndexerPointsResponse {\n pointsPerEpoch: IndexerPointsEpoch[];\n allTimePoints: IndexerAllTimePoints;\n}\n\n/**\n * V2 Tickers\n */\n\n/**\n * Market type for ticker filtering\n */\nexport type TickerMarketType = 'spot' | 'perp';\n\n/**\n * Parameters for querying v2 tickers endpoint\n */\nexport interface GetIndexerV2TickersParams {\n /**\n * Filter tickers by market type (spot or perp)\n * @example 'spot'\n * @example 'perp'\n */\n market?: TickerMarketType;\n /**\n * Whether to include edge products\n * @default false\n */\n edge?: boolean;\n}\n\n/**\n * Individual ticker data from v2 endpoint\n */\nexport interface IndexerV2TickerResponse {\n /** Unique product identifier */\n productId: number;\n /** Unique ticker identifier */\n tickerId: string;\n /** Base currency symbol */\n baseCurrency: string;\n /** Quote currency symbol */\n quoteCurrency: string;\n /** Last traded price */\n lastPrice: number;\n /** 24h trading volume in base currency */\n baseVolume: number;\n /** 24h trading volume in quote currency */\n quoteVolume: number;\n /** 24h price change percentage */\n priceChangePercent24h: number;\n}\n\n/**\n * Response from v2 tickers endpoint\n * Maps ticker IDs to their respective ticker data\n */\nexport type GetIndexerV2TickersResponse = Record<\n string,\n IndexerV2TickerResponse\n>;\n\n/**\n * Parameters for querying v2 symbols endpoint\n */\nexport interface GetIndexerV2SymbolsParams {\n /**\n * Filter by product type\n * @example 'spot'\n * @example 'perp'\n */\n productType?: 'spot' | 'perp';\n /**\n * Comma-separated list of product IDs to filter by\n * @example '2,4,42'\n */\n productIds?: string;\n}\n\n/**\n * Market hours information for a product\n */\nexport interface IndexerV2MarketHours {\n /** Whether the market is currently in its regular trading session */\n isOpen: boolean;\n /** Why the market is closed: \"weekend\" or \"holiday\". Null when open. */\n reason: string | null;\n /** ISO 8601 UTC timestamp of the next session close. Null when closed. */\n nextClose: string | null;\n /** ISO 8601 UTC timestamp of the next session open. Null when no upcoming open. */\n nextOpen: string | null;\n}\n\nexport type IndexerV2TradingStatus =\n // Normal trading, all order types accepted\n | 'live'\n // Only post-only orders accepted (taker orders rejected)\n | 'post_only'\n // Only reduce-only orders accepted; used when a market is being delisted\n | 'reduce_only'\n // No new positions can be opened; only orders that reduce existing positions are accepted. Used during periods of low activity (e.g. weekends, holidays)\n | 'soft_reduce_only'\n // No orders accepted\n | 'not_tradable';\n\n/**\n * Individual symbol data from v2 endpoint\n */\nexport interface IndexerV2Symbol {\n /** Product type: \"spot\" or \"perp\" */\n type: string;\n /** Unique product identifier */\n productId: number;\n /** Trading symbol (e.g., \"BTC-PERP\", \"WETH\") */\n symbol: string;\n /** Minimum price increment */\n priceIncrement: BigNumber;\n /** Minimum order size increment (base denominated) */\n sizeIncrement: string;\n /** Minimum order size (USDT0 denominated) */\n minSize: string;\n /** Default maker fee rate (negative = rebate) */\n makerFeeRate: BigNumber;\n /** Default taker fee rate */\n takerFeeRate: BigNumber;\n /** Initial margin weight for long positions */\n longWeightInitial: BigNumber;\n /** Maintenance margin weight for long positions */\n longWeightMaintenance: BigNumber;\n /** Maximum open interest cap. Null if uncapped. */\n maxOpenInterest: BigNumber | null;\n /**\n * Exchange rate for xStocks. Null if not applicable.\n */\n exchangeRate: BigNumber | null;\n /** Current trading status */\n tradingStatus: IndexerV2TradingStatus;\n /** Whether the market only accepts isolated margin orders */\n isolatedOnly: boolean;\n /** Market hours information. Null for 24/7 markets. */\n marketHours: IndexerV2MarketHours | null;\n /**\n * Boost tier for products with rewards boosts. Null for non-boosted products.\n * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x\n */\n boostType: number | null;\n /** Taker rewards multiplier. Null for non-boosted products. */\n takerMultiplier: number | null;\n /** Maker rewards multiplier. Null for non-boosted products. */\n makerMultiplier: number | null;\n}\n\n/**\n * Response from v2 symbols endpoint\n * Maps symbols to their respective data\n */\nexport type GetIndexerV2SymbolsResponse = Record<string, IndexerV2Symbol>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -690,6 +690,15 @@ interface IndexerV2Symbol {
690
690
  isolatedOnly: boolean;
691
691
  /** Market hours information. Null for 24/7 markets. */
692
692
  marketHours: IndexerV2MarketHours | null;
693
+ /**
694
+ * Boost tier for products with rewards boosts. Null for non-boosted products.
695
+ * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x
696
+ */
697
+ boostType: number | null;
698
+ /** Taker rewards multiplier. Null for non-boosted products. */
699
+ takerMultiplier: number | null;
700
+ /** Maker rewards multiplier. Null for non-boosted products. */
701
+ makerMultiplier: number | null;
693
702
  }
694
703
  /**
695
704
  * Response from v2 symbols endpoint
@@ -690,6 +690,15 @@ interface IndexerV2Symbol {
690
690
  isolatedOnly: boolean;
691
691
  /** Market hours information. Null for 24/7 markets. */
692
692
  marketHours: IndexerV2MarketHours | null;
693
+ /**
694
+ * Boost tier for products with rewards boosts. Null for non-boosted products.
695
+ * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x
696
+ */
697
+ boostType: number | null;
698
+ /** Taker rewards multiplier. Null for non-boosted products. */
699
+ takerMultiplier: number | null;
700
+ /** Maker rewards multiplier. Null for non-boosted products. */
701
+ makerMultiplier: number | null;
693
702
  }
694
703
  /**
695
704
  * Response from v2 symbols endpoint
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/serverTypes.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationValues,\n EIP712SocialAuthenticationValues,\n SignedTx,\n} from '@nadohq/shared';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoWithdrawCollateralTx } from './NadoTx';\nimport {\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMarketSnapshotInterval,\n IndexerServerMatchEvent,\n IndexerServerNlpSnapshot,\n IndexerServerOraclePrice,\n IndexerServerOrder,\n IndexerServerProductPayment,\n IndexerServerProductSnapshot,\n IndexerServerSnapshotsInterval,\n IndexerServerSocialAccount,\n IndexerServerTx,\n} from './serverModelTypes';\n\n/**\n * Params\n */\n\nexport interface IndexerServerListSubaccountsParams {\n // Inclusive, defaults to 0\n start?: number;\n // Defaults to 100\n limit?: number;\n address?: string;\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsParams {\n // Subaccount hex identifiers\n subaccounts: string[];\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport interface IndexerServerReferralCodeParams {\n subaccount: string;\n}\n\nexport interface IndexerServerFundingRateParams {\n product_id: number;\n}\n\nexport interface IndexerServerFundingRatesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerPriceParams {\n product_id: number;\n}\n\nexport interface IndexerServerPerpPricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerOraclePricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerCandlesticksParams {\n product_id: number;\n granularity: number;\n // Seconds\n max_time?: number;\n limit: number;\n}\n\nexport type IndexerEdgeServerCandlesticksParams =\n IndexerServerCandlesticksParams;\n\nexport interface IndexerServerProductsParams {\n product_id: number;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMultiProductsParams {\n product_ids: number[];\n max_time: number[];\n}\n\nexport interface IndexerServerEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n event_types?: IndexerEventType[];\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n max_time?: number;\n limit?:\n | {\n raw: number;\n }\n | {\n txs: number;\n };\n}\n\nexport type IndexerServerTriggerTypeFilter =\n | 'none'\n | 'price_trigger'\n | 'time_trigger';\n\nexport interface IndexerServerOrdersParams {\n subaccounts?: string[];\n product_ids?: number[];\n trigger_types?: IndexerServerTriggerTypeFilter[];\n digests?: string[];\n max_time?: number;\n limit?: number;\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMatchEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerLinkedSignerParams {\n subaccount: string;\n}\n\nexport interface IndexerServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n // Defaults to all\n product_ids?: number[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n}\n\nexport interface IndexerServerInterestFundingParams {\n subaccount: string;\n product_ids: number[];\n // If not given, defaults to latest\n max_idx?: string;\n max_time?: number;\n limit: number;\n}\n\nexport interface IndexerServerMakerStatisticsParams {\n product_id: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerServerLeaderboardParams {\n contest_id: number;\n rank_type?: IndexerLeaderboardRankType;\n start?: number | string;\n limit?: number | string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface IndexerServerLeaderboardRankParams {\n subaccount: string;\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardContestsParams {\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegistrationsParams {\n subaccount: string;\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegisterParams {\n update_registration: SignedTx<EIP712LeaderboardAuthenticationValues>;\n}\n\nexport interface IndexerServerSocialConnectParams {\n update_social_account: SignedTx<EIP712SocialAuthenticationValues>;\n}\n\nexport interface IndexerServerListSocialAccountsParams {\n address: string;\n}\n\nexport type IndexerServerRevokeSocialAccountParams =\n IndexerServerSocialConnectParams;\n\nexport interface IndexerServerFastWithdrawalSignatureParams {\n /**\n * The submission index of the WithdrawCollateral tx to be used for fast withdraw.\n */\n idx: number | string;\n}\n\nexport interface IndexerServerNlpSnapshotsParams {\n interval: IndexerServerSnapshotsInterval;\n}\n\nexport interface IndexerServerDDAQueryParams {\n subaccount: string;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceParams {\n address: string;\n}\n\nexport interface IndexerServerPointsParams {\n address: string;\n}\n\n// Request\nexport interface IndexerServerQueryRequestByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;\n backlog: Record<string, never>;\n candlesticks: IndexerServerCandlesticksParams;\n direct_deposit_address: IndexerServerDDAQueryParams;\n edge_candlesticks: IndexerEdgeServerCandlesticksParams;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;\n events: IndexerServerEventsParams;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;\n funding_rate: IndexerServerFundingRateParams;\n funding_rates: IndexerServerFundingRatesParams;\n interest_and_funding: IndexerServerInterestFundingParams;\n leaderboard: IndexerServerLeaderboardParams;\n leaderboard_contests: IndexerServerLeaderboardContestsParams;\n leaderboard_rank: IndexerServerLeaderboardRankParams;\n leaderboard_register: IndexerServerLeaderboardRegisterParams;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsParams;\n linked_signer_rate_limit: IndexerServerLinkedSignerParams;\n maker_statistics: IndexerServerMakerStatisticsParams;\n market_snapshots: IndexerServerMarketSnapshotsParams;\n matches: IndexerServerMatchEventsParams;\n oracle_price: IndexerServerOraclePricesParams;\n orders: IndexerServerOrdersParams;\n perp_prices: IndexerServerPerpPricesParams;\n price: IndexerServerPriceParams;\n product_snapshots: IndexerServerMultiProductsParams;\n products: IndexerServerProductsParams;\n referral_code: IndexerServerReferralCodeParams;\n subaccounts: IndexerServerListSubaccountsParams;\n quote_price: Record<string, never>;\n nlp_snapshots: IndexerServerNlpSnapshotsParams;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceParams;\n nado_points: IndexerServerPointsParams;\n social_connect: IndexerServerSocialConnectParams;\n list_social_accounts: IndexerServerListSocialAccountsParams;\n revoke_social_account: IndexerServerRevokeSocialAccountParams;\n}\n\nexport type IndexerServerQueryRequestType =\n keyof IndexerServerQueryRequestByType;\n\n/**\n * Responses\n */\n\nexport interface IndexerServerListSubaccountsResponse {\n subaccounts: {\n id: string;\n // Hex of subaccount bytes\n subaccount: string;\n // UNIX timestamp in seconds\n created_at: string;\n isolated: boolean;\n }[];\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsResponse {\n // Map of subaccount hex -> timestamp requested -> latest events corresponding to each product\n snapshots: Record<string, Record<string, IndexerServerEvent[]>>;\n}\n\nexport interface IndexerServerReferralCodeResponse {\n referral_code: string | null;\n}\n\nexport interface IndexerServerFundingRate {\n product_id: number;\n funding_rate_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerFundingRateResponse = IndexerServerFundingRate;\n\n// Map of productId -> IndexerServerFundingRate\nexport type IndexerServerFundingRatesResponse = Record<\n string,\n IndexerServerFundingRate\n>;\n\nexport interface IndexerServerPerpPrices {\n product_id: number;\n index_price_x18: string;\n mark_price_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerPriceResponse = IndexerServerPerpPrices;\n\n// Map of productId -> IndexerServerPerpPrices\nexport type IndexerServerPerpPricesResponse = Record<\n string,\n IndexerServerPerpPrices\n>;\n\nexport interface IndexerServerOraclePricesResponse {\n prices: IndexerServerOraclePrice[];\n}\n\nexport interface IndexerServerCandlesticksResponse {\n candlesticks: IndexerServerCandlestick[];\n}\n\nexport type IndexerEdgeServerCandlesticksResponse =\n IndexerServerCandlesticksResponse;\n\nexport interface IndexerServerProductsResponse {\n products: IndexerServerProductSnapshot[];\n txs: IndexerServerTx[];\n}\n\n// Map of timestamp -> (productID -> IndexerServerProductSnapshot)\nexport type IndexerServerMultiProductsResponse = Record<\n string,\n Record<string, IndexerServerProductSnapshot>\n>;\n\nexport interface IndexerServerEventsResponse {\n events: IndexerServerEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerOrdersResponse {\n orders: IndexerServerOrder[];\n}\n\nexport interface IndexerServerMatchEventsResponse {\n matches: IndexerServerMatchEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerQuotePriceResponse {\n price_x18: string;\n}\n\nexport interface IndexerServerLinkedSignerResponse {\n total_tx_limit: string;\n remaining_tx: string;\n wait_time: string;\n signer: string;\n}\n\nexport interface IndexerServerMarketSnapshotsResponse {\n snapshots: IndexerServerMarketSnapshot[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsResponse {\n snapshots: Record<number, IndexerServerMarketSnapshot[]>;\n}\n\nexport interface IndexerServerInterestFundingResponse {\n interest_payments: IndexerServerProductPayment[];\n funding_payments: IndexerServerProductPayment[];\n next_idx: string;\n}\n\nexport interface IndexerServerMakerStatisticsResponse {\n reward_coefficient: string;\n makers: IndexerServerMaker[];\n}\n\nexport interface IndexerServerLeaderboardResponse {\n positions: IndexerServerLeaderboardPosition[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationsResponse {\n registrations: IndexerServerLeaderboardRegistration[];\n}\n\nexport type IndexerServerLeaderboardRegisterResponse =\n IndexerServerLeaderboardRegistrationsResponse;\n\nexport interface IndexerServerLeaderboardRankResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerServerLeaderboardPosition\n positions: Record<string, IndexerServerLeaderboardPosition>;\n}\n\nexport interface IndexerServerLeaderboardContestsResponse {\n contests: IndexerServerLeaderboardContest[];\n}\n\nexport interface IndexerServerFastWithdrawalSignatureResponse {\n idx: string;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n tx_bytes: string;\n signatures: string[];\n}\n\nexport interface IndexerServerNlpSnapshotsResponse {\n snapshots: IndexerServerNlpSnapshot[];\n}\n\nexport interface IndexerServerDDAResponse {\n v1_address: string;\n}\n\nexport interface IndexerServerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n total_txs: string;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n total_submissions: string;\n // Number of unprocessed transactions (total_txs - total_submissions)\n backlog_size: string;\n // UNIX timestamp (in seconds) of when the data was last updated\n updated_at: string;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlog_eta_in_seconds: string | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txs_per_second: string | null;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceResponse {\n points: string;\n fee_refund: string;\n nft_eligibility: boolean;\n}\n\nexport interface IndexerServerPointsEpoch {\n epoch: number;\n description: string;\n start_time: string;\n end_time: string;\n total_points: string;\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerAllTimePoints {\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerPointsResponse {\n points_per_epoch: IndexerServerPointsEpoch[];\n all_time_points: IndexerServerAllTimePoints;\n}\n\nexport interface IndexerServerSocialConnectResponse {\n url: string;\n}\n\nexport interface IndexerServerSocialAccountsResponse {\n accounts: IndexerServerSocialAccount[];\n}\n\n// Response\nexport interface IndexerServerQueryResponseByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;\n backlog: IndexerServerBacklogResponse;\n candlesticks: IndexerServerCandlesticksResponse;\n direct_deposit_address: IndexerServerDDAResponse;\n edge_candlesticks: IndexerEdgeServerCandlesticksResponse;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;\n events: IndexerServerEventsResponse;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;\n funding_rate: IndexerServerFundingRateResponse;\n funding_rates: IndexerServerFundingRatesResponse;\n interest_and_funding: IndexerServerInterestFundingResponse;\n leaderboard: IndexerServerLeaderboardResponse;\n leaderboard_contests: IndexerServerLeaderboardContestsResponse;\n leaderboard_rank: IndexerServerLeaderboardRankResponse;\n leaderboard_register: IndexerServerLeaderboardRegisterResponse;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsResponse;\n linked_signer_rate_limit: IndexerServerLinkedSignerResponse;\n maker_statistics: IndexerServerMakerStatisticsResponse;\n market_snapshots: IndexerServerMarketSnapshotsResponse;\n matches: IndexerServerMatchEventsResponse;\n oracle_price: IndexerServerOraclePricesResponse;\n orders: IndexerServerOrdersResponse;\n perp_prices: IndexerServerPerpPricesResponse;\n price: IndexerServerPriceResponse;\n product_snapshots: IndexerServerMultiProductsResponse;\n products: IndexerServerProductsResponse;\n referral_code: IndexerServerReferralCodeResponse;\n subaccounts: IndexerServerListSubaccountsResponse;\n quote_price: IndexerServerQuotePriceResponse;\n nlp_snapshots: IndexerServerNlpSnapshotsResponse;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceResponse;\n nado_points: IndexerServerPointsResponse;\n social_connect: IndexerServerSocialConnectResponse;\n list_social_accounts: IndexerServerSocialAccountsResponse;\n revoke_social_account: IndexerServerSocialAccountsResponse;\n}\n\n/**\n * V2 API Types\n */\n\n/**\n * Individual ticker data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2TickerResponse {\n product_id: number;\n ticker_id: string;\n base_currency: string;\n quote_currency: string;\n last_price: number;\n base_volume: number;\n quote_volume: number;\n price_change_percent_24h: number;\n}\n\n/**\n * Response from v2 tickers endpoint (server format)\n * Maps ticker IDs to their respective ticker data\n */\nexport type IndexerServerV2TickersResponse = Record<\n string,\n IndexerServerV2TickerResponse\n>;\n\n/**\n * Market hours data from v2 symbols endpoint (server format)\n */\nexport interface IndexerServerV2MarketHours {\n is_open: boolean;\n reason: string | null;\n next_close: string | null;\n next_open: string | null;\n}\n\n/**\n * Individual symbol data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2Symbol {\n type: string;\n product_id: number;\n symbol: string;\n price_increment_x18: string;\n size_increment: string;\n min_size: string;\n maker_fee_rate_x18: string;\n taker_fee_rate_x18: string;\n long_weight_initial_x18: string;\n long_weight_maintenance_x18: string;\n /**\n * Defined only for perp markets with a max OI cap\n */\n max_open_interest_x18: string | null;\n /**\n * Defined only for xStocks spot markets\n */\n exchange_rate_x18: string | null;\n trading_status: string;\n isolated_only: boolean;\n market_hours: IndexerServerV2MarketHours | null;\n}\n\n/**\n * Response from v2 symbols endpoint (server format)\n * Maps symbols to their respective data\n */\nexport type IndexerServerV2SymbolsResponse = Record<\n string,\n IndexerServerV2Symbol\n>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/serverTypes.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationValues,\n EIP712SocialAuthenticationValues,\n SignedTx,\n} from '@nadohq/shared';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoWithdrawCollateralTx } from './NadoTx';\nimport {\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMarketSnapshotInterval,\n IndexerServerMatchEvent,\n IndexerServerNlpSnapshot,\n IndexerServerOraclePrice,\n IndexerServerOrder,\n IndexerServerProductPayment,\n IndexerServerProductSnapshot,\n IndexerServerSnapshotsInterval,\n IndexerServerSocialAccount,\n IndexerServerTx,\n} from './serverModelTypes';\n\n/**\n * Params\n */\n\nexport interface IndexerServerListSubaccountsParams {\n // Inclusive, defaults to 0\n start?: number;\n // Defaults to 100\n limit?: number;\n address?: string;\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsParams {\n // Subaccount hex identifiers\n subaccounts: string[];\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport interface IndexerServerReferralCodeParams {\n subaccount: string;\n}\n\nexport interface IndexerServerFundingRateParams {\n product_id: number;\n}\n\nexport interface IndexerServerFundingRatesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerPriceParams {\n product_id: number;\n}\n\nexport interface IndexerServerPerpPricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerOraclePricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerCandlesticksParams {\n product_id: number;\n granularity: number;\n // Seconds\n max_time?: number;\n limit: number;\n}\n\nexport type IndexerEdgeServerCandlesticksParams =\n IndexerServerCandlesticksParams;\n\nexport interface IndexerServerProductsParams {\n product_id: number;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMultiProductsParams {\n product_ids: number[];\n max_time: number[];\n}\n\nexport interface IndexerServerEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n event_types?: IndexerEventType[];\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n max_time?: number;\n limit?:\n | {\n raw: number;\n }\n | {\n txs: number;\n };\n}\n\nexport type IndexerServerTriggerTypeFilter =\n | 'none'\n | 'price_trigger'\n | 'time_trigger';\n\nexport interface IndexerServerOrdersParams {\n subaccounts?: string[];\n product_ids?: number[];\n trigger_types?: IndexerServerTriggerTypeFilter[];\n digests?: string[];\n max_time?: number;\n limit?: number;\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMatchEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerLinkedSignerParams {\n subaccount: string;\n}\n\nexport interface IndexerServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n // Defaults to all\n product_ids?: number[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n}\n\nexport interface IndexerServerInterestFundingParams {\n subaccount: string;\n product_ids: number[];\n // If not given, defaults to latest\n max_idx?: string;\n max_time?: number;\n limit: number;\n}\n\nexport interface IndexerServerMakerStatisticsParams {\n product_id: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerServerLeaderboardParams {\n contest_id: number;\n rank_type?: IndexerLeaderboardRankType;\n start?: number | string;\n limit?: number | string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface IndexerServerLeaderboardRankParams {\n subaccount: string;\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardContestsParams {\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegistrationsParams {\n subaccount: string;\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegisterParams {\n update_registration: SignedTx<EIP712LeaderboardAuthenticationValues>;\n}\n\nexport interface IndexerServerSocialConnectParams {\n update_social_account: SignedTx<EIP712SocialAuthenticationValues>;\n}\n\nexport interface IndexerServerListSocialAccountsParams {\n address: string;\n}\n\nexport type IndexerServerRevokeSocialAccountParams =\n IndexerServerSocialConnectParams;\n\nexport interface IndexerServerFastWithdrawalSignatureParams {\n /**\n * The submission index of the WithdrawCollateral tx to be used for fast withdraw.\n */\n idx: number | string;\n}\n\nexport interface IndexerServerNlpSnapshotsParams {\n interval: IndexerServerSnapshotsInterval;\n}\n\nexport interface IndexerServerDDAQueryParams {\n subaccount: string;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceParams {\n address: string;\n}\n\nexport interface IndexerServerPointsParams {\n address: string;\n}\n\n// Request\nexport interface IndexerServerQueryRequestByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;\n backlog: Record<string, never>;\n candlesticks: IndexerServerCandlesticksParams;\n direct_deposit_address: IndexerServerDDAQueryParams;\n edge_candlesticks: IndexerEdgeServerCandlesticksParams;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;\n events: IndexerServerEventsParams;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;\n funding_rate: IndexerServerFundingRateParams;\n funding_rates: IndexerServerFundingRatesParams;\n interest_and_funding: IndexerServerInterestFundingParams;\n leaderboard: IndexerServerLeaderboardParams;\n leaderboard_contests: IndexerServerLeaderboardContestsParams;\n leaderboard_rank: IndexerServerLeaderboardRankParams;\n leaderboard_register: IndexerServerLeaderboardRegisterParams;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsParams;\n linked_signer_rate_limit: IndexerServerLinkedSignerParams;\n maker_statistics: IndexerServerMakerStatisticsParams;\n market_snapshots: IndexerServerMarketSnapshotsParams;\n matches: IndexerServerMatchEventsParams;\n oracle_price: IndexerServerOraclePricesParams;\n orders: IndexerServerOrdersParams;\n perp_prices: IndexerServerPerpPricesParams;\n price: IndexerServerPriceParams;\n product_snapshots: IndexerServerMultiProductsParams;\n products: IndexerServerProductsParams;\n referral_code: IndexerServerReferralCodeParams;\n subaccounts: IndexerServerListSubaccountsParams;\n quote_price: Record<string, never>;\n nlp_snapshots: IndexerServerNlpSnapshotsParams;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceParams;\n nado_points: IndexerServerPointsParams;\n social_connect: IndexerServerSocialConnectParams;\n list_social_accounts: IndexerServerListSocialAccountsParams;\n revoke_social_account: IndexerServerRevokeSocialAccountParams;\n}\n\nexport type IndexerServerQueryRequestType =\n keyof IndexerServerQueryRequestByType;\n\n/**\n * Responses\n */\n\nexport interface IndexerServerListSubaccountsResponse {\n subaccounts: {\n id: string;\n // Hex of subaccount bytes\n subaccount: string;\n // UNIX timestamp in seconds\n created_at: string;\n isolated: boolean;\n }[];\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsResponse {\n // Map of subaccount hex -> timestamp requested -> latest events corresponding to each product\n snapshots: Record<string, Record<string, IndexerServerEvent[]>>;\n}\n\nexport interface IndexerServerReferralCodeResponse {\n referral_code: string | null;\n}\n\nexport interface IndexerServerFundingRate {\n product_id: number;\n funding_rate_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerFundingRateResponse = IndexerServerFundingRate;\n\n// Map of productId -> IndexerServerFundingRate\nexport type IndexerServerFundingRatesResponse = Record<\n string,\n IndexerServerFundingRate\n>;\n\nexport interface IndexerServerPerpPrices {\n product_id: number;\n index_price_x18: string;\n mark_price_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerPriceResponse = IndexerServerPerpPrices;\n\n// Map of productId -> IndexerServerPerpPrices\nexport type IndexerServerPerpPricesResponse = Record<\n string,\n IndexerServerPerpPrices\n>;\n\nexport interface IndexerServerOraclePricesResponse {\n prices: IndexerServerOraclePrice[];\n}\n\nexport interface IndexerServerCandlesticksResponse {\n candlesticks: IndexerServerCandlestick[];\n}\n\nexport type IndexerEdgeServerCandlesticksResponse =\n IndexerServerCandlesticksResponse;\n\nexport interface IndexerServerProductsResponse {\n products: IndexerServerProductSnapshot[];\n txs: IndexerServerTx[];\n}\n\n// Map of timestamp -> (productID -> IndexerServerProductSnapshot)\nexport type IndexerServerMultiProductsResponse = Record<\n string,\n Record<string, IndexerServerProductSnapshot>\n>;\n\nexport interface IndexerServerEventsResponse {\n events: IndexerServerEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerOrdersResponse {\n orders: IndexerServerOrder[];\n}\n\nexport interface IndexerServerMatchEventsResponse {\n matches: IndexerServerMatchEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerQuotePriceResponse {\n price_x18: string;\n}\n\nexport interface IndexerServerLinkedSignerResponse {\n total_tx_limit: string;\n remaining_tx: string;\n wait_time: string;\n signer: string;\n}\n\nexport interface IndexerServerMarketSnapshotsResponse {\n snapshots: IndexerServerMarketSnapshot[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsResponse {\n snapshots: Record<number, IndexerServerMarketSnapshot[]>;\n}\n\nexport interface IndexerServerInterestFundingResponse {\n interest_payments: IndexerServerProductPayment[];\n funding_payments: IndexerServerProductPayment[];\n next_idx: string;\n}\n\nexport interface IndexerServerMakerStatisticsResponse {\n reward_coefficient: string;\n makers: IndexerServerMaker[];\n}\n\nexport interface IndexerServerLeaderboardResponse {\n positions: IndexerServerLeaderboardPosition[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationsResponse {\n registrations: IndexerServerLeaderboardRegistration[];\n}\n\nexport type IndexerServerLeaderboardRegisterResponse =\n IndexerServerLeaderboardRegistrationsResponse;\n\nexport interface IndexerServerLeaderboardRankResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerServerLeaderboardPosition\n positions: Record<string, IndexerServerLeaderboardPosition>;\n}\n\nexport interface IndexerServerLeaderboardContestsResponse {\n contests: IndexerServerLeaderboardContest[];\n}\n\nexport interface IndexerServerFastWithdrawalSignatureResponse {\n idx: string;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n tx_bytes: string;\n signatures: string[];\n}\n\nexport interface IndexerServerNlpSnapshotsResponse {\n snapshots: IndexerServerNlpSnapshot[];\n}\n\nexport interface IndexerServerDDAResponse {\n v1_address: string;\n}\n\nexport interface IndexerServerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n total_txs: string;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n total_submissions: string;\n // Number of unprocessed transactions (total_txs - total_submissions)\n backlog_size: string;\n // UNIX timestamp (in seconds) of when the data was last updated\n updated_at: string;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlog_eta_in_seconds: string | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txs_per_second: string | null;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceResponse {\n points: string;\n fee_refund: string;\n nft_eligibility: boolean;\n}\n\nexport interface IndexerServerPointsEpoch {\n epoch: number;\n description: string;\n start_time: string;\n end_time: string;\n total_points: string;\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerAllTimePoints {\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerPointsResponse {\n points_per_epoch: IndexerServerPointsEpoch[];\n all_time_points: IndexerServerAllTimePoints;\n}\n\nexport interface IndexerServerSocialConnectResponse {\n url: string;\n}\n\nexport interface IndexerServerSocialAccountsResponse {\n accounts: IndexerServerSocialAccount[];\n}\n\n// Response\nexport interface IndexerServerQueryResponseByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;\n backlog: IndexerServerBacklogResponse;\n candlesticks: IndexerServerCandlesticksResponse;\n direct_deposit_address: IndexerServerDDAResponse;\n edge_candlesticks: IndexerEdgeServerCandlesticksResponse;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;\n events: IndexerServerEventsResponse;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;\n funding_rate: IndexerServerFundingRateResponse;\n funding_rates: IndexerServerFundingRatesResponse;\n interest_and_funding: IndexerServerInterestFundingResponse;\n leaderboard: IndexerServerLeaderboardResponse;\n leaderboard_contests: IndexerServerLeaderboardContestsResponse;\n leaderboard_rank: IndexerServerLeaderboardRankResponse;\n leaderboard_register: IndexerServerLeaderboardRegisterResponse;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsResponse;\n linked_signer_rate_limit: IndexerServerLinkedSignerResponse;\n maker_statistics: IndexerServerMakerStatisticsResponse;\n market_snapshots: IndexerServerMarketSnapshotsResponse;\n matches: IndexerServerMatchEventsResponse;\n oracle_price: IndexerServerOraclePricesResponse;\n orders: IndexerServerOrdersResponse;\n perp_prices: IndexerServerPerpPricesResponse;\n price: IndexerServerPriceResponse;\n product_snapshots: IndexerServerMultiProductsResponse;\n products: IndexerServerProductsResponse;\n referral_code: IndexerServerReferralCodeResponse;\n subaccounts: IndexerServerListSubaccountsResponse;\n quote_price: IndexerServerQuotePriceResponse;\n nlp_snapshots: IndexerServerNlpSnapshotsResponse;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceResponse;\n nado_points: IndexerServerPointsResponse;\n social_connect: IndexerServerSocialConnectResponse;\n list_social_accounts: IndexerServerSocialAccountsResponse;\n revoke_social_account: IndexerServerSocialAccountsResponse;\n}\n\n/**\n * V2 API Types\n */\n\n/**\n * Individual ticker data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2TickerResponse {\n product_id: number;\n ticker_id: string;\n base_currency: string;\n quote_currency: string;\n last_price: number;\n base_volume: number;\n quote_volume: number;\n price_change_percent_24h: number;\n}\n\n/**\n * Response from v2 tickers endpoint (server format)\n * Maps ticker IDs to their respective ticker data\n */\nexport type IndexerServerV2TickersResponse = Record<\n string,\n IndexerServerV2TickerResponse\n>;\n\n/**\n * Market hours data from v2 symbols endpoint (server format)\n */\nexport interface IndexerServerV2MarketHours {\n is_open: boolean;\n reason: string | null;\n next_close: string | null;\n next_open: string | null;\n}\n\n/**\n * Individual symbol data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2Symbol {\n type: string;\n product_id: number;\n symbol: string;\n price_increment_x18: string;\n size_increment: string;\n min_size: string;\n maker_fee_rate_x18: string;\n taker_fee_rate_x18: string;\n long_weight_initial_x18: string;\n long_weight_maintenance_x18: string;\n /**\n * Defined only for perp markets with a max OI cap\n */\n max_open_interest_x18: string | null;\n /**\n * Defined only for xStocks spot markets\n */\n exchange_rate_x18: string | null;\n trading_status: string;\n isolated_only: boolean;\n market_hours: IndexerServerV2MarketHours | null;\n /**\n * Boost tier for products with rewards boosts. Null for non-boosted products.\n * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x\n */\n boost_type: number | null;\n /**\n * Taker rewards multiplier. Null for non-boosted products.\n */\n taker_multiplier: number | null;\n /**\n * Maker rewards multiplier. Null for non-boosted products.\n */\n maker_multiplier: number | null;\n}\n\n/**\n * Response from v2 symbols endpoint (server format)\n * Maps symbols to their respective data\n */\nexport type IndexerServerV2SymbolsResponse = Record<\n string,\n IndexerServerV2Symbol\n>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -428,6 +428,19 @@ interface IndexerServerV2Symbol {
428
428
  trading_status: string;
429
429
  isolated_only: boolean;
430
430
  market_hours: IndexerServerV2MarketHours | null;
431
+ /**
432
+ * Boost tier for products with rewards boosts. Null for non-boosted products.
433
+ * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x
434
+ */
435
+ boost_type: number | null;
436
+ /**
437
+ * Taker rewards multiplier. Null for non-boosted products.
438
+ */
439
+ taker_multiplier: number | null;
440
+ /**
441
+ * Maker rewards multiplier. Null for non-boosted products.
442
+ */
443
+ maker_multiplier: number | null;
431
444
  }
432
445
  /**
433
446
  * Response from v2 symbols endpoint (server format)
@@ -428,6 +428,19 @@ interface IndexerServerV2Symbol {
428
428
  trading_status: string;
429
429
  isolated_only: boolean;
430
430
  market_hours: IndexerServerV2MarketHours | null;
431
+ /**
432
+ * Boost tier for products with rewards boosts. Null for non-boosted products.
433
+ * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x
434
+ */
435
+ boost_type: number | null;
436
+ /**
437
+ * Taker rewards multiplier. Null for non-boosted products.
438
+ */
439
+ taker_multiplier: number | null;
440
+ /**
441
+ * Maker rewards multiplier. Null for non-boosted products.
442
+ */
443
+ maker_multiplier: number | null;
431
444
  }
432
445
  /**
433
446
  * Response from v2 symbols endpoint (server format)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadohq/indexer-client",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "HTTP client for the Nado indexer — historical data, events, and analytics queries",
@@ -41,8 +41,8 @@
41
41
  "module": "./dist/index.js",
42
42
  "types": "./dist/index.d.ts",
43
43
  "dependencies": {
44
- "@nadohq/engine-client": "^0.11.0",
45
- "@nadohq/shared": "^0.11.0",
44
+ "@nadohq/engine-client": "^0.12.0",
45
+ "@nadohq/shared": "^0.12.0",
46
46
  "axios": "1.14.0",
47
47
  "ts-mixer": "6.0.4"
48
48
  },
@@ -54,5 +54,5 @@
54
54
  "bignumber.js": "10.0.2",
55
55
  "viem": "2.45.3"
56
56
  },
57
- "gitHead": "67e111a1c7b4c989a686784a564f3b246b6b1caf"
57
+ "gitHead": "bad9b58d3e5bde93b62838b5cb75dad79cefbc78"
58
58
  }
@@ -437,5 +437,8 @@ export function mapIndexerV2Symbols(
437
437
  marketHours: symbol.market_hours
438
438
  ? mapIndexerV2MarketHours(symbol.market_hours)
439
439
  : null,
440
+ boostType: symbol.boost_type ?? null,
441
+ takerMultiplier: symbol.taker_multiplier ?? null,
442
+ makerMultiplier: symbol.maker_multiplier ?? null,
440
443
  };
441
444
  }
@@ -946,6 +946,15 @@ export interface IndexerV2Symbol {
946
946
  isolatedOnly: boolean;
947
947
  /** Market hours information. Null for 24/7 markets. */
948
948
  marketHours: IndexerV2MarketHours | null;
949
+ /**
950
+ * Boost tier for products with rewards boosts. Null for non-boosted products.
951
+ * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x
952
+ */
953
+ boostType: number | null;
954
+ /** Taker rewards multiplier. Null for non-boosted products. */
955
+ takerMultiplier: number | null;
956
+ /** Maker rewards multiplier. Null for non-boosted products. */
957
+ makerMultiplier: number | null;
949
958
  }
950
959
 
951
960
  /**
@@ -583,6 +583,19 @@ export interface IndexerServerV2Symbol {
583
583
  trading_status: string;
584
584
  isolated_only: boolean;
585
585
  market_hours: IndexerServerV2MarketHours | null;
586
+ /**
587
+ * Boost tier for products with rewards boosts. Null for non-boosted products.
588
+ * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x
589
+ */
590
+ boost_type: number | null;
591
+ /**
592
+ * Taker rewards multiplier. Null for non-boosted products.
593
+ */
594
+ taker_multiplier: number | null;
595
+ /**
596
+ * Maker rewards multiplier. Null for non-boosted products.
597
+ */
598
+ maker_multiplier: number | null;
586
599
  }
587
600
 
588
601
  /**