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

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 (66) hide show
  1. package/dist/IndexerBaseClient.cjs +83 -57
  2. package/dist/IndexerBaseClient.cjs.map +1 -1
  3. package/dist/IndexerBaseClient.d.cts +13 -4
  4. package/dist/IndexerBaseClient.d.ts +13 -4
  5. package/dist/IndexerBaseClient.js +36 -9
  6. package/dist/IndexerBaseClient.js.map +1 -1
  7. package/dist/IndexerClient.cjs +17 -16
  8. package/dist/IndexerClient.cjs.map +1 -1
  9. package/dist/IndexerClient.d.cts +2 -3
  10. package/dist/IndexerClient.d.ts +2 -3
  11. package/dist/IndexerClient.js +6 -3
  12. package/dist/IndexerClient.js.map +1 -1
  13. package/dist/dataMappers.cjs +119 -109
  14. package/dist/dataMappers.cjs.map +1 -1
  15. package/dist/dataMappers.d.cts +5 -5
  16. package/dist/dataMappers.d.ts +5 -5
  17. package/dist/dataMappers.js +26 -18
  18. package/dist/dataMappers.js.map +1 -1
  19. package/dist/endpoints.cjs +2 -2
  20. package/dist/endpoints.cjs.map +1 -1
  21. package/dist/endpoints.d.cts +1 -1
  22. package/dist/endpoints.d.ts +1 -1
  23. package/dist/endpoints.js +2 -2
  24. package/dist/endpoints.js.map +1 -1
  25. package/dist/index.cjs +6 -4
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +10 -11
  28. package/dist/index.d.ts +10 -11
  29. package/dist/index.js +3 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/types/clientTypes.cjs.map +1 -1
  32. package/dist/types/clientTypes.d.cts +64 -11
  33. package/dist/types/clientTypes.d.ts +64 -11
  34. package/dist/types/index.cjs +11 -11
  35. package/dist/types/index.cjs.map +1 -1
  36. package/dist/types/index.d.cts +6 -7
  37. package/dist/types/index.d.ts +6 -7
  38. package/dist/types/index.js +5 -5
  39. package/dist/types/index.js.map +1 -1
  40. package/dist/types/paginatedEventsTypes.cjs.map +1 -1
  41. package/dist/types/paginatedEventsTypes.d.cts +6 -7
  42. package/dist/types/paginatedEventsTypes.d.ts +6 -7
  43. package/dist/types/serverModelTypes.cjs.map +1 -1
  44. package/dist/types/serverModelTypes.d.cts +8 -4
  45. package/dist/types/serverModelTypes.d.ts +8 -4
  46. package/dist/types/serverTypes.cjs.map +1 -1
  47. package/dist/types/serverTypes.d.cts +36 -5
  48. package/dist/types/serverTypes.d.ts +36 -5
  49. package/dist/utils/index.d.cts +2 -3
  50. package/dist/utils/index.d.ts +2 -3
  51. package/dist/utils/indexerBalanceValue.cjs.map +1 -1
  52. package/dist/utils/indexerBalanceValue.d.cts +2 -3
  53. package/dist/utils/indexerBalanceValue.d.ts +2 -3
  54. package/dist/utils/indexerBalanceValue.js.map +1 -1
  55. package/package.json +4 -5
  56. package/src/IndexerBaseClient.ts +55 -13
  57. package/src/IndexerClient.ts +9 -6
  58. package/src/dataMappers.ts +33 -21
  59. package/src/endpoints.ts +2 -2
  60. package/src/index.ts +3 -2
  61. package/src/types/clientTypes.ts +77 -12
  62. package/src/types/index.ts +5 -5
  63. package/src/types/paginatedEventsTypes.ts +2 -3
  64. package/src/types/serverModelTypes.ts +8 -4
  65. package/src/types/serverTypes.ts +48 -5
  66. package/src/utils/indexerBalanceValue.ts +1 -1
@@ -33,15 +33,16 @@ __export(IndexerBaseClient_exports, {
33
33
  IndexerBaseClient: () => IndexerBaseClient
34
34
  });
35
35
  module.exports = __toCommonJS(IndexerBaseClient_exports);
36
- var import_contracts = require("@nadohq/contracts");
37
- var import_utils = require("@nadohq/utils");
36
+ var import_shared = require("@nadohq/shared");
38
37
  var import_axios = __toESM(require("axios"), 1);
39
38
  var import_dataMappers = require("./dataMappers.cjs");
40
39
  var IndexerBaseClient = class {
41
40
  constructor(opts) {
42
41
  this.opts = opts;
43
42
  this.axiosInstance = import_axios.default.create({
44
- withCredentials: true
43
+ withCredentials: true,
44
+ // We have custom logic to validate response status and create an appropriate error
45
+ validateStatus: () => true
45
46
  });
46
47
  this.v2Url = opts.v2Url ? opts.v2Url : opts.url.replace("v1", "v2");
47
48
  }
@@ -53,7 +54,7 @@ var IndexerBaseClient = class {
53
54
  async listSubaccounts(params) {
54
55
  const baseResponse = await this.query("subaccounts", params);
55
56
  return baseResponse.subaccounts.map((item) => {
56
- const subaccount = (0, import_contracts.subaccountFromHex)(item.subaccount);
57
+ const subaccount = (0, import_shared.subaccountFromHex)(item.subaccount);
57
58
  return {
58
59
  hexId: item.subaccount,
59
60
  ...subaccount
@@ -68,7 +69,7 @@ var IndexerBaseClient = class {
68
69
  */
69
70
  async getMultiSubaccountSnapshots(params) {
70
71
  const subaccountHexIds = params.subaccounts.map(
71
- ({ subaccountOwner, subaccountName }) => (0, import_contracts.subaccountToHex)({
72
+ ({ subaccountOwner, subaccountName }) => (0, import_shared.subaccountToHex)({
72
73
  subaccountOwner,
73
74
  subaccountName
74
75
  })
@@ -78,14 +79,14 @@ var IndexerBaseClient = class {
78
79
  timestamps: params.timestamps,
79
80
  isolated: params.isolated
80
81
  });
81
- const snapshotsBySubaccount = (0, import_utils.mapValues)(
82
+ const snapshotsBySubaccount = (0, import_shared.mapValues)(
82
83
  baseResponse.snapshots,
83
84
  (balanceSnapshots) => {
84
85
  const snapshotByTimestamp = {};
85
86
  Object.entries(balanceSnapshots).forEach(([timestamp, events]) => {
86
87
  const balances = events.map(import_dataMappers.mapIndexerEvent);
87
88
  snapshotByTimestamp[timestamp] = {
88
- timestamp: (0, import_utils.toBigDecimal)(timestamp),
89
+ timestamp: (0, import_shared.toBigDecimal)(timestamp),
89
90
  balances
90
91
  };
91
92
  });
@@ -104,7 +105,7 @@ var IndexerBaseClient = class {
104
105
  */
105
106
  async getReferralCode(params) {
106
107
  const baseResponse = await this.query("referral_code", {
107
- subaccount: (0, import_contracts.subaccountToHex)({
108
+ subaccount: (0, import_shared.subaccountToHex)({
108
109
  subaccountOwner: params.subaccount.subaccountOwner,
109
110
  subaccountName: params.subaccount.subaccountName
110
111
  })
@@ -131,7 +132,7 @@ var IndexerBaseClient = class {
131
132
  const baseResponse = await this.query("funding_rates", {
132
133
  product_ids: params.productIds
133
134
  });
134
- return (0, import_utils.mapValues)(baseResponse, import_dataMappers.mapIndexerFundingRate);
135
+ return (0, import_shared.mapValues)(baseResponse, import_dataMappers.mapIndexerFundingRate);
135
136
  }
136
137
  /**
137
138
  * Retrieves latest mark/index price for a perp product
@@ -151,7 +152,7 @@ var IndexerBaseClient = class {
151
152
  const baseResponse = await this.query("perp_prices", {
152
153
  product_ids: params.productIds
153
154
  });
154
- return (0, import_utils.mapValues)(baseResponse, import_dataMappers.mapIndexerPerpPrices);
155
+ return (0, import_shared.mapValues)(baseResponse, import_dataMappers.mapIndexerPerpPrices);
155
156
  }
156
157
  /**
157
158
  * Retrieves latest oracle prices for provided products
@@ -163,8 +164,8 @@ var IndexerBaseClient = class {
163
164
  });
164
165
  return baseResponse.prices.map((price) => {
165
166
  return {
166
- oraclePrice: (0, import_utils.removeDecimals)(price.oracle_price_x18),
167
- updateTime: (0, import_utils.toBigDecimal)(price.update_time),
167
+ oraclePrice: (0, import_shared.removeDecimals)(price.oracle_price_x18),
168
+ updateTime: (0, import_shared.toBigDecimal)(price.update_time),
168
169
  productId: price.product_id
169
170
  };
170
171
  });
@@ -220,10 +221,10 @@ var IndexerBaseClient = class {
220
221
  async getMultiProductSnapshots(params) {
221
222
  const timestampToProductsMap = await this.query("product_snapshots", {
222
223
  product_ids: params.productIds,
223
- max_time: params.maxTimestampInclusive ?? [(0, import_utils.nowInSeconds)()]
224
+ max_time: params.maxTimestampInclusive ?? [(0, import_shared.nowInSeconds)()]
224
225
  });
225
- return (0, import_utils.mapValues)(timestampToProductsMap, (productIdToProduct) => {
226
- return (0, import_utils.mapValues)(productIdToProduct, (indexerProduct) => {
226
+ return (0, import_shared.mapValues)(timestampToProductsMap, (productIdToProduct) => {
227
+ return (0, import_shared.mapValues)(productIdToProduct, (indexerProduct) => {
227
228
  return {
228
229
  ...(0, import_dataMappers.mapIndexerServerProduct)(indexerProduct.product),
229
230
  submissionIndex: indexerProduct.submission_idx
@@ -251,7 +252,7 @@ var IndexerBaseClient = class {
251
252
  };
252
253
  })();
253
254
  const baseResponse = await this.query("events", {
254
- subaccount: params.subaccount ? (0, import_contracts.subaccountToHex)({
255
+ subaccount: params.subaccount ? (0, import_shared.subaccountToHex)({
255
256
  subaccountOwner: params.subaccount.subaccountOwner,
256
257
  subaccountName: params.subaccount.subaccountName
257
258
  }) : void 0,
@@ -278,11 +279,12 @@ var IndexerBaseClient = class {
278
279
  */
279
280
  async getOrders(params) {
280
281
  const baseResponse = await this.query("orders", {
281
- subaccount: params.subaccount ? (0, import_contracts.subaccountToHex)({
282
+ subaccount: params.subaccount ? (0, import_shared.subaccountToHex)({
282
283
  subaccountOwner: params.subaccount.subaccountOwner,
283
284
  subaccountName: params.subaccount.subaccountName
284
285
  }) : void 0,
285
286
  product_ids: params.productIds,
287
+ trigger_types: params.triggerTypes,
286
288
  isolated: params.isolated,
287
289
  digests: params.digests,
288
290
  max_time: params.maxTimestampInclusive,
@@ -299,7 +301,7 @@ var IndexerBaseClient = class {
299
301
  */
300
302
  async getMatchEvents(params) {
301
303
  const baseResponse = await this.query("matches", {
302
- subaccount: params.subaccount ? (0, import_contracts.subaccountToHex)({
304
+ subaccount: params.subaccount ? (0, import_shared.subaccountToHex)({
303
305
  subaccountOwner: params.subaccount.subaccountOwner,
304
306
  subaccountName: params.subaccount.subaccountName
305
307
  }) : void 0,
@@ -321,25 +323,25 @@ var IndexerBaseClient = class {
321
323
  return {
322
324
  productId: postBalances.base.productId,
323
325
  isolated: matchEvent.isolated,
324
- totalFee: (0, import_utils.toBigDecimal)(matchEvent.fee),
325
- sequencerFee: (0, import_utils.toBigDecimal)(matchEvent.sequencer_fee),
326
- baseFilled: (0, import_utils.toBigDecimal)(matchEvent.base_filled),
327
- quoteFilled: (0, import_utils.toBigDecimal)(matchEvent.quote_filled),
328
- cumulativeFee: (0, import_utils.toBigDecimal)(matchEvent.cumulative_fee),
329
- cumulativeBaseFilled: (0, import_utils.toBigDecimal)(matchEvent.cumulative_base_filled),
330
- cumulativeQuoteFilled: (0, import_utils.toBigDecimal)(matchEvent.cumulative_quote_filled),
326
+ totalFee: (0, import_shared.toBigDecimal)(matchEvent.fee),
327
+ sequencerFee: (0, import_shared.toBigDecimal)(matchEvent.sequencer_fee),
328
+ baseFilled: (0, import_shared.toBigDecimal)(matchEvent.base_filled),
329
+ quoteFilled: (0, import_shared.toBigDecimal)(matchEvent.quote_filled),
330
+ cumulativeFee: (0, import_shared.toBigDecimal)(matchEvent.cumulative_fee),
331
+ cumulativeBaseFilled: (0, import_shared.toBigDecimal)(matchEvent.cumulative_base_filled),
332
+ cumulativeQuoteFilled: (0, import_shared.toBigDecimal)(matchEvent.cumulative_quote_filled),
331
333
  digest: matchEvent.digest,
332
334
  order: matchEvent.order,
333
335
  submissionIndex: matchEvent.submission_idx,
334
- timestamp: (0, import_utils.toBigDecimal)(timestamp),
336
+ timestamp: (0, import_shared.toBigDecimal)(timestamp),
335
337
  preEventTrackedVars: {
336
- netEntryUnrealized: (0, import_utils.toBigDecimal)(matchEvent.net_entry_unrealized),
337
- netEntryCumulative: (0, import_utils.toBigDecimal)(matchEvent.net_entry_cumulative)
338
+ netEntryUnrealized: (0, import_shared.toBigDecimal)(matchEvent.net_entry_unrealized),
339
+ netEntryCumulative: (0, import_shared.toBigDecimal)(matchEvent.net_entry_cumulative)
338
340
  },
339
341
  preBalances: (0, import_dataMappers.mapIndexerMatchEventBalances)(matchEvent.pre_balance),
340
342
  postBalances,
341
343
  tx,
342
- ...(0, import_contracts.subaccountFromHex)(matchEvent.order.sender)
344
+ ...(0, import_shared.subaccountFromHex)(matchEvent.order.sender)
343
345
  };
344
346
  });
345
347
  }
@@ -353,7 +355,7 @@ var IndexerBaseClient = class {
353
355
  */
354
356
  async getInterestFundingPayments(params) {
355
357
  const baseResponse = await this.query("interest_and_funding", {
356
- subaccount: (0, import_contracts.subaccountToHex)({
358
+ subaccount: (0, import_shared.subaccountToHex)({
357
359
  subaccountOwner: params.subaccount.subaccountOwner,
358
360
  subaccountName: params.subaccount.subaccountName
359
361
  }),
@@ -373,12 +375,12 @@ var IndexerBaseClient = class {
373
375
  };
374
376
  }
375
377
  /**
376
- * Gets quote (USDC) price in terms of USD
378
+ * Gets quote (USDT) price in terms of USD
377
379
  */
378
380
  async getQuotePrice() {
379
- const baseResponse = await this.query("usdc_price", {});
381
+ const baseResponse = await this.query("quote_price", {});
380
382
  return {
381
- price: (0, import_utils.removeDecimals)(baseResponse.price_x18)
383
+ price: (0, import_shared.removeDecimals)(baseResponse.price_x18)
382
384
  };
383
385
  }
384
386
  /**
@@ -386,13 +388,13 @@ var IndexerBaseClient = class {
386
388
  */
387
389
  async getLinkedSignerWithRateLimit(params) {
388
390
  const baseResponse = await this.query("linked_signer_rate_limit", {
389
- subaccount: (0, import_contracts.subaccountToHex)(params.subaccount)
391
+ subaccount: (0, import_shared.subaccountToHex)(params.subaccount)
390
392
  });
391
393
  return {
392
- totalTxLimit: (0, import_utils.toBigDecimal)(baseResponse.total_tx_limit),
393
- remainingTxs: (0, import_utils.toBigDecimal)(baseResponse.remaining_tx),
394
+ totalTxLimit: (0, import_shared.toBigDecimal)(baseResponse.total_tx_limit),
395
+ remainingTxs: (0, import_shared.toBigDecimal)(baseResponse.remaining_tx),
394
396
  signer: baseResponse.signer,
395
- waitTimeUntilNextTx: (0, import_utils.toBigDecimal)(baseResponse.wait_time)
397
+ waitTimeUntilNextTx: (0, import_shared.toBigDecimal)(baseResponse.wait_time)
396
398
  };
397
399
  }
398
400
  /**
@@ -414,7 +416,7 @@ var IndexerBaseClient = class {
414
416
  const baseResponse = await this.query("edge_market_snapshots", {
415
417
  interval: (0, import_dataMappers.mapSnapshotsIntervalToServerParams)(params)
416
418
  });
417
- return (0, import_utils.mapValues)(
419
+ return (0, import_shared.mapValues)(
418
420
  baseResponse.snapshots,
419
421
  (snapshots) => snapshots.map(import_dataMappers.mapIndexerMarketSnapshot)
420
422
  );
@@ -431,7 +433,7 @@ var IndexerBaseClient = class {
431
433
  interval: params.interval
432
434
  });
433
435
  return {
434
- rewardCoefficient: (0, import_utils.toBigDecimal)(baseResponse.reward_coefficient),
436
+ rewardCoefficient: (0, import_shared.toBigDecimal)(baseResponse.reward_coefficient),
435
437
  makers: baseResponse.makers.map(import_dataMappers.mapIndexerMakerStatistics)
436
438
  };
437
439
  }
@@ -458,11 +460,11 @@ var IndexerBaseClient = class {
458
460
  */
459
461
  async getLeaderboardParticipant(params) {
460
462
  const baseResponse = await this.query("leaderboard_rank", {
461
- subaccount: (0, import_contracts.subaccountToHex)(params.subaccount),
463
+ subaccount: (0, import_shared.subaccountToHex)(params.subaccount),
462
464
  contest_ids: params.contestIds
463
465
  });
464
466
  return {
465
- participant: (0, import_utils.mapValues)(
467
+ participant: (0, import_shared.mapValues)(
466
468
  baseResponse.positions,
467
469
  (position) => (0, import_dataMappers.mapIndexerLeaderboardPosition)(position)
468
470
  )
@@ -475,11 +477,11 @@ var IndexerBaseClient = class {
475
477
  async updateLeaderboardRegistration(params) {
476
478
  const signatureParams = {
477
479
  // Default to 90 seconds from now if no recvTime is provided
478
- expiration: (0, import_utils.toIntegerString)(params.recvTime ?? (0, import_contracts.getDefaultRecvTime)()),
480
+ expiration: (0, import_shared.toIntegerString)(params.recvTime ?? (0, import_shared.getDefaultRecvTime)()),
479
481
  subaccountName: params.subaccountName,
480
482
  subaccountOwner: params.subaccountOwner
481
483
  };
482
- const tx = (0, import_contracts.getNadoEIP712Values)(
484
+ const tx = (0, import_shared.getNadoEIP712Values)(
483
485
  "leaderboard_authentication",
484
486
  signatureParams
485
487
  );
@@ -494,7 +496,7 @@ var IndexerBaseClient = class {
494
496
  signature
495
497
  };
496
498
  const baseResponse = await this.query("leaderboard_registration", {
497
- subaccount: (0, import_contracts.subaccountToHex)({
499
+ subaccount: (0, import_shared.subaccountToHex)({
498
500
  subaccountOwner: params.subaccountOwner,
499
501
  subaccountName: params.subaccountName
500
502
  }),
@@ -511,7 +513,7 @@ var IndexerBaseClient = class {
511
513
  */
512
514
  async getLeaderboardRegistration(params) {
513
515
  const baseResponse = await this.query("leaderboard_registration", {
514
- subaccount: (0, import_contracts.subaccountToHex)({
516
+ subaccount: (0, import_shared.subaccountToHex)({
515
517
  subaccountOwner: params.subaccountOwner,
516
518
  subaccountName: params.subaccountName
517
519
  }),
@@ -543,17 +545,17 @@ var IndexerBaseClient = class {
543
545
  async getFastWithdrawalSignature(params) {
544
546
  const baseResponse = await this.query("fast_withdrawal_signature", params);
545
547
  return {
546
- idx: (0, import_utils.toBigInt)(baseResponse.idx),
548
+ idx: (0, import_shared.toBigInt)(baseResponse.idx),
547
549
  tx: baseResponse.tx,
548
- txBytes: (0, import_utils.getValidatedHex)(baseResponse.tx_bytes),
549
- signatures: baseResponse.signatures.map(import_utils.getValidatedHex)
550
+ txBytes: (0, import_shared.getValidatedHex)(baseResponse.tx_bytes),
551
+ signatures: baseResponse.signatures.map(import_shared.getValidatedHex)
550
552
  };
551
553
  }
552
554
  async getNlpSnapshots(params) {
553
555
  const baseResponse = await this.query("nlp_snapshots", {
554
556
  interval: {
555
557
  count: params.limit,
556
- max_time: params.maxTimeInclusive ? (0, import_utils.toIntegerString)(params.maxTimeInclusive) : void 0,
558
+ max_time: params.maxTimeInclusive ? (0, import_shared.toIntegerString)(params.maxTimeInclusive) : void 0,
557
559
  granularity: params.granularity
558
560
  }
559
561
  });
@@ -561,17 +563,41 @@ var IndexerBaseClient = class {
561
563
  snapshots: baseResponse.snapshots.map(import_dataMappers.mapIndexerNlpSnapshot)
562
564
  };
563
565
  }
566
+ /**
567
+ * Retrieves the subaccount's DDA (Direct Deposit Address)
568
+ * @param params
569
+ */
570
+ async getSubaccountDDA(params) {
571
+ const baseResponse = await this.query("direct_deposit_address", {
572
+ subaccount: (0, import_shared.subaccountToHex)(params.subaccount)
573
+ });
574
+ return {
575
+ address: (0, import_shared.getValidatedAddress)(baseResponse.v1_address)
576
+ };
577
+ }
564
578
  async getSequencerBacklog() {
565
579
  const baseResponse = await this.query("backlog", {});
566
580
  return {
567
- totalTxs: (0, import_utils.toBigDecimal)(baseResponse.total_txs),
568
- totalSubmissions: (0, import_utils.toBigDecimal)(baseResponse.total_submissions),
569
- backlogSize: (0, import_utils.toBigDecimal)(baseResponse.backlog_size),
570
- updatedAt: (0, import_utils.toBigDecimal)(baseResponse.updated_at),
571
- backlogEtaInSeconds: baseResponse.backlog_eta_in_seconds ? (0, import_utils.toBigDecimal)(baseResponse.backlog_eta_in_seconds) : null,
572
- txsPerSecond: baseResponse.txs_per_second ? (0, import_utils.toBigDecimal)(baseResponse.txs_per_second) : null
581
+ totalTxs: (0, import_shared.toBigDecimal)(baseResponse.total_txs),
582
+ totalSubmissions: (0, import_shared.toBigDecimal)(baseResponse.total_submissions),
583
+ backlogSize: (0, import_shared.toBigDecimal)(baseResponse.backlog_size),
584
+ updatedAt: (0, import_shared.toBigDecimal)(baseResponse.updated_at),
585
+ backlogEtaInSeconds: baseResponse.backlog_eta_in_seconds ? (0, import_shared.toBigDecimal)(baseResponse.backlog_eta_in_seconds) : null,
586
+ txsPerSecond: baseResponse.txs_per_second ? (0, import_shared.toBigDecimal)(baseResponse.txs_per_second) : null
573
587
  };
574
588
  }
589
+ /**
590
+ * Get tickers from the v2 indexer endpoint
591
+ * @param params
592
+ */
593
+ async getV2Tickers(params) {
594
+ const response = await this.axiosInstance.get(
595
+ `${this.v2Url}/tickers`,
596
+ { params }
597
+ );
598
+ this.checkResponseStatus(response);
599
+ return (0, import_shared.mapValues)(response.data, import_dataMappers.mapIndexerV2Ticker);
600
+ }
575
601
  async query(requestType, params) {
576
602
  const reqBody = {
577
603
  [requestType]: params
@@ -583,9 +609,9 @@ var IndexerBaseClient = class {
583
609
  async sign(requestType, verifyingContract, chainId, params) {
584
610
  const walletClient = this.opts.walletClient;
585
611
  if (!walletClient) {
586
- throw new import_utils.WalletNotProvidedError();
612
+ throw new import_shared.WalletNotProvidedError();
587
613
  }
588
- return (0, import_contracts.getSignedTransactionRequest)({
614
+ return (0, import_shared.getSignedTransactionRequest)({
589
615
  chainId,
590
616
  requestParams: params,
591
617
  requestType,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/IndexerBaseClient.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationParams,\n EIP712LeaderboardAuthenticationValues,\n getDefaultRecvTime,\n getNadoEIP712Values,\n getSignedTransactionRequest,\n SignableRequestType,\n SignableRequestTypeToParams,\n SignedTx,\n subaccountFromHex,\n subaccountToHex,\n WalletClientWithAccount,\n} from '@nadohq/contracts';\nimport {\n getValidatedHex,\n mapValues,\n nowInSeconds,\n removeDecimals,\n toBigDecimal,\n toBigInt,\n toIntegerString,\n WalletNotProvidedError,\n} from '@nadohq/utils';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapIndexerCandlesticks,\n mapIndexerEvent,\n mapIndexerEventWithTx,\n mapIndexerFundingRate,\n mapIndexerLeaderboardContest,\n mapIndexerLeaderboardPosition,\n mapIndexerLeaderboardRegistration,\n mapIndexerMakerStatistics,\n mapIndexerMarketSnapshot,\n mapIndexerMatchEventBalances,\n mapIndexerOrder,\n mapIndexerPerpPrices,\n mapIndexerProductPayment,\n mapIndexerServerProduct,\n mapIndexerNlpSnapshot,\n mapSnapshotsIntervalToServerParams,\n} from './dataMappers';\nimport {\n GetIndexerBacklogResponse,\n GetIndexerCandlesticksParams,\n GetIndexerCandlesticksResponse,\n GetIndexerEdgeCandlesticksParams,\n GetIndexerEdgeCandlesticksResponse,\n GetIndexerEdgeMarketSnapshotResponse,\n GetIndexerEdgeMarketSnapshotsParams,\n GetIndexerEventsParams,\n GetIndexerEventsResponse,\n GetIndexerFastWithdrawalSignatureParams,\n GetIndexerFastWithdrawalSignatureResponse,\n GetIndexerFundingRateParams,\n GetIndexerFundingRateResponse,\n GetIndexerInterestFundingPaymentsParams,\n GetIndexerInterestFundingPaymentsResponse,\n GetIndexerLeaderboardContestsParams,\n GetIndexerLeaderboardContestsResponse,\n GetIndexerLeaderboardParams,\n GetIndexerLeaderboardParticipantParams,\n GetIndexerLeaderboardParticipantResponse,\n GetIndexerLeaderboardRegistrationParams,\n GetIndexerLeaderboardRegistrationResponse,\n GetIndexerLeaderboardResponse,\n GetIndexerLinkedSignerParams,\n GetIndexerLinkedSignerResponse,\n GetIndexerMakerStatisticsParams,\n GetIndexerMakerStatisticsResponse,\n GetIndexerMarketSnapshotsParams,\n GetIndexerMarketSnapshotsResponse,\n GetIndexerMatchEventsParams,\n GetIndexerMatchEventsResponse,\n GetIndexerMultiProductFundingRatesParams,\n GetIndexerMultiProductFundingRatesResponse,\n GetIndexerMultiProductPerpPricesParams,\n GetIndexerMultiProductPerpPricesResponse,\n GetIndexerMultiProductSnapshotsParams,\n GetIndexerMultiProductSnapshotsResponse,\n GetIndexerMultiSubaccountSnapshotsParams,\n GetIndexerMultiSubaccountSnapshotsResponse,\n GetIndexerOraclePricesParams,\n GetIndexerOraclePricesResponse,\n GetIndexerOrdersParams,\n GetIndexerOrdersResponse,\n GetIndexerPerpPricesParams,\n GetIndexerPerpPricesResponse,\n GetIndexerProductSnapshotsParams,\n GetIndexerProductSnapshotsResponse,\n GetIndexerQuotePriceResponse,\n GetIndexerReferralCodeParams,\n GetIndexerReferralCodeResponse,\n GetIndexerNlpSnapshotsParams,\n GetIndexerNlpSnapshotsResponse,\n IndexerEventWithTx,\n IndexerMatchEvent,\n IndexerOraclePrice,\n IndexerServerEventsParams,\n IndexerServerQueryRequestByType,\n IndexerServerQueryRequestType,\n IndexerServerQueryResponseByType,\n IndexerSnapshotBalance,\n IndexerSubaccountSnapshot,\n ListIndexerSubaccountsParams,\n ListIndexerSubaccountsResponse,\n UpdateIndexerLeaderboardRegistrationParams,\n UpdateIndexerLeaderboardRegistrationResponse,\n} from './types';\n\nexport interface IndexerClientOpts {\n // Server URLs\n url: string;\n v2Url?: string;\n // Wallet Client for EIP712 signing\n walletClient?: WalletClientWithAccount;\n}\n\ntype IndexerQueryRequestBody = Partial<IndexerServerQueryRequestByType>;\n\n/**\n * Base client for all indexer requests\n */\nexport class IndexerBaseClient {\n readonly opts: IndexerClientOpts;\n readonly v2Url: string;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: IndexerClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n });\n this.v2Url = opts.v2Url ? opts.v2Url : opts.url.replace('v1', 'v2');\n }\n\n /**\n * List all subaccounts\n *\n * @param params\n */\n async listSubaccounts(\n params: ListIndexerSubaccountsParams,\n ): Promise<ListIndexerSubaccountsResponse> {\n const baseResponse = await this.query('subaccounts', params);\n\n return baseResponse.subaccounts.map((item) => {\n const subaccount = subaccountFromHex(item.subaccount);\n return {\n hexId: item.subaccount,\n ...subaccount,\n };\n });\n }\n\n /**\n * Retrieve snapshots of multiple subaccounts at multiple points in time.\n * Each snapshot is a view of the subaccount's balances at this point in time, with tracked variables for interest, funding, etc.\n *\n * @param params\n */\n async getMultiSubaccountSnapshots(\n params: GetIndexerMultiSubaccountSnapshotsParams,\n ): Promise<GetIndexerMultiSubaccountSnapshotsResponse> {\n const subaccountHexIds = params.subaccounts.map(\n ({ subaccountOwner, subaccountName }) =>\n subaccountToHex({\n subaccountOwner,\n subaccountName,\n }),\n );\n\n const baseResponse = await this.query('account_snapshots', {\n subaccounts: subaccountHexIds,\n timestamps: params.timestamps,\n isolated: params.isolated,\n });\n\n const snapshotsBySubaccount = mapValues(\n baseResponse.snapshots,\n (balanceSnapshots) => {\n const snapshotByTimestamp: Record<string, IndexerSubaccountSnapshot> =\n {};\n\n Object.entries(balanceSnapshots).forEach(([timestamp, events]) => {\n const balances: IndexerSnapshotBalance[] =\n events.map(mapIndexerEvent);\n\n snapshotByTimestamp[timestamp] = {\n timestamp: toBigDecimal(timestamp),\n balances,\n };\n });\n\n return snapshotByTimestamp;\n },\n );\n\n return {\n subaccountHexIds,\n snapshots: snapshotsBySubaccount,\n };\n }\n\n /**\n * Retrieves referral code for an address\n *\n * @param params\n */\n async getReferralCode(\n params: GetIndexerReferralCodeParams,\n ): Promise<GetIndexerReferralCodeResponse> {\n const baseResponse = await this.query('referral_code', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n }),\n });\n\n return {\n referralCode: baseResponse.referral_code,\n };\n }\n\n /**\n * Retrieves funding rate for a product, where 1 = 100%\n * @param params\n */\n async getFundingRate(\n params: GetIndexerFundingRateParams,\n ): Promise<GetIndexerFundingRateResponse> {\n const baseResponse = await this.query('funding_rate', {\n product_id: params.productId,\n });\n\n return mapIndexerFundingRate(baseResponse);\n }\n\n /**\n * Retrieves funding rate for multiple products, where 1 = 100%\n * @param params\n */\n async getMultiProductFundingRates(\n params: GetIndexerMultiProductFundingRatesParams,\n ): Promise<GetIndexerMultiProductFundingRatesResponse> {\n const baseResponse = await this.query('funding_rates', {\n product_ids: params.productIds,\n });\n\n return mapValues(baseResponse, mapIndexerFundingRate);\n }\n\n /**\n * Retrieves latest mark/index price for a perp product\n * @param params\n */\n async getPerpPrices(\n params: GetIndexerPerpPricesParams,\n ): Promise<GetIndexerPerpPricesResponse> {\n const baseResponse = await this.query('price', {\n product_id: params.productId,\n });\n\n return mapIndexerPerpPrices(baseResponse);\n }\n\n /**\n * Retrieves latest mark/index price for multiple perp products\n * @param params\n */\n async getMultiProductPerpPrices(\n params: GetIndexerMultiProductPerpPricesParams,\n ): Promise<GetIndexerMultiProductPerpPricesResponse> {\n const baseResponse = await this.query('perp_prices', {\n product_ids: params.productIds,\n });\n\n return mapValues(baseResponse, mapIndexerPerpPrices);\n }\n\n /**\n * Retrieves latest oracle prices for provided products\n * @param params\n */\n async getOraclePrices(\n params: GetIndexerOraclePricesParams,\n ): Promise<GetIndexerOraclePricesResponse> {\n const baseResponse = await this.query('oracle_price', {\n product_ids: params.productIds,\n });\n\n return baseResponse.prices.map((price): IndexerOraclePrice => {\n return {\n oraclePrice: removeDecimals(price.oracle_price_x18),\n updateTime: toBigDecimal(price.update_time),\n productId: price.product_id,\n };\n });\n }\n\n /**\n * Retrieves candlesticks for a product\n * @param params\n */\n async getCandlesticks(\n params: GetIndexerCandlesticksParams,\n ): Promise<GetIndexerCandlesticksResponse> {\n const baseResponse = await this.query('candlesticks', {\n product_id: params.productId,\n max_time: params.maxTimeInclusive,\n limit: params.limit,\n granularity: params.period,\n });\n\n return baseResponse.candlesticks.map(mapIndexerCandlesticks);\n }\n\n /**\n * Retrieves candlesticks for a product from Edge\n * @param params\n */\n async getEdgeCandlesticks(\n params: GetIndexerEdgeCandlesticksParams,\n ): Promise<GetIndexerEdgeCandlesticksResponse> {\n const baseResponse = await this.query('edge_candlesticks', {\n product_id: params.productId,\n max_time: params.maxTimeInclusive,\n limit: params.limit,\n granularity: params.period,\n });\n\n return baseResponse.candlesticks.map(mapIndexerCandlesticks);\n }\n\n /**\n * Retrieves historical snapshots for a product\n * @param params\n */\n async getProductSnapshots(\n params: GetIndexerProductSnapshotsParams,\n ): Promise<GetIndexerProductSnapshotsResponse> {\n const baseResponse = await this.query('products', {\n product_id: params.productId,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n idx: params.startCursor,\n });\n\n return baseResponse.products.map((product) => {\n return {\n ...mapIndexerServerProduct(product.product),\n submissionIndex: product.submission_idx,\n };\n });\n }\n\n /**\n * Retrieves historical snapshots for multiple products\n * @param params\n */\n async getMultiProductSnapshots(\n params: GetIndexerMultiProductSnapshotsParams,\n ): Promise<GetIndexerMultiProductSnapshotsResponse> {\n const timestampToProductsMap = await this.query('product_snapshots', {\n product_ids: params.productIds,\n max_time: params.maxTimestampInclusive ?? [nowInSeconds()],\n });\n\n return mapValues(timestampToProductsMap, (productIdToProduct) => {\n return mapValues(productIdToProduct, (indexerProduct) => {\n return {\n ...mapIndexerServerProduct(indexerProduct.product),\n submissionIndex: indexerProduct.submission_idx,\n };\n });\n });\n }\n\n /**\n * Retrieves historical events\n *\n * @param params\n */\n async getEvents(\n params: GetIndexerEventsParams,\n ): Promise<GetIndexerEventsResponse> {\n const serverLimit = ((): IndexerServerEventsParams['limit'] | undefined => {\n if (!params.limit) {\n return;\n }\n\n if (params.limit.type === 'events') {\n return {\n raw: params.limit.value,\n };\n }\n return {\n txs: params.limit.value,\n };\n })();\n\n const baseResponse = await this.query('events', {\n subaccount: params.subaccount\n ? subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n })\n : undefined,\n product_ids: params.productIds,\n isolated: params.isolated,\n event_types: params.eventTypes,\n max_time: params.maxTimestampInclusive,\n desc: params.desc,\n limit: serverLimit,\n idx: params.startCursor,\n });\n\n // Keep track of the last tx index, and go to the next one if the submission_idx for the currently processed event does not match\n // txs are ordered the same as events, so this should be correct\n let lastTxIdx = 0;\n return baseResponse.events.map((event): IndexerEventWithTx => {\n if (baseResponse.txs[lastTxIdx].submission_idx !== event.submission_idx) {\n lastTxIdx += 1;\n }\n const tx = baseResponse.txs[lastTxIdx];\n return mapIndexerEventWithTx(event, tx);\n });\n }\n\n /**\n * Retrieves historical orders\n * @param params\n */\n async getOrders(\n params: GetIndexerOrdersParams,\n ): Promise<GetIndexerOrdersResponse> {\n const baseResponse = await this.query('orders', {\n subaccount: params.subaccount\n ? subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n })\n : undefined,\n product_ids: params.productIds,\n isolated: params.isolated,\n digests: params.digests,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n idx: params.startCursor,\n });\n\n return baseResponse.orders.map(mapIndexerOrder);\n }\n\n /**\n * Gets match order events, this will return the same events as the events query, but with additional information\n * to identify the order that was matched\n *\n * @param params\n */\n async getMatchEvents(\n params: GetIndexerMatchEventsParams,\n ): Promise<GetIndexerMatchEventsResponse> {\n const baseResponse = await this.query('matches', {\n subaccount: params.subaccount\n ? subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n })\n : undefined,\n product_ids: params.productIds,\n isolated: params.isolated,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n idx: params.startCursor,\n });\n\n // Same as logic in `getEvents`\n let lastTxIdx = 0;\n return baseResponse.matches.map((matchEvent): IndexerMatchEvent => {\n if (\n baseResponse.txs[lastTxIdx].submission_idx !== matchEvent.submission_idx\n ) {\n lastTxIdx += 1;\n }\n const { tx, timestamp } = baseResponse.txs[lastTxIdx];\n\n // We use this to derive the product ID for the match\n const postBalances = mapIndexerMatchEventBalances(\n matchEvent.post_balance,\n );\n\n return {\n productId: postBalances.base.productId,\n isolated: matchEvent.isolated,\n totalFee: toBigDecimal(matchEvent.fee),\n sequencerFee: toBigDecimal(matchEvent.sequencer_fee),\n baseFilled: toBigDecimal(matchEvent.base_filled),\n quoteFilled: toBigDecimal(matchEvent.quote_filled),\n cumulativeFee: toBigDecimal(matchEvent.cumulative_fee),\n cumulativeBaseFilled: toBigDecimal(matchEvent.cumulative_base_filled),\n cumulativeQuoteFilled: toBigDecimal(matchEvent.cumulative_quote_filled),\n digest: matchEvent.digest,\n order: matchEvent.order,\n submissionIndex: matchEvent.submission_idx,\n timestamp: toBigDecimal(timestamp),\n preEventTrackedVars: {\n netEntryUnrealized: toBigDecimal(matchEvent.net_entry_unrealized),\n netEntryCumulative: toBigDecimal(matchEvent.net_entry_cumulative),\n },\n preBalances: mapIndexerMatchEventBalances(matchEvent.pre_balance),\n postBalances,\n tx,\n ...subaccountFromHex(matchEvent.order.sender),\n };\n });\n }\n\n /**\n * Retrieves historical funding & interest payments.\n * NOTE: `limit` is an upperbound. If a user changes position size such that his position is 0 during each funding/interest tick,\n * then the indexer will return fewer than `limit` results per page. However, more events can be present. This means that\n * there isn't a reliable way to determine whether there is a next page. We just need to keep paginating until the next cursor is null.\n *\n * @param params\n */\n async getInterestFundingPayments(\n params: GetIndexerInterestFundingPaymentsParams,\n ): Promise<GetIndexerInterestFundingPaymentsResponse> {\n const baseResponse = await this.query('interest_and_funding', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n }),\n product_ids: params.productIds,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n max_idx: params.startCursor,\n });\n\n return {\n fundingPayments: baseResponse.funding_payments.map(\n mapIndexerProductPayment,\n ),\n interestPayments: baseResponse.interest_payments.map(\n mapIndexerProductPayment,\n ),\n nextCursor: baseResponse.next_idx,\n };\n }\n\n /**\n * Gets quote (USDC) price in terms of USD\n */\n async getQuotePrice(): Promise<GetIndexerQuotePriceResponse> {\n const baseResponse = await this.query('usdc_price', {});\n return {\n price: removeDecimals(baseResponse.price_x18),\n };\n }\n\n /**\n * Fetches currently registered linked signer with the remaining txs allowed for the subaccount\n */\n async getLinkedSignerWithRateLimit(\n params: GetIndexerLinkedSignerParams,\n ): Promise<GetIndexerLinkedSignerResponse> {\n const baseResponse = await this.query('linked_signer_rate_limit', {\n subaccount: subaccountToHex(params.subaccount),\n });\n return {\n totalTxLimit: toBigDecimal(baseResponse.total_tx_limit),\n remainingTxs: toBigDecimal(baseResponse.remaining_tx),\n signer: baseResponse.signer,\n waitTimeUntilNextTx: toBigDecimal(baseResponse.wait_time),\n };\n }\n\n /**\n * Retrieve historical market snapshots\n * @param params\n */\n async getMarketSnapshots(\n params: GetIndexerMarketSnapshotsParams,\n ): Promise<GetIndexerMarketSnapshotsResponse> {\n const baseResponse = await this.query('market_snapshots', {\n interval: mapSnapshotsIntervalToServerParams(params),\n product_ids: params.productIds,\n });\n\n return baseResponse.snapshots.map(mapIndexerMarketSnapshot);\n }\n\n /**\n * Retrieve historical market snapshots from Edge\n * @param params\n */\n async getEdgeMarketSnapshots(\n params: GetIndexerEdgeMarketSnapshotsParams,\n ): Promise<GetIndexerEdgeMarketSnapshotResponse> {\n const baseResponse = await this.query('edge_market_snapshots', {\n interval: mapSnapshotsIntervalToServerParams(params),\n });\n\n return mapValues(baseResponse.snapshots, (snapshots) =>\n snapshots.map(mapIndexerMarketSnapshot),\n );\n }\n\n /**\n * Retrieve maker statistics for a given epoch\n *\n * @param params\n */\n async getMakerStatistics(\n params: GetIndexerMakerStatisticsParams,\n ): Promise<GetIndexerMakerStatisticsResponse> {\n const baseResponse = await this.query('maker_statistics', {\n product_id: params.productId,\n epoch: params.epoch,\n interval: params.interval,\n });\n\n return {\n rewardCoefficient: toBigDecimal(baseResponse.reward_coefficient),\n makers: baseResponse.makers.map(mapIndexerMakerStatistics),\n };\n }\n\n /**\n * Retrieve leaderboard stats for a given contest\n *\n * @param params\n */\n async getLeaderboard(\n params: GetIndexerLeaderboardParams,\n ): Promise<GetIndexerLeaderboardResponse> {\n const baseResponse = await this.query('leaderboard', {\n contest_id: params.contestId,\n rank_type: params.rankType,\n start: params.startCursor,\n limit: params.limit,\n });\n\n return {\n participants: baseResponse.positions.map(mapIndexerLeaderboardPosition),\n };\n }\n\n /**\n * Retrieve leaderboard ranking of a subaccount on a given contest\n *\n * @param params\n */\n async getLeaderboardParticipant(\n params: GetIndexerLeaderboardParticipantParams,\n ): Promise<GetIndexerLeaderboardParticipantResponse> {\n const baseResponse = await this.query('leaderboard_rank', {\n subaccount: subaccountToHex(params.subaccount),\n contest_ids: params.contestIds,\n });\n\n return {\n participant: mapValues(baseResponse.positions, (position) =>\n mapIndexerLeaderboardPosition(position),\n ),\n };\n }\n\n /**\n * Attempts to update a user's registration to the provided `contestId`. This requires signing.\n * @param params\n */\n async updateLeaderboardRegistration(\n params: UpdateIndexerLeaderboardRegistrationParams,\n ): Promise<UpdateIndexerLeaderboardRegistrationResponse> {\n const signatureParams: EIP712LeaderboardAuthenticationParams = {\n // Default to 90 seconds from now if no recvTime is provided\n expiration: toIntegerString(params.recvTime ?? getDefaultRecvTime()),\n subaccountName: params.subaccountName,\n subaccountOwner: params.subaccountOwner,\n };\n\n const tx = getNadoEIP712Values(\n 'leaderboard_authentication',\n signatureParams,\n );\n const signature = await this.sign(\n 'leaderboard_authentication',\n params.updateRegistration.verifyingAddr,\n params.updateRegistration.chainId,\n signatureParams,\n );\n\n const updateRegistrationTx: SignedTx<EIP712LeaderboardAuthenticationValues> =\n {\n tx,\n signature,\n };\n\n const baseResponse = await this.query('leaderboard_registration', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n contest_id: params.contestId,\n update_registration: updateRegistrationTx,\n });\n return {\n registration: baseResponse.registration\n ? mapIndexerLeaderboardRegistration(baseResponse.registration)\n : null,\n };\n }\n\n /**\n * Retrieves the registration status for a leaderboard participant for provided `contestId`.\n * @param params\n */\n async getLeaderboardRegistration(\n params: GetIndexerLeaderboardRegistrationParams,\n ): Promise<GetIndexerLeaderboardRegistrationResponse> {\n const baseResponse = await this.query('leaderboard_registration', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n contest_id: params.contestId,\n update_registration: null,\n });\n return {\n registration: baseResponse.registration\n ? mapIndexerLeaderboardRegistration(baseResponse.registration)\n : null,\n };\n }\n\n /**\n * Retrieve metadata of provided leaderboard contests\n *\n * @param params\n */\n async getLeaderboardContests(\n params: GetIndexerLeaderboardContestsParams,\n ): Promise<GetIndexerLeaderboardContestsResponse> {\n const baseResponse = await this.query('leaderboard_contests', {\n contest_ids: params.contestIds,\n });\n\n return {\n contests: baseResponse.contests.map(mapIndexerLeaderboardContest),\n };\n }\n\n /**\n * Retrieve signature and tx to submit a fast withdrawal\n *\n * @param params\n */\n async getFastWithdrawalSignature(\n params: GetIndexerFastWithdrawalSignatureParams,\n ): Promise<GetIndexerFastWithdrawalSignatureResponse> {\n const baseResponse = await this.query('fast_withdrawal_signature', params);\n return {\n idx: toBigInt(baseResponse.idx),\n tx: baseResponse.tx,\n txBytes: getValidatedHex(baseResponse.tx_bytes),\n signatures: baseResponse.signatures.map(getValidatedHex),\n };\n }\n\n async getNlpSnapshots(\n params: GetIndexerNlpSnapshotsParams,\n ): Promise<GetIndexerNlpSnapshotsResponse> {\n const baseResponse = await this.query('nlp_snapshots', {\n interval: {\n count: params.limit,\n max_time: params.maxTimeInclusive\n ? toIntegerString(params.maxTimeInclusive)\n : undefined,\n granularity: params.granularity,\n },\n });\n\n return {\n snapshots: baseResponse.snapshots.map(mapIndexerNlpSnapshot),\n };\n }\n\n async getSequencerBacklog(): Promise<GetIndexerBacklogResponse> {\n const baseResponse = await this.query('backlog', {});\n\n return {\n totalTxs: toBigDecimal(baseResponse.total_txs),\n totalSubmissions: toBigDecimal(baseResponse.total_submissions),\n backlogSize: toBigDecimal(baseResponse.backlog_size),\n updatedAt: toBigDecimal(baseResponse.updated_at),\n backlogEtaInSeconds: baseResponse.backlog_eta_in_seconds\n ? toBigDecimal(baseResponse.backlog_eta_in_seconds)\n : null,\n txsPerSecond: baseResponse.txs_per_second\n ? toBigDecimal(baseResponse.txs_per_second)\n : null,\n };\n }\n\n protected async query<TRequestType extends IndexerServerQueryRequestType>(\n requestType: TRequestType,\n params: IndexerServerQueryRequestByType[TRequestType],\n ): Promise<IndexerServerQueryResponseByType[TRequestType]> {\n const reqBody: IndexerQueryRequestBody = {\n [requestType]: params,\n };\n const response = await this.axiosInstance.post<\n IndexerServerQueryResponseByType[TRequestType]\n >(this.opts.url, reqBody);\n\n this.checkResponseStatus(response);\n\n return response.data;\n }\n\n protected async sign<T extends SignableRequestType>(\n requestType: T,\n verifyingContract: string,\n chainId: number,\n params: SignableRequestTypeToParams[T],\n ) {\n const walletClient = this.opts.walletClient;\n\n if (!walletClient) {\n throw new WalletNotProvidedError();\n }\n\n return getSignedTransactionRequest({\n chainId,\n requestParams: params,\n requestType,\n walletClient,\n verifyingContract,\n });\n }\n\n private checkResponseStatus(response: AxiosResponse) {\n if (response.status !== 200 || !response.data) {\n throw Error(\n `Unexpected response from server: ${response.status} ${response.statusText}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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ACL,cAAU,2BAAa,aAAa,SAAS;AAAA,MAC7C,sBAAkB,2BAAa,aAAa,iBAAiB;AAAA,MAC7D,iBAAa,2BAAa,aAAa,YAAY;AAAA,MACnD,eAAW,2BAAa,aAAa,UAAU;AAAA,MAC/C,qBAAqB,aAAa,6BAC9B,2BAAa,aAAa,sBAAsB,IAChD;AAAA,MACJ,cAAc,aAAa,qBACvB,2BAAa,aAAa,cAAc,IACxC;AAAA,IACN;AAAA,EACF;AAAA,EAEA,MAAgB,MACd,aACA,QACyD;AACzD,UAAM,UAAmC;AAAA,MACvC,CAAC,WAAW,GAAG;AAAA,IACjB;AACA,UAAM,WAAW,MAAM,KAAK,cAAc,KAExC,KAAK,KAAK,KAAK,OAAO;AAExB,SAAK,oBAAoB,QAAQ;AAEjC,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAgB,KACd,aACA,mBACA,SACA,QACA;AACA,UAAM,eAAe,KAAK,KAAK;AAE/B,QAAI,CAAC,cAAc;AACjB,YAAM,IAAI,oCAAuB;AAAA,IACnC;AAEA,eAAO,8CAA4B;AAAA,MACjC;AAAA,MACA,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEQ,oBAAoB,UAAyB;AACnD,QAAI,SAAS,WAAW,OAAO,CAAC,SAAS,MAAM;AAC7C,YAAM;AAAA,QACJ,oCAAoC,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,MAC5E;AAAA,IACF;AAAA,EACF;AACF;","names":["axios"]}
1
+ {"version":3,"sources":["../src/IndexerBaseClient.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationParams,\n EIP712LeaderboardAuthenticationValues,\n getDefaultRecvTime,\n getNadoEIP712Values,\n getSignedTransactionRequest,\n getValidatedAddress,\n getValidatedHex,\n mapValues,\n nowInSeconds,\n removeDecimals,\n SignableRequestType,\n SignableRequestTypeToParams,\n SignedTx,\n subaccountFromHex,\n subaccountToHex,\n toBigDecimal,\n toBigInt,\n toIntegerString,\n WalletClientWithAccount,\n WalletNotProvidedError,\n} from '@nadohq/shared';\nimport axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapIndexerCandlesticks,\n mapIndexerEvent,\n mapIndexerEventWithTx,\n mapIndexerFundingRate,\n mapIndexerLeaderboardContest,\n mapIndexerLeaderboardPosition,\n mapIndexerLeaderboardRegistration,\n mapIndexerMakerStatistics,\n mapIndexerMarketSnapshot,\n mapIndexerMatchEventBalances,\n mapIndexerNlpSnapshot,\n mapIndexerOrder,\n mapIndexerPerpPrices,\n mapIndexerProductPayment,\n mapIndexerServerProduct,\n mapIndexerV2Ticker,\n mapSnapshotsIntervalToServerParams,\n} from './dataMappers';\nimport {\n GetIndexerBacklogResponse,\n GetIndexerCandlesticksParams,\n GetIndexerCandlesticksResponse,\n GetIndexerEdgeCandlesticksParams,\n GetIndexerEdgeCandlesticksResponse,\n GetIndexerEdgeMarketSnapshotResponse,\n GetIndexerEdgeMarketSnapshotsParams,\n GetIndexerEventsParams,\n GetIndexerEventsResponse,\n GetIndexerFastWithdrawalSignatureParams,\n GetIndexerFastWithdrawalSignatureResponse,\n GetIndexerFundingRateParams,\n GetIndexerFundingRateResponse,\n GetIndexerInterestFundingPaymentsParams,\n GetIndexerInterestFundingPaymentsResponse,\n GetIndexerLeaderboardContestsParams,\n GetIndexerLeaderboardContestsResponse,\n GetIndexerLeaderboardParams,\n GetIndexerLeaderboardParticipantParams,\n GetIndexerLeaderboardParticipantResponse,\n GetIndexerLeaderboardRegistrationParams,\n GetIndexerLeaderboardRegistrationResponse,\n GetIndexerLeaderboardResponse,\n GetIndexerLinkedSignerParams,\n GetIndexerLinkedSignerResponse,\n GetIndexerMakerStatisticsParams,\n GetIndexerMakerStatisticsResponse,\n GetIndexerMarketSnapshotsParams,\n GetIndexerMarketSnapshotsResponse,\n GetIndexerMatchEventsParams,\n GetIndexerMatchEventsResponse,\n GetIndexerMultiProductFundingRatesParams,\n GetIndexerMultiProductFundingRatesResponse,\n GetIndexerMultiProductPerpPricesParams,\n GetIndexerMultiProductPerpPricesResponse,\n GetIndexerMultiProductSnapshotsParams,\n GetIndexerMultiProductSnapshotsResponse,\n GetIndexerMultiSubaccountSnapshotsParams,\n GetIndexerMultiSubaccountSnapshotsResponse,\n GetIndexerNlpSnapshotsParams,\n GetIndexerNlpSnapshotsResponse,\n GetIndexerOraclePricesParams,\n GetIndexerOraclePricesResponse,\n GetIndexerOrdersParams,\n GetIndexerOrdersResponse,\n GetIndexerPerpPricesParams,\n GetIndexerPerpPricesResponse,\n GetIndexerProductSnapshotsParams,\n GetIndexerProductSnapshotsResponse,\n GetIndexerQuotePriceResponse,\n GetIndexerReferralCodeParams,\n GetIndexerReferralCodeResponse,\n GetIndexerSubaccountDDAParams,\n GetIndexerSubaccountDDAResponse,\n GetIndexerV2TickersParams,\n GetIndexerV2TickersResponse,\n IndexerEventWithTx,\n IndexerMatchEvent,\n IndexerOraclePrice,\n IndexerServerEventsParams,\n IndexerServerQueryRequestByType,\n IndexerServerQueryRequestType,\n IndexerServerQueryResponseByType,\n IndexerServerV2TickersResponse,\n IndexerSnapshotBalance,\n IndexerSubaccountSnapshot,\n ListIndexerSubaccountsParams,\n ListIndexerSubaccountsResponse,\n UpdateIndexerLeaderboardRegistrationParams,\n UpdateIndexerLeaderboardRegistrationResponse,\n} from './types';\n\nexport interface IndexerClientOpts {\n // Server URLs\n url: string;\n v2Url?: string;\n // Wallet Client for EIP712 signing\n walletClient?: WalletClientWithAccount;\n}\n\ntype IndexerQueryRequestBody = Partial<IndexerServerQueryRequestByType>;\n\n/**\n * Base client for all indexer requests\n */\nexport class IndexerBaseClient {\n readonly opts: IndexerClientOpts;\n readonly v2Url: string;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: IndexerClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n withCredentials: true,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n });\n this.v2Url = opts.v2Url ? opts.v2Url : opts.url.replace('v1', 'v2');\n }\n\n /**\n * List all subaccounts\n *\n * @param params\n */\n async listSubaccounts(\n params: ListIndexerSubaccountsParams,\n ): Promise<ListIndexerSubaccountsResponse> {\n const baseResponse = await this.query('subaccounts', params);\n\n return baseResponse.subaccounts.map((item) => {\n const subaccount = subaccountFromHex(item.subaccount);\n return {\n hexId: item.subaccount,\n ...subaccount,\n };\n });\n }\n\n /**\n * Retrieve snapshots of multiple subaccounts at multiple points in time.\n * Each snapshot is a view of the subaccount's balances at this point in time, with tracked variables for interest, funding, etc.\n *\n * @param params\n */\n async getMultiSubaccountSnapshots(\n params: GetIndexerMultiSubaccountSnapshotsParams,\n ): Promise<GetIndexerMultiSubaccountSnapshotsResponse> {\n const subaccountHexIds = params.subaccounts.map(\n ({ subaccountOwner, subaccountName }) =>\n subaccountToHex({\n subaccountOwner,\n subaccountName,\n }),\n );\n\n const baseResponse = await this.query('account_snapshots', {\n subaccounts: subaccountHexIds,\n timestamps: params.timestamps,\n isolated: params.isolated,\n });\n\n const snapshotsBySubaccount = mapValues(\n baseResponse.snapshots,\n (balanceSnapshots) => {\n const snapshotByTimestamp: Record<string, IndexerSubaccountSnapshot> =\n {};\n\n Object.entries(balanceSnapshots).forEach(([timestamp, events]) => {\n const balances: IndexerSnapshotBalance[] =\n events.map(mapIndexerEvent);\n\n snapshotByTimestamp[timestamp] = {\n timestamp: toBigDecimal(timestamp),\n balances,\n };\n });\n\n return snapshotByTimestamp;\n },\n );\n\n return {\n subaccountHexIds,\n snapshots: snapshotsBySubaccount,\n };\n }\n\n /**\n * Retrieves referral code for an address\n *\n * @param params\n */\n async getReferralCode(\n params: GetIndexerReferralCodeParams,\n ): Promise<GetIndexerReferralCodeResponse> {\n const baseResponse = await this.query('referral_code', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n }),\n });\n\n return {\n referralCode: baseResponse.referral_code,\n };\n }\n\n /**\n * Retrieves funding rate for a product, where 1 = 100%\n * @param params\n */\n async getFundingRate(\n params: GetIndexerFundingRateParams,\n ): Promise<GetIndexerFundingRateResponse> {\n const baseResponse = await this.query('funding_rate', {\n product_id: params.productId,\n });\n\n return mapIndexerFundingRate(baseResponse);\n }\n\n /**\n * Retrieves funding rate for multiple products, where 1 = 100%\n * @param params\n */\n async getMultiProductFundingRates(\n params: GetIndexerMultiProductFundingRatesParams,\n ): Promise<GetIndexerMultiProductFundingRatesResponse> {\n const baseResponse = await this.query('funding_rates', {\n product_ids: params.productIds,\n });\n\n return mapValues(baseResponse, mapIndexerFundingRate);\n }\n\n /**\n * Retrieves latest mark/index price for a perp product\n * @param params\n */\n async getPerpPrices(\n params: GetIndexerPerpPricesParams,\n ): Promise<GetIndexerPerpPricesResponse> {\n const baseResponse = await this.query('price', {\n product_id: params.productId,\n });\n\n return mapIndexerPerpPrices(baseResponse);\n }\n\n /**\n * Retrieves latest mark/index price for multiple perp products\n * @param params\n */\n async getMultiProductPerpPrices(\n params: GetIndexerMultiProductPerpPricesParams,\n ): Promise<GetIndexerMultiProductPerpPricesResponse> {\n const baseResponse = await this.query('perp_prices', {\n product_ids: params.productIds,\n });\n\n return mapValues(baseResponse, mapIndexerPerpPrices);\n }\n\n /**\n * Retrieves latest oracle prices for provided products\n * @param params\n */\n async getOraclePrices(\n params: GetIndexerOraclePricesParams,\n ): Promise<GetIndexerOraclePricesResponse> {\n const baseResponse = await this.query('oracle_price', {\n product_ids: params.productIds,\n });\n\n return baseResponse.prices.map((price): IndexerOraclePrice => {\n return {\n oraclePrice: removeDecimals(price.oracle_price_x18),\n updateTime: toBigDecimal(price.update_time),\n productId: price.product_id,\n };\n });\n }\n\n /**\n * Retrieves candlesticks for a product\n * @param params\n */\n async getCandlesticks(\n params: GetIndexerCandlesticksParams,\n ): Promise<GetIndexerCandlesticksResponse> {\n const baseResponse = await this.query('candlesticks', {\n product_id: params.productId,\n max_time: params.maxTimeInclusive,\n limit: params.limit,\n granularity: params.period,\n });\n\n return baseResponse.candlesticks.map(mapIndexerCandlesticks);\n }\n\n /**\n * Retrieves candlesticks for a product from Edge\n * @param params\n */\n async getEdgeCandlesticks(\n params: GetIndexerEdgeCandlesticksParams,\n ): Promise<GetIndexerEdgeCandlesticksResponse> {\n const baseResponse = await this.query('edge_candlesticks', {\n product_id: params.productId,\n max_time: params.maxTimeInclusive,\n limit: params.limit,\n granularity: params.period,\n });\n\n return baseResponse.candlesticks.map(mapIndexerCandlesticks);\n }\n\n /**\n * Retrieves historical snapshots for a product\n * @param params\n */\n async getProductSnapshots(\n params: GetIndexerProductSnapshotsParams,\n ): Promise<GetIndexerProductSnapshotsResponse> {\n const baseResponse = await this.query('products', {\n product_id: params.productId,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n idx: params.startCursor,\n });\n\n return baseResponse.products.map((product) => {\n return {\n ...mapIndexerServerProduct(product.product),\n submissionIndex: product.submission_idx,\n };\n });\n }\n\n /**\n * Retrieves historical snapshots for multiple products\n * @param params\n */\n async getMultiProductSnapshots(\n params: GetIndexerMultiProductSnapshotsParams,\n ): Promise<GetIndexerMultiProductSnapshotsResponse> {\n const timestampToProductsMap = await this.query('product_snapshots', {\n product_ids: params.productIds,\n max_time: params.maxTimestampInclusive ?? [nowInSeconds()],\n });\n\n return mapValues(timestampToProductsMap, (productIdToProduct) => {\n return mapValues(productIdToProduct, (indexerProduct) => {\n return {\n ...mapIndexerServerProduct(indexerProduct.product),\n submissionIndex: indexerProduct.submission_idx,\n };\n });\n });\n }\n\n /**\n * Retrieves historical events\n *\n * @param params\n */\n async getEvents(\n params: GetIndexerEventsParams,\n ): Promise<GetIndexerEventsResponse> {\n const serverLimit = ((): IndexerServerEventsParams['limit'] | undefined => {\n if (!params.limit) {\n return;\n }\n\n if (params.limit.type === 'events') {\n return {\n raw: params.limit.value,\n };\n }\n return {\n txs: params.limit.value,\n };\n })();\n\n const baseResponse = await this.query('events', {\n subaccount: params.subaccount\n ? subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n })\n : undefined,\n product_ids: params.productIds,\n isolated: params.isolated,\n event_types: params.eventTypes,\n max_time: params.maxTimestampInclusive,\n desc: params.desc,\n limit: serverLimit,\n idx: params.startCursor,\n });\n\n // Keep track of the last tx index, and go to the next one if the submission_idx for the currently processed event does not match\n // txs are ordered the same as events, so this should be correct\n let lastTxIdx = 0;\n return baseResponse.events.map((event): IndexerEventWithTx => {\n if (baseResponse.txs[lastTxIdx].submission_idx !== event.submission_idx) {\n lastTxIdx += 1;\n }\n const tx = baseResponse.txs[lastTxIdx];\n return mapIndexerEventWithTx(event, tx);\n });\n }\n\n /**\n * Retrieves historical orders\n * @param params\n */\n async getOrders(\n params: GetIndexerOrdersParams,\n ): Promise<GetIndexerOrdersResponse> {\n const baseResponse = await this.query('orders', {\n subaccount: params.subaccount\n ? subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n })\n : undefined,\n product_ids: params.productIds,\n trigger_types: params.triggerTypes,\n isolated: params.isolated,\n digests: params.digests,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n idx: params.startCursor,\n });\n\n return baseResponse.orders.map(mapIndexerOrder);\n }\n\n /**\n * Gets match order events, this will return the same events as the events query, but with additional information\n * to identify the order that was matched\n *\n * @param params\n */\n async getMatchEvents(\n params: GetIndexerMatchEventsParams,\n ): Promise<GetIndexerMatchEventsResponse> {\n const baseResponse = await this.query('matches', {\n subaccount: params.subaccount\n ? subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n })\n : undefined,\n product_ids: params.productIds,\n isolated: params.isolated,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n idx: params.startCursor,\n });\n\n // Same as logic in `getEvents`\n let lastTxIdx = 0;\n return baseResponse.matches.map((matchEvent): IndexerMatchEvent => {\n if (\n baseResponse.txs[lastTxIdx].submission_idx !== matchEvent.submission_idx\n ) {\n lastTxIdx += 1;\n }\n const { tx, timestamp } = baseResponse.txs[lastTxIdx];\n\n // We use this to derive the product ID for the match\n const postBalances = mapIndexerMatchEventBalances(\n matchEvent.post_balance,\n );\n\n return {\n productId: postBalances.base.productId,\n isolated: matchEvent.isolated,\n totalFee: toBigDecimal(matchEvent.fee),\n sequencerFee: toBigDecimal(matchEvent.sequencer_fee),\n baseFilled: toBigDecimal(matchEvent.base_filled),\n quoteFilled: toBigDecimal(matchEvent.quote_filled),\n cumulativeFee: toBigDecimal(matchEvent.cumulative_fee),\n cumulativeBaseFilled: toBigDecimal(matchEvent.cumulative_base_filled),\n cumulativeQuoteFilled: toBigDecimal(matchEvent.cumulative_quote_filled),\n digest: matchEvent.digest,\n order: matchEvent.order,\n submissionIndex: matchEvent.submission_idx,\n timestamp: toBigDecimal(timestamp),\n preEventTrackedVars: {\n netEntryUnrealized: toBigDecimal(matchEvent.net_entry_unrealized),\n netEntryCumulative: toBigDecimal(matchEvent.net_entry_cumulative),\n },\n preBalances: mapIndexerMatchEventBalances(matchEvent.pre_balance),\n postBalances,\n tx,\n ...subaccountFromHex(matchEvent.order.sender),\n };\n });\n }\n\n /**\n * Retrieves historical funding & interest payments.\n * NOTE: `limit` is an upperbound. If a user changes position size such that his position is 0 during each funding/interest tick,\n * then the indexer will return fewer than `limit` results per page. However, more events can be present. This means that\n * there isn't a reliable way to determine whether there is a next page. We just need to keep paginating until the next cursor is null.\n *\n * @param params\n */\n async getInterestFundingPayments(\n params: GetIndexerInterestFundingPaymentsParams,\n ): Promise<GetIndexerInterestFundingPaymentsResponse> {\n const baseResponse = await this.query('interest_and_funding', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccount.subaccountOwner,\n subaccountName: params.subaccount.subaccountName,\n }),\n product_ids: params.productIds,\n max_time: params.maxTimestampInclusive,\n limit: params.limit,\n max_idx: params.startCursor,\n });\n\n return {\n fundingPayments: baseResponse.funding_payments.map(\n mapIndexerProductPayment,\n ),\n interestPayments: baseResponse.interest_payments.map(\n mapIndexerProductPayment,\n ),\n nextCursor: baseResponse.next_idx,\n };\n }\n\n /**\n * Gets quote (USDT) price in terms of USD\n */\n async getQuotePrice(): Promise<GetIndexerQuotePriceResponse> {\n const baseResponse = await this.query('quote_price', {});\n return {\n price: removeDecimals(baseResponse.price_x18),\n };\n }\n\n /**\n * Fetches currently registered linked signer with the remaining txs allowed for the subaccount\n */\n async getLinkedSignerWithRateLimit(\n params: GetIndexerLinkedSignerParams,\n ): Promise<GetIndexerLinkedSignerResponse> {\n const baseResponse = await this.query('linked_signer_rate_limit', {\n subaccount: subaccountToHex(params.subaccount),\n });\n return {\n totalTxLimit: toBigDecimal(baseResponse.total_tx_limit),\n remainingTxs: toBigDecimal(baseResponse.remaining_tx),\n signer: baseResponse.signer,\n waitTimeUntilNextTx: toBigDecimal(baseResponse.wait_time),\n };\n }\n\n /**\n * Retrieve historical market snapshots\n * @param params\n */\n async getMarketSnapshots(\n params: GetIndexerMarketSnapshotsParams,\n ): Promise<GetIndexerMarketSnapshotsResponse> {\n const baseResponse = await this.query('market_snapshots', {\n interval: mapSnapshotsIntervalToServerParams(params),\n product_ids: params.productIds,\n });\n\n return baseResponse.snapshots.map(mapIndexerMarketSnapshot);\n }\n\n /**\n * Retrieve historical market snapshots from Edge\n * @param params\n */\n async getEdgeMarketSnapshots(\n params: GetIndexerEdgeMarketSnapshotsParams,\n ): Promise<GetIndexerEdgeMarketSnapshotResponse> {\n const baseResponse = await this.query('edge_market_snapshots', {\n interval: mapSnapshotsIntervalToServerParams(params),\n });\n\n return mapValues(baseResponse.snapshots, (snapshots) =>\n snapshots.map(mapIndexerMarketSnapshot),\n );\n }\n\n /**\n * Retrieve maker statistics for a given epoch\n *\n * @param params\n */\n async getMakerStatistics(\n params: GetIndexerMakerStatisticsParams,\n ): Promise<GetIndexerMakerStatisticsResponse> {\n const baseResponse = await this.query('maker_statistics', {\n product_id: params.productId,\n epoch: params.epoch,\n interval: params.interval,\n });\n\n return {\n rewardCoefficient: toBigDecimal(baseResponse.reward_coefficient),\n makers: baseResponse.makers.map(mapIndexerMakerStatistics),\n };\n }\n\n /**\n * Retrieve leaderboard stats for a given contest\n *\n * @param params\n */\n async getLeaderboard(\n params: GetIndexerLeaderboardParams,\n ): Promise<GetIndexerLeaderboardResponse> {\n const baseResponse = await this.query('leaderboard', {\n contest_id: params.contestId,\n rank_type: params.rankType,\n start: params.startCursor,\n limit: params.limit,\n });\n\n return {\n participants: baseResponse.positions.map(mapIndexerLeaderboardPosition),\n };\n }\n\n /**\n * Retrieve leaderboard ranking of a subaccount on a given contest\n *\n * @param params\n */\n async getLeaderboardParticipant(\n params: GetIndexerLeaderboardParticipantParams,\n ): Promise<GetIndexerLeaderboardParticipantResponse> {\n const baseResponse = await this.query('leaderboard_rank', {\n subaccount: subaccountToHex(params.subaccount),\n contest_ids: params.contestIds,\n });\n\n return {\n participant: mapValues(baseResponse.positions, (position) =>\n mapIndexerLeaderboardPosition(position),\n ),\n };\n }\n\n /**\n * Attempts to update a user's registration to the provided `contestId`. This requires signing.\n * @param params\n */\n async updateLeaderboardRegistration(\n params: UpdateIndexerLeaderboardRegistrationParams,\n ): Promise<UpdateIndexerLeaderboardRegistrationResponse> {\n const signatureParams: EIP712LeaderboardAuthenticationParams = {\n // Default to 90 seconds from now if no recvTime is provided\n expiration: toIntegerString(params.recvTime ?? getDefaultRecvTime()),\n subaccountName: params.subaccountName,\n subaccountOwner: params.subaccountOwner,\n };\n\n const tx = getNadoEIP712Values(\n 'leaderboard_authentication',\n signatureParams,\n );\n const signature = await this.sign(\n 'leaderboard_authentication',\n params.updateRegistration.verifyingAddr,\n params.updateRegistration.chainId,\n signatureParams,\n );\n\n const updateRegistrationTx: SignedTx<EIP712LeaderboardAuthenticationValues> =\n {\n tx,\n signature,\n };\n\n const baseResponse = await this.query('leaderboard_registration', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n contest_id: params.contestId,\n update_registration: updateRegistrationTx,\n });\n return {\n registration: baseResponse.registration\n ? mapIndexerLeaderboardRegistration(baseResponse.registration)\n : null,\n };\n }\n\n /**\n * Retrieves the registration status for a leaderboard participant for provided `contestId`.\n * @param params\n */\n async getLeaderboardRegistration(\n params: GetIndexerLeaderboardRegistrationParams,\n ): Promise<GetIndexerLeaderboardRegistrationResponse> {\n const baseResponse = await this.query('leaderboard_registration', {\n subaccount: subaccountToHex({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n contest_id: params.contestId,\n update_registration: null,\n });\n return {\n registration: baseResponse.registration\n ? mapIndexerLeaderboardRegistration(baseResponse.registration)\n : null,\n };\n }\n\n /**\n * Retrieve metadata of provided leaderboard contests\n *\n * @param params\n */\n async getLeaderboardContests(\n params: GetIndexerLeaderboardContestsParams,\n ): Promise<GetIndexerLeaderboardContestsResponse> {\n const baseResponse = await this.query('leaderboard_contests', {\n contest_ids: params.contestIds,\n });\n\n return {\n contests: baseResponse.contests.map(mapIndexerLeaderboardContest),\n };\n }\n\n /**\n * Retrieve signature and tx to submit a fast withdrawal\n *\n * @param params\n */\n async getFastWithdrawalSignature(\n params: GetIndexerFastWithdrawalSignatureParams,\n ): Promise<GetIndexerFastWithdrawalSignatureResponse> {\n const baseResponse = await this.query('fast_withdrawal_signature', params);\n return {\n idx: toBigInt(baseResponse.idx),\n tx: baseResponse.tx,\n txBytes: getValidatedHex(baseResponse.tx_bytes),\n signatures: baseResponse.signatures.map(getValidatedHex),\n };\n }\n\n async getNlpSnapshots(\n params: GetIndexerNlpSnapshotsParams,\n ): Promise<GetIndexerNlpSnapshotsResponse> {\n const baseResponse = await this.query('nlp_snapshots', {\n interval: {\n count: params.limit,\n max_time: params.maxTimeInclusive\n ? toIntegerString(params.maxTimeInclusive)\n : undefined,\n granularity: params.granularity,\n },\n });\n\n return {\n snapshots: baseResponse.snapshots.map(mapIndexerNlpSnapshot),\n };\n }\n\n /**\n * Retrieves the subaccount's DDA (Direct Deposit Address)\n * @param params\n */\n async getSubaccountDDA(\n params: GetIndexerSubaccountDDAParams,\n ): Promise<GetIndexerSubaccountDDAResponse> {\n const baseResponse = await this.query('direct_deposit_address', {\n subaccount: subaccountToHex(params.subaccount),\n });\n\n return {\n address: getValidatedAddress(baseResponse.v1_address),\n };\n }\n\n async getSequencerBacklog(): Promise<GetIndexerBacklogResponse> {\n const baseResponse = await this.query('backlog', {});\n\n return {\n totalTxs: toBigDecimal(baseResponse.total_txs),\n totalSubmissions: toBigDecimal(baseResponse.total_submissions),\n backlogSize: toBigDecimal(baseResponse.backlog_size),\n updatedAt: toBigDecimal(baseResponse.updated_at),\n backlogEtaInSeconds: baseResponse.backlog_eta_in_seconds\n ? toBigDecimal(baseResponse.backlog_eta_in_seconds)\n : null,\n txsPerSecond: baseResponse.txs_per_second\n ? toBigDecimal(baseResponse.txs_per_second)\n : null,\n };\n }\n\n /**\n * Get tickers from the v2 indexer endpoint\n * @param params\n */\n async getV2Tickers(\n params: GetIndexerV2TickersParams,\n ): Promise<GetIndexerV2TickersResponse> {\n const response =\n await this.axiosInstance.get<IndexerServerV2TickersResponse>(\n `${this.v2Url}/tickers`,\n { params },\n );\n\n this.checkResponseStatus(response);\n\n return mapValues(response.data, mapIndexerV2Ticker);\n }\n\n protected async query<TRequestType extends IndexerServerQueryRequestType>(\n requestType: TRequestType,\n params: IndexerServerQueryRequestByType[TRequestType],\n ): Promise<IndexerServerQueryResponseByType[TRequestType]> {\n const reqBody: IndexerQueryRequestBody = {\n [requestType]: params,\n };\n const response = await this.axiosInstance.post<\n IndexerServerQueryResponseByType[TRequestType]\n >(this.opts.url, reqBody);\n\n this.checkResponseStatus(response);\n\n return response.data;\n }\n\n protected async sign<T extends SignableRequestType>(\n requestType: T,\n verifyingContract: string,\n chainId: number,\n params: SignableRequestTypeToParams[T],\n ) {\n const walletClient = this.opts.walletClient;\n\n if (!walletClient) {\n throw new WalletNotProvidedError();\n }\n\n return getSignedTransactionRequest({\n chainId,\n requestParams: params,\n requestType,\n walletClient,\n verifyingContract,\n });\n }\n\n private checkResponseStatus(response: AxiosResponse) {\n if (response.status !== 200 || !response.data) {\n throw Error(\n `Unexpected response from server: ${response.status} ${response.statusText}`,\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAqBO;AACP,mBAAoD;AACpD,yBAkBO;AAuFA,IAAM,oBAAN,MAAwB;AAAA,EAK7B,YAAY,MAAyB;AACnC,SAAK,OAAO;AACZ,SAAK,gBAAgB,aAAAA,QAAM,OAAO;AAAA,MAChC,iBAAiB;AAAA;AAAA,MAEjB,gBAAgB,MAAM;AAAA,IACxB,CAAC;AACD,SAAK,QAAQ,KAAK,QAAQ,KAAK,QAAQ,KAAK,IAAI,QAAQ,MAAM,IAAI;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,gBACJ,QACyC;AACzC,UAAM,eAAe,MAAM,KAAK,MAAM,eAAe,MAAM;AAE3D,WAAO,aAAa,YAAY,IAAI,CAAC,SAAS;AAC5C,YAAM,iBAAa,iCAAkB,KAAK,UAAU;AACpD,aAAO;AAAA,QACL,OAAO,KAAK;AAAA,QACZ,GAAG;AAAA,MACL;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,4BACJ,QACqD;AACrD,UAAM,mBAAmB,OAAO,YAAY;AAAA,MAC1C,CAAC,EAAE,iBAAiB,eAAe,UACjC,+BAAgB;AAAA,QACd;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACL;AAEA,UAAM,eAAe,MAAM,KAAK,MAAM,qBAAqB;AAAA,MACzD,aAAa;AAAA,MACb,YAAY,OAAO;AAAA,MACnB,UAAU,OAAO;AAAA,IACnB,CAAC;AAED,UAAM,4BAAwB;AAAA,MAC5B,aAAa;AAAA,MACb,CAAC,qBAAqB;AACpB,cAAM,sBACJ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,aACA,mBACA,SACA,QACA;AACA,UAAM,eAAe,KAAK,KAAK;AAE/B,QAAI,CAAC,cAAc;AACjB,YAAM,IAAI,qCAAuB;AAAA,IACnC;AAEA,eAAO,2CAA4B;AAAA,MACjC;AAAA,MACA,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEQ,oBAAoB,UAAyB;AACnD,QAAI,SAAS,WAAW,OAAO,CAAC,SAAS,MAAM;AAC7C,YAAM;AAAA,QACJ,oCAAoC,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,MAC5E;AAAA,IACF;AAAA,EACF;AACF;","names":["axios"]}
@@ -1,8 +1,7 @@
1
- import { WalletClientWithAccount, SignableRequestType, SignableRequestTypeToParams } from '@nadohq/contracts';
1
+ import { WalletClientWithAccount, SignableRequestType, SignableRequestTypeToParams } from '@nadohq/shared';
2
2
  import { AxiosInstance } from 'axios';
3
- import { ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerQuotePriceResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEdgeMarketSnapshotResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardResponse, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerNlpSnapshotsParams, GetIndexerNlpSnapshotsResponse, GetIndexerBacklogResponse } from './types/clientTypes.cjs';
3
+ import { ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerQuotePriceResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEdgeMarketSnapshotResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardResponse, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerNlpSnapshotsParams, GetIndexerNlpSnapshotsResponse, GetIndexerSubaccountDDAParams, GetIndexerSubaccountDDAResponse, GetIndexerBacklogResponse, GetIndexerV2TickersParams, GetIndexerV2TickersResponse } from './types/clientTypes.cjs';
4
4
  import { IndexerServerQueryRequestType, IndexerServerQueryRequestByType, IndexerServerQueryResponseByType } from './types/serverTypes.cjs';
5
- import '@nadohq/utils';
6
5
  import 'viem';
7
6
  import './types/CandlestickPeriod.cjs';
8
7
  import './types/IndexerEventType.cjs';
@@ -116,7 +115,7 @@ declare class IndexerBaseClient {
116
115
  */
117
116
  getInterestFundingPayments(params: GetIndexerInterestFundingPaymentsParams): Promise<GetIndexerInterestFundingPaymentsResponse>;
118
117
  /**
119
- * Gets quote (USDC) price in terms of USD
118
+ * Gets quote (USDT) price in terms of USD
120
119
  */
121
120
  getQuotePrice(): Promise<GetIndexerQuotePriceResponse>;
122
121
  /**
@@ -174,7 +173,17 @@ declare class IndexerBaseClient {
174
173
  */
175
174
  getFastWithdrawalSignature(params: GetIndexerFastWithdrawalSignatureParams): Promise<GetIndexerFastWithdrawalSignatureResponse>;
176
175
  getNlpSnapshots(params: GetIndexerNlpSnapshotsParams): Promise<GetIndexerNlpSnapshotsResponse>;
176
+ /**
177
+ * Retrieves the subaccount's DDA (Direct Deposit Address)
178
+ * @param params
179
+ */
180
+ getSubaccountDDA(params: GetIndexerSubaccountDDAParams): Promise<GetIndexerSubaccountDDAResponse>;
177
181
  getSequencerBacklog(): Promise<GetIndexerBacklogResponse>;
182
+ /**
183
+ * Get tickers from the v2 indexer endpoint
184
+ * @param params
185
+ */
186
+ getV2Tickers(params: GetIndexerV2TickersParams): Promise<GetIndexerV2TickersResponse>;
178
187
  protected query<TRequestType extends IndexerServerQueryRequestType>(requestType: TRequestType, params: IndexerServerQueryRequestByType[TRequestType]): Promise<IndexerServerQueryResponseByType[TRequestType]>;
179
188
  protected sign<T extends SignableRequestType>(requestType: T, verifyingContract: string, chainId: number, params: SignableRequestTypeToParams[T]): Promise<`0x${string}`>;
180
189
  private checkResponseStatus;
@@ -1,8 +1,7 @@
1
- import { WalletClientWithAccount, SignableRequestType, SignableRequestTypeToParams } from '@nadohq/contracts';
1
+ import { WalletClientWithAccount, SignableRequestType, SignableRequestTypeToParams } from '@nadohq/shared';
2
2
  import { AxiosInstance } from 'axios';
3
- import { ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerQuotePriceResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEdgeMarketSnapshotResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardResponse, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerNlpSnapshotsParams, GetIndexerNlpSnapshotsResponse, GetIndexerBacklogResponse } from './types/clientTypes.js';
3
+ import { ListIndexerSubaccountsParams, ListIndexerSubaccountsResponse, GetIndexerMultiSubaccountSnapshotsParams, GetIndexerMultiSubaccountSnapshotsResponse, GetIndexerReferralCodeParams, GetIndexerReferralCodeResponse, GetIndexerFundingRateParams, GetIndexerFundingRateResponse, GetIndexerMultiProductFundingRatesParams, GetIndexerMultiProductFundingRatesResponse, GetIndexerPerpPricesParams, GetIndexerPerpPricesResponse, GetIndexerMultiProductPerpPricesParams, GetIndexerMultiProductPerpPricesResponse, GetIndexerOraclePricesParams, GetIndexerOraclePricesResponse, GetIndexerCandlesticksParams, GetIndexerCandlesticksResponse, GetIndexerEdgeCandlesticksParams, GetIndexerEdgeCandlesticksResponse, GetIndexerProductSnapshotsParams, GetIndexerProductSnapshotsResponse, GetIndexerMultiProductSnapshotsParams, GetIndexerMultiProductSnapshotsResponse, GetIndexerEventsParams, GetIndexerEventsResponse, GetIndexerOrdersParams, GetIndexerOrdersResponse, GetIndexerMatchEventsParams, GetIndexerMatchEventsResponse, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerQuotePriceResponse, GetIndexerLinkedSignerParams, GetIndexerLinkedSignerResponse, GetIndexerMarketSnapshotsParams, GetIndexerMarketSnapshotsResponse, GetIndexerEdgeMarketSnapshotsParams, GetIndexerEdgeMarketSnapshotResponse, GetIndexerMakerStatisticsParams, GetIndexerMakerStatisticsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardResponse, GetIndexerLeaderboardParticipantParams, GetIndexerLeaderboardParticipantResponse, UpdateIndexerLeaderboardRegistrationParams, UpdateIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardRegistrationParams, GetIndexerLeaderboardRegistrationResponse, GetIndexerLeaderboardContestsParams, GetIndexerLeaderboardContestsResponse, GetIndexerFastWithdrawalSignatureParams, GetIndexerFastWithdrawalSignatureResponse, GetIndexerNlpSnapshotsParams, GetIndexerNlpSnapshotsResponse, GetIndexerSubaccountDDAParams, GetIndexerSubaccountDDAResponse, GetIndexerBacklogResponse, GetIndexerV2TickersParams, GetIndexerV2TickersResponse } from './types/clientTypes.js';
4
4
  import { IndexerServerQueryRequestType, IndexerServerQueryRequestByType, IndexerServerQueryResponseByType } from './types/serverTypes.js';
5
- import '@nadohq/utils';
6
5
  import 'viem';
7
6
  import './types/CandlestickPeriod.js';
8
7
  import './types/IndexerEventType.js';
@@ -116,7 +115,7 @@ declare class IndexerBaseClient {
116
115
  */
117
116
  getInterestFundingPayments(params: GetIndexerInterestFundingPaymentsParams): Promise<GetIndexerInterestFundingPaymentsResponse>;
118
117
  /**
119
- * Gets quote (USDC) price in terms of USD
118
+ * Gets quote (USDT) price in terms of USD
120
119
  */
121
120
  getQuotePrice(): Promise<GetIndexerQuotePriceResponse>;
122
121
  /**
@@ -174,7 +173,17 @@ declare class IndexerBaseClient {
174
173
  */
175
174
  getFastWithdrawalSignature(params: GetIndexerFastWithdrawalSignatureParams): Promise<GetIndexerFastWithdrawalSignatureResponse>;
176
175
  getNlpSnapshots(params: GetIndexerNlpSnapshotsParams): Promise<GetIndexerNlpSnapshotsResponse>;
176
+ /**
177
+ * Retrieves the subaccount's DDA (Direct Deposit Address)
178
+ * @param params
179
+ */
180
+ getSubaccountDDA(params: GetIndexerSubaccountDDAParams): Promise<GetIndexerSubaccountDDAResponse>;
177
181
  getSequencerBacklog(): Promise<GetIndexerBacklogResponse>;
182
+ /**
183
+ * Get tickers from the v2 indexer endpoint
184
+ * @param params
185
+ */
186
+ getV2Tickers(params: GetIndexerV2TickersParams): Promise<GetIndexerV2TickersResponse>;
178
187
  protected query<TRequestType extends IndexerServerQueryRequestType>(requestType: TRequestType, params: IndexerServerQueryRequestByType[TRequestType]): Promise<IndexerServerQueryResponseByType[TRequestType]>;
179
188
  protected sign<T extends SignableRequestType>(requestType: T, verifyingContract: string, chainId: number, params: SignableRequestTypeToParams[T]): Promise<`0x${string}`>;
180
189
  private checkResponseStatus;