@nadohq/indexer-client 0.1.0-alpha.4 → 0.1.0-alpha.40

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 (55) hide show
  1. package/dist/IndexerBaseClient.cjs +38 -19
  2. package/dist/IndexerBaseClient.cjs.map +1 -1
  3. package/dist/IndexerBaseClient.d.cts +7 -2
  4. package/dist/IndexerBaseClient.d.ts +7 -2
  5. package/dist/IndexerBaseClient.js +40 -19
  6. package/dist/IndexerBaseClient.js.map +1 -1
  7. package/dist/IndexerClient.cjs +11 -10
  8. package/dist/IndexerClient.cjs.map +1 -1
  9. package/dist/IndexerClient.js +11 -8
  10. package/dist/IndexerClient.js.map +1 -1
  11. package/dist/dataMappers.cjs +109 -96
  12. package/dist/dataMappers.cjs.map +1 -1
  13. package/dist/dataMappers.d.cts +4 -3
  14. package/dist/dataMappers.d.ts +4 -3
  15. package/dist/dataMappers.js +22 -11
  16. package/dist/dataMappers.js.map +1 -1
  17. package/dist/endpoints.cjs +2 -2
  18. package/dist/endpoints.cjs.map +1 -1
  19. package/dist/endpoints.js +2 -2
  20. package/dist/endpoints.js.map +1 -1
  21. package/dist/index.cjs +6 -4
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +9 -9
  24. package/dist/index.d.ts +9 -9
  25. package/dist/index.js +3 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/types/clientTypes.cjs.map +1 -1
  28. package/dist/types/clientTypes.d.cts +66 -11
  29. package/dist/types/clientTypes.d.ts +66 -11
  30. package/dist/types/index.cjs +11 -11
  31. package/dist/types/index.cjs.map +1 -1
  32. package/dist/types/index.d.cts +5 -5
  33. package/dist/types/index.d.ts +5 -5
  34. package/dist/types/index.js +5 -5
  35. package/dist/types/index.js.map +1 -1
  36. package/dist/types/paginatedEventsTypes.cjs.map +1 -1
  37. package/dist/types/paginatedEventsTypes.d.cts +6 -6
  38. package/dist/types/paginatedEventsTypes.d.ts +6 -6
  39. package/dist/types/serverModelTypes.cjs.map +1 -1
  40. package/dist/types/serverModelTypes.d.cts +8 -4
  41. package/dist/types/serverModelTypes.d.ts +8 -4
  42. package/dist/types/serverTypes.cjs.map +1 -1
  43. package/dist/types/serverTypes.d.cts +32 -7
  44. package/dist/types/serverTypes.d.ts +32 -7
  45. package/package.json +8 -4
  46. package/src/IndexerBaseClient.ts +49 -25
  47. package/src/IndexerClient.ts +14 -11
  48. package/src/dataMappers.ts +27 -12
  49. package/src/endpoints.ts +2 -2
  50. package/src/index.ts +3 -2
  51. package/src/types/clientTypes.ts +75 -10
  52. package/src/types/index.ts +5 -5
  53. package/src/types/paginatedEventsTypes.ts +1 -1
  54. package/src/types/serverModelTypes.ts +8 -4
  55. package/src/types/serverTypes.ts +43 -7
@@ -1,4 +1,5 @@
1
1
  import {
2
+ BigDecimal,
2
3
  EIP712OrderValues,
3
4
  Market,
4
5
  OrderAppendix,
@@ -9,8 +10,7 @@ import {
9
10
  SpotMarket,
10
11
  Subaccount,
11
12
  } from '@nadohq/shared';
12
- import { BigDecimal } from '@nadohq/shared';
13
- import { Hex } from 'viem';
13
+ import { Address, Hex } from 'viem';
14
14
  import { CandlestickPeriod } from './CandlestickPeriod';
15
15
  import { IndexerEventType } from './IndexerEventType';
16
16
  import { IndexerLeaderboardRankType } from './IndexerLeaderboardType';
@@ -18,6 +18,7 @@ import { NadoTx, NadoWithdrawCollateralTx } from './NadoTx';
18
18
  import {
19
19
  IndexerServerFastWithdrawalSignatureParams,
20
20
  IndexerServerListSubaccountsParams,
21
+ IndexerServerTriggerTypeFilter,
21
22
  } from './serverTypes';
22
23
 
23
24
  /**
@@ -53,6 +54,7 @@ export interface IndexerBalanceTrackedVars {
53
54
  netFundingCumulative: BigDecimal;
54
55
  netEntryUnrealized: BigDecimal;
55
56
  netEntryCumulative: BigDecimal;
57
+ quoteVolumeCumulative: BigDecimal;
56
58
  }
57
59
 
58
60
  export interface IndexerEvent<
@@ -86,6 +88,9 @@ export type ListIndexerSubaccountsParams = IndexerServerListSubaccountsParams;
86
88
 
87
89
  export type ListIndexerSubaccountsResponse = ({
88
90
  hexId: string;
91
+ // Unix timestamp in seconds
92
+ createdAt: number;
93
+ isolated: boolean;
89
94
  } & Subaccount)[];
90
95
 
91
96
  /**
@@ -313,7 +318,7 @@ export type GetIndexerEventsLimitType = 'events' | 'txs';
313
318
  export interface GetIndexerEventsParams {
314
319
  // Max submission index, inclusive
315
320
  startCursor?: string;
316
- subaccount?: Subaccount;
321
+ subaccounts?: Subaccount[];
317
322
  productIds?: number[];
318
323
  // If not given, will return both isolated & non-iso events
319
324
  isolated?: boolean;
@@ -336,11 +341,12 @@ export type GetIndexerEventsResponse = IndexerEventWithTx[];
336
341
  export interface GetIndexerOrdersParams {
337
342
  // Max submission index, inclusive
338
343
  startCursor?: string;
339
- subaccount?: Subaccount;
344
+ subaccounts?: Subaccount[];
340
345
  minTimestampInclusive?: number;
341
346
  maxTimestampInclusive?: number;
342
347
  limit?: number;
343
348
  productIds?: number[];
349
+ triggerTypes?: IndexerServerTriggerTypeFilter[];
344
350
  // If not given, will return both isolated & non-iso orders
345
351
  isolated?: boolean;
346
352
  digests?: string[];
@@ -349,7 +355,6 @@ export interface GetIndexerOrdersParams {
349
355
  export interface IndexerOrder {
350
356
  digest: string;
351
357
  subaccount: string;
352
- isolated: boolean;
353
358
  productId: number;
354
359
  submissionIndex: string;
355
360
  amount: BigDecimal;
@@ -376,7 +381,7 @@ export type GetIndexerOrdersResponse = IndexerOrder[];
376
381
 
377
382
  export interface GetIndexerMatchEventsParams {
378
383
  // When not given, will return all maker events
379
- subaccount?: Subaccount;
384
+ subaccounts?: Subaccount[];
380
385
  productIds?: number[];
381
386
  // If not given, will return both isolated & non-iso events
382
387
  isolated?: boolean;
@@ -407,6 +412,7 @@ export interface IndexerMatchEvent extends Subaccount {
407
412
  cumulativeFee: BigDecimal;
408
413
  submissionIndex: string;
409
414
  timestamp: BigDecimal;
415
+ isTaker: boolean;
410
416
  // Tracked vars for the balance BEFORE this match event occurred
411
417
  preEventTrackedVars: Pick<
412
418
  IndexerBalanceTrackedVars,
@@ -649,8 +655,8 @@ export interface IndexerNlpSnapshot {
649
655
  // Total volume traded by the NLP, in terms of the primary quote
650
656
  cumulativeVolume: BigDecimal;
651
657
  cumulativeTrades: BigDecimal;
652
- cumulativeMintAmountUsdc: BigDecimal;
653
- cumulativeBurnAmountUsdc: BigDecimal;
658
+ cumulativeMintAmountQuote: BigDecimal;
659
+ cumulativeBurnAmountQuote: BigDecimal;
654
660
  cumulativePnl: BigDecimal;
655
661
  tvl: BigDecimal;
656
662
  oraclePrice: BigDecimal;
@@ -676,8 +682,67 @@ export interface GetIndexerBacklogResponse {
676
682
  txsPerSecond: BigDecimal | null;
677
683
  }
678
684
 
679
- export type GetIndexerSubaccountDDAParams = Subaccount;
685
+ export interface GetIndexerSubaccountDDAParams {
686
+ subaccount: Subaccount;
687
+ }
680
688
 
681
689
  export interface GetIndexerSubaccountDDAResponse {
682
- address: string;
690
+ address: Address;
683
691
  }
692
+
693
+ /**
694
+ * V2 Tickers
695
+ */
696
+
697
+ /**
698
+ * Market type for ticker filtering
699
+ */
700
+ export type TickerMarketType = 'spot' | 'perp';
701
+
702
+ /**
703
+ * Parameters for querying v2 tickers endpoint
704
+ */
705
+ export interface GetIndexerV2TickersParams {
706
+ /**
707
+ * Filter tickers by market type (spot or perp)
708
+ * @example 'spot'
709
+ * @example 'perp'
710
+ */
711
+ market?: TickerMarketType;
712
+ /**
713
+ * Whether to include edge products
714
+ * @default false
715
+ */
716
+ edge?: boolean;
717
+ }
718
+
719
+ /**
720
+ * Individual ticker data from v2 endpoint
721
+ */
722
+ export interface IndexerV2TickerResponse {
723
+ /** Unique product identifier */
724
+ productId: number;
725
+ /** Unique ticker identifier */
726
+ tickerId: string;
727
+ /** Base currency symbol */
728
+ baseCurrency: string;
729
+ /** Quote currency symbol */
730
+ quoteCurrency: string;
731
+ /** Last traded price */
732
+ lastPrice: number;
733
+ /** 24h trading volume in base currency */
734
+ baseVolume: number;
735
+ /** 24h trading volume in quote currency */
736
+ quoteVolume: number;
737
+ /** 24h price change percentage */
738
+ priceChangePercent24h: number;
739
+ }
740
+
741
+ /**
742
+ * Response from v2 tickers endpoint
743
+ * Maps ticker IDs to their respective ticker data
744
+ */
745
+ export type GetIndexerV2TickersResponse = Record<
746
+ string,
747
+ IndexerV2TickerResponse
748
+ >;
@@ -1,9 +1,9 @@
1
- export * from './clientTypes';
2
- export * from './paginatedEventsTypes';
3
- export * from './serverTypes';
4
- export * from './serverModelTypes';
5
1
  export * from './CandlestickPeriod';
2
+ export * from './clientTypes';
3
+ export * from './collateralEventType';
6
4
  export * from './IndexerEventType';
7
5
  export * from './IndexerLeaderboardType';
8
- export * from './collateralEventType';
9
6
  export * from './NadoTx';
7
+ export * from './paginatedEventsTypes';
8
+ export * from './serverModelTypes';
9
+ export * from './serverTypes';
@@ -103,7 +103,7 @@ export type GetIndexerSubaccountMatchEventsResponse =
103
103
  */
104
104
 
105
105
  export type GetIndexerPaginatedOrdersParams = BaseSubaccountPaginationParams &
106
- Pick<GetIndexerOrdersParams, 'productIds' | 'isolated'>;
106
+ Pick<GetIndexerOrdersParams, 'productIds' | 'triggerTypes' | 'isolated'>;
107
107
 
108
108
  export interface GetIndexerPaginatedOrdersResponse {
109
109
  orders: IndexerOrder[];
@@ -1,10 +1,10 @@
1
- import { EIP712OrderValues } from '@nadohq/shared';
2
1
  import {
3
2
  EngineServerPerpBalance,
4
3
  EngineServerPerpProduct,
5
4
  EngineServerSpotBalance,
6
5
  EngineServerSpotProduct,
7
6
  } from '@nadohq/engine-client';
7
+ import { EIP712OrderValues } from '@nadohq/shared';
8
8
  import { IndexerEventType } from './IndexerEventType';
9
9
  import { NadoTx } from './NadoTx';
10
10
 
@@ -78,6 +78,10 @@ export interface IndexerServerEvent {
78
78
  net_funding_cumulative: string;
79
79
  net_entry_unrealized: string;
80
80
  net_entry_cumulative: string;
81
+ /**
82
+ * Total traded volume in terms of the primary quote (i.e in terms of USDT) for this product
83
+ */
84
+ quote_volume_cumulative: string;
81
85
  }
82
86
 
83
87
  export interface IndexerServerTx {
@@ -92,7 +96,6 @@ export interface IndexerServerTx {
92
96
 
93
97
  export interface IndexerServerOrder {
94
98
  digest: string;
95
- isolated: boolean;
96
99
  subaccount: string;
97
100
  product_id: number;
98
101
  submission_idx: string;
@@ -130,6 +133,7 @@ export interface IndexerServerMatchEvent {
130
133
  net_entry_cumulative: string;
131
134
  pre_balance: IndexerServerMatchEventBalances;
132
135
  post_balance: IndexerServerMatchEventBalances;
136
+ is_taker: boolean;
133
137
  }
134
138
 
135
139
  export interface IndexerServerMatchEventBalances {
@@ -259,8 +263,8 @@ export interface IndexerServerLeaderboardRegistration {
259
263
  */
260
264
 
261
265
  export interface IndexerServerNlpSnapshot {
262
- cumulative_burn_usdc: string;
263
- cumulative_mint_usdc: string;
266
+ cumulative_burn_quote: string;
267
+ cumulative_mint_quote: string;
264
268
  cumulative_pnl: string;
265
269
  cumulative_trades: string;
266
270
  cumulative_volume: string;
@@ -15,13 +15,13 @@ import {
15
15
  IndexerServerMarketSnapshot,
16
16
  IndexerServerMarketSnapshotInterval,
17
17
  IndexerServerMatchEvent,
18
+ IndexerServerNlpSnapshot,
18
19
  IndexerServerOraclePrice,
19
20
  IndexerServerOrder,
20
21
  IndexerServerProductPayment,
21
22
  IndexerServerProductSnapshot,
22
23
  IndexerServerSnapshotsInterval,
23
24
  IndexerServerTx,
24
- IndexerServerNlpSnapshot,
25
25
  } from './serverModelTypes';
26
26
 
27
27
  /**
@@ -93,7 +93,7 @@ export interface IndexerServerMultiProductsParams {
93
93
  }
94
94
 
95
95
  export interface IndexerServerEventsParams {
96
- subaccount?: string;
96
+ subaccounts?: string[];
97
97
  product_ids?: number[];
98
98
  // If not given, will return both isolated & non-iso events
99
99
  isolated?: boolean;
@@ -112,9 +112,15 @@ export interface IndexerServerEventsParams {
112
112
  };
113
113
  }
114
114
 
115
+ export type IndexerServerTriggerTypeFilter =
116
+ | 'none'
117
+ | 'price_trigger'
118
+ | 'time_trigger';
119
+
115
120
  export interface IndexerServerOrdersParams {
116
- subaccount?: string;
121
+ subaccounts?: string[];
117
122
  product_ids?: number[];
123
+ trigger_types?: IndexerServerTriggerTypeFilter[];
118
124
  digests?: string[];
119
125
  max_time?: number;
120
126
  limit?: number;
@@ -125,7 +131,7 @@ export interface IndexerServerOrdersParams {
125
131
  }
126
132
 
127
133
  export interface IndexerServerMatchEventsParams {
128
- subaccount?: string;
134
+ subaccounts?: string[];
129
135
  product_ids?: number[];
130
136
  // If not given, will return both isolated & non-iso events
131
137
  isolated?: boolean;
@@ -230,7 +236,7 @@ export interface IndexerServerQueryRequestByType {
230
236
  products: IndexerServerProductsParams;
231
237
  referral_code: IndexerServerReferralCodeParams;
232
238
  subaccounts: IndexerServerListSubaccountsParams;
233
- usdc_price: Record<string, never>;
239
+ quote_price: Record<string, never>;
234
240
  nlp_snapshots: IndexerServerNlpSnapshotsParams;
235
241
  }
236
242
 
@@ -246,6 +252,9 @@ export interface IndexerServerListSubaccountsResponse {
246
252
  id: string;
247
253
  // Hex of subaccount bytes
248
254
  subaccount: string;
255
+ // UNIX timestamp in seconds
256
+ created_at: string;
257
+ isolated: boolean;
249
258
  }[];
250
259
  }
251
260
 
@@ -323,7 +332,7 @@ export interface IndexerServerMatchEventsResponse {
323
332
  txs: IndexerServerTx[];
324
333
  }
325
334
 
326
- export interface IndexerServerUsdcPriceResponse {
335
+ export interface IndexerServerQuotePriceResponse {
327
336
  price_x18: string;
328
337
  }
329
338
 
@@ -432,6 +441,33 @@ export interface IndexerServerQueryResponseByType {
432
441
  products: IndexerServerProductsResponse;
433
442
  referral_code: IndexerServerReferralCodeResponse;
434
443
  subaccounts: IndexerServerListSubaccountsResponse;
435
- usdc_price: IndexerServerUsdcPriceResponse;
444
+ quote_price: IndexerServerQuotePriceResponse;
436
445
  nlp_snapshots: IndexerServerNlpSnapshotsResponse;
437
446
  }
447
+
448
+ /**
449
+ * V2 API Types
450
+ */
451
+
452
+ /**
453
+ * Individual ticker data from v2 indexer endpoint (server format)
454
+ */
455
+ export interface IndexerServerV2TickerResponse {
456
+ product_id: number;
457
+ ticker_id: string;
458
+ base_currency: string;
459
+ quote_currency: string;
460
+ last_price: number;
461
+ base_volume: number;
462
+ quote_volume: number;
463
+ price_change_percent_24h: number;
464
+ }
465
+
466
+ /**
467
+ * Response from v2 tickers endpoint (server format)
468
+ * Maps ticker IDs to their respective ticker data
469
+ */
470
+ export type IndexerServerV2TickersResponse = Record<
471
+ string,
472
+ IndexerServerV2TickerResponse
473
+ >;