@nadohq/indexer-client 0.1.0-alpha.1

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 (121) hide show
  1. package/README.md +2 -0
  2. package/dist/IndexerBaseClient.cjs +608 -0
  3. package/dist/IndexerBaseClient.cjs.map +1 -0
  4. package/dist/IndexerBaseClient.d.cts +183 -0
  5. package/dist/IndexerBaseClient.d.ts +183 -0
  6. package/dist/IndexerBaseClient.js +605 -0
  7. package/dist/IndexerBaseClient.js.map +1 -0
  8. package/dist/IndexerClient.cjs +368 -0
  9. package/dist/IndexerClient.cjs.map +1 -0
  10. package/dist/IndexerClient.d.cts +50 -0
  11. package/dist/IndexerClient.d.ts +50 -0
  12. package/dist/IndexerClient.js +348 -0
  13. package/dist/IndexerClient.js.map +1 -0
  14. package/dist/dataMappers.cjs +324 -0
  15. package/dist/dataMappers.cjs.map +1 -0
  16. package/dist/dataMappers.d.cts +31 -0
  17. package/dist/dataMappers.d.ts +31 -0
  18. package/dist/dataMappers.js +296 -0
  19. package/dist/dataMappers.js.map +1 -0
  20. package/dist/endpoints.cjs +35 -0
  21. package/dist/endpoints.cjs.map +1 -0
  22. package/dist/endpoints.d.cts +5 -0
  23. package/dist/endpoints.d.ts +5 -0
  24. package/dist/endpoints.js +10 -0
  25. package/dist/endpoints.js.map +1 -0
  26. package/dist/index.cjs +31 -0
  27. package/dist/index.cjs.map +1 -0
  28. package/dist/index.d.cts +18 -0
  29. package/dist/index.d.ts +18 -0
  30. package/dist/index.js +6 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/types/CandlestickPeriod.cjs +42 -0
  33. package/dist/types/CandlestickPeriod.cjs.map +1 -0
  34. package/dist/types/CandlestickPeriod.d.cts +13 -0
  35. package/dist/types/CandlestickPeriod.d.ts +13 -0
  36. package/dist/types/CandlestickPeriod.js +17 -0
  37. package/dist/types/CandlestickPeriod.js.map +1 -0
  38. package/dist/types/IndexerEventType.cjs +19 -0
  39. package/dist/types/IndexerEventType.cjs.map +1 -0
  40. package/dist/types/IndexerEventType.d.cts +3 -0
  41. package/dist/types/IndexerEventType.d.ts +3 -0
  42. package/dist/types/IndexerEventType.js +1 -0
  43. package/dist/types/IndexerEventType.js.map +1 -0
  44. package/dist/types/IndexerLeaderboardType.cjs +19 -0
  45. package/dist/types/IndexerLeaderboardType.cjs.map +1 -0
  46. package/dist/types/IndexerLeaderboardType.d.cts +3 -0
  47. package/dist/types/IndexerLeaderboardType.d.ts +3 -0
  48. package/dist/types/IndexerLeaderboardType.js +1 -0
  49. package/dist/types/IndexerLeaderboardType.js.map +1 -0
  50. package/dist/types/NadoTx.cjs +19 -0
  51. package/dist/types/NadoTx.cjs.map +1 -0
  52. package/dist/types/NadoTx.d.cts +49 -0
  53. package/dist/types/NadoTx.d.ts +49 -0
  54. package/dist/types/NadoTx.js +1 -0
  55. package/dist/types/NadoTx.js.map +1 -0
  56. package/dist/types/clientTypes.cjs +19 -0
  57. package/dist/types/clientTypes.cjs.map +1 -0
  58. package/dist/types/clientTypes.d.cts +467 -0
  59. package/dist/types/clientTypes.d.ts +467 -0
  60. package/dist/types/clientTypes.js +1 -0
  61. package/dist/types/clientTypes.js.map +1 -0
  62. package/dist/types/collateralEventType.cjs +19 -0
  63. package/dist/types/collateralEventType.cjs.map +1 -0
  64. package/dist/types/collateralEventType.d.cts +3 -0
  65. package/dist/types/collateralEventType.d.ts +3 -0
  66. package/dist/types/collateralEventType.js +1 -0
  67. package/dist/types/collateralEventType.js.map +1 -0
  68. package/dist/types/index.cjs +41 -0
  69. package/dist/types/index.cjs.map +1 -0
  70. package/dist/types/index.d.cts +13 -0
  71. package/dist/types/index.d.ts +13 -0
  72. package/dist/types/index.js +11 -0
  73. package/dist/types/index.js.map +1 -0
  74. package/dist/types/paginatedEventsTypes.cjs +19 -0
  75. package/dist/types/paginatedEventsTypes.cjs.map +1 -0
  76. package/dist/types/paginatedEventsTypes.d.cts +115 -0
  77. package/dist/types/paginatedEventsTypes.d.ts +115 -0
  78. package/dist/types/paginatedEventsTypes.js +1 -0
  79. package/dist/types/paginatedEventsTypes.js.map +1 -0
  80. package/dist/types/serverModelTypes.cjs +19 -0
  81. package/dist/types/serverModelTypes.cjs.map +1 -0
  82. package/dist/types/serverModelTypes.d.cts +224 -0
  83. package/dist/types/serverModelTypes.d.ts +224 -0
  84. package/dist/types/serverModelTypes.js +1 -0
  85. package/dist/types/serverModelTypes.js.map +1 -0
  86. package/dist/types/serverTypes.cjs +19 -0
  87. package/dist/types/serverTypes.cjs.map +1 -0
  88. package/dist/types/serverTypes.d.cts +304 -0
  89. package/dist/types/serverTypes.d.ts +304 -0
  90. package/dist/types/serverTypes.js +1 -0
  91. package/dist/types/serverTypes.js.map +1 -0
  92. package/dist/utils/index.cjs +25 -0
  93. package/dist/utils/index.cjs.map +1 -0
  94. package/dist/utils/index.d.cts +12 -0
  95. package/dist/utils/index.d.ts +12 -0
  96. package/dist/utils/index.js +3 -0
  97. package/dist/utils/index.js.map +1 -0
  98. package/dist/utils/indexerBalanceValue.cjs +43 -0
  99. package/dist/utils/indexerBalanceValue.cjs.map +1 -0
  100. package/dist/utils/indexerBalanceValue.d.cts +39 -0
  101. package/dist/utils/indexerBalanceValue.d.ts +39 -0
  102. package/dist/utils/indexerBalanceValue.js +16 -0
  103. package/dist/utils/indexerBalanceValue.js.map +1 -0
  104. package/package.json +53 -0
  105. package/src/IndexerBaseClient.ts +851 -0
  106. package/src/IndexerClient.ts +468 -0
  107. package/src/dataMappers.ts +362 -0
  108. package/src/endpoints.ts +7 -0
  109. package/src/index.ts +4 -0
  110. package/src/types/CandlestickPeriod.ts +11 -0
  111. package/src/types/IndexerEventType.ts +9 -0
  112. package/src/types/IndexerLeaderboardType.ts +2 -0
  113. package/src/types/NadoTx.ts +63 -0
  114. package/src/types/clientTypes.ts +679 -0
  115. package/src/types/collateralEventType.ts +4 -0
  116. package/src/types/index.ts +9 -0
  117. package/src/types/paginatedEventsTypes.ts +194 -0
  118. package/src/types/serverModelTypes.ts +271 -0
  119. package/src/types/serverTypes.ts +427 -0
  120. package/src/utils/index.ts +1 -0
  121. package/src/utils/indexerBalanceValue.ts +46 -0
@@ -0,0 +1,224 @@
1
+ import { EIP712OrderValues } from '@nadohq/contracts';
2
+ import { EngineServerSpotBalance, EngineServerPerpBalance, EngineServerSpotProduct, EngineServerPerpProduct } from '@nadohq/engine-client';
3
+ import { IndexerEventType } from './IndexerEventType.js';
4
+ import { NadoTx } from './NadoTx.js';
5
+
6
+ interface IndexerServerSnapshotsInterval {
7
+ count: number;
8
+ granularity: number;
9
+ max_time?: string;
10
+ }
11
+ type IndexerServerProduct = {
12
+ spot: EngineServerSpotProduct;
13
+ } | {
14
+ perp: EngineServerPerpProduct;
15
+ };
16
+ type IndexerServerBalance = {
17
+ spot: EngineServerSpotBalance;
18
+ } | {
19
+ perp: EngineServerPerpBalance;
20
+ };
21
+ /**
22
+ * Candlesticks
23
+ */
24
+ interface IndexerServerCandlestick {
25
+ product_id: number;
26
+ granularity: string;
27
+ submission_idx: string;
28
+ timestamp: string;
29
+ open_x18: string;
30
+ high_x18: string;
31
+ low_x18: string;
32
+ close_x18: string;
33
+ volume: string;
34
+ }
35
+ /**
36
+ * Product snapshots
37
+ */
38
+ interface IndexerServerProductSnapshot {
39
+ product_id: number;
40
+ submission_idx: string;
41
+ product: IndexerServerProduct;
42
+ }
43
+ /**
44
+ * Base Events
45
+ */
46
+ interface IndexerServerEvent {
47
+ subaccount: string;
48
+ isolated: boolean;
49
+ isolated_product_id: number | null;
50
+ product_id: number;
51
+ submission_idx: string;
52
+ event_type: IndexerEventType;
53
+ pre_balance: IndexerServerBalance;
54
+ post_balance: IndexerServerBalance;
55
+ product: IndexerServerProduct;
56
+ net_interest_unrealized: string;
57
+ net_interest_cumulative: string;
58
+ net_funding_unrealized: string;
59
+ net_funding_cumulative: string;
60
+ net_entry_unrealized: string;
61
+ net_entry_cumulative: string;
62
+ }
63
+ interface IndexerServerTx {
64
+ submission_idx: string;
65
+ timestamp: string;
66
+ tx: NadoTx;
67
+ }
68
+ /**
69
+ * Orders
70
+ */
71
+ interface IndexerServerOrder {
72
+ digest: string;
73
+ isolated: boolean;
74
+ subaccount: string;
75
+ product_id: number;
76
+ submission_idx: string;
77
+ amount: string;
78
+ price_x18: string;
79
+ expiration: string;
80
+ nonce: string;
81
+ base_filled: string;
82
+ quote_filled: string;
83
+ fee: string;
84
+ }
85
+ /**
86
+ * Match events
87
+ */
88
+ interface IndexerServerMatchEvent {
89
+ digest: string;
90
+ isolated: boolean;
91
+ order: EIP712OrderValues;
92
+ base_filled: string;
93
+ quote_filled: string;
94
+ fee: string;
95
+ sequencer_fee: string;
96
+ cumulative_fee: string;
97
+ cumulative_base_filled: string;
98
+ cumulative_quote_filled: string;
99
+ submission_idx: string;
100
+ net_entry_unrealized: string;
101
+ net_entry_cumulative: string;
102
+ pre_balance: IndexerServerMatchEventBalances;
103
+ post_balance: IndexerServerMatchEventBalances;
104
+ }
105
+ interface IndexerServerMatchEventBalances {
106
+ base: IndexerServerBalance;
107
+ quote?: IndexerServerBalance;
108
+ }
109
+ /**
110
+ * Oracle price
111
+ */
112
+ interface IndexerServerOraclePrice {
113
+ product_id: number;
114
+ oracle_price_x18: string;
115
+ update_time: number;
116
+ }
117
+ /**
118
+ * Market snapshots
119
+ */
120
+ interface IndexerServerMarketSnapshotInterval {
121
+ count: number;
122
+ granularity: number;
123
+ max_time?: string;
124
+ }
125
+ interface IndexerServerMarketSnapshot {
126
+ timestamp: string;
127
+ cumulative_users: string;
128
+ daily_active_users: string;
129
+ tvl: string;
130
+ cumulative_volumes: Record<string, string>;
131
+ cumulative_taker_fees: Record<string, string>;
132
+ cumulative_sequencer_fees: Record<string, string>;
133
+ cumulative_maker_fees: Record<string, string>;
134
+ cumulative_trades: Record<string, string>;
135
+ cumulative_liquidation_amounts: Record<string, string>;
136
+ open_interests: Record<string, string>;
137
+ total_deposits: Record<string, string>;
138
+ total_borrows: Record<string, string>;
139
+ funding_rates: Record<string, string>;
140
+ deposit_rates: Record<string, string>;
141
+ borrow_rates: Record<string, string>;
142
+ cumulative_trade_sizes: Record<string, string>;
143
+ cumulative_inflows: Record<string, string>;
144
+ cumulative_outflows: Record<string, string>;
145
+ oracle_prices: Record<string, string>;
146
+ }
147
+ /**
148
+ * Interest / funding
149
+ */
150
+ interface IndexerServerProductPayment {
151
+ product_id: number;
152
+ idx: string;
153
+ timestamp: string;
154
+ amount: string;
155
+ balance_amount: string;
156
+ rate_x18: string;
157
+ oracle_price_x18: string;
158
+ isolated: boolean;
159
+ isolated_product_id: number | null;
160
+ }
161
+ /**
162
+ * Maker stats
163
+ */
164
+ interface IndexerServerMakerData {
165
+ timestamp: string;
166
+ maker_fee: string;
167
+ uptime: string;
168
+ sum_q_min: string;
169
+ q_score: string;
170
+ maker_share: string;
171
+ expected_maker_reward: string;
172
+ }
173
+ interface IndexerServerMaker {
174
+ address: string;
175
+ data: IndexerServerMakerData[];
176
+ }
177
+ /**
178
+ * Leaderboard
179
+ */
180
+ interface IndexerServerLeaderboardPosition {
181
+ subaccount: string;
182
+ contest_id: number;
183
+ pnl: string;
184
+ pnl_rank: string;
185
+ roi: string;
186
+ roi_rank: string;
187
+ account_value: string;
188
+ volume?: string;
189
+ update_time: string;
190
+ }
191
+ interface IndexerServerLeaderboardContest {
192
+ contest_id: number;
193
+ start_time: string;
194
+ end_time: string;
195
+ timeframe: string;
196
+ count: string;
197
+ threshold: string;
198
+ volume_threshold: string;
199
+ product_ids: number[];
200
+ last_updated: string;
201
+ active: boolean;
202
+ }
203
+ interface IndexerServerLeaderboardRegistration {
204
+ subaccount: string;
205
+ contest_id: number;
206
+ update_time: string;
207
+ }
208
+ /**
209
+ * VLP
210
+ */
211
+ interface IndexerServerVlpSnapshot {
212
+ cumulative_burn_usdc: string;
213
+ cumulative_mint_usdc: string;
214
+ cumulative_pnl: string;
215
+ cumulative_trades: string;
216
+ cumulative_volume: string;
217
+ depositors: string;
218
+ oracle_price_x18: string;
219
+ submission_idx: string;
220
+ timestamp: string;
221
+ tvl: string;
222
+ }
223
+
224
+ export type { IndexerServerBalance, IndexerServerCandlestick, IndexerServerEvent, IndexerServerLeaderboardContest, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerMaker, IndexerServerMakerData, IndexerServerMarketSnapshot, IndexerServerMarketSnapshotInterval, IndexerServerMatchEvent, IndexerServerMatchEventBalances, IndexerServerOraclePrice, IndexerServerOrder, IndexerServerProduct, IndexerServerProductPayment, IndexerServerProductSnapshot, IndexerServerSnapshotsInterval, IndexerServerTx, IndexerServerVlpSnapshot };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=serverModelTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/serverTypes.ts
17
+ var serverTypes_exports = {};
18
+ module.exports = __toCommonJS(serverTypes_exports);
19
+ //# sourceMappingURL=serverTypes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/serverTypes.ts"],"sourcesContent":["import {\n EIP712LeaderboardAuthenticationValues,\n SignedTx,\n} from '@nadohq/contracts';\nimport { IndexerEventType } from './IndexerEventType';\nimport { IndexerLeaderboardRankType } from './IndexerLeaderboardType';\nimport { NadoWithdrawCollateralTx } from './NadoTx';\nimport {\n IndexerServerCandlestick,\n IndexerServerEvent,\n IndexerServerLeaderboardContest,\n IndexerServerLeaderboardPosition,\n IndexerServerLeaderboardRegistration,\n IndexerServerMaker,\n IndexerServerMarketSnapshot,\n IndexerServerMarketSnapshotInterval,\n IndexerServerMatchEvent,\n IndexerServerOraclePrice,\n IndexerServerOrder,\n IndexerServerProductPayment,\n IndexerServerProductSnapshot,\n IndexerServerSnapshotsInterval,\n IndexerServerTx,\n IndexerServerVlpSnapshot,\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 IndexerServerPriceParams {\n product_id: number;\n}\n\nexport interface IndexerServerPerpPricesParams {\n product_ids: number[];\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 subaccount?: 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 interface IndexerServerOrdersParams {\n subaccount?: string;\n product_ids?: number[];\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 subaccount?: 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}\n\nexport interface IndexerServerLeaderboardRankParams {\n subaccount: string;\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardContestsParams {\n contest_ids: number[];\n}\n\nexport interface IndexerServerLeaderboardRegistrationParams {\n subaccount: string;\n contest_id: number;\n update_registration: SignedTx<EIP712LeaderboardAuthenticationValues> | null;\n}\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 IndexerServerVlpSnapshotsParams {\n interval: IndexerServerSnapshotsInterval;\n}\n\n// Request\nexport interface IndexerServerQueryRequestByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;\n backlog: Record<string, never>;\n candlesticks: IndexerServerCandlesticksParams;\n edge_candlesticks: IndexerEdgeServerCandlesticksParams;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;\n events: IndexerServerEventsParams;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;\n funding_rate: IndexerServerFundingRateParams;\n funding_rates: IndexerServerFundingRatesParams;\n interest_and_funding: IndexerServerInterestFundingParams;\n leaderboard: IndexerServerLeaderboardParams;\n leaderboard_contests: IndexerServerLeaderboardContestsParams;\n leaderboard_rank: IndexerServerLeaderboardRankParams;\n leaderboard_registration: IndexerServerLeaderboardRegistrationParams;\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 price: IndexerServerPriceParams;\n product_snapshots: IndexerServerMultiProductsParams;\n products: IndexerServerProductsParams;\n referral_code: IndexerServerReferralCodeParams;\n subaccounts: IndexerServerListSubaccountsParams;\n usdc_price: Record<string, never>;\n vlp_snapshots: IndexerServerVlpSnapshotsParams;\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 }[];\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 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 IndexerServerUsdcPriceResponse {\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 IndexerServerLeaderboardRegistrationResponse {\n // For non-tiered contests, null if the user is not registered for the provided contestId.\n // For tiered contests (i.e., related contests), null if the user is not registered for any of the contests in the tier group.\n registration: IndexerServerLeaderboardRegistration | null;\n}\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 tx_bytes: string;\n signatures: string[];\n}\n\nexport interface IndexerServerVlpSnapshotsResponse {\n snapshots: IndexerServerVlpSnapshot[];\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\n// Response\nexport interface IndexerServerQueryResponseByType {\n account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;\n backlog: IndexerServerBacklogResponse;\n candlesticks: IndexerServerCandlesticksResponse;\n edge_candlesticks: IndexerEdgeServerCandlesticksResponse;\n edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;\n events: IndexerServerEventsResponse;\n fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;\n funding_rate: IndexerServerFundingRateResponse;\n funding_rates: IndexerServerFundingRatesResponse;\n interest_and_funding: IndexerServerInterestFundingResponse;\n leaderboard: IndexerServerLeaderboardResponse;\n leaderboard_contests: IndexerServerLeaderboardContestsResponse;\n leaderboard_rank: IndexerServerLeaderboardRankResponse;\n leaderboard_registration: IndexerServerLeaderboardRegistrationResponse;\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 price: IndexerServerPriceResponse;\n product_snapshots: IndexerServerMultiProductsResponse;\n products: IndexerServerProductsResponse;\n referral_code: IndexerServerReferralCodeResponse;\n subaccounts: IndexerServerListSubaccountsResponse;\n usdc_price: IndexerServerUsdcPriceResponse;\n vlp_snapshots: IndexerServerVlpSnapshotsResponse;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,304 @@
1
+ import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/contracts';
2
+ import { IndexerEventType } from './IndexerEventType.cjs';
3
+ import { IndexerLeaderboardRankType } from './IndexerLeaderboardType.cjs';
4
+ import { NadoWithdrawCollateralTx } from './NadoTx.cjs';
5
+ import { IndexerServerMarketSnapshotInterval, IndexerServerSnapshotsInterval, IndexerServerEvent, IndexerServerCandlestick, IndexerServerMarketSnapshot, IndexerServerTx, IndexerServerProductPayment, IndexerServerLeaderboardPosition, IndexerServerLeaderboardContest, IndexerServerLeaderboardRegistration, IndexerServerMaker, IndexerServerMatchEvent, IndexerServerOraclePrice, IndexerServerOrder, IndexerServerProductSnapshot, IndexerServerVlpSnapshot } from './serverModelTypes.cjs';
6
+ import '@nadohq/engine-client';
7
+
8
+ /**
9
+ * Params
10
+ */
11
+ interface IndexerServerListSubaccountsParams {
12
+ start?: number;
13
+ limit?: number;
14
+ address?: string;
15
+ }
16
+ interface IndexerServerMultiSubaccountSnapshotsParams {
17
+ subaccounts: string[];
18
+ timestamps: number[];
19
+ isolated?: boolean;
20
+ }
21
+ interface IndexerServerReferralCodeParams {
22
+ subaccount: string;
23
+ }
24
+ interface IndexerServerFundingRateParams {
25
+ product_id: number;
26
+ }
27
+ interface IndexerServerFundingRatesParams {
28
+ product_ids: number[];
29
+ }
30
+ interface IndexerServerPriceParams {
31
+ product_id: number;
32
+ }
33
+ interface IndexerServerPerpPricesParams {
34
+ product_ids: number[];
35
+ }
36
+ interface IndexerServerOraclePricesParams {
37
+ product_ids: number[];
38
+ }
39
+ interface IndexerServerCandlesticksParams {
40
+ product_id: number;
41
+ granularity: number;
42
+ max_time?: number;
43
+ limit: number;
44
+ }
45
+ type IndexerEdgeServerCandlesticksParams = IndexerServerCandlesticksParams;
46
+ interface IndexerServerProductsParams {
47
+ product_id: number;
48
+ max_time?: number;
49
+ limit: number;
50
+ idx?: string;
51
+ }
52
+ interface IndexerServerMultiProductsParams {
53
+ product_ids: number[];
54
+ max_time: number[];
55
+ }
56
+ interface IndexerServerEventsParams {
57
+ subaccount?: string;
58
+ product_ids?: number[];
59
+ isolated?: boolean;
60
+ event_types?: IndexerEventType[];
61
+ desc?: boolean;
62
+ idx?: string;
63
+ max_time?: number;
64
+ limit?: {
65
+ raw: number;
66
+ } | {
67
+ txs: number;
68
+ };
69
+ }
70
+ interface IndexerServerOrdersParams {
71
+ subaccount?: string;
72
+ product_ids?: number[];
73
+ digests?: string[];
74
+ max_time?: number;
75
+ limit?: number;
76
+ isolated?: boolean;
77
+ idx?: string;
78
+ }
79
+ interface IndexerServerMatchEventsParams {
80
+ subaccount?: string;
81
+ product_ids?: number[];
82
+ isolated?: boolean;
83
+ max_time?: number;
84
+ limit: number;
85
+ idx?: string;
86
+ }
87
+ interface IndexerServerLinkedSignerParams {
88
+ subaccount: string;
89
+ }
90
+ interface IndexerServerMarketSnapshotsParams {
91
+ interval: IndexerServerMarketSnapshotInterval;
92
+ product_ids?: number[];
93
+ }
94
+ interface IndexerEdgeServerMarketSnapshotsParams {
95
+ interval: IndexerServerMarketSnapshotInterval;
96
+ }
97
+ interface IndexerServerInterestFundingParams {
98
+ subaccount: string;
99
+ product_ids: number[];
100
+ max_idx?: string;
101
+ max_time?: number;
102
+ limit: number;
103
+ }
104
+ interface IndexerServerMakerStatisticsParams {
105
+ product_id: number;
106
+ epoch: number;
107
+ interval: number;
108
+ }
109
+ interface IndexerServerLeaderboardParams {
110
+ contest_id: number;
111
+ rank_type: IndexerLeaderboardRankType;
112
+ start?: number | string;
113
+ limit?: number | string;
114
+ }
115
+ interface IndexerServerLeaderboardRankParams {
116
+ subaccount: string;
117
+ contest_ids: number[];
118
+ }
119
+ interface IndexerServerLeaderboardContestsParams {
120
+ contest_ids: number[];
121
+ }
122
+ interface IndexerServerLeaderboardRegistrationParams {
123
+ subaccount: string;
124
+ contest_id: number;
125
+ update_registration: SignedTx<EIP712LeaderboardAuthenticationValues> | null;
126
+ }
127
+ interface IndexerServerFastWithdrawalSignatureParams {
128
+ /**
129
+ * The submission index of the WithdrawCollateral tx to be used for fast withdraw.
130
+ */
131
+ idx: number | string;
132
+ }
133
+ interface IndexerServerVlpSnapshotsParams {
134
+ interval: IndexerServerSnapshotsInterval;
135
+ }
136
+ interface IndexerServerQueryRequestByType {
137
+ account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;
138
+ backlog: Record<string, never>;
139
+ candlesticks: IndexerServerCandlesticksParams;
140
+ edge_candlesticks: IndexerEdgeServerCandlesticksParams;
141
+ edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;
142
+ events: IndexerServerEventsParams;
143
+ fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureParams;
144
+ funding_rate: IndexerServerFundingRateParams;
145
+ funding_rates: IndexerServerFundingRatesParams;
146
+ interest_and_funding: IndexerServerInterestFundingParams;
147
+ leaderboard: IndexerServerLeaderboardParams;
148
+ leaderboard_contests: IndexerServerLeaderboardContestsParams;
149
+ leaderboard_rank: IndexerServerLeaderboardRankParams;
150
+ leaderboard_registration: IndexerServerLeaderboardRegistrationParams;
151
+ linked_signer_rate_limit: IndexerServerLinkedSignerParams;
152
+ maker_statistics: IndexerServerMakerStatisticsParams;
153
+ market_snapshots: IndexerServerMarketSnapshotsParams;
154
+ matches: IndexerServerMatchEventsParams;
155
+ oracle_price: IndexerServerOraclePricesParams;
156
+ orders: IndexerServerOrdersParams;
157
+ perp_prices: IndexerServerPerpPricesParams;
158
+ price: IndexerServerPriceParams;
159
+ product_snapshots: IndexerServerMultiProductsParams;
160
+ products: IndexerServerProductsParams;
161
+ referral_code: IndexerServerReferralCodeParams;
162
+ subaccounts: IndexerServerListSubaccountsParams;
163
+ usdc_price: Record<string, never>;
164
+ vlp_snapshots: IndexerServerVlpSnapshotsParams;
165
+ }
166
+ type IndexerServerQueryRequestType = keyof IndexerServerQueryRequestByType;
167
+ /**
168
+ * Responses
169
+ */
170
+ interface IndexerServerListSubaccountsResponse {
171
+ subaccounts: {
172
+ id: string;
173
+ subaccount: string;
174
+ }[];
175
+ }
176
+ interface IndexerServerMultiSubaccountSnapshotsResponse {
177
+ snapshots: Record<string, Record<string, IndexerServerEvent[]>>;
178
+ }
179
+ interface IndexerServerReferralCodeResponse {
180
+ referral_code: string | null;
181
+ }
182
+ interface IndexerServerFundingRate {
183
+ product_id: number;
184
+ funding_rate_x18: string;
185
+ update_time: number;
186
+ }
187
+ type IndexerServerFundingRateResponse = IndexerServerFundingRate;
188
+ type IndexerServerFundingRatesResponse = Record<string, IndexerServerFundingRate>;
189
+ interface IndexerServerPerpPrices {
190
+ product_id: number;
191
+ index_price_x18: string;
192
+ mark_price_x18: string;
193
+ update_time: number;
194
+ }
195
+ type IndexerServerPriceResponse = IndexerServerPerpPrices;
196
+ type IndexerServerPerpPricesResponse = Record<string, IndexerServerPerpPrices>;
197
+ interface IndexerServerOraclePricesResponse {
198
+ prices: IndexerServerOraclePrice[];
199
+ }
200
+ interface IndexerServerCandlesticksResponse {
201
+ candlesticks: IndexerServerCandlestick[];
202
+ }
203
+ type IndexerEdgeServerCandlesticksResponse = IndexerServerCandlesticksResponse;
204
+ interface IndexerServerProductsResponse {
205
+ products: IndexerServerProductSnapshot[];
206
+ txs: IndexerServerTx[];
207
+ }
208
+ type IndexerServerMultiProductsResponse = Record<string, Record<string, IndexerServerProductSnapshot>>;
209
+ interface IndexerServerEventsResponse {
210
+ events: IndexerServerEvent[];
211
+ txs: IndexerServerTx[];
212
+ }
213
+ interface IndexerServerOrdersResponse {
214
+ orders: IndexerServerOrder[];
215
+ }
216
+ interface IndexerServerMatchEventsResponse {
217
+ matches: IndexerServerMatchEvent[];
218
+ txs: IndexerServerTx[];
219
+ }
220
+ interface IndexerServerUsdcPriceResponse {
221
+ price_x18: string;
222
+ }
223
+ interface IndexerServerLinkedSignerResponse {
224
+ total_tx_limit: string;
225
+ remaining_tx: string;
226
+ wait_time: string;
227
+ signer: string;
228
+ }
229
+ interface IndexerServerMarketSnapshotsResponse {
230
+ snapshots: IndexerServerMarketSnapshot[];
231
+ }
232
+ interface IndexerEdgeServerMarketSnapshotsResponse {
233
+ snapshots: Record<number, IndexerServerMarketSnapshot[]>;
234
+ }
235
+ interface IndexerServerInterestFundingResponse {
236
+ interest_payments: IndexerServerProductPayment[];
237
+ funding_payments: IndexerServerProductPayment[];
238
+ next_idx: string;
239
+ }
240
+ interface IndexerServerMakerStatisticsResponse {
241
+ reward_coefficient: string;
242
+ makers: IndexerServerMaker[];
243
+ }
244
+ interface IndexerServerLeaderboardResponse {
245
+ positions: IndexerServerLeaderboardPosition[];
246
+ }
247
+ interface IndexerServerLeaderboardRegistrationResponse {
248
+ registration: IndexerServerLeaderboardRegistration | null;
249
+ }
250
+ interface IndexerServerLeaderboardRankResponse {
251
+ positions: Record<string, IndexerServerLeaderboardPosition>;
252
+ }
253
+ interface IndexerServerLeaderboardContestsResponse {
254
+ contests: IndexerServerLeaderboardContest[];
255
+ }
256
+ interface IndexerServerFastWithdrawalSignatureResponse {
257
+ idx: string;
258
+ tx: NadoWithdrawCollateralTx['withdraw_collateral'];
259
+ tx_bytes: string;
260
+ signatures: string[];
261
+ }
262
+ interface IndexerServerVlpSnapshotsResponse {
263
+ snapshots: IndexerServerVlpSnapshot[];
264
+ }
265
+ interface IndexerServerBacklogResponse {
266
+ total_txs: string;
267
+ total_submissions: string;
268
+ backlog_size: string;
269
+ updated_at: string;
270
+ backlog_eta_in_seconds: string | null;
271
+ txs_per_second: string | null;
272
+ }
273
+ interface IndexerServerQueryResponseByType {
274
+ account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;
275
+ backlog: IndexerServerBacklogResponse;
276
+ candlesticks: IndexerServerCandlesticksResponse;
277
+ edge_candlesticks: IndexerEdgeServerCandlesticksResponse;
278
+ edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;
279
+ events: IndexerServerEventsResponse;
280
+ fast_withdrawal_signature: IndexerServerFastWithdrawalSignatureResponse;
281
+ funding_rate: IndexerServerFundingRateResponse;
282
+ funding_rates: IndexerServerFundingRatesResponse;
283
+ interest_and_funding: IndexerServerInterestFundingResponse;
284
+ leaderboard: IndexerServerLeaderboardResponse;
285
+ leaderboard_contests: IndexerServerLeaderboardContestsResponse;
286
+ leaderboard_rank: IndexerServerLeaderboardRankResponse;
287
+ leaderboard_registration: IndexerServerLeaderboardRegistrationResponse;
288
+ linked_signer_rate_limit: IndexerServerLinkedSignerResponse;
289
+ maker_statistics: IndexerServerMakerStatisticsResponse;
290
+ market_snapshots: IndexerServerMarketSnapshotsResponse;
291
+ matches: IndexerServerMatchEventsResponse;
292
+ oracle_price: IndexerServerOraclePricesResponse;
293
+ orders: IndexerServerOrdersResponse;
294
+ perp_prices: IndexerServerPerpPricesResponse;
295
+ price: IndexerServerPriceResponse;
296
+ product_snapshots: IndexerServerMultiProductsResponse;
297
+ products: IndexerServerProductsResponse;
298
+ referral_code: IndexerServerReferralCodeResponse;
299
+ subaccounts: IndexerServerListSubaccountsResponse;
300
+ usdc_price: IndexerServerUsdcPriceResponse;
301
+ vlp_snapshots: IndexerServerVlpSnapshotsResponse;
302
+ }
303
+
304
+ export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerUsdcPriceResponse, IndexerServerVlpSnapshotsParams, IndexerServerVlpSnapshotsResponse };