@nadohq/indexer-client 0.1.0-alpha.2 → 0.1.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IndexerBaseClient.cjs +83 -57
- package/dist/IndexerBaseClient.cjs.map +1 -1
- package/dist/IndexerBaseClient.d.cts +13 -4
- package/dist/IndexerBaseClient.d.ts +13 -4
- package/dist/IndexerBaseClient.js +36 -9
- package/dist/IndexerBaseClient.js.map +1 -1
- package/dist/IndexerClient.cjs +17 -16
- package/dist/IndexerClient.cjs.map +1 -1
- package/dist/IndexerClient.d.cts +2 -3
- package/dist/IndexerClient.d.ts +2 -3
- package/dist/IndexerClient.js +6 -3
- package/dist/IndexerClient.js.map +1 -1
- package/dist/dataMappers.cjs +119 -109
- package/dist/dataMappers.cjs.map +1 -1
- package/dist/dataMappers.d.cts +5 -5
- package/dist/dataMappers.d.ts +5 -5
- package/dist/dataMappers.js +26 -18
- package/dist/dataMappers.js.map +1 -1
- package/dist/endpoints.cjs +2 -2
- package/dist/endpoints.cjs.map +1 -1
- package/dist/endpoints.d.cts +1 -1
- package/dist/endpoints.d.ts +1 -1
- package/dist/endpoints.js +2 -2
- package/dist/endpoints.js.map +1 -1
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -11
- package/dist/index.d.ts +10 -11
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/types/clientTypes.cjs.map +1 -1
- package/dist/types/clientTypes.d.cts +64 -11
- package/dist/types/clientTypes.d.ts +64 -11
- package/dist/types/index.cjs +11 -11
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +6 -7
- package/dist/types/index.d.ts +6 -7
- package/dist/types/index.js +5 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/paginatedEventsTypes.cjs.map +1 -1
- package/dist/types/paginatedEventsTypes.d.cts +6 -7
- package/dist/types/paginatedEventsTypes.d.ts +6 -7
- package/dist/types/serverModelTypes.cjs.map +1 -1
- package/dist/types/serverModelTypes.d.cts +8 -4
- package/dist/types/serverModelTypes.d.ts +8 -4
- package/dist/types/serverTypes.cjs.map +1 -1
- package/dist/types/serverTypes.d.cts +36 -5
- package/dist/types/serverTypes.d.ts +36 -5
- package/dist/utils/index.d.cts +2 -3
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/indexerBalanceValue.cjs.map +1 -1
- package/dist/utils/indexerBalanceValue.d.cts +2 -3
- package/dist/utils/indexerBalanceValue.d.ts +2 -3
- package/dist/utils/indexerBalanceValue.js.map +1 -1
- package/package.json +4 -5
- package/src/IndexerBaseClient.ts +55 -13
- package/src/IndexerClient.ts +9 -6
- package/src/dataMappers.ts +33 -21
- package/src/endpoints.ts +2 -2
- package/src/index.ts +3 -2
- package/src/types/clientTypes.ts +77 -12
- package/src/types/index.ts +5 -5
- package/src/types/paginatedEventsTypes.ts +2 -3
- package/src/types/serverModelTypes.ts +8 -4
- package/src/types/serverTypes.ts +48 -5
- package/src/utils/indexerBalanceValue.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/
|
|
1
|
+
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/shared';
|
|
2
2
|
import { IndexerEventType } from './IndexerEventType.cjs';
|
|
3
3
|
import { IndexerLeaderboardRankType } from './IndexerLeaderboardType.cjs';
|
|
4
4
|
import { NadoWithdrawCollateralTx } from './NadoTx.cjs';
|
|
@@ -67,9 +67,11 @@ interface IndexerServerEventsParams {
|
|
|
67
67
|
txs: number;
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
type IndexerServerTriggerTypeFilter = 'none' | 'price_trigger' | 'time_trigger';
|
|
70
71
|
interface IndexerServerOrdersParams {
|
|
71
72
|
subaccount?: string;
|
|
72
73
|
product_ids?: number[];
|
|
74
|
+
trigger_types?: IndexerServerTriggerTypeFilter[];
|
|
73
75
|
digests?: string[];
|
|
74
76
|
max_time?: number;
|
|
75
77
|
limit?: number;
|
|
@@ -133,10 +135,14 @@ interface IndexerServerFastWithdrawalSignatureParams {
|
|
|
133
135
|
interface IndexerServerNlpSnapshotsParams {
|
|
134
136
|
interval: IndexerServerSnapshotsInterval;
|
|
135
137
|
}
|
|
138
|
+
interface IndexerServerDDAQueryParams {
|
|
139
|
+
subaccount: string;
|
|
140
|
+
}
|
|
136
141
|
interface IndexerServerQueryRequestByType {
|
|
137
142
|
account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;
|
|
138
143
|
backlog: Record<string, never>;
|
|
139
144
|
candlesticks: IndexerServerCandlesticksParams;
|
|
145
|
+
direct_deposit_address: IndexerServerDDAQueryParams;
|
|
140
146
|
edge_candlesticks: IndexerEdgeServerCandlesticksParams;
|
|
141
147
|
edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;
|
|
142
148
|
events: IndexerServerEventsParams;
|
|
@@ -160,7 +166,7 @@ interface IndexerServerQueryRequestByType {
|
|
|
160
166
|
products: IndexerServerProductsParams;
|
|
161
167
|
referral_code: IndexerServerReferralCodeParams;
|
|
162
168
|
subaccounts: IndexerServerListSubaccountsParams;
|
|
163
|
-
|
|
169
|
+
quote_price: Record<string, never>;
|
|
164
170
|
nlp_snapshots: IndexerServerNlpSnapshotsParams;
|
|
165
171
|
}
|
|
166
172
|
type IndexerServerQueryRequestType = keyof IndexerServerQueryRequestByType;
|
|
@@ -217,7 +223,7 @@ interface IndexerServerMatchEventsResponse {
|
|
|
217
223
|
matches: IndexerServerMatchEvent[];
|
|
218
224
|
txs: IndexerServerTx[];
|
|
219
225
|
}
|
|
220
|
-
interface
|
|
226
|
+
interface IndexerServerQuotePriceResponse {
|
|
221
227
|
price_x18: string;
|
|
222
228
|
}
|
|
223
229
|
interface IndexerServerLinkedSignerResponse {
|
|
@@ -262,6 +268,9 @@ interface IndexerServerFastWithdrawalSignatureResponse {
|
|
|
262
268
|
interface IndexerServerNlpSnapshotsResponse {
|
|
263
269
|
snapshots: IndexerServerNlpSnapshot[];
|
|
264
270
|
}
|
|
271
|
+
interface IndexerServerDDAResponse {
|
|
272
|
+
v1_address: string;
|
|
273
|
+
}
|
|
265
274
|
interface IndexerServerBacklogResponse {
|
|
266
275
|
total_txs: string;
|
|
267
276
|
total_submissions: string;
|
|
@@ -274,6 +283,7 @@ interface IndexerServerQueryResponseByType {
|
|
|
274
283
|
account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;
|
|
275
284
|
backlog: IndexerServerBacklogResponse;
|
|
276
285
|
candlesticks: IndexerServerCandlesticksResponse;
|
|
286
|
+
direct_deposit_address: IndexerServerDDAResponse;
|
|
277
287
|
edge_candlesticks: IndexerEdgeServerCandlesticksResponse;
|
|
278
288
|
edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;
|
|
279
289
|
events: IndexerServerEventsResponse;
|
|
@@ -297,8 +307,29 @@ interface IndexerServerQueryResponseByType {
|
|
|
297
307
|
products: IndexerServerProductsResponse;
|
|
298
308
|
referral_code: IndexerServerReferralCodeResponse;
|
|
299
309
|
subaccounts: IndexerServerListSubaccountsResponse;
|
|
300
|
-
|
|
310
|
+
quote_price: IndexerServerQuotePriceResponse;
|
|
301
311
|
nlp_snapshots: IndexerServerNlpSnapshotsResponse;
|
|
302
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* V2 API Types
|
|
315
|
+
*/
|
|
316
|
+
/**
|
|
317
|
+
* Individual ticker data from v2 indexer endpoint (server format)
|
|
318
|
+
*/
|
|
319
|
+
interface IndexerServerV2TickerResponse {
|
|
320
|
+
product_id: number;
|
|
321
|
+
ticker_id: string;
|
|
322
|
+
base_currency: string;
|
|
323
|
+
quote_currency: string;
|
|
324
|
+
last_price: number;
|
|
325
|
+
base_volume: number;
|
|
326
|
+
quote_volume: number;
|
|
327
|
+
price_change_percent_24h: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Response from v2 tickers endpoint (server format)
|
|
331
|
+
* Maps ticker IDs to their respective ticker data
|
|
332
|
+
*/
|
|
333
|
+
type IndexerServerV2TickersResponse = Record<string, IndexerServerV2TickerResponse>;
|
|
303
334
|
|
|
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, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse,
|
|
335
|
+
export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerQuotePriceResponse, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerTriggerTypeFilter, IndexerServerV2TickerResponse, IndexerServerV2TickersResponse };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/
|
|
1
|
+
import { SignedTx, EIP712LeaderboardAuthenticationValues } from '@nadohq/shared';
|
|
2
2
|
import { IndexerEventType } from './IndexerEventType.js';
|
|
3
3
|
import { IndexerLeaderboardRankType } from './IndexerLeaderboardType.js';
|
|
4
4
|
import { NadoWithdrawCollateralTx } from './NadoTx.js';
|
|
@@ -67,9 +67,11 @@ interface IndexerServerEventsParams {
|
|
|
67
67
|
txs: number;
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
type IndexerServerTriggerTypeFilter = 'none' | 'price_trigger' | 'time_trigger';
|
|
70
71
|
interface IndexerServerOrdersParams {
|
|
71
72
|
subaccount?: string;
|
|
72
73
|
product_ids?: number[];
|
|
74
|
+
trigger_types?: IndexerServerTriggerTypeFilter[];
|
|
73
75
|
digests?: string[];
|
|
74
76
|
max_time?: number;
|
|
75
77
|
limit?: number;
|
|
@@ -133,10 +135,14 @@ interface IndexerServerFastWithdrawalSignatureParams {
|
|
|
133
135
|
interface IndexerServerNlpSnapshotsParams {
|
|
134
136
|
interval: IndexerServerSnapshotsInterval;
|
|
135
137
|
}
|
|
138
|
+
interface IndexerServerDDAQueryParams {
|
|
139
|
+
subaccount: string;
|
|
140
|
+
}
|
|
136
141
|
interface IndexerServerQueryRequestByType {
|
|
137
142
|
account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;
|
|
138
143
|
backlog: Record<string, never>;
|
|
139
144
|
candlesticks: IndexerServerCandlesticksParams;
|
|
145
|
+
direct_deposit_address: IndexerServerDDAQueryParams;
|
|
140
146
|
edge_candlesticks: IndexerEdgeServerCandlesticksParams;
|
|
141
147
|
edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;
|
|
142
148
|
events: IndexerServerEventsParams;
|
|
@@ -160,7 +166,7 @@ interface IndexerServerQueryRequestByType {
|
|
|
160
166
|
products: IndexerServerProductsParams;
|
|
161
167
|
referral_code: IndexerServerReferralCodeParams;
|
|
162
168
|
subaccounts: IndexerServerListSubaccountsParams;
|
|
163
|
-
|
|
169
|
+
quote_price: Record<string, never>;
|
|
164
170
|
nlp_snapshots: IndexerServerNlpSnapshotsParams;
|
|
165
171
|
}
|
|
166
172
|
type IndexerServerQueryRequestType = keyof IndexerServerQueryRequestByType;
|
|
@@ -217,7 +223,7 @@ interface IndexerServerMatchEventsResponse {
|
|
|
217
223
|
matches: IndexerServerMatchEvent[];
|
|
218
224
|
txs: IndexerServerTx[];
|
|
219
225
|
}
|
|
220
|
-
interface
|
|
226
|
+
interface IndexerServerQuotePriceResponse {
|
|
221
227
|
price_x18: string;
|
|
222
228
|
}
|
|
223
229
|
interface IndexerServerLinkedSignerResponse {
|
|
@@ -262,6 +268,9 @@ interface IndexerServerFastWithdrawalSignatureResponse {
|
|
|
262
268
|
interface IndexerServerNlpSnapshotsResponse {
|
|
263
269
|
snapshots: IndexerServerNlpSnapshot[];
|
|
264
270
|
}
|
|
271
|
+
interface IndexerServerDDAResponse {
|
|
272
|
+
v1_address: string;
|
|
273
|
+
}
|
|
265
274
|
interface IndexerServerBacklogResponse {
|
|
266
275
|
total_txs: string;
|
|
267
276
|
total_submissions: string;
|
|
@@ -274,6 +283,7 @@ interface IndexerServerQueryResponseByType {
|
|
|
274
283
|
account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;
|
|
275
284
|
backlog: IndexerServerBacklogResponse;
|
|
276
285
|
candlesticks: IndexerServerCandlesticksResponse;
|
|
286
|
+
direct_deposit_address: IndexerServerDDAResponse;
|
|
277
287
|
edge_candlesticks: IndexerEdgeServerCandlesticksResponse;
|
|
278
288
|
edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;
|
|
279
289
|
events: IndexerServerEventsResponse;
|
|
@@ -297,8 +307,29 @@ interface IndexerServerQueryResponseByType {
|
|
|
297
307
|
products: IndexerServerProductsResponse;
|
|
298
308
|
referral_code: IndexerServerReferralCodeResponse;
|
|
299
309
|
subaccounts: IndexerServerListSubaccountsResponse;
|
|
300
|
-
|
|
310
|
+
quote_price: IndexerServerQuotePriceResponse;
|
|
301
311
|
nlp_snapshots: IndexerServerNlpSnapshotsResponse;
|
|
302
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* V2 API Types
|
|
315
|
+
*/
|
|
316
|
+
/**
|
|
317
|
+
* Individual ticker data from v2 indexer endpoint (server format)
|
|
318
|
+
*/
|
|
319
|
+
interface IndexerServerV2TickerResponse {
|
|
320
|
+
product_id: number;
|
|
321
|
+
ticker_id: string;
|
|
322
|
+
base_currency: string;
|
|
323
|
+
quote_currency: string;
|
|
324
|
+
last_price: number;
|
|
325
|
+
base_volume: number;
|
|
326
|
+
quote_volume: number;
|
|
327
|
+
price_change_percent_24h: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Response from v2 tickers endpoint (server format)
|
|
331
|
+
* Maps ticker IDs to their respective ticker data
|
|
332
|
+
*/
|
|
333
|
+
type IndexerServerV2TickersResponse = Record<string, IndexerServerV2TickerResponse>;
|
|
303
334
|
|
|
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, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse,
|
|
335
|
+
export type { IndexerEdgeServerCandlesticksParams, IndexerEdgeServerCandlesticksResponse, IndexerEdgeServerMarketSnapshotsParams, IndexerEdgeServerMarketSnapshotsResponse, IndexerServerBacklogResponse, IndexerServerCandlesticksParams, IndexerServerCandlesticksResponse, IndexerServerDDAQueryParams, IndexerServerDDAResponse, IndexerServerEventsParams, IndexerServerEventsResponse, IndexerServerFastWithdrawalSignatureParams, IndexerServerFastWithdrawalSignatureResponse, IndexerServerFundingRate, IndexerServerFundingRateParams, IndexerServerFundingRateResponse, IndexerServerFundingRatesParams, IndexerServerFundingRatesResponse, IndexerServerInterestFundingParams, IndexerServerInterestFundingResponse, IndexerServerLeaderboardContestsParams, IndexerServerLeaderboardContestsResponse, IndexerServerLeaderboardParams, IndexerServerLeaderboardRankParams, IndexerServerLeaderboardRankResponse, IndexerServerLeaderboardRegistrationParams, IndexerServerLeaderboardRegistrationResponse, IndexerServerLeaderboardResponse, IndexerServerLinkedSignerParams, IndexerServerLinkedSignerResponse, IndexerServerListSubaccountsParams, IndexerServerListSubaccountsResponse, IndexerServerMakerStatisticsParams, IndexerServerMakerStatisticsResponse, IndexerServerMarketSnapshotsParams, IndexerServerMarketSnapshotsResponse, IndexerServerMatchEventsParams, IndexerServerMatchEventsResponse, IndexerServerMultiProductsParams, IndexerServerMultiProductsResponse, IndexerServerMultiSubaccountSnapshotsParams, IndexerServerMultiSubaccountSnapshotsResponse, IndexerServerNlpSnapshotsParams, IndexerServerNlpSnapshotsResponse, IndexerServerOraclePricesParams, IndexerServerOraclePricesResponse, IndexerServerOrdersParams, IndexerServerOrdersResponse, IndexerServerPerpPrices, IndexerServerPerpPricesParams, IndexerServerPerpPricesResponse, IndexerServerPriceParams, IndexerServerPriceResponse, IndexerServerProductsParams, IndexerServerProductsResponse, IndexerServerQueryRequestByType, IndexerServerQueryRequestType, IndexerServerQueryResponseByType, IndexerServerQuotePriceResponse, IndexerServerReferralCodeParams, IndexerServerReferralCodeResponse, IndexerServerTriggerTypeFilter, IndexerServerV2TickerResponse, IndexerServerV2TickersResponse };
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue } from './indexerBalanceValue.cjs';
|
|
2
|
-
import '@nadohq/
|
|
2
|
+
import '@nadohq/shared';
|
|
3
3
|
import '../types/clientTypes.cjs';
|
|
4
|
-
import '@nadohq/contracts';
|
|
5
4
|
import 'viem';
|
|
6
5
|
import '../types/CandlestickPeriod.cjs';
|
|
7
6
|
import '../types/IndexerEventType.cjs';
|
|
8
7
|
import '../types/IndexerLeaderboardType.cjs';
|
|
9
|
-
import '../types/serverTypes.cjs';
|
|
10
8
|
import '../types/NadoTx.cjs';
|
|
9
|
+
import '../types/serverTypes.cjs';
|
|
11
10
|
import '../types/serverModelTypes.cjs';
|
|
12
11
|
import '@nadohq/engine-client';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { calcIndexerPerpBalanceNotionalValue, calcIndexerPerpBalanceValue, calcIndexerSpotBalanceValue } from './indexerBalanceValue.js';
|
|
2
|
-
import '@nadohq/
|
|
2
|
+
import '@nadohq/shared';
|
|
3
3
|
import '../types/clientTypes.js';
|
|
4
|
-
import '@nadohq/contracts';
|
|
5
4
|
import 'viem';
|
|
6
5
|
import '../types/CandlestickPeriod.js';
|
|
7
6
|
import '../types/IndexerEventType.js';
|
|
8
7
|
import '../types/IndexerLeaderboardType.js';
|
|
9
|
-
import '../types/serverTypes.js';
|
|
10
8
|
import '../types/NadoTx.js';
|
|
9
|
+
import '../types/serverTypes.js';
|
|
11
10
|
import '../types/serverModelTypes.js';
|
|
12
11
|
import '@nadohq/engine-client';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/
|
|
1
|
+
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/shared';\nimport { IndexerPerpBalance, IndexerSpotBalance } from '../types';\n\n/**\n * Most of these calculations take oraclePrice as a separate parameter. This allows us to not rely on the Snapshot\n * interfaces to give clients the optionality to pass either the pre or post balance\n */\n\n/**\n * Calculates the quote value of an indexer spot balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerSpotBalanceValue(\n balance: IndexerSpotBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice);\n}\n\n/**\n * Calculates the notional value of an indexer perp balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceNotionalValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).abs();\n}\n\n/**\n * Calculates the true quote value of a indexer perp balance, which is the same as its unrealized pnl / unsettled quote\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).plus(balance.vQuoteBalance);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW;AAChD;AAQO,SAAS,oCACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,IAAI;AACtD;AAQO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,KAAK,QAAQ,aAAa;AAC5E;","names":[]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { BigDecimal } from '@nadohq/
|
|
1
|
+
import { BigDecimal } from '@nadohq/shared';
|
|
2
2
|
import { IndexerSpotBalance, IndexerPerpBalance } from '../types/clientTypes.cjs';
|
|
3
|
-
import '@nadohq/contracts';
|
|
4
3
|
import 'viem';
|
|
5
4
|
import '../types/CandlestickPeriod.cjs';
|
|
6
5
|
import '../types/IndexerEventType.cjs';
|
|
7
6
|
import '../types/IndexerLeaderboardType.cjs';
|
|
8
|
-
import '../types/serverTypes.cjs';
|
|
9
7
|
import '../types/NadoTx.cjs';
|
|
8
|
+
import '../types/serverTypes.cjs';
|
|
10
9
|
import '../types/serverModelTypes.cjs';
|
|
11
10
|
import '@nadohq/engine-client';
|
|
12
11
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { BigDecimal } from '@nadohq/
|
|
1
|
+
import { BigDecimal } from '@nadohq/shared';
|
|
2
2
|
import { IndexerSpotBalance, IndexerPerpBalance } from '../types/clientTypes.js';
|
|
3
|
-
import '@nadohq/contracts';
|
|
4
3
|
import 'viem';
|
|
5
4
|
import '../types/CandlestickPeriod.js';
|
|
6
5
|
import '../types/IndexerEventType.js';
|
|
7
6
|
import '../types/IndexerLeaderboardType.js';
|
|
8
|
-
import '../types/serverTypes.js';
|
|
9
7
|
import '../types/NadoTx.js';
|
|
8
|
+
import '../types/serverTypes.js';
|
|
10
9
|
import '../types/serverModelTypes.js';
|
|
11
10
|
import '@nadohq/engine-client';
|
|
12
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/
|
|
1
|
+
{"version":3,"sources":["../../src/utils/indexerBalanceValue.ts"],"sourcesContent":["import { BigDecimal } from '@nadohq/shared';\nimport { IndexerPerpBalance, IndexerSpotBalance } from '../types';\n\n/**\n * Most of these calculations take oraclePrice as a separate parameter. This allows us to not rely on the Snapshot\n * interfaces to give clients the optionality to pass either the pre or post balance\n */\n\n/**\n * Calculates the quote value of an indexer spot balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerSpotBalanceValue(\n balance: IndexerSpotBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice);\n}\n\n/**\n * Calculates the notional value of an indexer perp balance\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceNotionalValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).abs();\n}\n\n/**\n * Calculates the true quote value of a indexer perp balance, which is the same as its unrealized pnl / unsettled quote\n *\n * @param balance\n * @param oraclePrice\n */\nexport function calcIndexerPerpBalanceValue(\n balance: IndexerPerpBalance,\n oraclePrice: BigDecimal,\n): BigDecimal {\n return balance.amount.multipliedBy(oraclePrice).plus(balance.vQuoteBalance);\n}\n"],"mappings":";AAcO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW;AAChD;AAQO,SAAS,oCACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,IAAI;AACtD;AAQO,SAAS,4BACd,SACA,aACY;AACZ,SAAO,QAAQ,OAAO,aAAa,WAAW,EAAE,KAAK,QAAQ,aAAa;AAC5E;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/indexer-client",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "> TODO: description",
|
|
@@ -37,9 +37,8 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@nadohq/
|
|
41
|
-
"@nadohq/
|
|
42
|
-
"@nadohq/utils": "^0.1.0-alpha.2",
|
|
40
|
+
"@nadohq/engine-client": "^0.1.0-alpha.21",
|
|
41
|
+
"@nadohq/shared": "^0.1.0-alpha.21",
|
|
43
42
|
"axios": "*",
|
|
44
43
|
"ts-mixer": "*"
|
|
45
44
|
},
|
|
@@ -49,5 +48,5 @@
|
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"viem": "*"
|
|
51
50
|
},
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "cf061e1db4540a8d797a3250f86a3197c8256045"
|
|
53
52
|
}
|
package/src/IndexerBaseClient.ts
CHANGED
|
@@ -4,23 +4,22 @@ import {
|
|
|
4
4
|
getDefaultRecvTime,
|
|
5
5
|
getNadoEIP712Values,
|
|
6
6
|
getSignedTransactionRequest,
|
|
7
|
+
getValidatedAddress,
|
|
8
|
+
getValidatedHex,
|
|
9
|
+
mapValues,
|
|
10
|
+
nowInSeconds,
|
|
11
|
+
removeDecimals,
|
|
7
12
|
SignableRequestType,
|
|
8
13
|
SignableRequestTypeToParams,
|
|
9
14
|
SignedTx,
|
|
10
15
|
subaccountFromHex,
|
|
11
16
|
subaccountToHex,
|
|
12
|
-
WalletClientWithAccount,
|
|
13
|
-
} from '@nadohq/contracts';
|
|
14
|
-
import {
|
|
15
|
-
getValidatedHex,
|
|
16
|
-
mapValues,
|
|
17
|
-
nowInSeconds,
|
|
18
|
-
removeDecimals,
|
|
19
17
|
toBigDecimal,
|
|
20
18
|
toBigInt,
|
|
21
19
|
toIntegerString,
|
|
20
|
+
WalletClientWithAccount,
|
|
22
21
|
WalletNotProvidedError,
|
|
23
|
-
} from '@nadohq/
|
|
22
|
+
} from '@nadohq/shared';
|
|
24
23
|
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
|
25
24
|
import {
|
|
26
25
|
mapIndexerCandlesticks,
|
|
@@ -33,11 +32,12 @@ import {
|
|
|
33
32
|
mapIndexerMakerStatistics,
|
|
34
33
|
mapIndexerMarketSnapshot,
|
|
35
34
|
mapIndexerMatchEventBalances,
|
|
35
|
+
mapIndexerNlpSnapshot,
|
|
36
36
|
mapIndexerOrder,
|
|
37
37
|
mapIndexerPerpPrices,
|
|
38
38
|
mapIndexerProductPayment,
|
|
39
39
|
mapIndexerServerProduct,
|
|
40
|
-
|
|
40
|
+
mapIndexerV2Ticker,
|
|
41
41
|
mapSnapshotsIntervalToServerParams,
|
|
42
42
|
} from './dataMappers';
|
|
43
43
|
import {
|
|
@@ -80,6 +80,8 @@ import {
|
|
|
80
80
|
GetIndexerMultiProductSnapshotsResponse,
|
|
81
81
|
GetIndexerMultiSubaccountSnapshotsParams,
|
|
82
82
|
GetIndexerMultiSubaccountSnapshotsResponse,
|
|
83
|
+
GetIndexerNlpSnapshotsParams,
|
|
84
|
+
GetIndexerNlpSnapshotsResponse,
|
|
83
85
|
GetIndexerOraclePricesParams,
|
|
84
86
|
GetIndexerOraclePricesResponse,
|
|
85
87
|
GetIndexerOrdersParams,
|
|
@@ -91,8 +93,10 @@ import {
|
|
|
91
93
|
GetIndexerQuotePriceResponse,
|
|
92
94
|
GetIndexerReferralCodeParams,
|
|
93
95
|
GetIndexerReferralCodeResponse,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
GetIndexerSubaccountDDAParams,
|
|
97
|
+
GetIndexerSubaccountDDAResponse,
|
|
98
|
+
GetIndexerV2TickersParams,
|
|
99
|
+
GetIndexerV2TickersResponse,
|
|
96
100
|
IndexerEventWithTx,
|
|
97
101
|
IndexerMatchEvent,
|
|
98
102
|
IndexerOraclePrice,
|
|
@@ -100,6 +104,7 @@ import {
|
|
|
100
104
|
IndexerServerQueryRequestByType,
|
|
101
105
|
IndexerServerQueryRequestType,
|
|
102
106
|
IndexerServerQueryResponseByType,
|
|
107
|
+
IndexerServerV2TickersResponse,
|
|
103
108
|
IndexerSnapshotBalance,
|
|
104
109
|
IndexerSubaccountSnapshot,
|
|
105
110
|
ListIndexerSubaccountsParams,
|
|
@@ -130,6 +135,8 @@ export class IndexerBaseClient {
|
|
|
130
135
|
this.opts = opts;
|
|
131
136
|
this.axiosInstance = axios.create({
|
|
132
137
|
withCredentials: true,
|
|
138
|
+
// We have custom logic to validate response status and create an appropriate error
|
|
139
|
+
validateStatus: () => true,
|
|
133
140
|
});
|
|
134
141
|
this.v2Url = opts.v2Url ? opts.v2Url : opts.url.replace('v1', 'v2');
|
|
135
142
|
}
|
|
@@ -442,6 +449,7 @@ export class IndexerBaseClient {
|
|
|
442
449
|
})
|
|
443
450
|
: undefined,
|
|
444
451
|
product_ids: params.productIds,
|
|
452
|
+
trigger_types: params.triggerTypes,
|
|
445
453
|
isolated: params.isolated,
|
|
446
454
|
digests: params.digests,
|
|
447
455
|
max_time: params.maxTimestampInclusive,
|
|
@@ -550,10 +558,10 @@ export class IndexerBaseClient {
|
|
|
550
558
|
}
|
|
551
559
|
|
|
552
560
|
/**
|
|
553
|
-
* Gets quote (
|
|
561
|
+
* Gets quote (USDT) price in terms of USD
|
|
554
562
|
*/
|
|
555
563
|
async getQuotePrice(): Promise<GetIndexerQuotePriceResponse> {
|
|
556
|
-
const baseResponse = await this.query('
|
|
564
|
+
const baseResponse = await this.query('quote_price', {});
|
|
557
565
|
return {
|
|
558
566
|
price: removeDecimals(baseResponse.price_x18),
|
|
559
567
|
};
|
|
@@ -787,6 +795,22 @@ export class IndexerBaseClient {
|
|
|
787
795
|
};
|
|
788
796
|
}
|
|
789
797
|
|
|
798
|
+
/**
|
|
799
|
+
* Retrieves the subaccount's DDA (Direct Deposit Address)
|
|
800
|
+
* @param params
|
|
801
|
+
*/
|
|
802
|
+
async getSubaccountDDA(
|
|
803
|
+
params: GetIndexerSubaccountDDAParams,
|
|
804
|
+
): Promise<GetIndexerSubaccountDDAResponse> {
|
|
805
|
+
const baseResponse = await this.query('direct_deposit_address', {
|
|
806
|
+
subaccount: subaccountToHex(params.subaccount),
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
return {
|
|
810
|
+
address: getValidatedAddress(baseResponse.v1_address),
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
790
814
|
async getSequencerBacklog(): Promise<GetIndexerBacklogResponse> {
|
|
791
815
|
const baseResponse = await this.query('backlog', {});
|
|
792
816
|
|
|
@@ -804,6 +828,24 @@ export class IndexerBaseClient {
|
|
|
804
828
|
};
|
|
805
829
|
}
|
|
806
830
|
|
|
831
|
+
/**
|
|
832
|
+
* Get tickers from the v2 indexer endpoint
|
|
833
|
+
* @param params
|
|
834
|
+
*/
|
|
835
|
+
async getV2Tickers(
|
|
836
|
+
params: GetIndexerV2TickersParams,
|
|
837
|
+
): Promise<GetIndexerV2TickersResponse> {
|
|
838
|
+
const response =
|
|
839
|
+
await this.axiosInstance.get<IndexerServerV2TickersResponse>(
|
|
840
|
+
`${this.v2Url}/tickers`,
|
|
841
|
+
{ params },
|
|
842
|
+
);
|
|
843
|
+
|
|
844
|
+
this.checkResponseStatus(response);
|
|
845
|
+
|
|
846
|
+
return mapValues(response.data, mapIndexerV2Ticker);
|
|
847
|
+
}
|
|
848
|
+
|
|
807
849
|
protected async query<TRequestType extends IndexerServerQueryRequestType>(
|
|
808
850
|
requestType: TRequestType,
|
|
809
851
|
params: IndexerServerQueryRequestByType[TRequestType],
|
package/src/IndexerClient.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NLP_PRODUCT_ID,
|
|
2
3
|
ProductEngineType,
|
|
3
4
|
QUOTE_PRODUCT_ID,
|
|
4
5
|
subaccountFromHex,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
toBigDecimal,
|
|
7
|
+
toIntegerString,
|
|
8
|
+
} from '@nadohq/shared';
|
|
8
9
|
|
|
9
10
|
import { IndexerBaseClient } from './IndexerBaseClient';
|
|
10
11
|
import {
|
|
@@ -22,17 +23,17 @@ import {
|
|
|
22
23
|
GetIndexerSubaccountLiquidationEventsResponse,
|
|
23
24
|
GetIndexerSubaccountMatchEventParams,
|
|
24
25
|
GetIndexerSubaccountMatchEventsResponse,
|
|
25
|
-
GetIndexerSubaccountSettlementEventsParams,
|
|
26
|
-
GetIndexerSubaccountSettlementEventsResponse,
|
|
27
26
|
GetIndexerSubaccountNlpEventsParams,
|
|
28
27
|
GetIndexerSubaccountNlpEventsResponse,
|
|
28
|
+
GetIndexerSubaccountSettlementEventsParams,
|
|
29
|
+
GetIndexerSubaccountSettlementEventsResponse,
|
|
29
30
|
IndexerCollateralEvent,
|
|
30
31
|
IndexerEventPerpStateSnapshot,
|
|
31
32
|
IndexerEventSpotStateSnapshot,
|
|
32
33
|
IndexerEventWithTx,
|
|
33
34
|
IndexerLiquidationEvent,
|
|
34
|
-
IndexerSettlementEvent,
|
|
35
35
|
IndexerNlpEvent,
|
|
36
|
+
IndexerSettlementEvent,
|
|
36
37
|
PaginatedIndexerEventsResponse,
|
|
37
38
|
} from './types';
|
|
38
39
|
|
|
@@ -195,6 +196,7 @@ export class IndexerClient extends IndexerBaseClient {
|
|
|
195
196
|
subaccountName,
|
|
196
197
|
subaccountOwner,
|
|
197
198
|
productIds,
|
|
199
|
+
triggerTypes,
|
|
198
200
|
isolated,
|
|
199
201
|
} = params;
|
|
200
202
|
|
|
@@ -205,6 +207,7 @@ export class IndexerClient extends IndexerBaseClient {
|
|
|
205
207
|
subaccount: { subaccountName, subaccountOwner },
|
|
206
208
|
limit,
|
|
207
209
|
productIds,
|
|
210
|
+
triggerTypes,
|
|
208
211
|
isolated,
|
|
209
212
|
});
|
|
210
213
|
|
package/src/dataMappers.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getRecvTimeFromOrderNonce,
|
|
3
|
-
Market,
|
|
4
|
-
parseRawExpirationTimestamp,
|
|
5
|
-
PerpMarket,
|
|
6
|
-
ProductEngineType,
|
|
7
|
-
SpotMarket,
|
|
8
|
-
subaccountFromHex,
|
|
9
|
-
} from '@nadohq/contracts';
|
|
10
1
|
import {
|
|
11
2
|
mapEngineServerPerpProduct,
|
|
12
3
|
mapEngineServerSpotProduct,
|
|
13
4
|
} from '@nadohq/engine-client';
|
|
14
5
|
import {
|
|
6
|
+
getRecvTimeFromOrderNonce,
|
|
15
7
|
mapValues,
|
|
8
|
+
Market,
|
|
9
|
+
PerpMarket,
|
|
10
|
+
ProductEngineType,
|
|
16
11
|
removeDecimals,
|
|
12
|
+
SpotMarket,
|
|
13
|
+
subaccountFromHex,
|
|
17
14
|
toBigDecimal,
|
|
18
15
|
toIntegerString,
|
|
19
|
-
|
|
16
|
+
unpackOrderAppendix,
|
|
17
|
+
} from '@nadohq/shared';
|
|
20
18
|
import {
|
|
21
19
|
Candlestick,
|
|
22
20
|
IndexerEvent,
|
|
@@ -28,6 +26,7 @@ import {
|
|
|
28
26
|
IndexerMaker,
|
|
29
27
|
IndexerMarketSnapshot,
|
|
30
28
|
IndexerMatchEventBalances,
|
|
29
|
+
IndexerNlpSnapshot,
|
|
31
30
|
IndexerOrder,
|
|
32
31
|
IndexerPerpBalance,
|
|
33
32
|
IndexerPerpPrices,
|
|
@@ -42,16 +41,17 @@ import {
|
|
|
42
41
|
IndexerServerMaker,
|
|
43
42
|
IndexerServerMarketSnapshot,
|
|
44
43
|
IndexerServerMatchEventBalances,
|
|
44
|
+
IndexerServerNlpSnapshot,
|
|
45
45
|
IndexerServerOrder,
|
|
46
46
|
IndexerServerPerpPrices,
|
|
47
47
|
IndexerServerProduct,
|
|
48
48
|
IndexerServerProductPayment,
|
|
49
49
|
IndexerServerSnapshotsInterval,
|
|
50
50
|
IndexerServerTx,
|
|
51
|
-
|
|
51
|
+
IndexerServerV2TickerResponse,
|
|
52
52
|
IndexerSnapshotsIntervalParams,
|
|
53
53
|
IndexerSpotBalance,
|
|
54
|
-
|
|
54
|
+
IndexerV2TickerResponse,
|
|
55
55
|
} from './types';
|
|
56
56
|
|
|
57
57
|
export function mapSnapshotsIntervalToServerParams(
|
|
@@ -92,16 +92,12 @@ export function mapIndexerServerBalance(
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export function mapIndexerOrder(order: IndexerServerOrder): IndexerOrder {
|
|
95
|
-
const
|
|
96
|
-
const expirationEncodedData = parseRawExpirationTimestamp(order.expiration);
|
|
95
|
+
const appendix = unpackOrderAppendix(order.appendix);
|
|
97
96
|
return {
|
|
98
97
|
amount: toBigDecimal(order.amount),
|
|
99
98
|
digest: order.digest,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
isReduceOnly: expirationEncodedData.reduceOnly,
|
|
103
|
-
expiration: expirationEncodedData.expirationTime,
|
|
104
|
-
orderType: expirationEncodedData.type,
|
|
99
|
+
expiration: Number(order.expiration),
|
|
100
|
+
appendix,
|
|
105
101
|
nonce: toBigDecimal(order.nonce),
|
|
106
102
|
recvTimeSeconds: getRecvTimeFromOrderNonce(order.nonce) / 1000,
|
|
107
103
|
price: removeDecimals(order.price_x18),
|
|
@@ -156,6 +152,7 @@ export function mapIndexerEvent(event: IndexerServerEvent): IndexerEvent {
|
|
|
156
152
|
netFundingUnrealized: toBigDecimal(event.net_funding_unrealized),
|
|
157
153
|
netInterestCumulative: toBigDecimal(event.net_interest_cumulative),
|
|
158
154
|
netInterestUnrealized: toBigDecimal(event.net_interest_unrealized),
|
|
155
|
+
quoteVolumeCumulative: toBigDecimal(event.quote_volume_cumulative),
|
|
159
156
|
},
|
|
160
157
|
};
|
|
161
158
|
}
|
|
@@ -350,8 +347,8 @@ export function mapIndexerNlpSnapshot(
|
|
|
350
347
|
return {
|
|
351
348
|
submissionIndex: snapshot.submission_idx,
|
|
352
349
|
timestamp: toBigDecimal(snapshot.timestamp),
|
|
353
|
-
|
|
354
|
-
|
|
350
|
+
cumulativeBurnAmountQuote: toBigDecimal(snapshot.cumulative_burn_quote),
|
|
351
|
+
cumulativeMintAmountQuote: toBigDecimal(snapshot.cumulative_mint_quote),
|
|
355
352
|
cumulativePnl: toBigDecimal(snapshot.cumulative_pnl),
|
|
356
353
|
cumulativeTrades: toBigDecimal(snapshot.cumulative_trades),
|
|
357
354
|
cumulativeVolume: toBigDecimal(snapshot.cumulative_volume),
|
|
@@ -360,3 +357,18 @@ export function mapIndexerNlpSnapshot(
|
|
|
360
357
|
tvl: toBigDecimal(snapshot.tvl),
|
|
361
358
|
};
|
|
362
359
|
}
|
|
360
|
+
|
|
361
|
+
export function mapIndexerV2Ticker(
|
|
362
|
+
ticker: IndexerServerV2TickerResponse,
|
|
363
|
+
): IndexerV2TickerResponse {
|
|
364
|
+
return {
|
|
365
|
+
productId: ticker.product_id,
|
|
366
|
+
tickerId: ticker.ticker_id,
|
|
367
|
+
baseCurrency: ticker.base_currency,
|
|
368
|
+
quoteCurrency: ticker.quote_currency,
|
|
369
|
+
lastPrice: ticker.last_price,
|
|
370
|
+
baseVolume: ticker.base_volume,
|
|
371
|
+
quoteVolume: ticker.quote_volume,
|
|
372
|
+
priceChangePercent24h: ticker.price_change_percent_24h,
|
|
373
|
+
};
|
|
374
|
+
}
|
package/src/endpoints.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChainEnv } from '@nadohq/
|
|
1
|
+
import { ChainEnv } from '@nadohq/shared';
|
|
2
2
|
|
|
3
3
|
export const INDEXER_CLIENT_ENDPOINTS: Record<ChainEnv, string> = {
|
|
4
4
|
local: 'http://localhost:8000/indexer',
|
|
5
|
-
arbitrumTestnet: 'https://archive.sepolia-test.vertexprotocol.com/v1',
|
|
6
5
|
arbitrum: 'https://archive.prod.vertexprotocol.com/v1',
|
|
6
|
+
inkTestnet: 'https://archive.test.nado-backend.xyz/v1',
|
|
7
7
|
};
|