@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
@@ -57,6 +57,8 @@ var IndexerBaseClient = class {
57
57
  const subaccount = (0, import_shared.subaccountFromHex)(item.subaccount);
58
58
  return {
59
59
  hexId: item.subaccount,
60
+ createdAt: Number(item.created_at),
61
+ isolated: item.isolated,
60
62
  ...subaccount
61
63
  };
62
64
  });
@@ -252,10 +254,12 @@ var IndexerBaseClient = class {
252
254
  };
253
255
  })();
254
256
  const baseResponse = await this.query("events", {
255
- subaccount: params.subaccount ? (0, import_shared.subaccountToHex)({
256
- subaccountOwner: params.subaccount.subaccountOwner,
257
- subaccountName: params.subaccount.subaccountName
258
- }) : void 0,
257
+ subaccounts: params.subaccounts?.map(
258
+ (subaccount) => (0, import_shared.subaccountToHex)({
259
+ subaccountOwner: subaccount.subaccountOwner,
260
+ subaccountName: subaccount.subaccountName
261
+ })
262
+ ),
259
263
  product_ids: params.productIds,
260
264
  isolated: params.isolated,
261
265
  event_types: params.eventTypes,
@@ -279,11 +283,14 @@ var IndexerBaseClient = class {
279
283
  */
280
284
  async getOrders(params) {
281
285
  const baseResponse = await this.query("orders", {
282
- subaccount: params.subaccount ? (0, import_shared.subaccountToHex)({
283
- subaccountOwner: params.subaccount.subaccountOwner,
284
- subaccountName: params.subaccount.subaccountName
285
- }) : void 0,
286
+ subaccounts: params?.subaccounts?.map(
287
+ (subaccount) => (0, import_shared.subaccountToHex)({
288
+ subaccountOwner: subaccount.subaccountOwner,
289
+ subaccountName: subaccount.subaccountName
290
+ })
291
+ ),
286
292
  product_ids: params.productIds,
293
+ trigger_types: params.triggerTypes,
287
294
  isolated: params.isolated,
288
295
  digests: params.digests,
289
296
  max_time: params.maxTimestampInclusive,
@@ -300,10 +307,12 @@ var IndexerBaseClient = class {
300
307
  */
301
308
  async getMatchEvents(params) {
302
309
  const baseResponse = await this.query("matches", {
303
- subaccount: params.subaccount ? (0, import_shared.subaccountToHex)({
304
- subaccountOwner: params.subaccount.subaccountOwner,
305
- subaccountName: params.subaccount.subaccountName
306
- }) : void 0,
310
+ subaccounts: params?.subaccounts?.map(
311
+ (subaccount) => (0, import_shared.subaccountToHex)({
312
+ subaccountOwner: subaccount.subaccountOwner,
313
+ subaccountName: subaccount.subaccountName
314
+ })
315
+ ),
307
316
  product_ids: params.productIds,
308
317
  isolated: params.isolated,
309
318
  max_time: params.maxTimestampInclusive,
@@ -340,6 +349,7 @@ var IndexerBaseClient = class {
340
349
  preBalances: (0, import_dataMappers.mapIndexerMatchEventBalances)(matchEvent.pre_balance),
341
350
  postBalances,
342
351
  tx,
352
+ isTaker: matchEvent.is_taker,
343
353
  ...(0, import_shared.subaccountFromHex)(matchEvent.order.sender)
344
354
  };
345
355
  });
@@ -374,10 +384,10 @@ var IndexerBaseClient = class {
374
384
  };
375
385
  }
376
386
  /**
377
- * Gets quote (USDC) price in terms of USD
387
+ * Gets quote (USDT) price in terms of USD
378
388
  */
379
389
  async getQuotePrice() {
380
- const baseResponse = await this.query("usdc_price", {});
390
+ const baseResponse = await this.query("quote_price", {});
381
391
  return {
382
392
  price: (0, import_shared.removeDecimals)(baseResponse.price_x18)
383
393
  };
@@ -568,13 +578,10 @@ var IndexerBaseClient = class {
568
578
  */
569
579
  async getSubaccountDDA(params) {
570
580
  const baseResponse = await this.query("direct_deposit_address", {
571
- subaccount: (0, import_shared.subaccountToHex)({
572
- subaccountOwner: params.subaccountOwner,
573
- subaccountName: params.subaccountName
574
- })
581
+ subaccount: (0, import_shared.subaccountToHex)(params.subaccount)
575
582
  });
576
583
  return {
577
- address: baseResponse.v1_address
584
+ address: (0, import_shared.getValidatedAddress)(baseResponse.v1_address)
578
585
  };
579
586
  }
580
587
  async getSequencerBacklog() {
@@ -588,6 +595,18 @@ var IndexerBaseClient = class {
588
595
  txsPerSecond: baseResponse.txs_per_second ? (0, import_shared.toBigDecimal)(baseResponse.txs_per_second) : null
589
596
  };
590
597
  }
598
+ /**
599
+ * Get tickers from the v2 indexer endpoint
600
+ * @param params
601
+ */
602
+ async getV2Tickers(params) {
603
+ const response = await this.axiosInstance.get(
604
+ `${this.v2Url}/tickers`,
605
+ { params }
606
+ );
607
+ this.checkResponseStatus(response);
608
+ return (0, import_shared.mapValues)(response.data, import_dataMappers.mapIndexerV2Ticker);
609
+ }
591
610
  async query(requestType, params) {
592
611
  const reqBody = {
593
612
  [requestType]: params
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/IndexerBaseClient.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationParams,\n EIP712LeaderboardAuthenticationValues,\n getDefaultRecvTime,\n getNadoEIP712Values,\n getSignedTransactionRequest,\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 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 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 // 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 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 /**\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({\n subaccountOwner: params.subaccountOwner,\n subaccountName: params.subaccountName,\n }),\n });\n\n return {\n address: 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 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,oBAoBO;AACP,mBAAoD;AACpD,yBAiBO;AAoFA,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;AACz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,MACnD,eAAW,4BAAa,aAAa,UAAU;AAAA,MAC/C,qBAAqB,aAAa,6BAC9B,4BAAa,aAAa,sBAAsB,IAChD;AAAA,MACJ,cAAc,aAAa,qBACvB,4BAAa,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,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
+ {"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 createdAt: Number(item.created_at),\n isolated: item.isolated,\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 subaccounts: params.subaccounts?.map((subaccount) =>\n subaccountToHex({\n subaccountOwner: subaccount.subaccountOwner,\n subaccountName: subaccount.subaccountName,\n }),\n ),\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 subaccounts: params?.subaccounts?.map((subaccount) =>\n subaccountToHex({\n subaccountOwner: subaccount.subaccountOwner,\n subaccountName: subaccount.subaccountName,\n }),\n ),\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 subaccounts: params?.subaccounts?.map((subaccount) =>\n subaccountToHex({\n subaccountOwner: subaccount.subaccountOwner,\n subaccountName: subaccount.subaccountName,\n }),\n ),\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 isTaker: matchEvent.is_taker,\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,WAAW,OAAO,KAAK,UAAU;AAAA,QACjC,UAAU,KAAK;AAAA,QACf,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;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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,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,6 +1,6 @@
1
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, GetIndexerSubaccountDDAParams, GetIndexerSubaccountDDAResponse, 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
5
  import 'viem';
6
6
  import './types/CandlestickPeriod.cjs';
@@ -115,7 +115,7 @@ declare class IndexerBaseClient {
115
115
  */
116
116
  getInterestFundingPayments(params: GetIndexerInterestFundingPaymentsParams): Promise<GetIndexerInterestFundingPaymentsResponse>;
117
117
  /**
118
- * Gets quote (USDC) price in terms of USD
118
+ * Gets quote (USDT) price in terms of USD
119
119
  */
120
120
  getQuotePrice(): Promise<GetIndexerQuotePriceResponse>;
121
121
  /**
@@ -179,6 +179,11 @@ declare class IndexerBaseClient {
179
179
  */
180
180
  getSubaccountDDA(params: GetIndexerSubaccountDDAParams): Promise<GetIndexerSubaccountDDAResponse>;
181
181
  getSequencerBacklog(): Promise<GetIndexerBacklogResponse>;
182
+ /**
183
+ * Get tickers from the v2 indexer endpoint
184
+ * @param params
185
+ */
186
+ getV2Tickers(params: GetIndexerV2TickersParams): Promise<GetIndexerV2TickersResponse>;
182
187
  protected query<TRequestType extends IndexerServerQueryRequestType>(requestType: TRequestType, params: IndexerServerQueryRequestByType[TRequestType]): Promise<IndexerServerQueryResponseByType[TRequestType]>;
183
188
  protected sign<T extends SignableRequestType>(requestType: T, verifyingContract: string, chainId: number, params: SignableRequestTypeToParams[T]): Promise<`0x${string}`>;
184
189
  private checkResponseStatus;
@@ -1,6 +1,6 @@
1
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, GetIndexerSubaccountDDAParams, GetIndexerSubaccountDDAResponse, 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
5
  import 'viem';
6
6
  import './types/CandlestickPeriod.js';
@@ -115,7 +115,7 @@ declare class IndexerBaseClient {
115
115
  */
116
116
  getInterestFundingPayments(params: GetIndexerInterestFundingPaymentsParams): Promise<GetIndexerInterestFundingPaymentsResponse>;
117
117
  /**
118
- * Gets quote (USDC) price in terms of USD
118
+ * Gets quote (USDT) price in terms of USD
119
119
  */
120
120
  getQuotePrice(): Promise<GetIndexerQuotePriceResponse>;
121
121
  /**
@@ -179,6 +179,11 @@ declare class IndexerBaseClient {
179
179
  */
180
180
  getSubaccountDDA(params: GetIndexerSubaccountDDAParams): Promise<GetIndexerSubaccountDDAResponse>;
181
181
  getSequencerBacklog(): Promise<GetIndexerBacklogResponse>;
182
+ /**
183
+ * Get tickers from the v2 indexer endpoint
184
+ * @param params
185
+ */
186
+ getV2Tickers(params: GetIndexerV2TickersParams): Promise<GetIndexerV2TickersResponse>;
182
187
  protected query<TRequestType extends IndexerServerQueryRequestType>(requestType: TRequestType, params: IndexerServerQueryRequestByType[TRequestType]): Promise<IndexerServerQueryResponseByType[TRequestType]>;
183
188
  protected sign<T extends SignableRequestType>(requestType: T, verifyingContract: string, chainId: number, params: SignableRequestTypeToParams[T]): Promise<`0x${string}`>;
184
189
  private checkResponseStatus;
@@ -3,6 +3,7 @@ import {
3
3
  getDefaultRecvTime,
4
4
  getNadoEIP712Values,
5
5
  getSignedTransactionRequest,
6
+ getValidatedAddress,
6
7
  getValidatedHex,
7
8
  mapValues,
8
9
  nowInSeconds,
@@ -31,6 +32,7 @@ import {
31
32
  mapIndexerPerpPrices,
32
33
  mapIndexerProductPayment,
33
34
  mapIndexerServerProduct,
35
+ mapIndexerV2Ticker,
34
36
  mapSnapshotsIntervalToServerParams
35
37
  } from "./dataMappers.js";
36
38
  var IndexerBaseClient = class {
@@ -54,6 +56,8 @@ var IndexerBaseClient = class {
54
56
  const subaccount = subaccountFromHex(item.subaccount);
55
57
  return {
56
58
  hexId: item.subaccount,
59
+ createdAt: Number(item.created_at),
60
+ isolated: item.isolated,
57
61
  ...subaccount
58
62
  };
59
63
  });
@@ -249,10 +253,12 @@ var IndexerBaseClient = class {
249
253
  };
250
254
  })();
251
255
  const baseResponse = await this.query("events", {
252
- subaccount: params.subaccount ? subaccountToHex({
253
- subaccountOwner: params.subaccount.subaccountOwner,
254
- subaccountName: params.subaccount.subaccountName
255
- }) : void 0,
256
+ subaccounts: params.subaccounts?.map(
257
+ (subaccount) => subaccountToHex({
258
+ subaccountOwner: subaccount.subaccountOwner,
259
+ subaccountName: subaccount.subaccountName
260
+ })
261
+ ),
256
262
  product_ids: params.productIds,
257
263
  isolated: params.isolated,
258
264
  event_types: params.eventTypes,
@@ -276,11 +282,14 @@ var IndexerBaseClient = class {
276
282
  */
277
283
  async getOrders(params) {
278
284
  const baseResponse = await this.query("orders", {
279
- subaccount: params.subaccount ? subaccountToHex({
280
- subaccountOwner: params.subaccount.subaccountOwner,
281
- subaccountName: params.subaccount.subaccountName
282
- }) : void 0,
285
+ subaccounts: params?.subaccounts?.map(
286
+ (subaccount) => subaccountToHex({
287
+ subaccountOwner: subaccount.subaccountOwner,
288
+ subaccountName: subaccount.subaccountName
289
+ })
290
+ ),
283
291
  product_ids: params.productIds,
292
+ trigger_types: params.triggerTypes,
284
293
  isolated: params.isolated,
285
294
  digests: params.digests,
286
295
  max_time: params.maxTimestampInclusive,
@@ -297,10 +306,12 @@ var IndexerBaseClient = class {
297
306
  */
298
307
  async getMatchEvents(params) {
299
308
  const baseResponse = await this.query("matches", {
300
- subaccount: params.subaccount ? subaccountToHex({
301
- subaccountOwner: params.subaccount.subaccountOwner,
302
- subaccountName: params.subaccount.subaccountName
303
- }) : void 0,
309
+ subaccounts: params?.subaccounts?.map(
310
+ (subaccount) => subaccountToHex({
311
+ subaccountOwner: subaccount.subaccountOwner,
312
+ subaccountName: subaccount.subaccountName
313
+ })
314
+ ),
304
315
  product_ids: params.productIds,
305
316
  isolated: params.isolated,
306
317
  max_time: params.maxTimestampInclusive,
@@ -337,6 +348,7 @@ var IndexerBaseClient = class {
337
348
  preBalances: mapIndexerMatchEventBalances(matchEvent.pre_balance),
338
349
  postBalances,
339
350
  tx,
351
+ isTaker: matchEvent.is_taker,
340
352
  ...subaccountFromHex(matchEvent.order.sender)
341
353
  };
342
354
  });
@@ -371,10 +383,10 @@ var IndexerBaseClient = class {
371
383
  };
372
384
  }
373
385
  /**
374
- * Gets quote (USDC) price in terms of USD
386
+ * Gets quote (USDT) price in terms of USD
375
387
  */
376
388
  async getQuotePrice() {
377
- const baseResponse = await this.query("usdc_price", {});
389
+ const baseResponse = await this.query("quote_price", {});
378
390
  return {
379
391
  price: removeDecimals(baseResponse.price_x18)
380
392
  };
@@ -565,13 +577,10 @@ var IndexerBaseClient = class {
565
577
  */
566
578
  async getSubaccountDDA(params) {
567
579
  const baseResponse = await this.query("direct_deposit_address", {
568
- subaccount: subaccountToHex({
569
- subaccountOwner: params.subaccountOwner,
570
- subaccountName: params.subaccountName
571
- })
580
+ subaccount: subaccountToHex(params.subaccount)
572
581
  });
573
582
  return {
574
- address: baseResponse.v1_address
583
+ address: getValidatedAddress(baseResponse.v1_address)
575
584
  };
576
585
  }
577
586
  async getSequencerBacklog() {
@@ -585,6 +594,18 @@ var IndexerBaseClient = class {
585
594
  txsPerSecond: baseResponse.txs_per_second ? toBigDecimal(baseResponse.txs_per_second) : null
586
595
  };
587
596
  }
597
+ /**
598
+ * Get tickers from the v2 indexer endpoint
599
+ * @param params
600
+ */
601
+ async getV2Tickers(params) {
602
+ const response = await this.axiosInstance.get(
603
+ `${this.v2Url}/tickers`,
604
+ { params }
605
+ );
606
+ this.checkResponseStatus(response);
607
+ return mapValues(response.data, mapIndexerV2Ticker);
608
+ }
588
609
  async query(requestType, params) {
589
610
  const reqBody = {
590
611
  [requestType]: params