@nadohq/indexer-client 0.1.0-alpha.1 → 0.1.0-alpha.2

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.
Files changed (48) hide show
  1. package/dist/IndexerBaseClient.cjs +3 -3
  2. package/dist/IndexerBaseClient.cjs.map +1 -1
  3. package/dist/IndexerBaseClient.d.cts +2 -2
  4. package/dist/IndexerBaseClient.d.ts +2 -2
  5. package/dist/IndexerBaseClient.js +4 -4
  6. package/dist/IndexerBaseClient.js.map +1 -1
  7. package/dist/IndexerClient.cjs +6 -6
  8. package/dist/IndexerClient.cjs.map +1 -1
  9. package/dist/IndexerClient.d.cts +2 -2
  10. package/dist/IndexerClient.d.ts +2 -2
  11. package/dist/IndexerClient.js +7 -7
  12. package/dist/IndexerClient.js.map +1 -1
  13. package/dist/dataMappers.cjs +3 -3
  14. package/dist/dataMappers.cjs.map +1 -1
  15. package/dist/dataMappers.d.cts +4 -4
  16. package/dist/dataMappers.d.ts +4 -4
  17. package/dist/dataMappers.js +2 -2
  18. package/dist/dataMappers.js.map +1 -1
  19. package/dist/index.d.cts +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/types/IndexerEventType.cjs.map +1 -1
  22. package/dist/types/IndexerEventType.d.cts +1 -1
  23. package/dist/types/IndexerEventType.d.ts +1 -1
  24. package/dist/types/NadoTx.cjs.map +1 -1
  25. package/dist/types/clientTypes.cjs.map +1 -1
  26. package/dist/types/clientTypes.d.cts +6 -6
  27. package/dist/types/clientTypes.d.ts +6 -6
  28. package/dist/types/index.d.cts +4 -4
  29. package/dist/types/index.d.ts +4 -4
  30. package/dist/types/paginatedEventsTypes.cjs.map +1 -1
  31. package/dist/types/paginatedEventsTypes.d.cts +6 -6
  32. package/dist/types/paginatedEventsTypes.d.ts +6 -6
  33. package/dist/types/serverModelTypes.cjs.map +1 -1
  34. package/dist/types/serverModelTypes.d.cts +3 -3
  35. package/dist/types/serverModelTypes.d.ts +3 -3
  36. package/dist/types/serverTypes.cjs.map +1 -1
  37. package/dist/types/serverTypes.d.cts +7 -7
  38. package/dist/types/serverTypes.d.ts +7 -7
  39. package/package.json +5 -5
  40. package/src/IndexerBaseClient.ts +8 -8
  41. package/src/IndexerClient.ts +15 -15
  42. package/src/dataMappers.ts +5 -5
  43. package/src/types/IndexerEventType.ts +2 -2
  44. package/src/types/NadoTx.ts +1 -1
  45. package/src/types/clientTypes.ts +6 -6
  46. package/src/types/paginatedEventsTypes.ts +6 -6
  47. package/src/types/serverModelTypes.ts +2 -2
  48. package/src/types/serverTypes.ts +6 -6
@@ -1,5 +1,5 @@
1
1
  import { IndexerBaseClient } from './IndexerBaseClient.cjs';
2
- import { GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountVlpEventsParams, GetIndexerSubaccountVlpEventsResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse } from './types/paginatedEventsTypes.cjs';
2
+ import { GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountNlpEventsParams, GetIndexerSubaccountNlpEventsResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse } from './types/paginatedEventsTypes.cjs';
3
3
  import '@nadohq/contracts';
4
4
  import 'axios';
5
5
  import './types/clientTypes.cjs';
@@ -19,7 +19,7 @@ import './types/collateralEventType.cjs';
19
19
  */
20
20
  declare class IndexerClient extends IndexerBaseClient {
21
21
  getPaginatedSubaccountMatchEvents(params: GetIndexerSubaccountMatchEventParams): Promise<GetIndexerSubaccountMatchEventsResponse>;
22
- getPaginatedSubaccountVlpEvents(params: GetIndexerSubaccountVlpEventsParams): Promise<GetIndexerSubaccountVlpEventsResponse>;
22
+ getPaginatedSubaccountNlpEvents(params: GetIndexerSubaccountNlpEventsParams): Promise<GetIndexerSubaccountNlpEventsResponse>;
23
23
  getPaginatedSubaccountCollateralEvents(params: GetIndexerSubaccountCollateralEventsParams): Promise<GetIndexerSubaccountCollateralEventsResponse>;
24
24
  getPaginatedSubaccountOrders(params: GetIndexerPaginatedOrdersParams): Promise<GetIndexerPaginatedOrdersResponse>;
25
25
  getPaginatedSubaccountSettlementEvents(params: GetIndexerSubaccountSettlementEventsParams): Promise<GetIndexerSubaccountSettlementEventsResponse>;
@@ -1,5 +1,5 @@
1
1
  import { IndexerBaseClient } from './IndexerBaseClient.js';
2
- import { GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountVlpEventsParams, GetIndexerSubaccountVlpEventsResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse } from './types/paginatedEventsTypes.js';
2
+ import { GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountNlpEventsParams, GetIndexerSubaccountNlpEventsResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse } from './types/paginatedEventsTypes.js';
3
3
  import '@nadohq/contracts';
4
4
  import 'axios';
5
5
  import './types/clientTypes.js';
@@ -19,7 +19,7 @@ import './types/collateralEventType.js';
19
19
  */
20
20
  declare class IndexerClient extends IndexerBaseClient {
21
21
  getPaginatedSubaccountMatchEvents(params: GetIndexerSubaccountMatchEventParams): Promise<GetIndexerSubaccountMatchEventsResponse>;
22
- getPaginatedSubaccountVlpEvents(params: GetIndexerSubaccountVlpEventsParams): Promise<GetIndexerSubaccountVlpEventsResponse>;
22
+ getPaginatedSubaccountNlpEvents(params: GetIndexerSubaccountNlpEventsParams): Promise<GetIndexerSubaccountNlpEventsResponse>;
23
23
  getPaginatedSubaccountCollateralEvents(params: GetIndexerSubaccountCollateralEventsParams): Promise<GetIndexerSubaccountCollateralEventsResponse>;
24
24
  getPaginatedSubaccountOrders(params: GetIndexerPaginatedOrdersParams): Promise<GetIndexerPaginatedOrdersResponse>;
25
25
  getPaginatedSubaccountSettlementEvents(params: GetIndexerSubaccountSettlementEventsParams): Promise<GetIndexerSubaccountSettlementEventsResponse>;
@@ -3,7 +3,7 @@ import {
3
3
  ProductEngineType,
4
4
  QUOTE_PRODUCT_ID,
5
5
  subaccountFromHex,
6
- VLP_PRODUCT_ID
6
+ NLP_PRODUCT_ID
7
7
  } from "@nadohq/contracts";
8
8
  import { toBigDecimal, toIntegerString } from "@nadohq/utils";
9
9
  import { IndexerBaseClient } from "./IndexerBaseClient.js";
@@ -29,7 +29,7 @@ var IndexerClient = class extends IndexerBaseClient {
29
29
  });
30
30
  return this.getPaginationEventsResponse(events, requestedLimit);
31
31
  }
32
- async getPaginatedSubaccountVlpEvents(params) {
32
+ async getPaginatedSubaccountNlpEvents(params) {
33
33
  const {
34
34
  startCursor,
35
35
  maxTimestampInclusive,
@@ -41,7 +41,7 @@ var IndexerClient = class extends IndexerBaseClient {
41
41
  const baseResponse = await this.getEvents({
42
42
  startCursor,
43
43
  maxTimestampInclusive,
44
- eventTypes: ["mint_vlp", "burn_vlp"],
44
+ eventTypes: ["mint_nlp", "burn_nlp"],
45
45
  limit: {
46
46
  type: "txs",
47
47
  value: limit
@@ -56,7 +56,7 @@ var IndexerClient = class extends IndexerBaseClient {
56
56
  return existingEvent;
57
57
  }
58
58
  const newEvent = {
59
- vlpDelta: toBigDecimal(0),
59
+ nlpDelta: toBigDecimal(0),
60
60
  primaryQuoteDelta: toBigDecimal(0),
61
61
  timestamp: event.timestamp,
62
62
  submissionIndex: event.submissionIndex,
@@ -72,10 +72,10 @@ var IndexerClient = class extends IndexerBaseClient {
72
72
  const productId = event.state.market.productId;
73
73
  if (productId === QUOTE_PRODUCT_ID) {
74
74
  mappedEvent.primaryQuoteDelta = balanceDelta;
75
- } else if (productId === VLP_PRODUCT_ID) {
76
- mappedEvent.vlpDelta = balanceDelta;
75
+ } else if (productId === NLP_PRODUCT_ID) {
76
+ mappedEvent.nlpDelta = balanceDelta;
77
77
  } else {
78
- throw Error(`Invalid product ID for VLP event ${productId}`);
78
+ throw Error(`Invalid product ID for NLP event ${productId}`);
79
79
  }
80
80
  });
81
81
  const events = Array.from(eventsBySubmissionIdx.values());
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/IndexerClient.ts"],"sourcesContent":["import {\n ProductEngineType,\n QUOTE_PRODUCT_ID,\n subaccountFromHex,\n VLP_PRODUCT_ID,\n} from '@nadohq/contracts';\nimport { toBigDecimal, toIntegerString } from '@nadohq/utils';\n\nimport { IndexerBaseClient } from './IndexerBaseClient';\nimport {\n BaseIndexerPaginatedEvent,\n CollateralEventType,\n GetIndexerPaginatedInterestFundingPaymentsResponse,\n GetIndexerPaginatedLeaderboardParams,\n GetIndexerPaginatedLeaderboardResponse,\n GetIndexerPaginatedOrdersParams,\n GetIndexerPaginatedOrdersResponse,\n GetIndexerSubaccountCollateralEventsParams,\n GetIndexerSubaccountCollateralEventsResponse,\n GetIndexerSubaccountInterestFundingPaymentsParams,\n GetIndexerSubaccountLiquidationEventsParams,\n GetIndexerSubaccountLiquidationEventsResponse,\n GetIndexerSubaccountMatchEventParams,\n GetIndexerSubaccountMatchEventsResponse,\n GetIndexerSubaccountSettlementEventsParams,\n GetIndexerSubaccountSettlementEventsResponse,\n GetIndexerSubaccountVlpEventsParams,\n GetIndexerSubaccountVlpEventsResponse,\n IndexerCollateralEvent,\n IndexerEventPerpStateSnapshot,\n IndexerEventSpotStateSnapshot,\n IndexerEventWithTx,\n IndexerLiquidationEvent,\n IndexerSettlementEvent,\n IndexerVlpEvent,\n PaginatedIndexerEventsResponse,\n} from './types';\n\n/**\n * Indexer client providing paginated queries for historical data from the Nado indexer service\n */\nexport class IndexerClient extends IndexerBaseClient {\n async getPaginatedSubaccountMatchEvents(\n params: GetIndexerSubaccountMatchEventParams,\n ): Promise<GetIndexerSubaccountMatchEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n isolated,\n productIds,\n } = params;\n\n const limit = requestedLimit + 1;\n const events = await this.getMatchEvents({\n startCursor,\n maxTimestampInclusive,\n limit,\n subaccount: { subaccountName, subaccountOwner },\n productIds,\n isolated,\n });\n\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountVlpEvents(\n params: GetIndexerSubaccountVlpEventsParams,\n ): Promise<GetIndexerSubaccountVlpEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n } = params;\n\n // There are 2 events per mint/burn for spot - one associated with the VLP product & the other with the primary quote\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: ['mint_vlp', 'burn_vlp'],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n });\n\n // Now aggregate results by the submission index, use map to maintain insertion order\n const eventsBySubmissionIdx = new Map<string, IndexerVlpEvent>();\n\n baseResponse.forEach((event) => {\n const mappedEvent = (() => {\n const existingEvent = eventsBySubmissionIdx.get(event.submissionIndex);\n if (existingEvent) {\n return existingEvent;\n }\n\n const newEvent: IndexerVlpEvent = {\n vlpDelta: toBigDecimal(0),\n primaryQuoteDelta: toBigDecimal(0),\n timestamp: event.timestamp,\n submissionIndex: event.submissionIndex,\n tx: event.tx,\n ...subaccountFromHex(event.subaccount),\n };\n eventsBySubmissionIdx.set(event.submissionIndex, newEvent);\n\n return newEvent;\n })();\n\n const balanceDelta = event.state.postBalance.amount.minus(\n event.state.preBalance.amount,\n );\n\n const productId = event.state.market.productId;\n if (productId === QUOTE_PRODUCT_ID) {\n mappedEvent.primaryQuoteDelta = balanceDelta;\n } else if (productId === VLP_PRODUCT_ID) {\n mappedEvent.vlpDelta = balanceDelta;\n } else {\n throw Error(`Invalid product ID for VLP event ${productId}`);\n }\n });\n\n // Force cast to get rid of the `Partial`\n const events = Array.from(eventsBySubmissionIdx.values());\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountCollateralEvents(\n params: GetIndexerSubaccountCollateralEventsParams,\n ): Promise<GetIndexerSubaccountCollateralEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n eventTypes,\n isolated,\n } = params;\n\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: eventTypes ?? [\n 'deposit_collateral',\n 'withdraw_collateral',\n 'transfer_quote',\n ],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n isolated,\n });\n\n const events = baseResponse.map((event): IndexerCollateralEvent => {\n if (event.state.type !== ProductEngineType.SPOT) {\n throw Error('Incorrect event state for collateral event');\n }\n\n return {\n timestamp: event.timestamp,\n // This cast is safe as the query param restricts to collateral events\n eventType: event.eventType as CollateralEventType,\n submissionIndex: event.submissionIndex,\n snapshot: event.state,\n amount: event.state.postBalance.amount.minus(\n event.state.preBalance.amount,\n ),\n newAmount: event.state.postBalance.amount,\n tx: event.tx,\n ...subaccountFromHex(event.subaccount),\n };\n });\n\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountOrders(\n params: GetIndexerPaginatedOrdersParams,\n ): Promise<GetIndexerPaginatedOrdersResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n productIds,\n isolated,\n } = params;\n\n const limit = requestedLimit + 1;\n const baseResponse = await this.getOrders({\n startCursor,\n maxTimestampInclusive,\n subaccount: { subaccountName, subaccountOwner },\n limit,\n productIds,\n isolated,\n });\n\n // Same pagination meta logic as events, but duplicate for now as this return type is slightly different\n const truncatedOrders = baseResponse.slice(0, requestedLimit);\n const hasMore = baseResponse.length > truncatedOrders.length;\n return {\n meta: {\n hasMore,\n nextCursor: baseResponse[truncatedOrders.length]?.submissionIndex,\n },\n orders: truncatedOrders,\n };\n }\n\n async getPaginatedSubaccountSettlementEvents(\n params: GetIndexerSubaccountSettlementEventsParams,\n ): Promise<GetIndexerSubaccountSettlementEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n } = params;\n\n // Each settlement has a quote & perp balance change, so 2 events per settlement tx\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: ['settle_pnl'],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n });\n\n const events = baseResponse\n .map((event): IndexerSettlementEvent | undefined => {\n if (event.state.market.productId === QUOTE_PRODUCT_ID) {\n return;\n }\n if (event.state.type !== ProductEngineType.PERP) {\n throw Error('Incorrect event state for settlement event');\n }\n\n return {\n timestamp: event.timestamp,\n submissionIndex: event.submissionIndex,\n snapshot: event.state,\n // Spot quote delta = -vQuote delta\n quoteDelta: event.state.preBalance.vQuoteBalance.minus(\n event.state.postBalance.vQuoteBalance,\n ),\n isolated: event.isolated,\n tx: event.tx,\n ...subaccountFromHex(event.subaccount),\n };\n })\n .filter((event): event is IndexerSettlementEvent => !!event);\n\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountLiquidationEvents(\n params: GetIndexerSubaccountLiquidationEventsParams,\n ): Promise<GetIndexerSubaccountLiquidationEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n } = params;\n\n // There is 1 event emitted per product, including quote\n // However, if the balance change is 0, then the liquidation did not touch the product\n // A tx operates on a given health group, so only a spot & its associated perp can be actually liquidated within a single tx\n // with an associated quote balance change\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: ['liquidate_subaccount'],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n });\n\n // Now aggregate results by the submission index, use map to maintain insertion order\n const eventsBySubmissionIdx = new Map<\n string,\n Partial<IndexerLiquidationEvent>\n >();\n\n baseResponse.forEach((event) => {\n const mappedEvent = (() => {\n const existingEvent = eventsBySubmissionIdx.get(event.submissionIndex);\n if (existingEvent) {\n return existingEvent;\n }\n\n const newEvent: Partial<IndexerLiquidationEvent> = {\n perp: undefined,\n spot: undefined,\n quote: undefined,\n timestamp: event.timestamp,\n submissionIndex: event.submissionIndex,\n };\n\n return newEvent;\n })();\n\n // The original balance is the negated delta\n const balanceDelta = event.state.postBalance.amount.minus(\n event.state.preBalance.amount,\n );\n\n // Event without balance change - not part of this liq\n // However, we could have zero balance changes for the quote product if this was a partial liquidation\n if (\n balanceDelta.isZero() &&\n event.state.market.productId !== QUOTE_PRODUCT_ID\n ) {\n return;\n }\n\n if (event.state.type === ProductEngineType.PERP) {\n mappedEvent.perp = {\n amountLiquidated: balanceDelta.negated(),\n // This cast is safe because we're checking for event.state.type\n indexerEvent:\n event as IndexerEventWithTx<IndexerEventPerpStateSnapshot>,\n };\n } else if (event.state.market.productId === QUOTE_PRODUCT_ID) {\n mappedEvent.quote = {\n balanceDelta,\n indexerEvent:\n event as IndexerEventWithTx<IndexerEventSpotStateSnapshot>,\n };\n } else {\n mappedEvent.spot = {\n amountLiquidated: balanceDelta.negated(),\n indexerEvent:\n event as IndexerEventWithTx<IndexerEventSpotStateSnapshot>,\n };\n }\n\n eventsBySubmissionIdx.set(event.submissionIndex, mappedEvent);\n });\n\n // Force cast to get rid of the `Partial`\n const events = Array.from(\n eventsBySubmissionIdx.values(),\n ) as IndexerLiquidationEvent[];\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n /**\n * Get all interest funding payments for a given subaccount with the standard pagination response\n * This is a simple wrapper over the underlying `getInterestFundingPayments` function. Very little\n * additional processing is needed because the endpoint is well structured for pagination\n *\n * @param params\n */\n async getPaginatedSubaccountInterestFundingPayments(\n params: GetIndexerSubaccountInterestFundingPaymentsParams,\n ): Promise<GetIndexerPaginatedInterestFundingPaymentsResponse> {\n const {\n limit,\n productIds,\n startCursor,\n maxTimestampInclusive,\n subaccountName,\n subaccountOwner,\n } = params;\n const baseResponse = await this.getInterestFundingPayments({\n limit,\n productIds,\n startCursor,\n maxTimestampInclusive,\n subaccount: {\n subaccountName,\n subaccountOwner,\n },\n });\n\n return {\n ...baseResponse,\n meta: {\n hasMore: baseResponse.nextCursor != null,\n nextCursor: baseResponse.nextCursor ?? undefined,\n },\n };\n }\n\n /**\n * Paginated leaderboard query that paginates on rank number.\n *\n * @param params\n */\n async getPaginatedLeaderboard(\n params: GetIndexerPaginatedLeaderboardParams,\n ): Promise<GetIndexerPaginatedLeaderboardResponse> {\n const requestedLimit = params.limit;\n\n const baseResponse = await this.getLeaderboard({\n contestId: params.contestId,\n rankType: params.rankType,\n // Query for 1 more result for proper pagination\n limit: requestedLimit + 1,\n // Start cursor is the next rank number\n startCursor: params.startCursor,\n });\n\n // Next cursor is the rank number of the (requestedLimit+1)th item\n const nextCursor =\n params.rankType === 'pnl'\n ? baseResponse.participants[requestedLimit]?.pnlRank\n : baseResponse.participants[requestedLimit]?.roiRank;\n\n return {\n ...baseResponse,\n // Truncate the response to the requested limit\n participants: baseResponse.participants.slice(0, requestedLimit),\n meta: {\n hasMore: baseResponse.participants.length > requestedLimit,\n nextCursor:\n nextCursor !== undefined ? toIntegerString(nextCursor) : undefined,\n },\n };\n }\n\n /**\n * A util function to generate the standard pagination response for events\n * @param events\n * @param requestedLimit given by consumers of the SDK\n * @private\n */\n private getPaginationEventsResponse<T extends BaseIndexerPaginatedEvent>(\n events: T[],\n requestedLimit: number,\n ): PaginatedIndexerEventsResponse<T> {\n const truncatedEvents = events.slice(0, requestedLimit);\n const hasMore = events.length > truncatedEvents.length;\n\n return {\n events: truncatedEvents,\n meta: {\n hasMore,\n // We want the NEXT available cursor, so we use the first event after the truncation cutoff\n // If len(events) === len(truncatedEvents), there are no more entries and this is undefined\n nextCursor: events[truncatedEvents.length]?.submissionIndex,\n },\n };\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc,uBAAuB;AAE9C,SAAS,yBAAyB;AAiC3B,IAAM,gBAAN,cAA4B,kBAAkB;AAAA,EACnD,MAAM,kCACJ,QACkD;AAClD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,O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AA,MACL,GAAG;AAAA;AAAA,MAEH,cAAc,aAAa,aAAa,MAAM,GAAG,cAAc;AAAA,MAC/D,MAAM;AAAA,QACJ,SAAS,aAAa,aAAa,SAAS;AAAA,QAC5C,YACE,eAAe,SAAY,gBAAgB,UAAU,IAAI;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,4BACN,QACA,gBACmC;AACnC,UAAM,kBAAkB,OAAO,MAAM,GAAG,cAAc;AACtD,UAAM,UAAU,OAAO,SAAS,gBAAgB;AAEhD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ;AAAA;AAAA;AAAA,QAGA,YAAY,OAAO,gBAAgB,MAAM,GAAG;AAAA,MAC9C;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/IndexerClient.ts"],"sourcesContent":["import {\n ProductEngineType,\n QUOTE_PRODUCT_ID,\n subaccountFromHex,\n NLP_PRODUCT_ID,\n} from '@nadohq/contracts';\nimport { toBigDecimal, toIntegerString } from '@nadohq/utils';\n\nimport { IndexerBaseClient } from './IndexerBaseClient';\nimport {\n BaseIndexerPaginatedEvent,\n CollateralEventType,\n GetIndexerPaginatedInterestFundingPaymentsResponse,\n GetIndexerPaginatedLeaderboardParams,\n GetIndexerPaginatedLeaderboardResponse,\n GetIndexerPaginatedOrdersParams,\n GetIndexerPaginatedOrdersResponse,\n GetIndexerSubaccountCollateralEventsParams,\n GetIndexerSubaccountCollateralEventsResponse,\n GetIndexerSubaccountInterestFundingPaymentsParams,\n GetIndexerSubaccountLiquidationEventsParams,\n GetIndexerSubaccountLiquidationEventsResponse,\n GetIndexerSubaccountMatchEventParams,\n GetIndexerSubaccountMatchEventsResponse,\n GetIndexerSubaccountSettlementEventsParams,\n GetIndexerSubaccountSettlementEventsResponse,\n GetIndexerSubaccountNlpEventsParams,\n GetIndexerSubaccountNlpEventsResponse,\n IndexerCollateralEvent,\n IndexerEventPerpStateSnapshot,\n IndexerEventSpotStateSnapshot,\n IndexerEventWithTx,\n IndexerLiquidationEvent,\n IndexerSettlementEvent,\n IndexerNlpEvent,\n PaginatedIndexerEventsResponse,\n} from './types';\n\n/**\n * Indexer client providing paginated queries for historical data from the Nado indexer service\n */\nexport class IndexerClient extends IndexerBaseClient {\n async getPaginatedSubaccountMatchEvents(\n params: GetIndexerSubaccountMatchEventParams,\n ): Promise<GetIndexerSubaccountMatchEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n isolated,\n productIds,\n } = params;\n\n const limit = requestedLimit + 1;\n const events = await this.getMatchEvents({\n startCursor,\n maxTimestampInclusive,\n limit,\n subaccount: { subaccountName, subaccountOwner },\n productIds,\n isolated,\n });\n\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountNlpEvents(\n params: GetIndexerSubaccountNlpEventsParams,\n ): Promise<GetIndexerSubaccountNlpEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n } = params;\n\n // There are 2 events per mint/burn for spot - one associated with the NLP product & the other with the primary quote\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: ['mint_nlp', 'burn_nlp'],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n });\n\n // Now aggregate results by the submission index, use map to maintain insertion order\n const eventsBySubmissionIdx = new Map<string, IndexerNlpEvent>();\n\n baseResponse.forEach((event) => {\n const mappedEvent = (() => {\n const existingEvent = eventsBySubmissionIdx.get(event.submissionIndex);\n if (existingEvent) {\n return existingEvent;\n }\n\n const newEvent: IndexerNlpEvent = {\n nlpDelta: toBigDecimal(0),\n primaryQuoteDelta: toBigDecimal(0),\n timestamp: event.timestamp,\n submissionIndex: event.submissionIndex,\n tx: event.tx,\n ...subaccountFromHex(event.subaccount),\n };\n eventsBySubmissionIdx.set(event.submissionIndex, newEvent);\n\n return newEvent;\n })();\n\n const balanceDelta = event.state.postBalance.amount.minus(\n event.state.preBalance.amount,\n );\n\n const productId = event.state.market.productId;\n if (productId === QUOTE_PRODUCT_ID) {\n mappedEvent.primaryQuoteDelta = balanceDelta;\n } else if (productId === NLP_PRODUCT_ID) {\n mappedEvent.nlpDelta = balanceDelta;\n } else {\n throw Error(`Invalid product ID for NLP event ${productId}`);\n }\n });\n\n // Force cast to get rid of the `Partial`\n const events = Array.from(eventsBySubmissionIdx.values());\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountCollateralEvents(\n params: GetIndexerSubaccountCollateralEventsParams,\n ): Promise<GetIndexerSubaccountCollateralEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n eventTypes,\n isolated,\n } = params;\n\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: eventTypes ?? [\n 'deposit_collateral',\n 'withdraw_collateral',\n 'transfer_quote',\n ],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n isolated,\n });\n\n const events = baseResponse.map((event): IndexerCollateralEvent => {\n if (event.state.type !== ProductEngineType.SPOT) {\n throw Error('Incorrect event state for collateral event');\n }\n\n return {\n timestamp: event.timestamp,\n // This cast is safe as the query param restricts to collateral events\n eventType: event.eventType as CollateralEventType,\n submissionIndex: event.submissionIndex,\n snapshot: event.state,\n amount: event.state.postBalance.amount.minus(\n event.state.preBalance.amount,\n ),\n newAmount: event.state.postBalance.amount,\n tx: event.tx,\n ...subaccountFromHex(event.subaccount),\n };\n });\n\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountOrders(\n params: GetIndexerPaginatedOrdersParams,\n ): Promise<GetIndexerPaginatedOrdersResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n productIds,\n isolated,\n } = params;\n\n const limit = requestedLimit + 1;\n const baseResponse = await this.getOrders({\n startCursor,\n maxTimestampInclusive,\n subaccount: { subaccountName, subaccountOwner },\n limit,\n productIds,\n isolated,\n });\n\n // Same pagination meta logic as events, but duplicate for now as this return type is slightly different\n const truncatedOrders = baseResponse.slice(0, requestedLimit);\n const hasMore = baseResponse.length > truncatedOrders.length;\n return {\n meta: {\n hasMore,\n nextCursor: baseResponse[truncatedOrders.length]?.submissionIndex,\n },\n orders: truncatedOrders,\n };\n }\n\n async getPaginatedSubaccountSettlementEvents(\n params: GetIndexerSubaccountSettlementEventsParams,\n ): Promise<GetIndexerSubaccountSettlementEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n } = params;\n\n // Each settlement has a quote & perp balance change, so 2 events per settlement tx\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: ['settle_pnl'],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n });\n\n const events = baseResponse\n .map((event): IndexerSettlementEvent | undefined => {\n if (event.state.market.productId === QUOTE_PRODUCT_ID) {\n return;\n }\n if (event.state.type !== ProductEngineType.PERP) {\n throw Error('Incorrect event state for settlement event');\n }\n\n return {\n timestamp: event.timestamp,\n submissionIndex: event.submissionIndex,\n snapshot: event.state,\n // Spot quote delta = -vQuote delta\n quoteDelta: event.state.preBalance.vQuoteBalance.minus(\n event.state.postBalance.vQuoteBalance,\n ),\n isolated: event.isolated,\n tx: event.tx,\n ...subaccountFromHex(event.subaccount),\n };\n })\n .filter((event): event is IndexerSettlementEvent => !!event);\n\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n async getPaginatedSubaccountLiquidationEvents(\n params: GetIndexerSubaccountLiquidationEventsParams,\n ): Promise<GetIndexerSubaccountLiquidationEventsResponse> {\n const {\n startCursor,\n maxTimestampInclusive,\n limit: requestedLimit,\n subaccountName,\n subaccountOwner,\n } = params;\n\n // There is 1 event emitted per product, including quote\n // However, if the balance change is 0, then the liquidation did not touch the product\n // A tx operates on a given health group, so only a spot & its associated perp can be actually liquidated within a single tx\n // with an associated quote balance change\n const limit = requestedLimit + 1;\n const baseResponse = await this.getEvents({\n startCursor,\n maxTimestampInclusive,\n eventTypes: ['liquidate_subaccount'],\n limit: {\n type: 'txs',\n value: limit,\n },\n subaccount: { subaccountName, subaccountOwner },\n });\n\n // Now aggregate results by the submission index, use map to maintain insertion order\n const eventsBySubmissionIdx = new Map<\n string,\n Partial<IndexerLiquidationEvent>\n >();\n\n baseResponse.forEach((event) => {\n const mappedEvent = (() => {\n const existingEvent = eventsBySubmissionIdx.get(event.submissionIndex);\n if (existingEvent) {\n return existingEvent;\n }\n\n const newEvent: Partial<IndexerLiquidationEvent> = {\n perp: undefined,\n spot: undefined,\n quote: undefined,\n timestamp: event.timestamp,\n submissionIndex: event.submissionIndex,\n };\n\n return newEvent;\n })();\n\n // The original balance is the negated delta\n const balanceDelta = event.state.postBalance.amount.minus(\n event.state.preBalance.amount,\n );\n\n // Event without balance change - not part of this liq\n // However, we could have zero balance changes for the quote product if this was a partial liquidation\n if (\n balanceDelta.isZero() &&\n event.state.market.productId !== QUOTE_PRODUCT_ID\n ) {\n return;\n }\n\n if (event.state.type === ProductEngineType.PERP) {\n mappedEvent.perp = {\n amountLiquidated: balanceDelta.negated(),\n // This cast is safe because we're checking for event.state.type\n indexerEvent:\n event as IndexerEventWithTx<IndexerEventPerpStateSnapshot>,\n };\n } else if (event.state.market.productId === QUOTE_PRODUCT_ID) {\n mappedEvent.quote = {\n balanceDelta,\n indexerEvent:\n event as IndexerEventWithTx<IndexerEventSpotStateSnapshot>,\n };\n } else {\n mappedEvent.spot = {\n amountLiquidated: balanceDelta.negated(),\n indexerEvent:\n event as IndexerEventWithTx<IndexerEventSpotStateSnapshot>,\n };\n }\n\n eventsBySubmissionIdx.set(event.submissionIndex, mappedEvent);\n });\n\n // Force cast to get rid of the `Partial`\n const events = Array.from(\n eventsBySubmissionIdx.values(),\n ) as IndexerLiquidationEvent[];\n return this.getPaginationEventsResponse(events, requestedLimit);\n }\n\n /**\n * Get all interest funding payments for a given subaccount with the standard pagination response\n * This is a simple wrapper over the underlying `getInterestFundingPayments` function. Very little\n * additional processing is needed because the endpoint is well structured for pagination\n *\n * @param params\n */\n async getPaginatedSubaccountInterestFundingPayments(\n params: GetIndexerSubaccountInterestFundingPaymentsParams,\n ): Promise<GetIndexerPaginatedInterestFundingPaymentsResponse> {\n const {\n limit,\n productIds,\n startCursor,\n maxTimestampInclusive,\n subaccountName,\n subaccountOwner,\n } = params;\n const baseResponse = await this.getInterestFundingPayments({\n limit,\n productIds,\n startCursor,\n maxTimestampInclusive,\n subaccount: {\n subaccountName,\n subaccountOwner,\n },\n });\n\n return {\n ...baseResponse,\n meta: {\n hasMore: baseResponse.nextCursor != null,\n nextCursor: baseResponse.nextCursor ?? undefined,\n },\n };\n }\n\n /**\n * Paginated leaderboard query that paginates on rank number.\n *\n * @param params\n */\n async getPaginatedLeaderboard(\n params: GetIndexerPaginatedLeaderboardParams,\n ): Promise<GetIndexerPaginatedLeaderboardResponse> {\n const requestedLimit = params.limit;\n\n const baseResponse = await this.getLeaderboard({\n contestId: params.contestId,\n rankType: params.rankType,\n // Query for 1 more result for proper pagination\n limit: requestedLimit + 1,\n // Start cursor is the next rank number\n startCursor: params.startCursor,\n });\n\n // Next cursor is the rank number of the (requestedLimit+1)th item\n const nextCursor =\n params.rankType === 'pnl'\n ? baseResponse.participants[requestedLimit]?.pnlRank\n : baseResponse.participants[requestedLimit]?.roiRank;\n\n return {\n ...baseResponse,\n // Truncate the response to the requested limit\n participants: baseResponse.participants.slice(0, requestedLimit),\n meta: {\n hasMore: baseResponse.participants.length > requestedLimit,\n nextCursor:\n nextCursor !== undefined ? toIntegerString(nextCursor) : undefined,\n },\n };\n }\n\n /**\n * A util function to generate the standard pagination response for events\n * @param events\n * @param requestedLimit given by consumers of the SDK\n * @private\n */\n private getPaginationEventsResponse<T extends BaseIndexerPaginatedEvent>(\n events: T[],\n requestedLimit: number,\n ): PaginatedIndexerEventsResponse<T> {\n const truncatedEvents = events.slice(0, requestedLimit);\n const hasMore = events.length > truncatedEvents.length;\n\n return {\n events: truncatedEvents,\n meta: {\n hasMore,\n // We want the NEXT available cursor, so we use the first event after the truncation cutoff\n // If len(events) === len(truncatedEvents), there are no more entries and this is undefined\n nextCursor: events[truncatedEvents.length]?.submissionIndex,\n },\n };\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc,uBAAuB;AAE9C,SAAS,yBAAyB;AAiC3B,IAAM,gBAAN,cAA4B,kBAAkB;AAAA,EACnD,MAAM,kCACJ,QACkD;AAClD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI;AAEJ,UAAM,QAAQ,iBAAiB;AAC/B,UAAM,SAAS,MAAM,KAAK,eAAe;AAAA,MACvC;AAAA,MACA;AAAA,MACA;AAAA,MACA,YAAY,EAAE,gBAAgB,gBAAgB;AAAA,MAC9C;AAAA,MACA;AAAA,IACF,CAAC;AAED,WAAO,KAAK,4BAA4B,QAAQ,cAAc;AAAA,EAChE;AAAA,EAEA,MAAM,gCACJ,QACgD;AAChD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,IACF,IAAI;AAGJ,UAAM,QAAQ,iBAAiB;AAC/B,UAAM,eAAe,MAAM,KAAK,UAAU;AAAA,MACxC;AAAA,MACA;AAAA,MACA,YAAY,CAAC,YAAY,UAAU;AAAA,MACnC,OAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,MACT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
31
31
  mapIndexerMarketSnapshot: () => mapIndexerMarketSnapshot,
32
32
  mapIndexerMatchEventBalances: () => mapIndexerMatchEventBalances,
33
+ mapIndexerNlpSnapshot: () => mapIndexerNlpSnapshot,
33
34
  mapIndexerOrder: () => mapIndexerOrder,
34
35
  mapIndexerPerpPrices: () => mapIndexerPerpPrices,
35
36
  mapIndexerProductPayment: () => mapIndexerProductPayment,
36
37
  mapIndexerServerBalance: () => mapIndexerServerBalance,
37
38
  mapIndexerServerProduct: () => mapIndexerServerProduct,
38
- mapIndexerVlpSnapshot: () => mapIndexerVlpSnapshot,
39
39
  mapSnapshotsIntervalToServerParams: () => mapSnapshotsIntervalToServerParams
40
40
  });
41
41
  module.exports = __toCommonJS(dataMappers_exports);
@@ -287,7 +287,7 @@ function mapIndexerMarketSnapshot(snapshot) {
287
287
  )
288
288
  };
289
289
  }
290
- function mapIndexerVlpSnapshot(snapshot) {
290
+ function mapIndexerNlpSnapshot(snapshot) {
291
291
  return {
292
292
  submissionIndex: snapshot.submission_idx,
293
293
  timestamp: (0, import_utils.toBigDecimal)(snapshot.timestamp),
@@ -313,12 +313,12 @@ function mapIndexerVlpSnapshot(snapshot) {
313
313
  mapIndexerMakerStatistics,
314
314
  mapIndexerMarketSnapshot,
315
315
  mapIndexerMatchEventBalances,
316
+ mapIndexerNlpSnapshot,
316
317
  mapIndexerOrder,
317
318
  mapIndexerPerpPrices,
318
319
  mapIndexerProductPayment,
319
320
  mapIndexerServerBalance,
320
321
  mapIndexerServerProduct,
321
- mapIndexerVlpSnapshot,
322
322
  mapSnapshotsIntervalToServerParams
323
323
  });
324
324
  //# sourceMappingURL=dataMappers.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n getRecvTimeFromOrderNonce,\n Market,\n parseRawExpirationTimestamp,\n PerpMarket,\n ProductEngineType,\n SpotMarket,\n subaccountFromHex,\n} from '@nadohq/contracts';\nimport {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n mapValues,\n removeDecimals,\n toBigDecimal,\n toIntegerString,\n} from '@nadohq/utils';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\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 IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerVlpSnapshot,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerVlpSnapshot,\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: toBigDecimal(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigDecimal(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigDecimal(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const expiration = toBigDecimal(order.expiration);\n const expirationEncodedData = parseRawExpirationTimestamp(order.expiration);\n return {\n amount: toBigDecimal(order.amount),\n digest: order.digest,\n isolated: order.isolated,\n rawExpiration: expiration,\n isReduceOnly: expirationEncodedData.reduceOnly,\n expiration: expirationEncodedData.expirationTime,\n orderType: expirationEncodedData.type,\n nonce: toBigDecimal(order.nonce),\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 baseFilled: toBigDecimal(order.base_filled),\n quoteFilled: toBigDecimal(order.quote_filled),\n totalFee: toBigDecimal(order.fee),\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: toBigDecimal(event.net_entry_cumulative),\n netEntryUnrealized: toBigDecimal(event.net_entry_unrealized),\n netFundingCumulative: toBigDecimal(event.net_funding_cumulative),\n netFundingUnrealized: toBigDecimal(event.net_funding_unrealized),\n netInterestCumulative: toBigDecimal(event.net_interest_cumulative),\n netInterestUnrealized: toBigDecimal(event.net_interest_unrealized),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigDecimal(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: toBigDecimal(payment.timestamp),\n paymentAmount: toBigDecimal(payment.amount),\n balanceAmount: toBigDecimal(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: toBigDecimal(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: toBigDecimal(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: toBigDecimal(makerData.timestamp),\n makerFee: toBigDecimal(makerData.maker_fee),\n uptime: toBigDecimal(makerData.uptime),\n sumQMin: toBigDecimal(makerData.sum_q_min),\n qScore: toBigDecimal(makerData.q_score),\n makerShare: toBigDecimal(makerData.maker_share),\n expectedMakerReward: toBigDecimal(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n pnl: toBigDecimal(position.pnl),\n pnlRank: toBigDecimal(position.pnl_rank),\n percentRoi: toBigDecimal(position.roi),\n roiRank: toBigDecimal(position.roi_rank),\n accountValue: toBigDecimal(position.account_value),\n volume: position.volume ? toBigDecimal(position.volume) : undefined,\n updateTime: toBigDecimal(position.update_time),\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: toBigDecimal(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n return {\n contestId: contest.contest_id,\n startTime: toBigDecimal(contest.start_time),\n endTime: toBigDecimal(contest.end_time),\n period: toBigDecimal(contest.threshold),\n totalParticipants: toBigDecimal(contest.count),\n minRequiredAccountValue: toBigDecimal(contest.threshold),\n minRequiredVolume: toBigDecimal(contest.volume_threshold),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigDecimal(contest.last_updated),\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: toBigDecimal(candlestick.timestamp),\n volume: toBigDecimal(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigDecimal(snapshot.timestamp),\n cumulativeUsers: toBigDecimal(snapshot.cumulative_users),\n dailyActiveUsers: toBigDecimal(snapshot.daily_active_users),\n tvl: toBigDecimal(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigDecimal,\n ),\n cumulativeMakerFees: mapValues(\n snapshot.cumulative_maker_fees,\n toBigDecimal,\n ),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigDecimal,\n ),\n cumulativeTakerFees: mapValues(\n snapshot.cumulative_taker_fees,\n toBigDecimal,\n ),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigDecimal),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigDecimal),\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, toBigDecimal),\n totalBorrows: mapValues(snapshot.total_borrows, toBigDecimal),\n totalDeposits: mapValues(snapshot.total_deposits, toBigDecimal),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigDecimal,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigDecimal),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigDecimal),\n oraclePrices: mapValues(snapshot.oracle_prices, (value) =>\n removeDecimals(value),\n ),\n };\n}\n\nexport function mapIndexerVlpSnapshot(\n snapshot: IndexerServerVlpSnapshot,\n): IndexerVlpSnapshot {\n return {\n submissionIndex: snapshot.submission_idx,\n timestamp: toBigDecimal(snapshot.timestamp),\n cumulativeBurnAmountUsdc: toBigDecimal(snapshot.cumulative_burn_usdc),\n cumulativeMintAmountUsdc: toBigDecimal(snapshot.cumulative_mint_usdc),\n cumulativePnl: toBigDecimal(snapshot.cumulative_pnl),\n cumulativeTrades: toBigDecimal(snapshot.cumulative_trades),\n cumulativeVolume: toBigDecimal(snapshot.cumulative_volume),\n depositors: toBigDecimal(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigDecimal(snapshot.tvl),\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,uBAQO;AACP,2BAGO;AACP,mBAKO;AAsCA,SAAS,mCACd,QACgC;AAChC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,UAAU,OAAO,uBACb,8BAAgB,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,2BAAa,QAAQ,KAAK,QAAQ,MAAM;AAAA,MAChD,WAAW,QAAQ,KAAK;AAAA,MACxB,MAAM,mCAAkB;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AAAA,IACL,YAAQ,2BAAa,QAAQ,KAAK,QAAQ,MAAM;AAAA,IAChD,WAAW,QAAQ,KAAK;AAAA,IACxB,MAAM,mCAAkB;AAAA,IACxB,mBAAe,2BAAa,QAAQ,KAAK,QAAQ,eAAe;AAAA,EAClE;AACF;AAEO,SAAS,gBAAgB,OAAyC;AACvE,QAAM,iBAAa,2BAAa,MAAM,UAAU;AAChD,QAAM,4BAAwB,8CAA4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SAAS;AAAA,MAAe,CAAC,cAC/C,6BAAe,KAAK;AAAA,IACtB;AAAA,IACA,wBAAoB,wBAAU,SAAS,gBAAgB,yBAAY;AAAA,IACnE,kBAAc,wBAAU,SAAS,eAAe,yBAAY;AAAA,IAC5D,mBAAe,wBAAU,SAAS,gBAAgB,yBAAY;AAAA,IAC9D,0BAAsB;AAAA,MACpB,SAAS;AAAA,MACT;AAAA,IACF;AAAA,IACA,uBAAmB,wBAAU,SAAS,oBAAoB,yBAAY;AAAA,IACtE,wBAAoB,wBAAU,SAAS,qBAAqB,yBAAY;AAAA,IACxE,kBAAc;AAAA,MAAU,SAAS;AAAA,MAAe,CAAC,cAC/C,6BAAe,KAAK;AAAA,IACtB;AAAA,EACF;AACF;AAEO,SAAS,sBACd,UACoB;AACpB,SAAO;AAAA,IACL,iBAAiB,SAAS;AAAA,IAC1B,eAAW,2BAAa,SAAS,SAAS;AAAA,IAC1C,8BAA0B,2BAAa,SAAS,oBAAoB;AAAA,IACpE,8BAA0B,2BAAa,SAAS,oBAAoB;AAAA,IACpE,mBAAe,2BAAa,SAAS,cAAc;AAAA,IACnD,sBAAkB,2BAAa,SAAS,iBAAiB;AAAA,IACzD,sBAAkB,2BAAa,SAAS,iBAAiB;AAAA,IACzD,gBAAY,2BAAa,SAAS,UAAU;AAAA,IAC5C,iBAAa,6BAAe,SAAS,gBAAgB;AAAA,IACrD,SAAK,2BAAa,SAAS,GAAG;AAAA,EAChC;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n getRecvTimeFromOrderNonce,\n Market,\n parseRawExpirationTimestamp,\n PerpMarket,\n ProductEngineType,\n SpotMarket,\n subaccountFromHex,\n} from '@nadohq/contracts';\nimport {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n mapValues,\n removeDecimals,\n toBigDecimal,\n toIntegerString,\n} from '@nadohq/utils';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\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 IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerNlpSnapshot,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerNlpSnapshot,\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: toBigDecimal(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigDecimal(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigDecimal(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const expiration = toBigDecimal(order.expiration);\n const expirationEncodedData = parseRawExpirationTimestamp(order.expiration);\n return {\n amount: toBigDecimal(order.amount),\n digest: order.digest,\n isolated: order.isolated,\n rawExpiration: expiration,\n isReduceOnly: expirationEncodedData.reduceOnly,\n expiration: expirationEncodedData.expirationTime,\n orderType: expirationEncodedData.type,\n nonce: toBigDecimal(order.nonce),\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 baseFilled: toBigDecimal(order.base_filled),\n quoteFilled: toBigDecimal(order.quote_filled),\n totalFee: toBigDecimal(order.fee),\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: toBigDecimal(event.net_entry_cumulative),\n netEntryUnrealized: toBigDecimal(event.net_entry_unrealized),\n netFundingCumulative: toBigDecimal(event.net_funding_cumulative),\n netFundingUnrealized: toBigDecimal(event.net_funding_unrealized),\n netInterestCumulative: toBigDecimal(event.net_interest_cumulative),\n netInterestUnrealized: toBigDecimal(event.net_interest_unrealized),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigDecimal(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: toBigDecimal(payment.timestamp),\n paymentAmount: toBigDecimal(payment.amount),\n balanceAmount: toBigDecimal(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: toBigDecimal(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: toBigDecimal(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: toBigDecimal(makerData.timestamp),\n makerFee: toBigDecimal(makerData.maker_fee),\n uptime: toBigDecimal(makerData.uptime),\n sumQMin: toBigDecimal(makerData.sum_q_min),\n qScore: toBigDecimal(makerData.q_score),\n makerShare: toBigDecimal(makerData.maker_share),\n expectedMakerReward: toBigDecimal(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n pnl: toBigDecimal(position.pnl),\n pnlRank: toBigDecimal(position.pnl_rank),\n percentRoi: toBigDecimal(position.roi),\n roiRank: toBigDecimal(position.roi_rank),\n accountValue: toBigDecimal(position.account_value),\n volume: position.volume ? toBigDecimal(position.volume) : undefined,\n updateTime: toBigDecimal(position.update_time),\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: toBigDecimal(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n return {\n contestId: contest.contest_id,\n startTime: toBigDecimal(contest.start_time),\n endTime: toBigDecimal(contest.end_time),\n period: toBigDecimal(contest.threshold),\n totalParticipants: toBigDecimal(contest.count),\n minRequiredAccountValue: toBigDecimal(contest.threshold),\n minRequiredVolume: toBigDecimal(contest.volume_threshold),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigDecimal(contest.last_updated),\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: toBigDecimal(candlestick.timestamp),\n volume: toBigDecimal(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigDecimal(snapshot.timestamp),\n cumulativeUsers: toBigDecimal(snapshot.cumulative_users),\n dailyActiveUsers: toBigDecimal(snapshot.daily_active_users),\n tvl: toBigDecimal(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigDecimal,\n ),\n cumulativeMakerFees: mapValues(\n snapshot.cumulative_maker_fees,\n toBigDecimal,\n ),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigDecimal,\n ),\n cumulativeTakerFees: mapValues(\n snapshot.cumulative_taker_fees,\n toBigDecimal,\n ),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigDecimal),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigDecimal),\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, toBigDecimal),\n totalBorrows: mapValues(snapshot.total_borrows, toBigDecimal),\n totalDeposits: mapValues(snapshot.total_deposits, toBigDecimal),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigDecimal,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigDecimal),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigDecimal),\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: toBigDecimal(snapshot.timestamp),\n cumulativeBurnAmountUsdc: toBigDecimal(snapshot.cumulative_burn_usdc),\n cumulativeMintAmountUsdc: toBigDecimal(snapshot.cumulative_mint_usdc),\n cumulativePnl: toBigDecimal(snapshot.cumulative_pnl),\n cumulativeTrades: toBigDecimal(snapshot.cumulative_trades),\n cumulativeVolume: toBigDecimal(snapshot.cumulative_volume),\n depositors: toBigDecimal(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigDecimal(snapshot.tvl),\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,uBAQO;AACP,2BAGO;AACP,mBAKO;AAsCA,SAAS,mCACd,QACgC;AAChC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,UAAU,OAAO,uBACb,8BAAgB,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,2BAAa,QAAQ,KAAK,QAAQ,MAAM;AAAA,MAChD,WAAW,QAAQ,KAAK;AAAA,MACxB,MAAM,mCAAkB;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AAAA,IACL,YAAQ,2BAAa,QAAQ,KAAK,QAAQ,MAAM;AAAA,IAChD,WAAW,QAAQ,KAAK;AAAA,IACxB,MAAM,mCAAkB;AAAA,IACxB,mBAAe,2BAAa,QAAQ,KAAK,QAAQ,eAAe;AAAA,EAClE;AACF;AAEO,SAAS,gBAAgB,OAAyC;AACvE,QAAM,iBAAa,2BAAa,MAAM,UAAU;AAChD,QAAM,4BAAwB,8CAA4B,MAAM,UAAU;AAC1E,SAAO;AAAA,IACL,YAAQ,2BAAa,MAAM,MAAM;AAAA,IACjC,QAAQ,MAAM;AAAA,IACd,UAAU,MAAM;AAAA,IAChB,eAAe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,SAAS,eAAe,yBAAY;AAAA,IAC5D,mBAAe,wBAAU,SAAS,gBAAgB,yBAAY;AAAA,IAC9D,0BAAsB;AAAA,MACpB,SAAS;AAAA,MACT;AAAA,IACF;AAAA,IACA,uBAAmB,wBAAU,SAAS,oBAAoB,yBAAY;AAAA,IACtE,wBAAoB,wBAAU,SAAS,qBAAqB,yBAAY;AAAA,IACxE,kBAAc;AAAA,MAAU,SAAS;AAAA,MAAe,CAAC,cAC/C,6BAAe,KAAK;AAAA,IACtB;AAAA,EACF;AACF;AAEO,SAAS,sBACd,UACoB;AACpB,SAAO;AAAA,IACL,iBAAiB,SAAS;AAAA,IAC1B,eAAW,2BAAa,SAAS,SAAS;AAAA,IAC1C,8BAA0B,2BAAa,SAAS,oBAAoB;AAAA,IACpE,8BAA0B,2BAAa,SAAS,oBAAoB;AAAA,IACpE,mBAAe,2BAAa,SAAS,cAAc;AAAA,IACnD,sBAAkB,2BAAa,SAAS,iBAAiB;AAAA,IACzD,sBAAkB,2BAAa,SAAS,iBAAiB;AAAA,IACzD,gBAAY,2BAAa,SAAS,UAAU;AAAA,IAC5C,iBAAa,6BAAe,SAAS,gBAAgB;AAAA,IACrD,SAAK,2BAAa,SAAS,GAAG;AAAA,EAChC;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import { Market } from '@nadohq/contracts';
2
- import { IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerPerpBalance, IndexerOrder, IndexerEvent, IndexerEventWithTx, IndexerMatchEventBalances, IndexerProductPayment, IndexerPerpPrices, IndexerFundingRate, IndexerMaker, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerLeaderboardContest, Candlestick, IndexerMarketSnapshot, IndexerVlpSnapshot } from './types/clientTypes.cjs';
2
+ import { IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerPerpBalance, IndexerOrder, IndexerEvent, IndexerEventWithTx, IndexerMatchEventBalances, IndexerProductPayment, IndexerPerpPrices, IndexerFundingRate, IndexerMaker, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerLeaderboardContest, Candlestick, IndexerMarketSnapshot, IndexerNlpSnapshot } from './types/clientTypes.cjs';
3
3
  import { IndexerServerPerpPrices, IndexerServerFundingRate } from './types/serverTypes.cjs';
4
- import { IndexerServerSnapshotsInterval, IndexerServerProduct, IndexerServerBalance, IndexerServerOrder, IndexerServerEvent, IndexerServerTx, IndexerServerMatchEventBalances, IndexerServerProductPayment, IndexerServerMaker, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerLeaderboardContest, IndexerServerCandlestick, IndexerServerMarketSnapshot, IndexerServerVlpSnapshot } from './types/serverModelTypes.cjs';
4
+ import { IndexerServerSnapshotsInterval, IndexerServerProduct, IndexerServerBalance, IndexerServerOrder, IndexerServerEvent, IndexerServerTx, IndexerServerMatchEventBalances, IndexerServerProductPayment, IndexerServerMaker, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerLeaderboardContest, IndexerServerCandlestick, IndexerServerMarketSnapshot, IndexerServerNlpSnapshot } from './types/serverModelTypes.cjs';
5
5
  import '@nadohq/utils';
6
6
  import 'viem';
7
7
  import './types/CandlestickPeriod.cjs';
@@ -26,6 +26,6 @@ declare function mapIndexerLeaderboardRegistration(registration: IndexerServerLe
26
26
  declare function mapIndexerLeaderboardContest(contest: IndexerServerLeaderboardContest): IndexerLeaderboardContest;
27
27
  declare function mapIndexerCandlesticks(candlestick: IndexerServerCandlestick): Candlestick;
28
28
  declare function mapIndexerMarketSnapshot(snapshot: IndexerServerMarketSnapshot): IndexerMarketSnapshot;
29
- declare function mapIndexerVlpSnapshot(snapshot: IndexerServerVlpSnapshot): IndexerVlpSnapshot;
29
+ declare function mapIndexerNlpSnapshot(snapshot: IndexerServerNlpSnapshot): IndexerNlpSnapshot;
30
30
 
31
- export { mapIndexerCandlesticks, mapIndexerEvent, mapIndexerEventWithTx, mapIndexerFundingRate, mapIndexerLeaderboardContest, mapIndexerLeaderboardPosition, mapIndexerLeaderboardRegistration, mapIndexerMakerStatistics, mapIndexerMarketSnapshot, mapIndexerMatchEventBalances, mapIndexerOrder, mapIndexerPerpPrices, mapIndexerProductPayment, mapIndexerServerBalance, mapIndexerServerProduct, mapIndexerVlpSnapshot, mapSnapshotsIntervalToServerParams };
31
+ export { mapIndexerCandlesticks, mapIndexerEvent, mapIndexerEventWithTx, mapIndexerFundingRate, mapIndexerLeaderboardContest, mapIndexerLeaderboardPosition, mapIndexerLeaderboardRegistration, mapIndexerMakerStatistics, mapIndexerMarketSnapshot, mapIndexerMatchEventBalances, mapIndexerNlpSnapshot, mapIndexerOrder, mapIndexerPerpPrices, mapIndexerProductPayment, mapIndexerServerBalance, mapIndexerServerProduct, mapSnapshotsIntervalToServerParams };
@@ -1,7 +1,7 @@
1
1
  import { Market } from '@nadohq/contracts';
2
- import { IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerPerpBalance, IndexerOrder, IndexerEvent, IndexerEventWithTx, IndexerMatchEventBalances, IndexerProductPayment, IndexerPerpPrices, IndexerFundingRate, IndexerMaker, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerLeaderboardContest, Candlestick, IndexerMarketSnapshot, IndexerVlpSnapshot } from './types/clientTypes.js';
2
+ import { IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerPerpBalance, IndexerOrder, IndexerEvent, IndexerEventWithTx, IndexerMatchEventBalances, IndexerProductPayment, IndexerPerpPrices, IndexerFundingRate, IndexerMaker, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerLeaderboardContest, Candlestick, IndexerMarketSnapshot, IndexerNlpSnapshot } from './types/clientTypes.js';
3
3
  import { IndexerServerPerpPrices, IndexerServerFundingRate } from './types/serverTypes.js';
4
- import { IndexerServerSnapshotsInterval, IndexerServerProduct, IndexerServerBalance, IndexerServerOrder, IndexerServerEvent, IndexerServerTx, IndexerServerMatchEventBalances, IndexerServerProductPayment, IndexerServerMaker, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerLeaderboardContest, IndexerServerCandlestick, IndexerServerMarketSnapshot, IndexerServerVlpSnapshot } from './types/serverModelTypes.js';
4
+ import { IndexerServerSnapshotsInterval, IndexerServerProduct, IndexerServerBalance, IndexerServerOrder, IndexerServerEvent, IndexerServerTx, IndexerServerMatchEventBalances, IndexerServerProductPayment, IndexerServerMaker, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerLeaderboardContest, IndexerServerCandlestick, IndexerServerMarketSnapshot, IndexerServerNlpSnapshot } from './types/serverModelTypes.js';
5
5
  import '@nadohq/utils';
6
6
  import 'viem';
7
7
  import './types/CandlestickPeriod.js';
@@ -26,6 +26,6 @@ declare function mapIndexerLeaderboardRegistration(registration: IndexerServerLe
26
26
  declare function mapIndexerLeaderboardContest(contest: IndexerServerLeaderboardContest): IndexerLeaderboardContest;
27
27
  declare function mapIndexerCandlesticks(candlestick: IndexerServerCandlestick): Candlestick;
28
28
  declare function mapIndexerMarketSnapshot(snapshot: IndexerServerMarketSnapshot): IndexerMarketSnapshot;
29
- declare function mapIndexerVlpSnapshot(snapshot: IndexerServerVlpSnapshot): IndexerVlpSnapshot;
29
+ declare function mapIndexerNlpSnapshot(snapshot: IndexerServerNlpSnapshot): IndexerNlpSnapshot;
30
30
 
31
- export { mapIndexerCandlesticks, mapIndexerEvent, mapIndexerEventWithTx, mapIndexerFundingRate, mapIndexerLeaderboardContest, mapIndexerLeaderboardPosition, mapIndexerLeaderboardRegistration, mapIndexerMakerStatistics, mapIndexerMarketSnapshot, mapIndexerMatchEventBalances, mapIndexerOrder, mapIndexerPerpPrices, mapIndexerProductPayment, mapIndexerServerBalance, mapIndexerServerProduct, mapIndexerVlpSnapshot, mapSnapshotsIntervalToServerParams };
31
+ export { mapIndexerCandlesticks, mapIndexerEvent, mapIndexerEventWithTx, mapIndexerFundingRate, mapIndexerLeaderboardContest, mapIndexerLeaderboardPosition, mapIndexerLeaderboardRegistration, mapIndexerMakerStatistics, mapIndexerMarketSnapshot, mapIndexerMatchEventBalances, mapIndexerNlpSnapshot, mapIndexerOrder, mapIndexerPerpPrices, mapIndexerProductPayment, mapIndexerServerBalance, mapIndexerServerProduct, mapSnapshotsIntervalToServerParams };
@@ -260,7 +260,7 @@ function mapIndexerMarketSnapshot(snapshot) {
260
260
  )
261
261
  };
262
262
  }
263
- function mapIndexerVlpSnapshot(snapshot) {
263
+ function mapIndexerNlpSnapshot(snapshot) {
264
264
  return {
265
265
  submissionIndex: snapshot.submission_idx,
266
266
  timestamp: toBigDecimal(snapshot.timestamp),
@@ -285,12 +285,12 @@ export {
285
285
  mapIndexerMakerStatistics,
286
286
  mapIndexerMarketSnapshot,
287
287
  mapIndexerMatchEventBalances,
288
+ mapIndexerNlpSnapshot,
288
289
  mapIndexerOrder,
289
290
  mapIndexerPerpPrices,
290
291
  mapIndexerProductPayment,
291
292
  mapIndexerServerBalance,
292
293
  mapIndexerServerProduct,
293
- mapIndexerVlpSnapshot,
294
294
  mapSnapshotsIntervalToServerParams
295
295
  };
296
296
  //# sourceMappingURL=dataMappers.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n getRecvTimeFromOrderNonce,\n Market,\n parseRawExpirationTimestamp,\n PerpMarket,\n ProductEngineType,\n SpotMarket,\n subaccountFromHex,\n} from '@nadohq/contracts';\nimport {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n mapValues,\n removeDecimals,\n toBigDecimal,\n toIntegerString,\n} from '@nadohq/utils';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\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 IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerVlpSnapshot,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerVlpSnapshot,\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: toBigDecimal(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigDecimal(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigDecimal(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const expiration = toBigDecimal(order.expiration);\n const expirationEncodedData = parseRawExpirationTimestamp(order.expiration);\n return {\n amount: toBigDecimal(order.amount),\n digest: order.digest,\n isolated: order.isolated,\n rawExpiration: expiration,\n isReduceOnly: expirationEncodedData.reduceOnly,\n expiration: expirationEncodedData.expirationTime,\n orderType: expirationEncodedData.type,\n nonce: toBigDecimal(order.nonce),\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 baseFilled: toBigDecimal(order.base_filled),\n quoteFilled: toBigDecimal(order.quote_filled),\n totalFee: toBigDecimal(order.fee),\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: toBigDecimal(event.net_entry_cumulative),\n netEntryUnrealized: toBigDecimal(event.net_entry_unrealized),\n netFundingCumulative: toBigDecimal(event.net_funding_cumulative),\n netFundingUnrealized: toBigDecimal(event.net_funding_unrealized),\n netInterestCumulative: toBigDecimal(event.net_interest_cumulative),\n netInterestUnrealized: toBigDecimal(event.net_interest_unrealized),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigDecimal(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: toBigDecimal(payment.timestamp),\n paymentAmount: toBigDecimal(payment.amount),\n balanceAmount: toBigDecimal(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: toBigDecimal(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: toBigDecimal(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: toBigDecimal(makerData.timestamp),\n makerFee: toBigDecimal(makerData.maker_fee),\n uptime: toBigDecimal(makerData.uptime),\n sumQMin: toBigDecimal(makerData.sum_q_min),\n qScore: toBigDecimal(makerData.q_score),\n makerShare: toBigDecimal(makerData.maker_share),\n expectedMakerReward: toBigDecimal(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n pnl: toBigDecimal(position.pnl),\n pnlRank: toBigDecimal(position.pnl_rank),\n percentRoi: toBigDecimal(position.roi),\n roiRank: toBigDecimal(position.roi_rank),\n accountValue: toBigDecimal(position.account_value),\n volume: position.volume ? toBigDecimal(position.volume) : undefined,\n updateTime: toBigDecimal(position.update_time),\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: toBigDecimal(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n return {\n contestId: contest.contest_id,\n startTime: toBigDecimal(contest.start_time),\n endTime: toBigDecimal(contest.end_time),\n period: toBigDecimal(contest.threshold),\n totalParticipants: toBigDecimal(contest.count),\n minRequiredAccountValue: toBigDecimal(contest.threshold),\n minRequiredVolume: toBigDecimal(contest.volume_threshold),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigDecimal(contest.last_updated),\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: toBigDecimal(candlestick.timestamp),\n volume: toBigDecimal(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigDecimal(snapshot.timestamp),\n cumulativeUsers: toBigDecimal(snapshot.cumulative_users),\n dailyActiveUsers: toBigDecimal(snapshot.daily_active_users),\n tvl: toBigDecimal(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigDecimal,\n ),\n cumulativeMakerFees: mapValues(\n snapshot.cumulative_maker_fees,\n toBigDecimal,\n ),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigDecimal,\n ),\n cumulativeTakerFees: mapValues(\n snapshot.cumulative_taker_fees,\n toBigDecimal,\n ),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigDecimal),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigDecimal),\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, toBigDecimal),\n totalBorrows: mapValues(snapshot.total_borrows, toBigDecimal),\n totalDeposits: mapValues(snapshot.total_deposits, toBigDecimal),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigDecimal,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigDecimal),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigDecimal),\n oraclePrices: mapValues(snapshot.oracle_prices, (value) =>\n removeDecimals(value),\n ),\n };\n}\n\nexport function mapIndexerVlpSnapshot(\n snapshot: IndexerServerVlpSnapshot,\n): IndexerVlpSnapshot {\n return {\n submissionIndex: snapshot.submission_idx,\n timestamp: toBigDecimal(snapshot.timestamp),\n cumulativeBurnAmountUsdc: toBigDecimal(snapshot.cumulative_burn_usdc),\n cumulativeMintAmountUsdc: toBigDecimal(snapshot.cumulative_mint_usdc),\n cumulativePnl: toBigDecimal(snapshot.cumulative_pnl),\n cumulativeTrades: toBigDecimal(snapshot.cumulative_trades),\n cumulativeVolume: toBigDecimal(snapshot.cumulative_volume),\n depositors: toBigDecimal(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigDecimal(snapshot.tvl),\n };\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP;AA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AAO;AAAA,IACL,iBAAiB,SAAS;AAAA,IAC1B,WAAW,aAAa,SAAS,SAAS;AAAA,IAC1C,0BAA0B,aAAa,SAAS,oBAAoB;AAAA,IACpE,0BAA0B,aAAa,SAAS,oBAAoB;AAAA,IACpE,eAAe,aAAa,SAAS,cAAc;AAAA,IACnD,kBAAkB,aAAa,SAAS,iBAAiB;AAAA,IACzD,kBAAkB,aAAa,SAAS,iBAAiB;AAAA,IACzD,YAAY,aAAa,SAAS,UAAU;AAAA,IAC5C,aAAa,eAAe,SAAS,gBAAgB;AAAA,IACrD,KAAK,aAAa,SAAS,GAAG;AAAA,EAChC;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/dataMappers.ts"],"sourcesContent":["import {\n getRecvTimeFromOrderNonce,\n Market,\n parseRawExpirationTimestamp,\n PerpMarket,\n ProductEngineType,\n SpotMarket,\n subaccountFromHex,\n} from '@nadohq/contracts';\nimport {\n mapEngineServerPerpProduct,\n mapEngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport {\n mapValues,\n removeDecimals,\n toBigDecimal,\n toIntegerString,\n} from '@nadohq/utils';\nimport {\n Candlestick,\n IndexerEvent,\n IndexerEventWithTx,\n IndexerFundingRate,\n IndexerLeaderboardContest,\n IndexerLeaderboardParticipant,\n IndexerLeaderboardRegistration,\n IndexerMaker,\n IndexerMarketSnapshot,\n IndexerMatchEventBalances,\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 IndexerServerOrder,\n IndexerServerPerpPrices,\n IndexerServerProduct,\n IndexerServerProductPayment,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerNlpSnapshot,\n IndexerSnapshotsIntervalParams,\n IndexerSpotBalance,\n IndexerNlpSnapshot,\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: toBigDecimal(balance.spot.balance.amount),\n productId: balance.spot.product_id,\n type: ProductEngineType.SPOT,\n };\n }\n return {\n amount: toBigDecimal(balance.perp.balance.amount),\n productId: balance.perp.product_id,\n type: ProductEngineType.PERP,\n vQuoteBalance: toBigDecimal(balance.perp.balance.v_quote_balance),\n };\n}\n\nexport function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {\n const expiration = toBigDecimal(order.expiration);\n const expirationEncodedData = parseRawExpirationTimestamp(order.expiration);\n return {\n amount: toBigDecimal(order.amount),\n digest: order.digest,\n isolated: order.isolated,\n rawExpiration: expiration,\n isReduceOnly: expirationEncodedData.reduceOnly,\n expiration: expirationEncodedData.expirationTime,\n orderType: expirationEncodedData.type,\n nonce: toBigDecimal(order.nonce),\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 baseFilled: toBigDecimal(order.base_filled),\n quoteFilled: toBigDecimal(order.quote_filled),\n totalFee: toBigDecimal(order.fee),\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: toBigDecimal(event.net_entry_cumulative),\n netEntryUnrealized: toBigDecimal(event.net_entry_unrealized),\n netFundingCumulative: toBigDecimal(event.net_funding_cumulative),\n netFundingUnrealized: toBigDecimal(event.net_funding_unrealized),\n netInterestCumulative: toBigDecimal(event.net_interest_cumulative),\n netInterestUnrealized: toBigDecimal(event.net_interest_unrealized),\n },\n };\n}\n\nexport function mapIndexerEventWithTx(\n event: IndexerServerEvent,\n tx: IndexerServerTx,\n): IndexerEventWithTx {\n return {\n timestamp: toBigDecimal(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: toBigDecimal(payment.timestamp),\n paymentAmount: toBigDecimal(payment.amount),\n balanceAmount: toBigDecimal(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: toBigDecimal(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: toBigDecimal(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: toBigDecimal(makerData.timestamp),\n makerFee: toBigDecimal(makerData.maker_fee),\n uptime: toBigDecimal(makerData.uptime),\n sumQMin: toBigDecimal(makerData.sum_q_min),\n qScore: toBigDecimal(makerData.q_score),\n makerShare: toBigDecimal(makerData.maker_share),\n expectedMakerReward: toBigDecimal(makerData.expected_maker_reward),\n };\n }),\n };\n}\n\nexport function mapIndexerLeaderboardPosition(\n position: IndexerServerLeaderboardPosition,\n): IndexerLeaderboardParticipant {\n return {\n subaccount: subaccountFromHex(position.subaccount),\n contestId: position.contest_id,\n pnl: toBigDecimal(position.pnl),\n pnlRank: toBigDecimal(position.pnl_rank),\n percentRoi: toBigDecimal(position.roi),\n roiRank: toBigDecimal(position.roi_rank),\n accountValue: toBigDecimal(position.account_value),\n volume: position.volume ? toBigDecimal(position.volume) : undefined,\n updateTime: toBigDecimal(position.update_time),\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: toBigDecimal(registration.update_time),\n };\n}\n\nexport function mapIndexerLeaderboardContest(\n contest: IndexerServerLeaderboardContest,\n): IndexerLeaderboardContest {\n return {\n contestId: contest.contest_id,\n startTime: toBigDecimal(contest.start_time),\n endTime: toBigDecimal(contest.end_time),\n period: toBigDecimal(contest.threshold),\n totalParticipants: toBigDecimal(contest.count),\n minRequiredAccountValue: toBigDecimal(contest.threshold),\n minRequiredVolume: toBigDecimal(contest.volume_threshold),\n requiredProductIds: contest.product_ids,\n active: contest.active,\n lastUpdated: toBigDecimal(contest.last_updated),\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: toBigDecimal(candlestick.timestamp),\n volume: toBigDecimal(candlestick.volume),\n };\n}\n\nexport function mapIndexerMarketSnapshot(\n snapshot: IndexerServerMarketSnapshot,\n): IndexerMarketSnapshot {\n return {\n timestamp: toBigDecimal(snapshot.timestamp),\n cumulativeUsers: toBigDecimal(snapshot.cumulative_users),\n dailyActiveUsers: toBigDecimal(snapshot.daily_active_users),\n tvl: toBigDecimal(snapshot.tvl),\n borrowRates: mapValues(snapshot.borrow_rates, (value) =>\n removeDecimals(value),\n ),\n cumulativeLiquidationAmounts: mapValues(\n snapshot.cumulative_liquidation_amounts,\n toBigDecimal,\n ),\n cumulativeMakerFees: mapValues(\n snapshot.cumulative_maker_fees,\n toBigDecimal,\n ),\n cumulativeSequencerFees: mapValues(\n snapshot.cumulative_sequencer_fees,\n toBigDecimal,\n ),\n cumulativeTakerFees: mapValues(\n snapshot.cumulative_taker_fees,\n toBigDecimal,\n ),\n cumulativeTrades: mapValues(snapshot.cumulative_trades, toBigDecimal),\n cumulativeVolumes: mapValues(snapshot.cumulative_volumes, toBigDecimal),\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, toBigDecimal),\n totalBorrows: mapValues(snapshot.total_borrows, toBigDecimal),\n totalDeposits: mapValues(snapshot.total_deposits, toBigDecimal),\n cumulativeTradeSizes: mapValues(\n snapshot.cumulative_trade_sizes,\n toBigDecimal,\n ),\n cumulativeInflows: mapValues(snapshot.cumulative_inflows, toBigDecimal),\n cumulativeOutflows: mapValues(snapshot.cumulative_outflows, toBigDecimal),\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: toBigDecimal(snapshot.timestamp),\n cumulativeBurnAmountUsdc: toBigDecimal(snapshot.cumulative_burn_usdc),\n cumulativeMintAmountUsdc: toBigDecimal(snapshot.cumulative_mint_usdc),\n cumulativePnl: toBigDecimal(snapshot.cumulative_pnl),\n cumulativeTrades: toBigDecimal(snapshot.cumulative_trades),\n cumulativeVolume: toBigDecimal(snapshot.cumulative_volume),\n depositors: toBigDecimal(snapshot.depositors),\n oraclePrice: removeDecimals(snapshot.oracle_price_x18),\n tvl: toBigDecimal(snapshot.tvl),\n };\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAsCA,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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AAS,UAAU;AAAA,IAC5C,aAAa,eAAe,SAAS,gBAAgB;AAAA,IACrD,KAAK,aAAa,SAAS,GAAG;AAAA,EAChC;AACF;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- export { Candlestick, GetIndexerBacklogResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerEdgeMarketSnapshotResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEventsLimitType, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerQuotePriceResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, GetIndexerVlpSnapshotsParams, GetIndexerVlpSnapshotsResponse, IndexerBalanceTrackedVars, IndexerEvent, IndexerEventBalanceStateSnapshot, IndexerEventPerpStateSnapshot, IndexerEventSpotStateSnapshot, IndexerEventWithTx, IndexerFundingRate, IndexerLeaderboardContest, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerMaker, IndexerMakerSnapshot, IndexerMarketSnapshot, IndexerMatchEvent, IndexerMatchEventBalances, IndexerOraclePrice, IndexerOrder, IndexerPerpBalance, IndexerPerpPrices, IndexerProductPayment, IndexerProductSnapshot, IndexerSnapshotBalance, IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerSubaccountSnapshot, IndexerVlpSnapshot, ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse } from './types/clientTypes.cjs';
2
- export { BaseIndexerPaginatedEvent, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountVlpEventsParams, GetIndexerSubaccountVlpEventsResponse, IndexerCollateralEvent, IndexerLiquidationEvent, IndexerPaginationMeta, IndexerPaginationParams, IndexerSettlementEvent, IndexerVlpEvent, PaginatedIndexerEventsResponse, WithPaginationMeta } from './types/paginatedEventsTypes.cjs';
3
- export { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerUsdcPriceResponse, IndexerServerVlpSnapshotsParams, IndexerServerVlpSnapshotsResponse } from './types/serverTypes.cjs';
4
- export { IndexerServerBalance, IndexerServerCandlestick, IndexerServerEvent, IndexerServerLeaderboardContest, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerMaker, IndexerServerMakerData, IndexerServerMarketSnapshot, IndexerServerMarketSnapshotInterval, IndexerServerMatchEvent, IndexerServerMatchEventBalances, IndexerServerOraclePrice, IndexerServerOrder, IndexerServerProduct, IndexerServerProductPayment, IndexerServerProductSnapshot, IndexerServerSnapshotsInterval, IndexerServerTx, IndexerServerVlpSnapshot } from './types/serverModelTypes.cjs';
1
+ export { Candlestick, GetIndexerBacklogResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerEdgeMarketSnapshotResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEventsLimitType, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerNlpSnapshotsParams, GetIndexerNlpSnapshotsResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerQuotePriceResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, IndexerBalanceTrackedVars, IndexerEvent, IndexerEventBalanceStateSnapshot, IndexerEventPerpStateSnapshot, IndexerEventSpotStateSnapshot, IndexerEventWithTx, IndexerFundingRate, IndexerLeaderboardContest, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerMaker, IndexerMakerSnapshot, IndexerMarketSnapshot, IndexerMatchEvent, IndexerMatchEventBalances, IndexerNlpSnapshot, IndexerOraclePrice, IndexerOrder, IndexerPerpBalance, IndexerPerpPrices, IndexerProductPayment, IndexerProductSnapshot, IndexerSnapshotBalance, IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerSubaccountSnapshot, ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse } from './types/clientTypes.cjs';
2
+ export { BaseIndexerPaginatedEvent, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountNlpEventsParams, GetIndexerSubaccountNlpEventsResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, IndexerCollateralEvent, IndexerLiquidationEvent, IndexerNlpEvent, IndexerPaginationMeta, IndexerPaginationParams, IndexerSettlementEvent, PaginatedIndexerEventsResponse, WithPaginationMeta } from './types/paginatedEventsTypes.cjs';
3
+ export { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerUsdcPriceResponse } from './types/serverTypes.cjs';
4
+ export { IndexerServerBalance, IndexerServerCandlestick, IndexerServerEvent, IndexerServerLeaderboardContest, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerMaker, IndexerServerMakerData, IndexerServerMarketSnapshot, IndexerServerMarketSnapshotInterval, IndexerServerMatchEvent, IndexerServerMatchEventBalances, IndexerServerNlpSnapshot, IndexerServerOraclePrice, IndexerServerOrder, IndexerServerProduct, IndexerServerProductPayment, IndexerServerProductSnapshot, IndexerServerSnapshotsInterval, IndexerServerTx } from './types/serverModelTypes.cjs';
5
5
  export { CandlestickPeriod } from './types/CandlestickPeriod.cjs';
6
6
  export { IndexerEventType } from './types/IndexerEventType.cjs';
7
7
  export { IndexerLeaderboardRankType } from './types/IndexerLeaderboardType.cjs';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { Candlestick, GetIndexerBacklogResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerEdgeMarketSnapshotResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEventsLimitType, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerQuotePriceResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, GetIndexerVlpSnapshotsParams, GetIndexerVlpSnapshotsResponse, IndexerBalanceTrackedVars, IndexerEvent, IndexerEventBalanceStateSnapshot, IndexerEventPerpStateSnapshot, IndexerEventSpotStateSnapshot, IndexerEventWithTx, IndexerFundingRate, IndexerLeaderboardContest, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerMaker, IndexerMakerSnapshot, IndexerMarketSnapshot, IndexerMatchEvent, IndexerMatchEventBalances, IndexerOraclePrice, IndexerOrder, IndexerPerpBalance, IndexerPerpPrices, IndexerProductPayment, IndexerProductSnapshot, IndexerSnapshotBalance, IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerSubaccountSnapshot, IndexerVlpSnapshot, ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse } from './types/clientTypes.js';
2
- export { BaseIndexerPaginatedEvent, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountVlpEventsParams, GetIndexerSubaccountVlpEventsResponse, IndexerCollateralEvent, IndexerLiquidationEvent, IndexerPaginationMeta, IndexerPaginationParams, IndexerSettlementEvent, IndexerVlpEvent, PaginatedIndexerEventsResponse, WithPaginationMeta } from './types/paginatedEventsTypes.js';
3
- export { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerUsdcPriceResponse, IndexerServerVlpSnapshotsParams, IndexerServerVlpSnapshotsResponse } from './types/serverTypes.js';
4
- export { IndexerServerBalance, IndexerServerCandlestick, IndexerServerEvent, IndexerServerLeaderboardContest, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerMaker, IndexerServerMakerData, IndexerServerMarketSnapshot, IndexerServerMarketSnapshotInterval, IndexerServerMatchEvent, IndexerServerMatchEventBalances, IndexerServerOraclePrice, IndexerServerOrder, IndexerServerProduct, IndexerServerProductPayment, IndexerServerProductSnapshot, IndexerServerSnapshotsInterval, IndexerServerTx, IndexerServerVlpSnapshot } from './types/serverModelTypes.js';
1
+ export { Candlestick, GetIndexerBacklogResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerEdgeMarketSnapshotResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEventsLimitType, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerNlpSnapshotsParams, GetIndexerNlpSnapshotsResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerQuotePriceResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, IndexerBalanceTrackedVars, IndexerEvent, IndexerEventBalanceStateSnapshot, IndexerEventPerpStateSnapshot, IndexerEventSpotStateSnapshot, IndexerEventWithTx, IndexerFundingRate, IndexerLeaderboardContest, IndexerLeaderboardParticipant, IndexerLeaderboardRegistration, IndexerMaker, IndexerMakerSnapshot, IndexerMarketSnapshot, IndexerMatchEvent, IndexerMatchEventBalances, IndexerNlpSnapshot, IndexerOraclePrice, IndexerOrder, IndexerPerpBalance, IndexerPerpPrices, IndexerProductPayment, IndexerProductSnapshot, IndexerSnapshotBalance, IndexerSnapshotsIntervalParams, IndexerSpotBalance, IndexerSubaccountSnapshot, ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse } from './types/clientTypes.js';
2
+ export { BaseIndexerPaginatedEvent, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountNlpEventsParams, GetIndexerSubaccountNlpEventsResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, IndexerCollateralEvent, IndexerLiquidationEvent, IndexerNlpEvent, IndexerPaginationMeta, IndexerPaginationParams, IndexerSettlementEvent, PaginatedIndexerEventsResponse, WithPaginationMeta } from './types/paginatedEventsTypes.js';
3
+ export { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerUsdcPriceResponse } from './types/serverTypes.js';
4
+ export { IndexerServerBalance, IndexerServerCandlestick, IndexerServerEvent, IndexerServerLeaderboardContest, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerMaker, IndexerServerMakerData, IndexerServerMarketSnapshot, IndexerServerMarketSnapshotInterval, IndexerServerMatchEvent, IndexerServerMatchEventBalances, IndexerServerNlpSnapshot, IndexerServerOraclePrice, IndexerServerOrder, IndexerServerProduct, IndexerServerProductPayment, IndexerServerProductSnapshot, IndexerServerSnapshotsInterval, IndexerServerTx } from './types/serverModelTypes.js';
5
5
  export { CandlestickPeriod } from './types/CandlestickPeriod.js';
6
6
  export { IndexerEventType } from './types/IndexerEventType.js';
7
7
  export { IndexerLeaderboardRankType } from './types/IndexerLeaderboardType.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/IndexerEventType.ts"],"sourcesContent":["export type IndexerEventType =\n | 'liquidate_subaccount'\n | 'deposit_collateral'\n | 'withdraw_collateral'\n | 'settle_pnl'\n | 'match_orders'\n | 'transfer_quote'\n | 'mint_vlp'\n | 'burn_vlp';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/IndexerEventType.ts"],"sourcesContent":["export type IndexerEventType =\n | 'liquidate_subaccount'\n | 'deposit_collateral'\n | 'withdraw_collateral'\n | 'settle_pnl'\n | 'match_orders'\n | 'transfer_quote'\n | 'mint_nlp'\n | 'burn_nlp';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,3 +1,3 @@
1
- type IndexerEventType = 'liquidate_subaccount' | 'deposit_collateral' | 'withdraw_collateral' | 'settle_pnl' | 'match_orders' | 'transfer_quote' | 'mint_vlp' | 'burn_vlp';
1
+ type IndexerEventType = 'liquidate_subaccount' | 'deposit_collateral' | 'withdraw_collateral' | 'settle_pnl' | 'match_orders' | 'transfer_quote' | 'mint_nlp' | 'burn_nlp';
2
2
 
3
3
  export type { IndexerEventType };
@@ -1,3 +1,3 @@
1
- type IndexerEventType = 'liquidate_subaccount' | 'deposit_collateral' | 'withdraw_collateral' | 'settle_pnl' | 'match_orders' | 'transfer_quote' | 'mint_vlp' | 'burn_vlp';
1
+ type IndexerEventType = 'liquidate_subaccount' | 'deposit_collateral' | 'withdraw_collateral' | 'settle_pnl' | 'match_orders' | 'transfer_quote' | 'mint_nlp' | 'burn_nlp';
2
2
 
3
3
  export type { IndexerEventType };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/NadoTx.ts"],"sourcesContent":["export interface NadoMatchOrdersTx {\n match_orders: {\n product_id: number;\n };\n}\n\nexport interface NadoMatchOrdersRfqTx {\n match_orders_r_f_q: {\n product_id: number;\n };\n}\n\nexport interface NadoLiquidateSubaccountTx {\n liquidate_subaccount: {\n sender: string;\n liquidatee: string;\n mode: number;\n // On V2 - should encode health group\n product_id: number | undefined;\n // On V1\n health_group: number | undefined;\n amount: string;\n nonce: number;\n };\n}\n\nexport interface NadoWithdrawCollateralTx {\n withdraw_collateral: {\n sender: string;\n product_id: number;\n amount: string;\n nonce: number;\n };\n}\n\nexport interface NadoDepositCollateralTx {\n deposit_collateral: {\n sender: string;\n product_id: number;\n amount: string;\n };\n}\n\nexport interface NadoTransferQuoteTx {\n transfer_quote: {\n sender: string;\n recipient: string;\n amount: string;\n nonce: number;\n };\n}\n\nexport type NadoTx =\n | NadoMatchOrdersTx\n | NadoMatchOrdersRfqTx\n | NadoLiquidateSubaccountTx\n | NadoDepositCollateralTx\n | NadoTransferQuoteTx\n | NadoWithdrawCollateralTx\n | {\n // TODO: Populate all types\n [key: string]: never;\n };"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/NadoTx.ts"],"sourcesContent":["export interface NadoMatchOrdersTx {\n match_orders: {\n product_id: number;\n };\n}\n\nexport interface NadoMatchOrdersRfqTx {\n match_orders_r_f_q: {\n product_id: number;\n };\n}\n\nexport interface NadoLiquidateSubaccountTx {\n liquidate_subaccount: {\n sender: string;\n liquidatee: string;\n mode: number;\n // On V2 - should encode health group\n product_id: number | undefined;\n // On V1\n health_group: number | undefined;\n amount: string;\n nonce: number;\n };\n}\n\nexport interface NadoWithdrawCollateralTx {\n withdraw_collateral: {\n sender: string;\n product_id: number;\n amount: string;\n nonce: number;\n };\n}\n\nexport interface NadoDepositCollateralTx {\n deposit_collateral: {\n sender: string;\n product_id: number;\n amount: string;\n };\n}\n\nexport interface NadoTransferQuoteTx {\n transfer_quote: {\n sender: string;\n recipient: string;\n amount: string;\n nonce: number;\n };\n}\n\nexport type NadoTx =\n | NadoMatchOrdersTx\n | NadoMatchOrdersRfqTx\n | NadoLiquidateSubaccountTx\n | NadoDepositCollateralTx\n | NadoTransferQuoteTx\n | NadoWithdrawCollateralTx\n | {\n // TODO: Populate all types\n [key: string]: never;\n };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}