@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
@@ -54,7 +54,7 @@ interface IndexerServerMultiProductsParams {
54
54
  max_time: number[];
55
55
  }
56
56
  interface IndexerServerEventsParams {
57
- subaccount?: string;
57
+ subaccounts?: string[];
58
58
  product_ids?: number[];
59
59
  isolated?: boolean;
60
60
  event_types?: IndexerEventType[];
@@ -67,9 +67,11 @@ interface IndexerServerEventsParams {
67
67
  txs: number;
68
68
  };
69
69
  }
70
+ type IndexerServerTriggerTypeFilter = 'none' | 'price_trigger' | 'time_trigger';
70
71
  interface IndexerServerOrdersParams {
71
- subaccount?: string;
72
+ subaccounts?: string[];
72
73
  product_ids?: number[];
74
+ trigger_types?: IndexerServerTriggerTypeFilter[];
73
75
  digests?: string[];
74
76
  max_time?: number;
75
77
  limit?: number;
@@ -77,7 +79,7 @@ interface IndexerServerOrdersParams {
77
79
  idx?: string;
78
80
  }
79
81
  interface IndexerServerMatchEventsParams {
80
- subaccount?: string;
82
+ subaccounts?: string[];
81
83
  product_ids?: number[];
82
84
  isolated?: boolean;
83
85
  max_time?: number;
@@ -164,7 +166,7 @@ interface IndexerServerQueryRequestByType {
164
166
  products: IndexerServerProductsParams;
165
167
  referral_code: IndexerServerReferralCodeParams;
166
168
  subaccounts: IndexerServerListSubaccountsParams;
167
- usdc_price: Record<string, never>;
169
+ quote_price: Record<string, never>;
168
170
  nlp_snapshots: IndexerServerNlpSnapshotsParams;
169
171
  }
170
172
  type IndexerServerQueryRequestType = keyof IndexerServerQueryRequestByType;
@@ -175,6 +177,8 @@ interface IndexerServerListSubaccountsResponse {
175
177
  subaccounts: {
176
178
  id: string;
177
179
  subaccount: string;
180
+ created_at: string;
181
+ isolated: boolean;
178
182
  }[];
179
183
  }
180
184
  interface IndexerServerMultiSubaccountSnapshotsResponse {
@@ -221,7 +225,7 @@ interface IndexerServerMatchEventsResponse {
221
225
  matches: IndexerServerMatchEvent[];
222
226
  txs: IndexerServerTx[];
223
227
  }
224
- interface IndexerServerUsdcPriceResponse {
228
+ interface IndexerServerQuotePriceResponse {
225
229
  price_x18: string;
226
230
  }
227
231
  interface IndexerServerLinkedSignerResponse {
@@ -305,8 +309,29 @@ interface IndexerServerQueryResponseByType {
305
309
  products: IndexerServerProductsResponse;
306
310
  referral_code: IndexerServerReferralCodeResponse;
307
311
  subaccounts: IndexerServerListSubaccountsResponse;
308
- usdc_price: IndexerServerUsdcPriceResponse;
312
+ quote_price: IndexerServerQuotePriceResponse;
309
313
  nlp_snapshots: IndexerServerNlpSnapshotsResponse;
310
314
  }
315
+ /**
316
+ * V2 API Types
317
+ */
318
+ /**
319
+ * Individual ticker data from v2 indexer endpoint (server format)
320
+ */
321
+ interface IndexerServerV2TickerResponse {
322
+ product_id: number;
323
+ ticker_id: string;
324
+ base_currency: string;
325
+ quote_currency: string;
326
+ last_price: number;
327
+ base_volume: number;
328
+ quote_volume: number;
329
+ price_change_percent_24h: number;
330
+ }
331
+ /**
332
+ * Response from v2 tickers endpoint (server format)
333
+ * Maps ticker IDs to their respective ticker data
334
+ */
335
+ type IndexerServerV2TickersResponse = Record<string, IndexerServerV2TickerResponse>;
311
336
 
312
- export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, 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 };
337
+ export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, 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, IndexerServerQuotePriceResponse, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerTriggerTypeFilter, IndexerServerV2TickerResponse, IndexerServerV2TickersResponse };
@@ -54,7 +54,7 @@ interface IndexerServerMultiProductsParams {
54
54
  max_time: number[];
55
55
  }
56
56
  interface IndexerServerEventsParams {
57
- subaccount?: string;
57
+ subaccounts?: string[];
58
58
  product_ids?: number[];
59
59
  isolated?: boolean;
60
60
  event_types?: IndexerEventType[];
@@ -67,9 +67,11 @@ interface IndexerServerEventsParams {
67
67
  txs: number;
68
68
  };
69
69
  }
70
+ type IndexerServerTriggerTypeFilter = 'none' | 'price_trigger' | 'time_trigger';
70
71
  interface IndexerServerOrdersParams {
71
- subaccount?: string;
72
+ subaccounts?: string[];
72
73
  product_ids?: number[];
74
+ trigger_types?: IndexerServerTriggerTypeFilter[];
73
75
  digests?: string[];
74
76
  max_time?: number;
75
77
  limit?: number;
@@ -77,7 +79,7 @@ interface IndexerServerOrdersParams {
77
79
  idx?: string;
78
80
  }
79
81
  interface IndexerServerMatchEventsParams {
80
- subaccount?: string;
82
+ subaccounts?: string[];
81
83
  product_ids?: number[];
82
84
  isolated?: boolean;
83
85
  max_time?: number;
@@ -164,7 +166,7 @@ interface IndexerServerQueryRequestByType {
164
166
  products: IndexerServerProductsParams;
165
167
  referral_code: IndexerServerReferralCodeParams;
166
168
  subaccounts: IndexerServerListSubaccountsParams;
167
- usdc_price: Record<string, never>;
169
+ quote_price: Record<string, never>;
168
170
  nlp_snapshots: IndexerServerNlpSnapshotsParams;
169
171
  }
170
172
  type IndexerServerQueryRequestType = keyof IndexerServerQueryRequestByType;
@@ -175,6 +177,8 @@ interface IndexerServerListSubaccountsResponse {
175
177
  subaccounts: {
176
178
  id: string;
177
179
  subaccount: string;
180
+ created_at: string;
181
+ isolated: boolean;
178
182
  }[];
179
183
  }
180
184
  interface IndexerServerMultiSubaccountSnapshotsResponse {
@@ -221,7 +225,7 @@ interface IndexerServerMatchEventsResponse {
221
225
  matches: IndexerServerMatchEvent[];
222
226
  txs: IndexerServerTx[];
223
227
  }
224
- interface IndexerServerUsdcPriceResponse {
228
+ interface IndexerServerQuotePriceResponse {
225
229
  price_x18: string;
226
230
  }
227
231
  interface IndexerServerLinkedSignerResponse {
@@ -305,8 +309,29 @@ interface IndexerServerQueryResponseByType {
305
309
  products: IndexerServerProductsResponse;
306
310
  referral_code: IndexerServerReferralCodeResponse;
307
311
  subaccounts: IndexerServerListSubaccountsResponse;
308
- usdc_price: IndexerServerUsdcPriceResponse;
312
+ quote_price: IndexerServerQuotePriceResponse;
309
313
  nlp_snapshots: IndexerServerNlpSnapshotsResponse;
310
314
  }
315
+ /**
316
+ * V2 API Types
317
+ */
318
+ /**
319
+ * Individual ticker data from v2 indexer endpoint (server format)
320
+ */
321
+ interface IndexerServerV2TickerResponse {
322
+ product_id: number;
323
+ ticker_id: string;
324
+ base_currency: string;
325
+ quote_currency: string;
326
+ last_price: number;
327
+ base_volume: number;
328
+ quote_volume: number;
329
+ price_change_percent_24h: number;
330
+ }
331
+ /**
332
+ * Response from v2 tickers endpoint (server format)
333
+ * Maps ticker IDs to their respective ticker data
334
+ */
335
+ type IndexerServerV2TickersResponse = Record<string, IndexerServerV2TickerResponse>;
311
336
 
312
- export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, 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 };
337
+ export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, 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, IndexerServerQuotePriceResponse, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerTriggerTypeFilter, IndexerServerV2TickerResponse, IndexerServerV2TickersResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadohq/indexer-client",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.40",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "> TODO: description",
@@ -36,9 +36,13 @@
36
36
  }
37
37
  }
38
38
  },
39
+ "react-native": "./dist/index.js",
40
+ "main": "./dist/index.cjs",
41
+ "module": "./dist/index.js",
42
+ "types": "./dist/index.d.ts",
39
43
  "dependencies": {
40
- "@nadohq/engine-client": "^0.1.0-alpha.4",
41
- "@nadohq/shared": "^0.1.0-alpha.4",
44
+ "@nadohq/engine-client": "^0.1.0-alpha.40",
45
+ "@nadohq/shared": "^0.1.0-alpha.40",
42
46
  "axios": "*",
43
47
  "ts-mixer": "*"
44
48
  },
@@ -48,5 +52,5 @@
48
52
  "devDependencies": {
49
53
  "viem": "*"
50
54
  },
51
- "gitHead": "b852ce36b851303225d3f4b81739ac667c64cf8c"
55
+ "gitHead": "5dad68b2e53c49a0cfc95a1d8c6abfc1ee2a6f3b"
52
56
  }
@@ -4,6 +4,7 @@ import {
4
4
  getDefaultRecvTime,
5
5
  getNadoEIP712Values,
6
6
  getSignedTransactionRequest,
7
+ getValidatedAddress,
7
8
  getValidatedHex,
8
9
  mapValues,
9
10
  nowInSeconds,
@@ -36,6 +37,7 @@ import {
36
37
  mapIndexerPerpPrices,
37
38
  mapIndexerProductPayment,
38
39
  mapIndexerServerProduct,
40
+ mapIndexerV2Ticker,
39
41
  mapSnapshotsIntervalToServerParams,
40
42
  } from './dataMappers';
41
43
  import {
@@ -93,6 +95,8 @@ import {
93
95
  GetIndexerReferralCodeResponse,
94
96
  GetIndexerSubaccountDDAParams,
95
97
  GetIndexerSubaccountDDAResponse,
98
+ GetIndexerV2TickersParams,
99
+ GetIndexerV2TickersResponse,
96
100
  IndexerEventWithTx,
97
101
  IndexerMatchEvent,
98
102
  IndexerOraclePrice,
@@ -100,6 +104,7 @@ import {
100
104
  IndexerServerQueryRequestByType,
101
105
  IndexerServerQueryRequestType,
102
106
  IndexerServerQueryResponseByType,
107
+ IndexerServerV2TickersResponse,
103
108
  IndexerSnapshotBalance,
104
109
  IndexerSubaccountSnapshot,
105
110
  ListIndexerSubaccountsParams,
@@ -150,6 +155,8 @@ export class IndexerBaseClient {
150
155
  const subaccount = subaccountFromHex(item.subaccount);
151
156
  return {
152
157
  hexId: item.subaccount,
158
+ createdAt: Number(item.created_at),
159
+ isolated: item.isolated,
153
160
  ...subaccount,
154
161
  };
155
162
  });
@@ -402,12 +409,12 @@ export class IndexerBaseClient {
402
409
  })();
403
410
 
404
411
  const baseResponse = await this.query('events', {
405
- subaccount: params.subaccount
406
- ? subaccountToHex({
407
- subaccountOwner: params.subaccount.subaccountOwner,
408
- subaccountName: params.subaccount.subaccountName,
409
- })
410
- : undefined,
412
+ subaccounts: params.subaccounts?.map((subaccount) =>
413
+ subaccountToHex({
414
+ subaccountOwner: subaccount.subaccountOwner,
415
+ subaccountName: subaccount.subaccountName,
416
+ }),
417
+ ),
411
418
  product_ids: params.productIds,
412
419
  isolated: params.isolated,
413
420
  event_types: params.eventTypes,
@@ -437,13 +444,14 @@ export class IndexerBaseClient {
437
444
  params: GetIndexerOrdersParams,
438
445
  ): Promise<GetIndexerOrdersResponse> {
439
446
  const baseResponse = await this.query('orders', {
440
- subaccount: params.subaccount
441
- ? subaccountToHex({
442
- subaccountOwner: params.subaccount.subaccountOwner,
443
- subaccountName: params.subaccount.subaccountName,
444
- })
445
- : undefined,
447
+ subaccounts: params?.subaccounts?.map((subaccount) =>
448
+ subaccountToHex({
449
+ subaccountOwner: subaccount.subaccountOwner,
450
+ subaccountName: subaccount.subaccountName,
451
+ }),
452
+ ),
446
453
  product_ids: params.productIds,
454
+ trigger_types: params.triggerTypes,
447
455
  isolated: params.isolated,
448
456
  digests: params.digests,
449
457
  max_time: params.maxTimestampInclusive,
@@ -464,12 +472,12 @@ export class IndexerBaseClient {
464
472
  params: GetIndexerMatchEventsParams,
465
473
  ): Promise<GetIndexerMatchEventsResponse> {
466
474
  const baseResponse = await this.query('matches', {
467
- subaccount: params.subaccount
468
- ? subaccountToHex({
469
- subaccountOwner: params.subaccount.subaccountOwner,
470
- subaccountName: params.subaccount.subaccountName,
471
- })
472
- : undefined,
475
+ subaccounts: params?.subaccounts?.map((subaccount) =>
476
+ subaccountToHex({
477
+ subaccountOwner: subaccount.subaccountOwner,
478
+ subaccountName: subaccount.subaccountName,
479
+ }),
480
+ ),
473
481
  product_ids: params.productIds,
474
482
  isolated: params.isolated,
475
483
  max_time: params.maxTimestampInclusive,
@@ -513,6 +521,7 @@ export class IndexerBaseClient {
513
521
  preBalances: mapIndexerMatchEventBalances(matchEvent.pre_balance),
514
522
  postBalances,
515
523
  tx,
524
+ isTaker: matchEvent.is_taker,
516
525
  ...subaccountFromHex(matchEvent.order.sender),
517
526
  };
518
527
  });
@@ -552,10 +561,10 @@ export class IndexerBaseClient {
552
561
  }
553
562
 
554
563
  /**
555
- * Gets quote (USDC) price in terms of USD
564
+ * Gets quote (USDT) price in terms of USD
556
565
  */
557
566
  async getQuotePrice(): Promise<GetIndexerQuotePriceResponse> {
558
- const baseResponse = await this.query('usdc_price', {});
567
+ const baseResponse = await this.query('quote_price', {});
559
568
  return {
560
569
  price: removeDecimals(baseResponse.price_x18),
561
570
  };
@@ -797,14 +806,11 @@ export class IndexerBaseClient {
797
806
  params: GetIndexerSubaccountDDAParams,
798
807
  ): Promise<GetIndexerSubaccountDDAResponse> {
799
808
  const baseResponse = await this.query('direct_deposit_address', {
800
- subaccount: subaccountToHex({
801
- subaccountOwner: params.subaccountOwner,
802
- subaccountName: params.subaccountName,
803
- }),
809
+ subaccount: subaccountToHex(params.subaccount),
804
810
  });
805
811
 
806
812
  return {
807
- address: baseResponse.v1_address,
813
+ address: getValidatedAddress(baseResponse.v1_address),
808
814
  };
809
815
  }
810
816
 
@@ -825,6 +831,24 @@ export class IndexerBaseClient {
825
831
  };
826
832
  }
827
833
 
834
+ /**
835
+ * Get tickers from the v2 indexer endpoint
836
+ * @param params
837
+ */
838
+ async getV2Tickers(
839
+ params: GetIndexerV2TickersParams,
840
+ ): Promise<GetIndexerV2TickersResponse> {
841
+ const response =
842
+ await this.axiosInstance.get<IndexerServerV2TickersResponse>(
843
+ `${this.v2Url}/tickers`,
844
+ { params },
845
+ );
846
+
847
+ this.checkResponseStatus(response);
848
+
849
+ return mapValues(response.data, mapIndexerV2Ticker);
850
+ }
851
+
828
852
  protected async query<TRequestType extends IndexerServerQueryRequestType>(
829
853
  requestType: TRequestType,
830
854
  params: IndexerServerQueryRequestByType[TRequestType],
@@ -1,10 +1,11 @@
1
1
  import {
2
+ NLP_PRODUCT_ID,
2
3
  ProductEngineType,
3
4
  QUOTE_PRODUCT_ID,
4
5
  subaccountFromHex,
5
- NLP_PRODUCT_ID,
6
+ toBigDecimal,
7
+ toIntegerString,
6
8
  } from '@nadohq/shared';
7
- import { toBigDecimal, toIntegerString } from '@nadohq/shared';
8
9
 
9
10
  import { IndexerBaseClient } from './IndexerBaseClient';
10
11
  import {
@@ -22,17 +23,17 @@ import {
22
23
  GetIndexerSubaccountLiquidationEventsResponse,
23
24
  GetIndexerSubaccountMatchEventParams,
24
25
  GetIndexerSubaccountMatchEventsResponse,
25
- GetIndexerSubaccountSettlementEventsParams,
26
- GetIndexerSubaccountSettlementEventsResponse,
27
26
  GetIndexerSubaccountNlpEventsParams,
28
27
  GetIndexerSubaccountNlpEventsResponse,
28
+ GetIndexerSubaccountSettlementEventsParams,
29
+ GetIndexerSubaccountSettlementEventsResponse,
29
30
  IndexerCollateralEvent,
30
31
  IndexerEventPerpStateSnapshot,
31
32
  IndexerEventSpotStateSnapshot,
32
33
  IndexerEventWithTx,
33
34
  IndexerLiquidationEvent,
34
- IndexerSettlementEvent,
35
35
  IndexerNlpEvent,
36
+ IndexerSettlementEvent,
36
37
  PaginatedIndexerEventsResponse,
37
38
  } from './types';
38
39
 
@@ -58,7 +59,7 @@ export class IndexerClient extends IndexerBaseClient {
58
59
  startCursor,
59
60
  maxTimestampInclusive,
60
61
  limit,
61
- subaccount: { subaccountName, subaccountOwner },
62
+ subaccounts: [{ subaccountName, subaccountOwner }],
62
63
  productIds,
63
64
  isolated,
64
65
  });
@@ -87,7 +88,7 @@ export class IndexerClient extends IndexerBaseClient {
87
88
  type: 'txs',
88
89
  value: limit,
89
90
  },
90
- subaccount: { subaccountName, subaccountOwner },
91
+ subaccounts: [{ subaccountName, subaccountOwner }],
91
92
  });
92
93
 
93
94
  // Now aggregate results by the submission index, use map to maintain insertion order
@@ -158,7 +159,7 @@ export class IndexerClient extends IndexerBaseClient {
158
159
  type: 'txs',
159
160
  value: limit,
160
161
  },
161
- subaccount: { subaccountName, subaccountOwner },
162
+ subaccounts: [{ subaccountName, subaccountOwner }],
162
163
  isolated,
163
164
  });
164
165
 
@@ -195,6 +196,7 @@ export class IndexerClient extends IndexerBaseClient {
195
196
  subaccountName,
196
197
  subaccountOwner,
197
198
  productIds,
199
+ triggerTypes,
198
200
  isolated,
199
201
  } = params;
200
202
 
@@ -202,9 +204,10 @@ export class IndexerClient extends IndexerBaseClient {
202
204
  const baseResponse = await this.getOrders({
203
205
  startCursor,
204
206
  maxTimestampInclusive,
205
- subaccount: { subaccountName, subaccountOwner },
207
+ subaccounts: [{ subaccountName, subaccountOwner }],
206
208
  limit,
207
209
  productIds,
210
+ triggerTypes,
208
211
  isolated,
209
212
  });
210
213
 
@@ -241,7 +244,7 @@ export class IndexerClient extends IndexerBaseClient {
241
244
  type: 'txs',
242
245
  value: limit,
243
246
  },
244
- subaccount: { subaccountName, subaccountOwner },
247
+ subaccounts: [{ subaccountName, subaccountOwner }],
245
248
  });
246
249
 
247
250
  const events = baseResponse
@@ -295,7 +298,7 @@ export class IndexerClient extends IndexerBaseClient {
295
298
  type: 'txs',
296
299
  value: limit,
297
300
  },
298
- subaccount: { subaccountName, subaccountOwner },
301
+ subaccounts: [{ subaccountName, subaccountOwner }],
299
302
  });
300
303
 
301
304
  // Now aggregate results by the submission index, use map to maintain insertion order
@@ -1,21 +1,19 @@
1
- import {
2
- getRecvTimeFromOrderNonce,
3
- Market,
4
- PerpMarket,
5
- ProductEngineType,
6
- SpotMarket,
7
- subaccountFromHex,
8
- unpackOrderAppendix,
9
- } from '@nadohq/shared';
10
1
  import {
11
2
  mapEngineServerPerpProduct,
12
3
  mapEngineServerSpotProduct,
13
4
  } from '@nadohq/engine-client';
14
5
  import {
6
+ getRecvTimeFromOrderNonce,
15
7
  mapValues,
8
+ Market,
9
+ PerpMarket,
10
+ ProductEngineType,
16
11
  removeDecimals,
12
+ SpotMarket,
13
+ subaccountFromHex,
17
14
  toBigDecimal,
18
15
  toIntegerString,
16
+ unpackOrderAppendix,
19
17
  } from '@nadohq/shared';
20
18
  import {
21
19
  Candlestick,
@@ -50,8 +48,10 @@ import {
50
48
  IndexerServerProductPayment,
51
49
  IndexerServerSnapshotsInterval,
52
50
  IndexerServerTx,
51
+ IndexerServerV2TickerResponse,
53
52
  IndexerSnapshotsIntervalParams,
54
53
  IndexerSpotBalance,
54
+ IndexerV2TickerResponse,
55
55
  } from './types';
56
56
 
57
57
  export function mapSnapshotsIntervalToServerParams(
@@ -96,7 +96,6 @@ export function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {
96
96
  return {
97
97
  amount: toBigDecimal(order.amount),
98
98
  digest: order.digest,
99
- isolated: order.isolated,
100
99
  expiration: Number(order.expiration),
101
100
  appendix,
102
101
  nonce: toBigDecimal(order.nonce),
@@ -153,6 +152,7 @@ export function mapIndexerEvent(event: IndexerServerEvent): IndexerEvent {
153
152
  netFundingUnrealized: toBigDecimal(event.net_funding_unrealized),
154
153
  netInterestCumulative: toBigDecimal(event.net_interest_cumulative),
155
154
  netInterestUnrealized: toBigDecimal(event.net_interest_unrealized),
155
+ quoteVolumeCumulative: toBigDecimal(event.quote_volume_cumulative),
156
156
  },
157
157
  };
158
158
  }
@@ -347,8 +347,8 @@ export function mapIndexerNlpSnapshot(
347
347
  return {
348
348
  submissionIndex: snapshot.submission_idx,
349
349
  timestamp: toBigDecimal(snapshot.timestamp),
350
- cumulativeBurnAmountUsdc: toBigDecimal(snapshot.cumulative_burn_usdc),
351
- cumulativeMintAmountUsdc: toBigDecimal(snapshot.cumulative_mint_usdc),
350
+ cumulativeBurnAmountQuote: toBigDecimal(snapshot.cumulative_burn_quote),
351
+ cumulativeMintAmountQuote: toBigDecimal(snapshot.cumulative_mint_quote),
352
352
  cumulativePnl: toBigDecimal(snapshot.cumulative_pnl),
353
353
  cumulativeTrades: toBigDecimal(snapshot.cumulative_trades),
354
354
  cumulativeVolume: toBigDecimal(snapshot.cumulative_volume),
@@ -357,3 +357,18 @@ export function mapIndexerNlpSnapshot(
357
357
  tvl: toBigDecimal(snapshot.tvl),
358
358
  };
359
359
  }
360
+
361
+ export function mapIndexerV2Ticker(
362
+ ticker: IndexerServerV2TickerResponse,
363
+ ): IndexerV2TickerResponse {
364
+ return {
365
+ productId: ticker.product_id,
366
+ tickerId: ticker.ticker_id,
367
+ baseCurrency: ticker.base_currency,
368
+ quoteCurrency: ticker.quote_currency,
369
+ lastPrice: ticker.last_price,
370
+ baseVolume: ticker.base_volume,
371
+ quoteVolume: ticker.quote_volume,
372
+ priceChangePercent24h: ticker.price_change_percent_24h,
373
+ };
374
+ }
package/src/endpoints.ts CHANGED
@@ -2,6 +2,6 @@ import { ChainEnv } from '@nadohq/shared';
2
2
 
3
3
  export const INDEXER_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {
4
4
  local: 'http://localhost:8000/indexer',
5
- arbitrum: 'https://archive.prod.vertexprotocol.com/v1',
6
- inkTestnet: 'https://archive.test.nado-backend.xyz/v1',
5
+ inkTestnet: 'https://archive.test.nado.xyz/v1',
6
+ inkMainnet: 'https://archive.prod.nado.xyz/v1',
7
7
  };
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
- export * from './types';
2
- export * from './IndexerClient';
3
1
  export * from './endpoints';
2
+ export * from './IndexerBaseClient';
3
+ export * from './IndexerClient';
4
+ export * from './types';
4
5
  export * from './utils';