@nadohq/indexer-client 0.33.0 → 0.35.0

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-dpwAE5Om.cjs → IndexerBaseClient-C6VZdI3h.cjs} +16 -5
  2. package/dist/IndexerBaseClient-C6VZdI3h.cjs.map +1 -0
  3. package/dist/IndexerBaseClient.cjs +1 -1
  4. package/dist/IndexerBaseClient.d.cts +6 -4
  5. package/dist/IndexerBaseClient.d.cts.map +1 -1
  6. package/dist/IndexerBaseClient.d.ts +6 -4
  7. package/dist/IndexerBaseClient.d.ts.map +1 -1
  8. package/dist/IndexerBaseClient.js +16 -5
  9. package/dist/IndexerBaseClient.js.map +1 -1
  10. package/dist/IndexerClient.cjs +1 -1
  11. package/dist/IndexerClient.d.cts +1 -1
  12. package/dist/IndexerClient.d.ts +1 -1
  13. package/dist/{IndexerServerFailureError-C1Rn5KxM.d.cts → IndexerServerFailureError-BMmMPfFJ.d.cts} +2 -2
  14. package/dist/{IndexerServerFailureError-C1Rn5KxM.d.cts.map → IndexerServerFailureError-BMmMPfFJ.d.cts.map} +1 -1
  15. package/dist/{IndexerServerFailureError-CSVuKIi6.d.ts → IndexerServerFailureError-ClC8vkmR.d.ts} +2 -2
  16. package/dist/{IndexerServerFailureError-CSVuKIi6.d.ts.map → IndexerServerFailureError-ClC8vkmR.d.ts.map} +1 -1
  17. package/dist/{clientTypes-DKN-EsOj.d.ts → clientTypes-BLKeWmIr.d.ts} +44 -3
  18. package/dist/{clientTypes-DKN-EsOj.d.ts.map → clientTypes-BLKeWmIr.d.ts.map} +1 -1
  19. package/dist/{clientTypes-DFn6P-tv.d.cts → clientTypes-QBgifUeV.d.cts} +44 -3
  20. package/dist/{clientTypes-DFn6P-tv.d.cts.map → clientTypes-QBgifUeV.d.cts.map} +1 -1
  21. package/dist/dataMappers.cjs +1 -1
  22. package/dist/dataMappers.d.cts +2 -2
  23. package/dist/dataMappers.d.ts +2 -2
  24. package/dist/index.cjs +2 -1
  25. package/dist/index.d.cts +6 -6
  26. package/dist/index.d.ts +6 -6
  27. package/dist/index.js +2 -2
  28. package/dist/{indexerBalanceValue-DhC367Il.d.cts → indexerBalanceValue-DqMAvUsj.d.cts} +2 -2
  29. package/dist/{indexerBalanceValue-DhC367Il.d.cts.map → indexerBalanceValue-DqMAvUsj.d.cts.map} +1 -1
  30. package/dist/{indexerBalanceValue-C9soABg1.d.ts → indexerBalanceValue-ZJec8hfI.d.ts} +2 -2
  31. package/dist/{indexerBalanceValue-C9soABg1.d.ts.map → indexerBalanceValue-ZJec8hfI.d.ts.map} +1 -1
  32. package/dist/{paginatedEventsTypes-CBdWvsGe.d.cts → paginatedEventsTypes-4I9Ibp9q.d.cts} +2 -2
  33. package/dist/{paginatedEventsTypes-CBdWvsGe.d.cts.map → paginatedEventsTypes-4I9Ibp9q.d.cts.map} +1 -1
  34. package/dist/{paginatedEventsTypes-Cc3NsS_6.d.ts → paginatedEventsTypes-D668Hgzl.d.ts} +2 -2
  35. package/dist/{paginatedEventsTypes-Cc3NsS_6.d.ts.map → paginatedEventsTypes-D668Hgzl.d.ts.map} +1 -1
  36. package/dist/{serverTypes-DhOquJu2.d.ts → serverTypes-BQafrknp.d.ts} +37 -2
  37. package/dist/{serverTypes-DhOquJu2.d.ts.map → serverTypes-BQafrknp.d.ts.map} +1 -1
  38. package/dist/{serverTypes-CKMTuCwh.d.cts → serverTypes-DeUDMCog.d.cts} +37 -2
  39. package/dist/{serverTypes-CKMTuCwh.d.cts.map → serverTypes-DeUDMCog.d.cts.map} +1 -1
  40. package/dist/types/IndexerServerFailureError.cjs +1 -1
  41. package/dist/types/IndexerServerFailureError.d.cts +1 -1
  42. package/dist/types/IndexerServerFailureError.d.ts +1 -1
  43. package/dist/types/clientTypes.d.cts +2 -2
  44. package/dist/types/clientTypes.d.ts +2 -2
  45. package/dist/types/index.cjs +1 -0
  46. package/dist/types/index.d.cts +5 -5
  47. package/dist/types/index.d.ts +5 -5
  48. package/dist/types/index.js +2 -2
  49. package/dist/types/indexerErrorCodes.cjs +1 -1
  50. package/dist/types/paginatedEventsTypes.d.cts +1 -1
  51. package/dist/types/paginatedEventsTypes.d.ts +1 -1
  52. package/dist/types/serverTypes.cjs +19 -0
  53. package/dist/types/serverTypes.cjs.map +1 -1
  54. package/dist/types/serverTypes.d.cts +2 -2
  55. package/dist/types/serverTypes.d.ts +2 -2
  56. package/dist/types/serverTypes.js +19 -1
  57. package/dist/types/serverTypes.js.map +1 -1
  58. package/dist/utils/index.d.cts +1 -1
  59. package/dist/utils/index.d.ts +1 -1
  60. package/dist/utils/indexerBalanceValue.d.cts +1 -1
  61. package/dist/utils/indexerBalanceValue.d.ts +1 -1
  62. package/package.json +4 -4
  63. package/src/IndexerBaseClient.ts +20 -2
  64. package/src/types/clientTypes.ts +47 -0
  65. package/src/types/serverTypes.ts +51 -0
  66. package/dist/IndexerBaseClient-dpwAE5Om.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"serverTypes.js","names":[],"sources":["../../src/types/serverTypes.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationValues,\n EIP712SocialAuthenticationValues,\n SignedTx,\n} from '@nadohq/shared';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoWithdrawCollateralTx, NadoWithdrawCollateralV2Tx } from './NadoTx';\nimport {\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMarketSnapshotInterval,\n IndexerServerMatchEvent,\n IndexerServerNlpSnapshot,\n IndexerServerOraclePrice,\n IndexerServerOrder,\n IndexerServerProductPayment,\n IndexerServerProductSnapshot,\n IndexerServerSnapshotsInterval,\n IndexerServerSocialAccount,\n IndexerServerTx,\n} from './serverModelTypes';\n\n/**\n * Params\n */\n\nexport interface IndexerServerListSubaccountsParams {\n // Inclusive, defaults to 0\n start?: number;\n // Defaults to 100\n limit?: number;\n address?: string;\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsParams {\n // Subaccount hex identifiers\n subaccounts: string[];\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport interface IndexerServerReferralCodeParams {\n subaccount: string;\n}\n\nexport interface IndexerServerFundingRateParams {\n product_id: number;\n}\n\nexport interface IndexerServerFundingRatesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerFundingRateHistoryParams {\n product_id: number;\n start_time?: number | string;\n end_time?: number | string;\n // Max number of rates to return. Defaults to 100, max 1000.\n limit?: number;\n}\n\nexport interface IndexerServerPriceParams {\n product_id: number;\n}\n\nexport interface IndexerServerPerpPricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerPortfolioParams {\n subaccount: string;\n}\n\nexport interface IndexerServerOraclePricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerCandlesticksParams {\n product_id: number;\n granularity: number;\n // Seconds\n max_time?: number;\n limit: number;\n}\n\nexport type IndexerEdgeServerCandlesticksParams =\n IndexerServerCandlesticksParams;\n\nexport interface IndexerServerProductsParams {\n product_id: number;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMultiProductsParams {\n product_ids: number[];\n max_time: number[];\n}\n\nexport interface IndexerServerEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n event_types?: IndexerEventType[];\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n max_time?: number;\n limit?:\n | {\n raw: number;\n }\n | {\n txs: number;\n };\n}\n\nexport type IndexerServerTriggerTypeFilter =\n | 'none'\n | 'price_trigger'\n | 'time_trigger';\n\nexport interface IndexerServerOrdersParams {\n subaccounts?: string[];\n product_ids?: number[];\n trigger_types?: IndexerServerTriggerTypeFilter[];\n digests?: string[];\n max_time?: number;\n limit?: number;\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMatchEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerLinkedSignerParams {\n subaccount: string;\n}\n\nexport interface IndexerServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n // Defaults to all\n product_ids?: number[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n}\n\nexport interface IndexerServerInterestFundingParams {\n subaccount: string;\n product_ids: number[];\n // If not given, defaults to latest\n max_idx?: string;\n max_time?: number;\n limit: number;\n}\n\nexport interface IndexerServerMakerStatisticsParams {\n product_id: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerServerLeaderboardParams {\n contest_id: number;\n rank_type?: IndexerLeaderboardRankType;\n start?: number | string;\n limit?: number | string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface IndexerServerLeaderboardRankParams {\n subaccount: string;\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardContestsParams {\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegistrationsParams {\n subaccount: string;\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegisterParams {\n update_registration: SignedTx<EIP712LeaderboardAuthenticationValues>;\n}\n\nexport interface IndexerServerSocialConnectParams {\n update_social_account: SignedTx<EIP712SocialAuthenticationValues>;\n}\n\nexport interface IndexerServerListSocialAccountsParams {\n address: string;\n}\n\nexport type IndexerServerRevokeSocialAccountParams =\n IndexerServerSocialConnectParams;\n\nexport interface IndexerServerFastWithdrawalSignatureParams {\n /**\n * The submission index of the WithdrawCollateral tx to be used for fast withdraw.\n */\n idx: number | string;\n}\n\nexport interface IndexerServerNlpSnapshotsParams {\n interval: IndexerServerSnapshotsInterval;\n}\n\nexport interface IndexerServerDDAQueryParams {\n subaccount: string;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceParams {\n address: string;\n}\n\nexport interface IndexerServerPointsParams {\n address: string;\n}\n\nexport interface IndexerServerXPointsParams {\n address: string;\n}\n\nexport interface IndexerServerCashIncentivesParams {\n wallet_address: string;\n}\n\n// Request\nexport interface IndexerServerQueryRequestByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;\n backlog: Record<string, never>;\n candlesticks: IndexerServerCandlesticksParams;\n direct_deposit_address: IndexerServerDDAQueryParams;\n edge_candlesticks: IndexerEdgeServerCandlesticksParams;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;\n events: IndexerServerEventsParams;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;\n funding_rate: IndexerServerFundingRateParams;\n funding_rate_history: IndexerServerFundingRateHistoryParams;\n funding_rates: IndexerServerFundingRatesParams;\n interest_and_funding: IndexerServerInterestFundingParams;\n leaderboard: IndexerServerLeaderboardParams;\n leaderboard_contests: IndexerServerLeaderboardContestsParams;\n leaderboard_rank: IndexerServerLeaderboardRankParams;\n leaderboard_register: IndexerServerLeaderboardRegisterParams;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsParams;\n linked_signer_rate_limit: IndexerServerLinkedSignerParams;\n maker_statistics: IndexerServerMakerStatisticsParams;\n market_snapshots: IndexerServerMarketSnapshotsParams;\n matches: IndexerServerMatchEventsParams;\n oracle_price: IndexerServerOraclePricesParams;\n orders: IndexerServerOrdersParams;\n perp_prices: IndexerServerPerpPricesParams;\n portfolio: IndexerServerPortfolioParams;\n price: IndexerServerPriceParams;\n product_snapshots: IndexerServerMultiProductsParams;\n products: IndexerServerProductsParams;\n referral_code: IndexerServerReferralCodeParams;\n subaccounts: IndexerServerListSubaccountsParams;\n quote_price: Record<string, never>;\n nlp_snapshots: IndexerServerNlpSnapshotsParams;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceParams;\n nado_points: IndexerServerPointsParams;\n nado_xpoints: IndexerServerXPointsParams;\n cash_incentives: IndexerServerCashIncentivesParams;\n social_connect: IndexerServerSocialConnectParams;\n list_social_accounts: IndexerServerListSocialAccountsParams;\n revoke_social_account: IndexerServerRevokeSocialAccountParams;\n}\n\nexport type IndexerServerQueryRequestType =\n keyof IndexerServerQueryRequestByType;\n\n/**\n * Responses\n */\n\nexport interface IndexerServerListSubaccountsResponse {\n subaccounts: {\n id: string;\n // Hex of subaccount bytes\n subaccount: string;\n // UNIX timestamp in seconds\n created_at: string;\n isolated: boolean;\n }[];\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsResponse {\n // Map of subaccount hex -> timestamp requested -> latest events corresponding to each product\n snapshots: Record<string, Record<string, IndexerServerEvent[]>>;\n}\n\nexport interface IndexerServerReferralCodeResponse {\n referral_code: string | null;\n}\n\nexport interface IndexerServerFundingRate {\n product_id: number;\n funding_rate_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerFundingRateResponse = IndexerServerFundingRate;\n\n// Map of productId -> IndexerServerFundingRate\nexport type IndexerServerFundingRatesResponse = Record<\n string,\n IndexerServerFundingRate\n>;\n\nexport interface IndexerServerFundingRateHistoryEntry {\n product_id: number;\n // Epoch time in seconds of the settlement tick this funding rate was recorded at.\n timestamp: string;\n // Realized hourly funding rate at this tick, multiplied by 10^18 (% = rate * 100).\n funding_rate_x18: string;\n}\n\nexport interface IndexerServerFundingRateHistoryResponse {\n // Always ascending by timestamp.\n funding_rates: IndexerServerFundingRateHistoryEntry[];\n}\n\nexport type IndexerServerPortfolioPeriod =\n | 'day'\n | 'week'\n | 'month'\n | 'allTime'\n | 'perpDay'\n | 'perpWeek'\n | 'perpMonth'\n | 'perpAllTime';\n\n/**\n * [timestamp (unix seconds), value] — both x18-free decimal strings. Values are\n * USDT0-denominated, except `marketCountHistory` points, which are integer counts.\n */\nexport type IndexerServerPortfolioPoint = [string, string];\n\n// All five series are aligned: same timestamps, same length.\nexport interface IndexerServerPortfolioHistory {\n accountValueHistory: IndexerServerPortfolioPoint[];\n pnlHistory: IndexerServerPortfolioPoint[];\n volumeHistory: IndexerServerPortfolioPoint[];\n tradeSizeHistory: IndexerServerPortfolioPoint[];\n marketCountHistory: IndexerServerPortfolioPoint[];\n}\n\nexport type IndexerServerPortfolioResponse = [\n IndexerServerPortfolioPeriod,\n IndexerServerPortfolioHistory,\n][];\n\nexport interface IndexerServerPerpPrices {\n product_id: number;\n index_price_x18: string;\n mark_price_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerPriceResponse = IndexerServerPerpPrices;\n\n// Map of productId -> IndexerServerPerpPrices\nexport type IndexerServerPerpPricesResponse = Record<\n string,\n IndexerServerPerpPrices\n>;\n\nexport interface IndexerServerOraclePricesResponse {\n prices: IndexerServerOraclePrice[];\n}\n\nexport interface IndexerServerCandlesticksResponse {\n candlesticks: IndexerServerCandlestick[];\n}\n\nexport type IndexerEdgeServerCandlesticksResponse =\n IndexerServerCandlesticksResponse;\n\nexport interface IndexerServerProductsResponse {\n products: IndexerServerProductSnapshot[];\n txs: IndexerServerTx[];\n}\n\n// Map of timestamp -> (productID -> IndexerServerProductSnapshot)\nexport type IndexerServerMultiProductsResponse = Record<\n string,\n Record<string, IndexerServerProductSnapshot>\n>;\n\nexport interface IndexerServerEventsResponse {\n events: IndexerServerEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerOrdersResponse {\n orders: IndexerServerOrder[];\n}\n\nexport interface IndexerServerMatchEventsResponse {\n matches: IndexerServerMatchEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerQuotePriceResponse {\n price_x18: string;\n}\n\nexport interface IndexerServerLinkedSignerResponse {\n total_tx_limit: string;\n remaining_tx: string;\n wait_time: string;\n signer: string;\n}\n\nexport interface IndexerServerMarketSnapshotsResponse {\n snapshots: IndexerServerMarketSnapshot[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsResponse {\n snapshots: Record<number, IndexerServerMarketSnapshot[]>;\n}\n\nexport interface IndexerServerInterestFundingResponse {\n interest_payments: IndexerServerProductPayment[];\n funding_payments: IndexerServerProductPayment[];\n next_idx: string;\n}\n\nexport interface IndexerServerMakerStatisticsResponse {\n reward_coefficient: string;\n makers: IndexerServerMaker[];\n}\n\nexport interface IndexerServerLeaderboardResponse {\n positions: IndexerServerLeaderboardPosition[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationsResponse {\n registrations: IndexerServerLeaderboardRegistration[];\n}\n\nexport type IndexerServerLeaderboardRegisterResponse =\n IndexerServerLeaderboardRegistrationsResponse;\n\nexport interface IndexerServerLeaderboardRankResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerServerLeaderboardPosition\n positions: Record<string, IndexerServerLeaderboardPosition>;\n}\n\nexport interface IndexerServerLeaderboardContestsResponse {\n contests: IndexerServerLeaderboardContest[];\n}\n\nexport interface IndexerServerFastWithdrawalSignatureResponse {\n idx: string;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n // Present only for `WithdrawCollateralV2` withdrawals.\n tx_v2?: NadoWithdrawCollateralV2Tx['withdraw_collateral_v2'];\n tx_bytes: string;\n signatures: string[];\n}\n\nexport interface IndexerServerNlpSnapshotsResponse {\n snapshots: IndexerServerNlpSnapshot[];\n}\n\nexport interface IndexerServerDDAResponse {\n v1_address: string;\n}\n\nexport interface IndexerServerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n total_txs: string;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n total_submissions: string;\n // Number of unprocessed transactions (total_txs - total_submissions)\n backlog_size: string;\n // UNIX timestamp (in seconds) of when the data was last updated\n updated_at: string;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlog_eta_in_seconds: string | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txs_per_second: string | null;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceResponse {\n points: string;\n fee_refund: string;\n nft_eligibility: boolean;\n}\n\nexport interface IndexerServerPointsEpoch {\n epoch: number;\n description: string;\n start_time: string;\n end_time: string;\n total_points: string;\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerAllTimePoints {\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerPointsResponse {\n points_per_epoch: IndexerServerPointsEpoch[];\n all_time_points: IndexerServerAllTimePoints;\n}\n\nexport interface IndexerServerXPointsQuest {\n quest_type: string;\n points: string;\n}\n\nexport interface IndexerServerXPointsEpoch {\n epoch: number;\n description: string;\n start_time: string;\n end_time: string;\n total_points: string;\n rank: number;\n quests: IndexerServerXPointsQuest[];\n}\n\nexport interface IndexerServerXPointsAllTime {\n total_points: string;\n rank: number;\n quests: IndexerServerXPointsQuest[];\n}\n\nexport interface IndexerServerXPointsResponse {\n points_per_epoch: IndexerServerXPointsEpoch[];\n all_time_points: IndexerServerXPointsAllTime;\n}\n\nexport interface IndexerServerCashIncentivesEventMetadata {\n event_id: number;\n description: string;\n // UNIX timestamp in seconds\n epoch_start: string;\n // UNIX timestamp in seconds\n epoch_end: string;\n // x18 string\n max_volume: string;\n // x18 string\n max_reward: string;\n // x18 string\n min_volume: string;\n // x18 string\n min_reward: string;\n}\n\nexport interface IndexerServerCashIncentivesEventPlatform {\n // x18 string\n platform_volume: string;\n // x18 string\n unlocked_reward: string;\n}\n\nexport interface IndexerServerCashIncentivesEventWallet {\n // x18 string\n reward: string;\n}\n\nexport interface IndexerServerCashIncentivesEvent {\n metadata: IndexerServerCashIncentivesEventMetadata;\n platform: IndexerServerCashIncentivesEventPlatform;\n wallet: IndexerServerCashIncentivesEventWallet;\n}\n\nexport interface IndexerServerCashIncentivesWalletSummary {\n // x18 string\n total_reward: string;\n // x18 string\n claimable_reward: string;\n}\n\nexport interface IndexerServerCashIncentivesResponse {\n events: IndexerServerCashIncentivesEvent[];\n wallet_summary: IndexerServerCashIncentivesWalletSummary;\n}\n\nexport interface IndexerServerSocialConnectResponse {\n url: string;\n}\n\nexport interface IndexerServerSocialAccountsResponse {\n accounts: IndexerServerSocialAccount[];\n}\n\n// Response\nexport interface IndexerServerQueryResponseByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;\n backlog: IndexerServerBacklogResponse;\n candlesticks: IndexerServerCandlesticksResponse;\n direct_deposit_address: IndexerServerDDAResponse;\n edge_candlesticks: IndexerEdgeServerCandlesticksResponse;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;\n events: IndexerServerEventsResponse;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;\n funding_rate: IndexerServerFundingRateResponse;\n funding_rate_history: IndexerServerFundingRateHistoryResponse;\n funding_rates: IndexerServerFundingRatesResponse;\n interest_and_funding: IndexerServerInterestFundingResponse;\n leaderboard: IndexerServerLeaderboardResponse;\n leaderboard_contests: IndexerServerLeaderboardContestsResponse;\n leaderboard_rank: IndexerServerLeaderboardRankResponse;\n leaderboard_register: IndexerServerLeaderboardRegisterResponse;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsResponse;\n linked_signer_rate_limit: IndexerServerLinkedSignerResponse;\n maker_statistics: IndexerServerMakerStatisticsResponse;\n market_snapshots: IndexerServerMarketSnapshotsResponse;\n matches: IndexerServerMatchEventsResponse;\n oracle_price: IndexerServerOraclePricesResponse;\n orders: IndexerServerOrdersResponse;\n perp_prices: IndexerServerPerpPricesResponse;\n portfolio: IndexerServerPortfolioResponse;\n price: IndexerServerPriceResponse;\n product_snapshots: IndexerServerMultiProductsResponse;\n products: IndexerServerProductsResponse;\n referral_code: IndexerServerReferralCodeResponse;\n subaccounts: IndexerServerListSubaccountsResponse;\n quote_price: IndexerServerQuotePriceResponse;\n nlp_snapshots: IndexerServerNlpSnapshotsResponse;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceResponse;\n nado_points: IndexerServerPointsResponse;\n nado_xpoints: IndexerServerXPointsResponse;\n cash_incentives: IndexerServerCashIncentivesResponse;\n social_connect: IndexerServerSocialConnectResponse;\n list_social_accounts: IndexerServerSocialAccountsResponse;\n revoke_social_account: IndexerServerSocialAccountsResponse;\n}\n\n/**\n * V2 API Types\n */\n\n/**\n * Individual ticker data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2TickerResponse {\n product_id: number;\n ticker_id: string;\n base_currency: string;\n quote_currency: string;\n last_price: number;\n base_volume: number;\n quote_volume: number;\n price_change_percent_24h: number;\n}\n\n/**\n * Response from v2 tickers endpoint (server format)\n * Maps ticker IDs to their respective ticker data\n */\nexport type IndexerServerV2TickersResponse = Record<\n string,\n IndexerServerV2TickerResponse\n>;\n\n/**\n * Market hours data from v2 symbols endpoint (server format)\n */\nexport interface IndexerServerV2MarketHours {\n is_open: boolean;\n reason: string | null;\n next_close: string | null;\n next_open: string | null;\n}\n\n/**\n * Individual symbol data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2Symbol {\n type: string;\n product_id: number;\n symbol: string;\n price_increment_x18: string;\n size_increment: string;\n min_size: string;\n maker_fee_rate_x18: string;\n taker_fee_rate_x18: string;\n long_weight_initial_x18: string;\n long_weight_maintenance_x18: string;\n /**\n * Defined only for perp markets with a max OI cap\n */\n max_open_interest_x18: string | null;\n /**\n * Defined only for xStocks spot markets\n */\n exchange_rate_x18: string | null;\n trading_status: string;\n isolated_only: boolean;\n market_hours: IndexerServerV2MarketHours | null;\n /**\n * Boost tier for products with rewards boosts. Null for non-boosted products.\n * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x\n */\n boost_type: number | null;\n /**\n * Taker rewards multiplier. Null for non-boosted products.\n */\n taker_multiplier: number | null;\n /**\n * Maker rewards multiplier. Null for non-boosted products.\n */\n maker_multiplier: number | null;\n}\n\n/**\n * Response from v2 symbols endpoint (server format)\n * Maps symbols to their respective data\n */\nexport type IndexerServerV2SymbolsResponse = Record<\n string,\n IndexerServerV2Symbol\n>;\n\n/**\n * Wire `request_type` the indexer echoes on failure envelopes. The indexer's failure envelope is\n * keyed by route (`<verb>_<query_type>`), mirroring the engine and trigger services. Kept as a\n * `${string}_${string}` template to avoid enumerating the full set of v1 query types declared\n * above.\n */\nexport type IndexerServerRequestType = `${string}_${string}`;\n\n/**\n * Failure envelope returned by the indexer service API. Mirrors the failure shape used by the\n * engine and trigger services: a `status: 'failure'` discriminant plus an `error`/`error_code`\n * pair and the originating `request_type`. A response missing this envelope shape (e.g. a\n * malformed body, or a non-JSON response) is a transport-level error, not a domain error.\n *\n * The v2 REST endpoints do not return this envelope — they use plain HTTP error responses\n * without an `error_code` field.\n */\nexport interface IndexerServerFailureResponse {\n status: 'failure';\n error: string;\n error_code: number;\n request_type: IndexerServerRequestType;\n}\n\n/**\n * Narrows an unknown response body to the indexer service API failure envelope.\n */\nexport function isIndexerServerFailureResponse(\n data: unknown,\n): data is IndexerServerFailureResponse {\n return (\n typeof data === 'object' &&\n data !== null &&\n (data as Record<string, unknown>).status === 'failure'\n );\n}\n"],"mappings":";;;;AA8wBA,SAAgB,+BACd,MACsC;CACtC,OACE,OAAO,SAAS,YAChB,SAAS,QACR,KAAiC,WAAW;AAEjD"}
1
+ {"version":3,"file":"serverTypes.js","names":[],"sources":["../../src/types/serverTypes.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationValues,\n EIP712SocialAuthenticationValues,\n SignedTx,\n} from '@nadohq/shared';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoWithdrawCollateralTx, NadoWithdrawCollateralV2Tx } from './NadoTx';\nimport {\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMarketSnapshotInterval,\n IndexerServerMatchEvent,\n IndexerServerNlpSnapshot,\n IndexerServerOraclePrice,\n IndexerServerOrder,\n IndexerServerProductPayment,\n IndexerServerProductSnapshot,\n IndexerServerSnapshotsInterval,\n IndexerServerSocialAccount,\n IndexerServerTx,\n} from './serverModelTypes';\n\n/**\n * Params\n */\n\nexport interface IndexerServerListSubaccountsParams {\n // Inclusive, defaults to 0\n start?: number;\n // Defaults to 100\n limit?: number;\n address?: string;\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsParams {\n // Subaccount hex identifiers\n subaccounts: string[];\n timestamps: number[];\n // If not given, will return both isolated & non-iso balances\n isolated?: boolean;\n}\n\nexport interface IndexerServerReferralCodeParams {\n subaccount: string;\n}\n\nexport interface IndexerServerFundingRateParams {\n product_id: number;\n}\n\nexport interface IndexerServerFundingRatesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerFundingRateHistoryParams {\n product_id: number;\n start_time?: number | string;\n end_time?: number | string;\n // Max number of rates to return. Defaults to 100, max 1000.\n limit?: number;\n}\n\nexport interface IndexerServerPriceParams {\n product_id: number;\n}\n\nexport interface IndexerServerPerpPricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerPortfolioParams {\n subaccount: string;\n}\n\nexport interface IndexerServerOraclePricesParams {\n product_ids: number[];\n}\n\nexport interface IndexerServerCandlesticksParams {\n product_id: number;\n granularity: number;\n // Seconds\n max_time?: number;\n limit: number;\n}\n\nexport type IndexerEdgeServerCandlesticksParams =\n IndexerServerCandlesticksParams;\n\nexport interface IndexerServerProductsParams {\n product_id: number;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMultiProductsParams {\n product_ids: number[];\n max_time: number[];\n}\n\nexport interface IndexerServerEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n event_types?: IndexerEventType[];\n // Descending order for idx (time), defaults to true\n desc?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n max_time?: number;\n limit?:\n | {\n raw: number;\n }\n | {\n txs: number;\n };\n}\n\nexport type IndexerServerTriggerTypeFilter =\n | 'none'\n | 'price_trigger'\n | 'time_trigger';\n\nexport interface IndexerServerOrdersParams {\n subaccounts?: string[];\n product_ids?: number[];\n trigger_types?: IndexerServerTriggerTypeFilter[];\n digests?: string[];\n max_time?: number;\n limit?: number;\n // If not given, will return both isolated & non-iso orders\n isolated?: boolean;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerMatchEventsParams {\n subaccounts?: string[];\n product_ids?: number[];\n // If not given, will return both isolated & non-iso events\n isolated?: boolean;\n max_time?: number;\n limit: number;\n // submission_idx for pagination, inclusive\n idx?: string;\n}\n\nexport interface IndexerServerLinkedSignerParams {\n subaccount: string;\n}\n\nexport interface IndexerServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n // Defaults to all\n product_ids?: number[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsParams {\n interval: IndexerServerMarketSnapshotInterval;\n}\n\nexport interface IndexerServerInterestFundingParams {\n subaccount: string;\n product_ids: number[];\n // If not given, defaults to latest\n max_idx?: string;\n max_time?: number;\n limit: number;\n}\n\nexport interface IndexerServerMakerStatisticsParams {\n product_id: number;\n epoch: number;\n interval: number;\n}\n\nexport interface IndexerServerLeaderboardParams {\n contest_id: number;\n rank_type?: IndexerLeaderboardRankType;\n start?: number | string;\n limit?: number | string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface IndexerServerLeaderboardRankParams {\n subaccount: string;\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardContestsParams {\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegistrationsParams {\n subaccount: string;\n contest_ids?: number[];\n active?: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegisterParams {\n update_registration: SignedTx<EIP712LeaderboardAuthenticationValues>;\n}\n\nexport interface IndexerServerSocialConnectParams {\n update_social_account: SignedTx<EIP712SocialAuthenticationValues>;\n}\n\nexport interface IndexerServerListSocialAccountsParams {\n address: string;\n}\n\nexport type IndexerServerRevokeSocialAccountParams =\n IndexerServerSocialConnectParams;\n\nexport interface IndexerServerFastWithdrawalSignatureParams {\n /**\n * The submission index of the WithdrawCollateral tx to be used for fast withdraw.\n */\n idx: number | string;\n}\n\nexport interface IndexerServerNlpSnapshotsParams {\n interval: IndexerServerSnapshotsInterval;\n}\n\nexport interface IndexerServerDDAQueryParams {\n subaccount: string;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceParams {\n address: string;\n}\n\nexport interface IndexerServerPointsParams {\n address: string;\n}\n\nexport interface IndexerServerXPointsParams {\n address: string;\n}\n\nexport interface IndexerServerCashIncentivesParams {\n wallet_address: string;\n}\n\n// Request\nexport interface IndexerServerQueryRequestByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;\n backlog: Record<string, never>;\n candlesticks: IndexerServerCandlesticksParams;\n direct_deposit_address: IndexerServerDDAQueryParams;\n edge_candlesticks: IndexerEdgeServerCandlesticksParams;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;\n events: IndexerServerEventsParams;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;\n funding_rate: IndexerServerFundingRateParams;\n funding_rate_history: IndexerServerFundingRateHistoryParams;\n funding_rates: IndexerServerFundingRatesParams;\n interest_and_funding: IndexerServerInterestFundingParams;\n leaderboard: IndexerServerLeaderboardParams;\n leaderboard_contests: IndexerServerLeaderboardContestsParams;\n leaderboard_rank: IndexerServerLeaderboardRankParams;\n leaderboard_register: IndexerServerLeaderboardRegisterParams;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsParams;\n linked_signer_rate_limit: IndexerServerLinkedSignerParams;\n maker_statistics: IndexerServerMakerStatisticsParams;\n market_snapshots: IndexerServerMarketSnapshotsParams;\n matches: IndexerServerMatchEventsParams;\n oracle_price: IndexerServerOraclePricesParams;\n orders: IndexerServerOrdersParams;\n perp_prices: IndexerServerPerpPricesParams;\n portfolio: IndexerServerPortfolioParams;\n price: IndexerServerPriceParams;\n product_snapshots: IndexerServerMultiProductsParams;\n products: IndexerServerProductsParams;\n referral_code: IndexerServerReferralCodeParams;\n subaccounts: IndexerServerListSubaccountsParams;\n quote_price: Record<string, never>;\n nlp_snapshots: IndexerServerNlpSnapshotsParams;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceParams;\n nado_points: IndexerServerPointsParams;\n nado_xpoints: IndexerServerXPointsParams;\n cash_incentives: IndexerServerCashIncentivesParams;\n social_connect: IndexerServerSocialConnectParams;\n list_social_accounts: IndexerServerListSocialAccountsParams;\n revoke_social_account: IndexerServerRevokeSocialAccountParams;\n}\n\nexport type IndexerServerQueryRequestType =\n keyof IndexerServerQueryRequestByType;\n\n/**\n * Responses\n */\n\nexport interface IndexerServerListSubaccountsResponse {\n subaccounts: {\n id: string;\n // Hex of subaccount bytes\n subaccount: string;\n // UNIX timestamp in seconds\n created_at: string;\n isolated: boolean;\n }[];\n}\n\nexport interface IndexerServerMultiSubaccountSnapshotsResponse {\n // Map of subaccount hex -> timestamp requested -> latest events corresponding to each product\n snapshots: Record<string, Record<string, IndexerServerEvent[]>>;\n}\n\nexport interface IndexerServerReferralCodeResponse {\n referral_code: string | null;\n}\n\nexport interface IndexerServerFundingRate {\n product_id: number;\n funding_rate_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerFundingRateResponse = IndexerServerFundingRate;\n\n// Map of productId -> IndexerServerFundingRate\nexport type IndexerServerFundingRatesResponse = Record<\n string,\n IndexerServerFundingRate\n>;\n\nexport interface IndexerServerFundingRateHistoryEntry {\n product_id: number;\n // Epoch time in seconds of the settlement tick this funding rate was recorded at.\n timestamp: string;\n // Realized hourly funding rate at this tick, multiplied by 10^18 (% = rate * 100).\n funding_rate_x18: string;\n}\n\nexport interface IndexerServerFundingRateHistoryResponse {\n // Always ascending by timestamp.\n funding_rates: IndexerServerFundingRateHistoryEntry[];\n}\n\nexport type IndexerServerPortfolioPeriod =\n | 'day'\n | 'week'\n | 'month'\n | 'allTime'\n | 'perpDay'\n | 'perpWeek'\n | 'perpMonth'\n | 'perpAllTime';\n\n/**\n * [timestamp (unix seconds), value] — both x18-free decimal strings. Values are\n * USDT0-denominated, except `marketCountHistory` points, which are integer counts.\n */\nexport type IndexerServerPortfolioPoint = [string, string];\n\n// All five series are aligned: same timestamps, same length.\nexport interface IndexerServerPortfolioHistory {\n accountValueHistory: IndexerServerPortfolioPoint[];\n pnlHistory: IndexerServerPortfolioPoint[];\n volumeHistory: IndexerServerPortfolioPoint[];\n tradeSizeHistory: IndexerServerPortfolioPoint[];\n marketCountHistory: IndexerServerPortfolioPoint[];\n}\n\nexport type IndexerServerPortfolioResponse = [\n IndexerServerPortfolioPeriod,\n IndexerServerPortfolioHistory,\n][];\n\nexport interface IndexerServerPerpPrices {\n product_id: number;\n index_price_x18: string;\n mark_price_x18: string;\n update_time: number;\n}\n\nexport type IndexerServerPriceResponse = IndexerServerPerpPrices;\n\n// Map of productId -> IndexerServerPerpPrices\nexport type IndexerServerPerpPricesResponse = Record<\n string,\n IndexerServerPerpPrices\n>;\n\nexport interface IndexerServerOraclePricesResponse {\n prices: IndexerServerOraclePrice[];\n}\n\nexport interface IndexerServerCandlesticksResponse {\n candlesticks: IndexerServerCandlestick[];\n}\n\nexport type IndexerEdgeServerCandlesticksResponse =\n IndexerServerCandlesticksResponse;\n\nexport interface IndexerServerProductsResponse {\n products: IndexerServerProductSnapshot[];\n txs: IndexerServerTx[];\n}\n\n// Map of timestamp -> (productID -> IndexerServerProductSnapshot)\nexport type IndexerServerMultiProductsResponse = Record<\n string,\n Record<string, IndexerServerProductSnapshot>\n>;\n\nexport interface IndexerServerEventsResponse {\n events: IndexerServerEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerOrdersResponse {\n orders: IndexerServerOrder[];\n}\n\nexport interface IndexerServerMatchEventsResponse {\n matches: IndexerServerMatchEvent[];\n txs: IndexerServerTx[];\n}\n\nexport interface IndexerServerQuotePriceResponse {\n price_x18: string;\n}\n\nexport interface IndexerServerLinkedSignerResponse {\n total_tx_limit: string;\n remaining_tx: string;\n wait_time: string;\n signer: string;\n}\n\nexport interface IndexerServerMarketSnapshotsResponse {\n snapshots: IndexerServerMarketSnapshot[];\n}\n\nexport interface IndexerEdgeServerMarketSnapshotsResponse {\n snapshots: Record<number, IndexerServerMarketSnapshot[]>;\n}\n\nexport interface IndexerServerInterestFundingResponse {\n interest_payments: IndexerServerProductPayment[];\n funding_payments: IndexerServerProductPayment[];\n next_idx: string;\n}\n\nexport interface IndexerServerMakerStatisticsResponse {\n reward_coefficient: string;\n makers: IndexerServerMaker[];\n}\n\nexport interface IndexerServerLeaderboardResponse {\n positions: IndexerServerLeaderboardPosition[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationsResponse {\n registrations: IndexerServerLeaderboardRegistration[];\n}\n\nexport type IndexerServerLeaderboardRegisterResponse =\n IndexerServerLeaderboardRegistrationsResponse;\n\nexport interface IndexerServerLeaderboardRankResponse {\n // If the subaccount is not eligible for a given contest, it would not be included in the response.\n // contestId -> IndexerServerLeaderboardPosition\n positions: Record<string, IndexerServerLeaderboardPosition>;\n}\n\nexport interface IndexerServerLeaderboardContestsResponse {\n contests: IndexerServerLeaderboardContest[];\n}\n\nexport interface IndexerServerFastWithdrawalSignatureResponse {\n idx: string;\n tx: NadoWithdrawCollateralTx['withdraw_collateral'];\n // Present only for `WithdrawCollateralV2` withdrawals.\n tx_v2?: NadoWithdrawCollateralV2Tx['withdraw_collateral_v2'];\n tx_bytes: string;\n signatures: string[];\n}\n\nexport interface IndexerServerNlpSnapshotsResponse {\n snapshots: IndexerServerNlpSnapshot[];\n}\n\nexport interface IndexerServerDDAResponse {\n v1_address: string;\n}\n\nexport interface IndexerServerBacklogResponse {\n // Total number of transactions stored in the indexer DB\n total_txs: string;\n // Current nSubmissions value from the chain (i.e., number of processed txs)\n total_submissions: string;\n // Number of unprocessed transactions (total_txs - total_submissions)\n backlog_size: string;\n // UNIX timestamp (in seconds) of when the data was last updated\n updated_at: string;\n // Estimated time in seconds (float) to clear the entire backlog (null if unavailable)\n backlog_eta_in_seconds: string | null;\n // Current submission rate in transactions per second (float) (null if unavailable)\n txs_per_second: string | null;\n}\n\nexport interface IndexerServerPrivateAlphaChoiceResponse {\n points: string;\n fee_refund: string;\n nft_eligibility: boolean;\n}\n\nexport interface IndexerServerPointsEpoch {\n epoch: number;\n description: string;\n start_time: string;\n end_time: string;\n total_points: string;\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerAllTimePoints {\n points: string;\n rank: number;\n tier: number;\n}\n\nexport interface IndexerServerPointsResponse {\n points_per_epoch: IndexerServerPointsEpoch[];\n all_time_points: IndexerServerAllTimePoints;\n}\n\nexport interface IndexerServerXPointsQuest {\n quest_type: string;\n points: string;\n}\n\nexport interface IndexerServerXPointsEpoch {\n epoch: number;\n description: string;\n start_time: string;\n end_time: string;\n total_points: string;\n rank: number;\n quests: IndexerServerXPointsQuest[];\n}\n\nexport interface IndexerServerXPointsAllTime {\n total_points: string;\n rank: number;\n quests: IndexerServerXPointsQuest[];\n}\n\nexport interface IndexerServerXPointsResponse {\n points_per_epoch: IndexerServerXPointsEpoch[];\n all_time_points: IndexerServerXPointsAllTime;\n}\n\nexport interface IndexerServerCashIncentivesEventMetadata {\n event_id: number;\n description: string;\n // UNIX timestamp in seconds\n epoch_start: string;\n // UNIX timestamp in seconds\n epoch_end: string;\n // x18 string\n max_volume: string;\n // x18 string\n max_reward: string;\n // x18 string\n min_volume: string;\n // x18 string\n min_reward: string;\n}\n\nexport interface IndexerServerCashIncentivesEventPlatform {\n // x18 string\n platform_volume: string;\n // x18 string\n unlocked_reward: string;\n}\n\n/**\n * Claim status of a wallet for a single Cash Incentives event.\n *\n * - `in_progress`: the event is still active.\n * - `pending`: the event has ended, but its settlement has not been published.\n * - `no_reward`: the settlement exists, but the wallet has no reward.\n * - `claimable`: the settlement grants this wallet a reward, and the proof to claim it is included.\n *\n * There is deliberately no `claimed` status. The airdrop contract's `getClaimed` is the source of\n * truth for whether a reward has already been taken, so a reward stays `claimable` here even after\n * it has been claimed onchain.\n */\nexport const INDEXER_SERVER_CASH_INCENTIVES_WALLET_STATUSES = [\n 'in_progress',\n 'pending',\n 'no_reward',\n 'claimable',\n] as const;\n\nexport type IndexerServerCashIncentivesWalletStatus =\n (typeof INDEXER_SERVER_CASH_INCENTIVES_WALLET_STATUSES)[number];\n\n/**\n * `wallet.claim` variant carrying everything needed to claim onchain.\n */\nexport interface IndexerServerCashIncentivesClaimableClaim {\n status: 'claimable';\n airdrop_address: string;\n // Reward event id within the airdrop contract, distinct from `metadata.event_id`\n week: number;\n // Integer string in raw token units, as committed to by the merkle root\n total_amount: string;\n // Merkle proof hashes\n proof: string[];\n}\n\n/**\n * `wallet.claim` variant for events with nothing to claim, which carries only the status.\n */\nexport interface IndexerServerCashIncentivesUnclaimableClaim {\n status: Exclude<IndexerServerCashIncentivesWalletStatus, 'claimable'>;\n}\n\n/**\n * Always present, tagged on `status`. Only the `claimable` variant carries proof data.\n */\nexport type IndexerServerCashIncentivesWalletClaim =\n | IndexerServerCashIncentivesClaimableClaim\n | IndexerServerCashIncentivesUnclaimableClaim;\n\nexport interface IndexerServerCashIncentivesEventWallet {\n // x18 string\n reward: string;\n claim: IndexerServerCashIncentivesWalletClaim;\n}\n\nexport interface IndexerServerCashIncentivesEvent {\n metadata: IndexerServerCashIncentivesEventMetadata;\n platform: IndexerServerCashIncentivesEventPlatform;\n wallet: IndexerServerCashIncentivesEventWallet;\n}\n\nexport interface IndexerServerCashIncentivesWalletSummary {\n // x18 string\n total_reward: string;\n // x18 string\n claimable_reward: string;\n}\n\nexport interface IndexerServerCashIncentivesResponse {\n events: IndexerServerCashIncentivesEvent[];\n wallet_summary: IndexerServerCashIncentivesWalletSummary;\n}\n\nexport interface IndexerServerSocialConnectResponse {\n url: string;\n}\n\nexport interface IndexerServerSocialAccountsResponse {\n accounts: IndexerServerSocialAccount[];\n}\n\n// Response\nexport interface IndexerServerQueryResponseByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;\n backlog: IndexerServerBacklogResponse;\n candlesticks: IndexerServerCandlesticksResponse;\n direct_deposit_address: IndexerServerDDAResponse;\n edge_candlesticks: IndexerEdgeServerCandlesticksResponse;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;\n events: IndexerServerEventsResponse;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;\n funding_rate: IndexerServerFundingRateResponse;\n funding_rate_history: IndexerServerFundingRateHistoryResponse;\n funding_rates: IndexerServerFundingRatesResponse;\n interest_and_funding: IndexerServerInterestFundingResponse;\n leaderboard: IndexerServerLeaderboardResponse;\n leaderboard_contests: IndexerServerLeaderboardContestsResponse;\n leaderboard_rank: IndexerServerLeaderboardRankResponse;\n leaderboard_register: IndexerServerLeaderboardRegisterResponse;\n leaderboard_registrations: IndexerServerLeaderboardRegistrationsResponse;\n linked_signer_rate_limit: IndexerServerLinkedSignerResponse;\n maker_statistics: IndexerServerMakerStatisticsResponse;\n market_snapshots: IndexerServerMarketSnapshotsResponse;\n matches: IndexerServerMatchEventsResponse;\n oracle_price: IndexerServerOraclePricesResponse;\n orders: IndexerServerOrdersResponse;\n perp_prices: IndexerServerPerpPricesResponse;\n portfolio: IndexerServerPortfolioResponse;\n price: IndexerServerPriceResponse;\n product_snapshots: IndexerServerMultiProductsResponse;\n products: IndexerServerProductsResponse;\n referral_code: IndexerServerReferralCodeResponse;\n subaccounts: IndexerServerListSubaccountsResponse;\n quote_price: IndexerServerQuotePriceResponse;\n nlp_snapshots: IndexerServerNlpSnapshotsResponse;\n private_alpha_choice: IndexerServerPrivateAlphaChoiceResponse;\n nado_points: IndexerServerPointsResponse;\n nado_xpoints: IndexerServerXPointsResponse;\n cash_incentives: IndexerServerCashIncentivesResponse;\n social_connect: IndexerServerSocialConnectResponse;\n list_social_accounts: IndexerServerSocialAccountsResponse;\n revoke_social_account: IndexerServerSocialAccountsResponse;\n}\n\n/**\n * V2 API Types\n */\n\n/**\n * Individual ticker data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2TickerResponse {\n product_id: number;\n ticker_id: string;\n base_currency: string;\n quote_currency: string;\n last_price: number;\n base_volume: number;\n quote_volume: number;\n price_change_percent_24h: number;\n}\n\n/**\n * Response from v2 tickers endpoint (server format)\n * Maps ticker IDs to their respective ticker data\n */\nexport type IndexerServerV2TickersResponse = Record<\n string,\n IndexerServerV2TickerResponse\n>;\n\n/**\n * Market hours data from v2 symbols endpoint (server format)\n */\nexport interface IndexerServerV2MarketHours {\n is_open: boolean;\n reason: string | null;\n next_close: string | null;\n next_open: string | null;\n}\n\n/**\n * Individual symbol data from v2 indexer endpoint (server format)\n */\nexport interface IndexerServerV2Symbol {\n type: string;\n product_id: number;\n symbol: string;\n price_increment_x18: string;\n size_increment: string;\n min_size: string;\n maker_fee_rate_x18: string;\n taker_fee_rate_x18: string;\n long_weight_initial_x18: string;\n long_weight_maintenance_x18: string;\n /**\n * Defined only for perp markets with a max OI cap\n */\n max_open_interest_x18: string | null;\n /**\n * Defined only for xStocks spot markets\n */\n exchange_rate_x18: string | null;\n trading_status: string;\n isolated_only: boolean;\n market_hours: IndexerServerV2MarketHours | null;\n /**\n * Boost tier for products with rewards boosts. Null for non-boosted products.\n * 0 = none, 1 = taker 4x / maker 4x, 2 = taker 3x / maker 4x\n */\n boost_type: number | null;\n /**\n * Taker rewards multiplier. Null for non-boosted products.\n */\n taker_multiplier: number | null;\n /**\n * Maker rewards multiplier. Null for non-boosted products.\n */\n maker_multiplier: number | null;\n}\n\n/**\n * Response from v2 symbols endpoint (server format)\n * Maps symbols to their respective data\n */\nexport type IndexerServerV2SymbolsResponse = Record<\n string,\n IndexerServerV2Symbol\n>;\n\n/**\n * Wire `request_type` the indexer echoes on failure envelopes. The indexer's failure envelope is\n * keyed by route (`<verb>_<query_type>`), mirroring the engine and trigger services. Kept as a\n * `${string}_${string}` template to avoid enumerating the full set of v1 query types declared\n * above.\n */\nexport type IndexerServerRequestType = `${string}_${string}`;\n\n/**\n * Failure envelope returned by the indexer service API. Mirrors the failure shape used by the\n * engine and trigger services: a `status: 'failure'` discriminant plus an `error`/`error_code`\n * pair and the originating `request_type`. A response missing this envelope shape (e.g. a\n * malformed body, or a non-JSON response) is a transport-level error, not a domain error.\n *\n * The v2 REST endpoints do not return this envelope — they use plain HTTP error responses\n * without an `error_code` field.\n */\nexport interface IndexerServerFailureResponse {\n status: 'failure';\n error: string;\n error_code: number;\n request_type: IndexerServerRequestType;\n}\n\n/**\n * Narrows an unknown response body to the indexer service API failure envelope.\n */\nexport function isIndexerServerFailureResponse(\n data: unknown,\n): data is IndexerServerFailureResponse {\n return (\n typeof data === 'object' &&\n data !== null &&\n (data as Record<string, unknown>).status === 'failure'\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+lBA,MAAa,iDAAiD;CAC5D;CACA;CACA;CACA;AACF;;;;AA6NA,SAAgB,+BACd,MACsC;CACtC,OACE,OAAO,SAAS,YAChB,SAAS,QACR,KAAiC,WAAW;AAEjD"}
@@ -1,2 +1,2 @@
1
- import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-DhC367Il.cjs";
1
+ import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-DqMAvUsj.cjs";
2
2
  export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue };
@@ -1,2 +1,2 @@
1
- import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-C9soABg1.js";
1
+ import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-ZJec8hfI.js";
2
2
  export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue };
@@ -1,2 +1,2 @@
1
- import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-DhC367Il.cjs";
1
+ import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-DqMAvUsj.cjs";
2
2
  export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue };
@@ -1,2 +1,2 @@
1
- import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-C9soABg1.js";
1
+ import { n as calcIndexerPerpBalanceValue, r as calcIndexerSpotBalanceValue, t as calcIndexerPerpBalanceNotionalValue } from "../indexerBalanceValue-ZJec8hfI.js";
2
2
  export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadohq/indexer-client",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "HTTP client for the Nado indexer — historical data, events, and analytics queries",
@@ -41,8 +41,8 @@
41
41
  "module": "./dist/index.js",
42
42
  "types": "./dist/index.d.ts",
43
43
  "dependencies": {
44
- "@nadohq/engine-client": "^0.33.0",
45
- "@nadohq/shared": "^0.33.0",
44
+ "@nadohq/engine-client": "^0.35.0",
45
+ "@nadohq/shared": "^0.35.0",
46
46
  "axios": "1.16.1",
47
47
  "ts-mixer": "6.0.4"
48
48
  },
@@ -54,5 +54,5 @@
54
54
  "bignumber.js": "11.1.1",
55
55
  "viem": "2.52.0"
56
56
  },
57
- "gitHead": "7743524dd36aa73253da8c01ffba4f4085dcffcb"
57
+ "gitHead": "232349cb0f432b024dab1b1c623e8ad3b74b8f85"
58
58
  }
@@ -3,6 +3,7 @@ import {
3
3
  EIP712LeaderboardAuthenticationValues,
4
4
  EIP712SocialAuthenticationParams,
5
5
  getDefaultRecvTime,
6
+ getNadoClientTypeHeaders,
6
7
  getNadoEIP712Values,
7
8
  getSignedTransactionRequest,
8
9
  getValidatedAddress,
@@ -148,6 +149,8 @@ export interface IndexerClientOpts {
148
149
  walletClient?: WalletClientWithAccount;
149
150
  // Linked signer registered through the engine, if provided, execute requests will use this signer
150
151
  linkedSignerWalletClient?: WalletClientWithAccount;
152
+ // If provided, identifies the calling client, sent as a header with every request
153
+ clientType?: string;
151
154
  }
152
155
 
153
156
  type IndexerQueryRequestBody = Partial<IndexerServerQueryRequestByType>;
@@ -166,6 +169,7 @@ export class IndexerBaseClient {
166
169
  withCredentials: true,
167
170
  // We have custom logic to validate response status and create an appropriate error
168
171
  validateStatus: () => true,
172
+ headers: getNadoClientTypeHeaders(opts.clientType),
169
173
  });
170
174
  this.v2Url = opts.v2Url ? opts.v2Url : opts.url.replace('v1', 'v2');
171
175
  }
@@ -1007,8 +1011,9 @@ export class IndexerBaseClient {
1007
1011
  }
1008
1012
 
1009
1013
  /**
1010
- * Retrieves cash incentives information (platform volume and unlocked rewards) for a given wallet address.
1011
- * If no `eventId` is provided, the latest event is returned.
1014
+ * Retrieves cash incentives information for a given wallet address: per-event platform volume,
1015
+ * unlocked rewards, and `wallet.claim`, which carries the claim status plus the merkle proof when
1016
+ * that status is `claimable`.
1012
1017
  * @param params
1013
1018
  */
1014
1019
  async getCashIncentives(
@@ -1036,6 +1041,19 @@ export class IndexerBaseClient {
1036
1041
  },
1037
1042
  wallet: {
1038
1043
  reward: removeDecimals(event.wallet.reward),
1044
+ claim:
1045
+ event.wallet.claim.status === 'claimable'
1046
+ ? {
1047
+ status: 'claimable',
1048
+ airdropAddress: getValidatedAddress(
1049
+ event.wallet.claim.airdrop_address,
1050
+ ),
1051
+ week: event.wallet.claim.week,
1052
+ // Kept in raw token units so it can be passed to the airdrop contract unchanged
1053
+ totalAmount: toBigNumber(event.wallet.claim.total_amount),
1054
+ proof: event.wallet.claim.proof.map(getValidatedHex),
1055
+ }
1056
+ : { status: event.wallet.claim.status },
1039
1057
  },
1040
1058
  })),
1041
1059
  walletSummary: {
@@ -21,6 +21,7 @@ import {
21
21
  NadoWithdrawCollateralV2Tx,
22
22
  } from './NadoTx';
23
23
  import {
24
+ IndexerServerCashIncentivesWalletStatus,
24
25
  IndexerServerFastWithdrawalSignatureParams,
25
26
  IndexerServerListSubaccountsParams,
26
27
  IndexerServerTriggerTypeFilter,
@@ -984,8 +985,54 @@ export interface IndexerCashIncentivesEventPlatform {
984
985
  unlockedReward: BigNumber;
985
986
  }
986
987
 
988
+ /**
989
+ * `wallet.claim` variant carrying the data needed to build an Airdrop contract `claim` call.
990
+ */
991
+ export interface IndexerCashIncentivesClaimableClaim {
992
+ /** Discriminant marking this claim as ready to submit onchain. */
993
+ status: 'claimable';
994
+ /** Airdrop contract holding the reward. */
995
+ airdropAddress: Address;
996
+ /**
997
+ * Reward event identifier within the airdrop contract. This is not the same as
998
+ * {@link IndexerCashIncentivesEventMetadata.eventId}, which identifies the Cash Incentives campaign.
999
+ */
1000
+ week: number;
1001
+ /**
1002
+ * Cumulative claimable amount in raw token units, as committed to by the merkle root. Pass this to
1003
+ * the contract unchanged; use {@link IndexerCashIncentivesEventWallet.reward} for display, since
1004
+ * the reward token's decimals are not part of the response.
1005
+ */
1006
+ totalAmount: BigNumber;
1007
+ /** Merkle proof for this wallet's reward. */
1008
+ proof: Hex[];
1009
+ }
1010
+
1011
+ /**
1012
+ * `wallet.claim` variant for events with nothing to claim, which carries only the status.
1013
+ */
1014
+ export interface IndexerCashIncentivesUnclaimableClaim {
1015
+ /** Why there is nothing to claim yet. */
1016
+ status: Exclude<IndexerServerCashIncentivesWalletStatus, 'claimable'>;
1017
+ }
1018
+
1019
+ /**
1020
+ * Always present, tagged on `status`. Only the `claimable` variant carries proof data, so narrow on
1021
+ * `status === 'claimable'` before reading it. See
1022
+ * {@link IndexerServerCashIncentivesWalletStatus} for the meaning of each status.
1023
+ */
1024
+ export type IndexerCashIncentivesWalletClaim =
1025
+ | IndexerCashIncentivesClaimableClaim
1026
+ | IndexerCashIncentivesUnclaimableClaim;
1027
+
987
1028
  export interface IndexerCashIncentivesEventWallet {
1029
+ /**
1030
+ * Reward for this wallet as a decimal token amount, already converted from the x18 value the
1031
+ * indexer returns. Populated before the reward becomes claimable.
1032
+ */
988
1033
  reward: BigNumber;
1034
+ /** Claim state for this event, always present and tagged on `status`. */
1035
+ claim: IndexerCashIncentivesWalletClaim;
989
1036
  }
990
1037
 
991
1038
  export interface IndexerCashIncentivesEvent {
@@ -593,9 +593,60 @@ export interface IndexerServerCashIncentivesEventPlatform {
593
593
  unlocked_reward: string;
594
594
  }
595
595
 
596
+ /**
597
+ * Claim status of a wallet for a single Cash Incentives event.
598
+ *
599
+ * - `in_progress`: the event is still active.
600
+ * - `pending`: the event has ended, but its settlement has not been published.
601
+ * - `no_reward`: the settlement exists, but the wallet has no reward.
602
+ * - `claimable`: the settlement grants this wallet a reward, and the proof to claim it is included.
603
+ *
604
+ * There is deliberately no `claimed` status. The airdrop contract's `getClaimed` is the source of
605
+ * truth for whether a reward has already been taken, so a reward stays `claimable` here even after
606
+ * it has been claimed onchain.
607
+ */
608
+ export const INDEXER_SERVER_CASH_INCENTIVES_WALLET_STATUSES = [
609
+ 'in_progress',
610
+ 'pending',
611
+ 'no_reward',
612
+ 'claimable',
613
+ ] as const;
614
+
615
+ export type IndexerServerCashIncentivesWalletStatus =
616
+ (typeof INDEXER_SERVER_CASH_INCENTIVES_WALLET_STATUSES)[number];
617
+
618
+ /**
619
+ * `wallet.claim` variant carrying everything needed to claim onchain.
620
+ */
621
+ export interface IndexerServerCashIncentivesClaimableClaim {
622
+ status: 'claimable';
623
+ airdrop_address: string;
624
+ // Reward event id within the airdrop contract, distinct from `metadata.event_id`
625
+ week: number;
626
+ // Integer string in raw token units, as committed to by the merkle root
627
+ total_amount: string;
628
+ // Merkle proof hashes
629
+ proof: string[];
630
+ }
631
+
632
+ /**
633
+ * `wallet.claim` variant for events with nothing to claim, which carries only the status.
634
+ */
635
+ export interface IndexerServerCashIncentivesUnclaimableClaim {
636
+ status: Exclude<IndexerServerCashIncentivesWalletStatus, 'claimable'>;
637
+ }
638
+
639
+ /**
640
+ * Always present, tagged on `status`. Only the `claimable` variant carries proof data.
641
+ */
642
+ export type IndexerServerCashIncentivesWalletClaim =
643
+ | IndexerServerCashIncentivesClaimableClaim
644
+ | IndexerServerCashIncentivesUnclaimableClaim;
645
+
596
646
  export interface IndexerServerCashIncentivesEventWallet {
597
647
  // x18 string
598
648
  reward: string;
649
+ claim: IndexerServerCashIncentivesWalletClaim;
599
650
  }
600
651
 
601
652
  export interface IndexerServerCashIncentivesEvent {
@@ -1 +0,0 @@
1
- {"version":3,"file":"IndexerBaseClient-dpwAE5Om.cjs","names":["mapIndexerEvent","mapIndexerFundingRate","mapIndexerFundingRateHistory","mapIndexerPortfolio","mapIndexerPerpPrices","mapIndexerCandlesticks","mapIndexerServerProduct","mapIndexerEventWithTx","mapIndexerOrder","mapIndexerMatchEventBalances","mapIndexerProductPayment","mapSnapshotsIntervalToServerParams","mapIndexerMarketSnapshot","mapIndexerMakerStatistics","mapIndexerLeaderboardPosition","mapIndexerLeaderboardRegistration","mapIndexerLeaderboardContest","getValidatedHex","mapIndexerNlpSnapshot","mapIndexerV2Ticker","mapIndexerV2Symbols","WalletNotProvidedError","isIndexerServerFailureResponse","IndexerServerFailureError"],"sources":["../src/IndexerBaseClient.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationParams,\n EIP712LeaderboardAuthenticationValues,\n EIP712SocialAuthenticationParams,\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 toBigInt,\n toBigNumber,\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 mapIndexerFundingRateHistory,\n mapIndexerLeaderboardContest,\n mapIndexerLeaderboardPosition,\n mapIndexerLeaderboardRegistration,\n mapIndexerMakerStatistics,\n mapIndexerMarketSnapshot,\n mapIndexerMatchEventBalances,\n mapIndexerNlpSnapshot,\n mapIndexerOrder,\n mapIndexerPerpPrices,\n mapIndexerPortfolio,\n mapIndexerProductPayment,\n mapIndexerServerProduct,\n mapIndexerV2Symbols,\n mapIndexerV2Ticker,\n mapSnapshotsIntervalToServerParams,\n} from './dataMappers';\nimport {\n ConnectSocialAccountParams,\n ConnectSocialAccountResponse,\n GetIndexerBacklogResponse,\n GetIndexerCandlesticksParams,\n GetIndexerCandlesticksResponse,\n GetIndexerCashIncentivesParams,\n GetIndexerCashIncentivesResponse,\n GetIndexerEdgeCandlesticksParams,\n GetIndexerEdgeCandlesticksResponse,\n GetIndexerEdgeMarketSnapshotResponse,\n GetIndexerEdgeMarketSnapshotsParams,\n GetIndexerEventsParams,\n GetIndexerEventsResponse,\n GetIndexerFastWithdrawalSignatureParams,\n GetIndexerFastWithdrawalSignatureResponse,\n GetIndexerFundingRateHistoryParams,\n GetIndexerFundingRateHistoryResponse,\n GetIndexerFundingRateParams,\n GetIndexerFundingRateResponse,\n GetIndexerInterestFundingPaymentsParams,\n GetIndexerInterestFundingPaymentsResponse,\n GetIndexerLeaderboardContestsParams,\n GetIndexerLeaderboardContestsResponse,\n GetIndexerLeaderboardParams,\n GetIndexerLeaderboardParticipantParams,\n GetIndexerLeaderboardParticipantResponse,\n GetIndexerLeaderboardRegistrationsParams,\n GetIndexerLeaderboardRegistrationsResponse,\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 GetIndexerPointsParams,\n GetIndexerPointsResponse,\n GetIndexerPortfolioParams,\n GetIndexerPortfolioResponse,\n GetIndexerPrivateAlphaChoiceParams,\n GetIndexerPrivateAlphaChoiceResponse,\n GetIndexerProductSnapshotsParams,\n GetIndexerProductSnapshotsResponse,\n GetIndexerQuotePriceResponse,\n GetIndexerReferralCodeParams,\n GetIndexerReferralCodeResponse,\n GetIndexerSubaccountDDAParams,\n GetIndexerSubaccountDDAResponse,\n GetIndexerV2SymbolsParams,\n GetIndexerV2SymbolsResponse,\n GetIndexerV2TickersParams,\n GetIndexerV2TickersResponse,\n GetIndexerXPointsParams,\n GetIndexerXPointsResponse,\n IndexerEventWithTx,\n IndexerMatchEvent,\n IndexerOraclePrice,\n IndexerServerEventsParams,\n IndexerServerFailureError,\n IndexerServerQueryRequestByType,\n IndexerServerQueryRequestType,\n IndexerServerQueryResponseByType,\n IndexerServerV2SymbolsResponse,\n IndexerServerV2TickersResponse,\n IndexerSnapshotBalance,\n IndexerSubaccountSnapshot,\n isIndexerServerFailureResponse,\n ListIndexerSocialAccountsParams,\n ListIndexerSocialAccountsResponse,\n ListIndexerSubaccountsParams,\n ListIndexerSubaccountsResponse,\n RegisterLeaderboardParams,\n RegisterLeaderboardResponse,\n RevokeSocialAccountParams,\n RevokeSocialAccountResponse,\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 // Linked signer registered through the engine, if provided, execute requests will use this signer\n linkedSignerWalletClient?: 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 * Sets the linked signer for execute requests\n *\n * @param linkedSignerWalletClient The linkedSigner to use for all signatures. Set to null to revert to the chain signer\n */\n public setLinkedSigner(\n linkedSignerWalletClient: WalletClientWithAccount | null,\n ) {\n this.opts.linkedSignerWalletClient = linkedSignerWalletClient ?? undefined;\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: toBigNumber(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 a perp product's historical (realized hourly) funding rates,\n * ordered ascending by timestamp, where 1 = 100%.\n *\n * To paginate forward, pass the last entry's `timestamp + 1` as the next\n * request's `startTimeInclusive`.\n *\n * @param params\n */\n async getFundingRateHistory(\n params: GetIndexerFundingRateHistoryParams,\n ): Promise<GetIndexerFundingRateHistoryResponse> {\n const baseResponse = await this.query('funding_rate_history', {\n product_id: params.productId,\n start_time: params.startTimeInclusive,\n end_time: params.endTimeInclusive,\n limit: params.limit,\n });\n\n return baseResponse.funding_rates.map(mapIndexerFundingRateHistory);\n }\n\n /**\n * Retrieves a subaccount's account-value, PnL, traded-volume, average-trade-size,\n * and markets-traded history across all timeframes, keyed by period. The value\n * aggregates the cross-margin account plus every isolated child; the queried\n * subaccount must be cross-margin.\n *\n * Points are downsampled per timeframe, so the most recent point can be up to\n * ~20 minutes stale. For the exact live value, use the engine client's\n * `getSubaccountSummary` query instead.\n *\n * @param params\n */\n async getPortfolio(\n params: GetIndexerPortfolioParams,\n ): Promise<GetIndexerPortfolioResponse> {\n const baseResponse = await this.query('portfolio', {\n subaccount: subaccountToHex(params.subaccount),\n });\n\n return mapIndexerPortfolio(baseResponse);\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: toBigNumber(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: toBigNumber(matchEvent.fee),\n sequencerFee: toBigNumber(matchEvent.sequencer_fee),\n builderFee: toBigNumber(matchEvent.builder_fee),\n baseFilled: toBigNumber(matchEvent.base_filled),\n quoteFilled: toBigNumber(matchEvent.quote_filled),\n cumulativeFee: toBigNumber(matchEvent.cumulative_fee),\n cumulativeBaseFilled: toBigNumber(matchEvent.cumulative_base_filled),\n cumulativeQuoteFilled: toBigNumber(matchEvent.cumulative_quote_filled),\n digest: matchEvent.digest,\n order: matchEvent.order,\n submissionIndex: matchEvent.submission_idx,\n timestamp: toBigNumber(timestamp),\n preEventTrackedVars: {\n netEntryUnrealized: toBigNumber(matchEvent.net_entry_unrealized),\n netEntryCumulative: toBigNumber(matchEvent.net_entry_cumulative),\n },\n preBalances: mapIndexerMatchEventBalances(matchEvent.pre_balance),\n postBalances,\n tx,\n isTaker: matchEvent.is_taker,\n realizedPnl: toBigNumber(matchEvent.realized_pnl),\n closedAmount: toBigNumber(matchEvent.closed_amount),\n closedNetEntry: toBigNumber(matchEvent.closed_net_entry),\n margin: matchEvent.margin ? toBigNumber(matchEvent.margin) : null,\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: toBigNumber(baseResponse.total_tx_limit),\n remainingTxs: toBigNumber(baseResponse.remaining_tx),\n signer: baseResponse.signer,\n waitTimeUntilNextTx: toBigNumber(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: toBigNumber(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 order: params.order,\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 * Registers a subaccount for one or more contests. Requires EIP-712 signing.\n *\n * @param params - Registration parameters including contest IDs and signing config.\n */\n async registerLeaderboard(\n params: RegisterLeaderboardParams,\n ): Promise<RegisterLeaderboardResponse> {\n const signatureParams: EIP712LeaderboardAuthenticationParams = {\n expiration: toIntegerString(params.recvTime ?? getDefaultRecvTime()),\n subaccountName: params.subaccountName,\n subaccountOwner: params.subaccountOwner,\n contestIds: params.contestIds,\n };\n\n const tx = getNadoEIP712Values(\n 'leaderboard_authentication',\n signatureParams,\n );\n const signature = await this.sign(\n 'leaderboard_authentication',\n params.verifyingAddr,\n params.chainId,\n signatureParams,\n );\n\n const updateRegistrationTx: SignedTx<EIP712LeaderboardAuthenticationValues> =\n {\n tx,\n signature,\n };\n\n const baseResponse = await this.query('leaderboard_register', {\n update_registration: updateRegistrationTx,\n });\n\n return {\n registrations: baseResponse.registrations.map(\n mapIndexerLeaderboardRegistration,\n ),\n };\n }\n\n /**\n * Retrieves contest registrations for a subaccount. Supports batch lookup\n * across multiple contests with an optional active filter.\n *\n * @param params - Query parameters including subaccount and contest IDs.\n */\n async getLeaderboardRegistrations(\n params: GetIndexerLeaderboardRegistrationsParams,\n ): Promise<GetIndexerLeaderboardRegistrationsResponse> {\n const baseResponse = await this.query('leaderboard_registrations', {\n subaccount: subaccountToHex(params.subaccount),\n contest_ids: params.contestIds,\n active: params.active,\n });\n\n return {\n registrations: baseResponse.registrations.map(\n mapIndexerLeaderboardRegistration,\n ),\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 active: params.active,\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 txV2: baseResponse.tx_v2,\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: toBigNumber(baseResponse.total_txs),\n totalSubmissions: toBigNumber(baseResponse.total_submissions),\n backlogSize: toBigNumber(baseResponse.backlog_size),\n updatedAt: toBigNumber(baseResponse.updated_at),\n backlogEtaInSeconds: baseResponse.backlog_eta_in_seconds\n ? toBigNumber(baseResponse.backlog_eta_in_seconds)\n : null,\n txsPerSecond: baseResponse.txs_per_second\n ? toBigNumber(baseResponse.txs_per_second)\n : null,\n };\n }\n\n /**\n * Retrieves private alpha choice information for a given address\n * @param params\n */\n async getPrivateAlphaChoice(\n params: GetIndexerPrivateAlphaChoiceParams,\n ): Promise<GetIndexerPrivateAlphaChoiceResponse> {\n const baseResponse = await this.query('private_alpha_choice', {\n address: params.address,\n });\n\n return {\n points: toBigNumber(baseResponse.points),\n feeRefund: toBigNumber(baseResponse.fee_refund),\n nftEligibility: baseResponse.nft_eligibility,\n };\n }\n\n /**\n * Retrieves points information for a given address, including points per epoch and all-time points\n * @param params\n */\n async getPoints(\n params: GetIndexerPointsParams,\n ): Promise<GetIndexerPointsResponse> {\n const baseResponse = await this.query('nado_points', {\n address: params.address,\n });\n\n return {\n pointsPerEpoch: baseResponse.points_per_epoch.map((epoch) => ({\n epoch: epoch.epoch,\n description: epoch.description,\n startTime: toBigNumber(epoch.start_time),\n endTime: toBigNumber(epoch.end_time),\n totalPoints: toBigNumber(epoch.total_points),\n points: toBigNumber(epoch.points),\n rank: epoch.rank,\n tier: epoch.tier,\n })),\n allTimePoints: {\n points: toBigNumber(baseResponse.all_time_points.points),\n rank: baseResponse.all_time_points.rank,\n tier: baseResponse.all_time_points.tier,\n },\n };\n }\n\n /**\n * Retrieves xPoints information (Nado x xStocks points program) for a given address,\n * including per-epoch points, all-time points, and per-quest breakdowns.\n * @param params\n */\n async getXPoints(\n params: GetIndexerXPointsParams,\n ): Promise<GetIndexerXPointsResponse> {\n const baseResponse = await this.query('nado_xpoints', {\n address: params.address,\n });\n\n const mapQuests = (\n quests: typeof baseResponse.all_time_points.quests,\n ): GetIndexerXPointsResponse['allTimePoints']['quests'] =>\n quests.map((quest) => ({\n questType: quest.quest_type,\n points: toBigNumber(quest.points),\n }));\n\n return {\n pointsPerEpoch: baseResponse.points_per_epoch.map((epoch) => ({\n epoch: epoch.epoch,\n description: epoch.description,\n startTime: toBigNumber(epoch.start_time),\n endTime: toBigNumber(epoch.end_time),\n totalPoints: toBigNumber(epoch.total_points),\n rank: epoch.rank,\n quests: mapQuests(epoch.quests),\n })),\n allTimePoints: {\n totalPoints: toBigNumber(baseResponse.all_time_points.total_points),\n rank: baseResponse.all_time_points.rank,\n quests: mapQuests(baseResponse.all_time_points.quests),\n },\n };\n }\n\n /**\n * Retrieves cash incentives information (platform volume and unlocked rewards) for a given wallet address.\n * If no `eventId` is provided, the latest event is returned.\n * @param params\n */\n async getCashIncentives(\n params: GetIndexerCashIncentivesParams,\n ): Promise<GetIndexerCashIncentivesResponse> {\n const baseResponse = await this.query('cash_incentives', {\n wallet_address: params.address,\n });\n\n return {\n events: baseResponse.events.map((event) => ({\n metadata: {\n eventId: event.metadata.event_id,\n description: event.metadata.description,\n epochStart: toBigNumber(event.metadata.epoch_start),\n epochEnd: toBigNumber(event.metadata.epoch_end),\n maxVolume: removeDecimals(event.metadata.max_volume),\n maxReward: removeDecimals(event.metadata.max_reward),\n minVolume: removeDecimals(event.metadata.min_volume),\n minReward: removeDecimals(event.metadata.min_reward),\n },\n platform: {\n platformVolume: removeDecimals(event.platform.platform_volume),\n unlockedReward: removeDecimals(event.platform.unlocked_reward),\n },\n wallet: {\n reward: removeDecimals(event.wallet.reward),\n },\n })),\n walletSummary: {\n totalReward: removeDecimals(baseResponse.wallet_summary.total_reward),\n claimableReward: removeDecimals(\n baseResponse.wallet_summary.claimable_reward,\n ),\n },\n };\n }\n\n /**\n * Initiates a social account connection flow. Returns a URL the user must visit to complete the OAuth flow.\n * Requires EIP-712 signing.\n *\n * @param params - Connection parameters including provider and signing config.\n */\n async connectSocialAccount(\n params: ConnectSocialAccountParams,\n ): Promise<ConnectSocialAccountResponse> {\n const signatureParams: EIP712SocialAuthenticationParams = {\n expiration: toIntegerString(params.recvTime ?? getDefaultRecvTime()),\n subaccountName: params.subaccountName,\n subaccountOwner: params.subaccountOwner,\n provider: params.provider,\n };\n\n const tx = getNadoEIP712Values('social_authentication', signatureParams);\n const signature = await this.sign(\n 'social_authentication',\n params.verifyingAddr,\n params.chainId,\n signatureParams,\n );\n\n const baseResponse = await this.query('social_connect', {\n update_social_account: { tx, signature },\n });\n\n return { url: baseResponse.url };\n }\n\n /**\n * Lists linked social accounts for a given address.\n *\n * @param params - Query parameters including the wallet address.\n */\n async listSocialAccounts(\n params: ListIndexerSocialAccountsParams,\n ): Promise<ListIndexerSocialAccountsResponse> {\n const baseResponse = await this.query('list_social_accounts', {\n address: params.address,\n });\n\n return {\n accounts: baseResponse.accounts.map((a) => ({\n provider: a.provider,\n username: a.username,\n displayName: a.display_name,\n profileImageUrl: a.profile_image_url,\n })),\n };\n }\n\n /**\n * Revokes a linked social account. Requires EIP-712 signing.\n *\n * @param params - Revocation parameters including provider and signing config.\n */\n async revokeSocialAccount(\n params: RevokeSocialAccountParams,\n ): Promise<RevokeSocialAccountResponse> {\n const signatureParams: EIP712SocialAuthenticationParams = {\n expiration: toIntegerString(params.recvTime ?? getDefaultRecvTime()),\n subaccountName: params.subaccountName,\n subaccountOwner: params.subaccountOwner,\n provider: params.provider,\n };\n\n const tx = getNadoEIP712Values('social_authentication', signatureParams);\n const signature = await this.sign(\n 'social_authentication',\n params.verifyingAddr,\n params.chainId,\n signatureParams,\n );\n\n const baseResponse = await this.query('revoke_social_account', {\n update_social_account: { tx, signature },\n });\n\n return {\n accounts: baseResponse.accounts.map((a) => ({\n provider: a.provider,\n username: a.username,\n displayName: a.display_name,\n profileImageUrl: a.profile_image_url,\n })),\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 /**\n * Get symbols with market hours from the v2 indexer endpoint\n * @param params\n */\n async getV2Symbols(\n params?: GetIndexerV2SymbolsParams,\n ): Promise<GetIndexerV2SymbolsResponse> {\n const response =\n await this.axiosInstance.get<IndexerServerV2SymbolsResponse>(\n `${this.v2Url}/symbols`,\n {\n params: {\n product_type: params?.productType,\n product_ids: params?.productIds,\n },\n },\n );\n\n this.checkResponseStatus(response);\n\n return mapValues(response.data, mapIndexerV2Symbols);\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 =\n this.opts.linkedSignerWalletClient ?? 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 (isIndexerServerFailureResponse(response.data)) {\n throw new IndexerServerFailureError(response.data, response.status);\n }\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6JA,IAAa,oBAAb,MAA+B;CAK7B,YAAY,MAAyB;EACnC,KAAK,OAAO;EACZ,KAAK,gBAAgB,MAAA,QAAM,OAAO;GAChC,iBAAiB;GAEjB,sBAAsB;EACxB,CAAC;EACD,KAAK,QAAQ,KAAK,QAAQ,KAAK,QAAQ,KAAK,IAAI,QAAQ,MAAM,IAAI;CACpE;;;;;;CAOA,gBACE,0BACA;EACA,KAAK,KAAK,2BAA2B,4BAA4B,KAAA;CACnE;;;;;;CAOA,MAAM,gBACJ,QACyC;EAGzC,QAAO,MAFoB,KAAK,MAAM,eAAe,MAAM,GAEvC,YAAY,KAAK,SAAS;GAC5C,MAAM,cAAA,GAAA,eAAA,mBAA+B,KAAK,UAAU;GACpD,OAAO;IACL,OAAO,KAAK;IACZ,WAAW,OAAO,KAAK,UAAU;IACjC,UAAU,KAAK;IACf,GAAG;GACL;EACF,CAAC;CACH;;;;;;;CAQA,MAAM,4BACJ,QAC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