@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
package/src/types/clientTypes.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BigDecimal,
|
|
2
3
|
EIP712OrderValues,
|
|
3
4
|
Market,
|
|
4
|
-
|
|
5
|
+
OrderAppendix,
|
|
5
6
|
PerpBalance,
|
|
6
7
|
PerpMarket,
|
|
7
8
|
ProductEngineType,
|
|
8
9
|
SpotBalance,
|
|
9
10
|
SpotMarket,
|
|
10
11
|
Subaccount,
|
|
11
|
-
} from '@nadohq/
|
|
12
|
-
import {
|
|
13
|
-
import { Hex } from 'viem';
|
|
12
|
+
} from '@nadohq/shared';
|
|
13
|
+
import { Address, Hex } from 'viem';
|
|
14
14
|
import { CandlestickPeriod } from './CandlestickPeriod';
|
|
15
15
|
import { IndexerEventType } from './IndexerEventType';
|
|
16
16
|
import { IndexerLeaderboardRankType } from './IndexerLeaderboardType';
|
|
17
|
+
import { NadoTx, NadoWithdrawCollateralTx } from './NadoTx';
|
|
17
18
|
import {
|
|
18
19
|
IndexerServerFastWithdrawalSignatureParams,
|
|
19
20
|
IndexerServerListSubaccountsParams,
|
|
21
|
+
IndexerServerTriggerTypeFilter,
|
|
20
22
|
} from './serverTypes';
|
|
21
|
-
import { NadoTx, NadoWithdrawCollateralTx } from './NadoTx';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Base types
|
|
@@ -53,6 +54,7 @@ export interface IndexerBalanceTrackedVars {
|
|
|
53
54
|
netFundingCumulative: BigDecimal;
|
|
54
55
|
netEntryUnrealized: BigDecimal;
|
|
55
56
|
netEntryCumulative: BigDecimal;
|
|
57
|
+
quoteVolumeCumulative: BigDecimal;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
export interface IndexerEvent<
|
|
@@ -341,6 +343,7 @@ export interface GetIndexerOrdersParams {
|
|
|
341
343
|
maxTimestampInclusive?: number;
|
|
342
344
|
limit?: number;
|
|
343
345
|
productIds?: number[];
|
|
346
|
+
triggerTypes?: IndexerServerTriggerTypeFilter[];
|
|
344
347
|
// If not given, will return both isolated & non-iso orders
|
|
345
348
|
isolated?: boolean;
|
|
346
349
|
digests?: string[];
|
|
@@ -349,16 +352,13 @@ export interface GetIndexerOrdersParams {
|
|
|
349
352
|
export interface IndexerOrder {
|
|
350
353
|
digest: string;
|
|
351
354
|
subaccount: string;
|
|
352
|
-
isolated: boolean;
|
|
353
355
|
productId: number;
|
|
354
356
|
submissionIndex: string;
|
|
355
357
|
amount: BigDecimal;
|
|
356
358
|
price: BigDecimal;
|
|
357
|
-
// This includes the order type
|
|
358
|
-
rawExpiration: BigDecimal;
|
|
359
|
-
isReduceOnly: boolean;
|
|
360
|
-
orderType: OrderExpirationType;
|
|
361
359
|
expiration: number;
|
|
360
|
+
// Order metadata from appendix
|
|
361
|
+
appendix: OrderAppendix;
|
|
362
362
|
nonce: BigDecimal;
|
|
363
363
|
// Derived from the nonce
|
|
364
364
|
recvTimeSeconds: number;
|
|
@@ -651,8 +651,8 @@ export interface IndexerNlpSnapshot {
|
|
|
651
651
|
// Total volume traded by the NLP, in terms of the primary quote
|
|
652
652
|
cumulativeVolume: BigDecimal;
|
|
653
653
|
cumulativeTrades: BigDecimal;
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
cumulativeMintAmountQuote: BigDecimal;
|
|
655
|
+
cumulativeBurnAmountQuote: BigDecimal;
|
|
656
656
|
cumulativePnl: BigDecimal;
|
|
657
657
|
tvl: BigDecimal;
|
|
658
658
|
oraclePrice: BigDecimal;
|
|
@@ -677,3 +677,68 @@ export interface GetIndexerBacklogResponse {
|
|
|
677
677
|
// Current submission rate in transactions per second (float) (null if unavailable)
|
|
678
678
|
txsPerSecond: BigDecimal | null;
|
|
679
679
|
}
|
|
680
|
+
|
|
681
|
+
export interface GetIndexerSubaccountDDAParams {
|
|
682
|
+
subaccount: Subaccount;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export interface GetIndexerSubaccountDDAResponse {
|
|
686
|
+
address: Address;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* V2 Tickers
|
|
691
|
+
*/
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Market type for ticker filtering
|
|
695
|
+
*/
|
|
696
|
+
export type TickerMarketType = 'spot' | 'perp';
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Parameters for querying v2 tickers endpoint
|
|
700
|
+
*/
|
|
701
|
+
export interface GetIndexerV2TickersParams {
|
|
702
|
+
/**
|
|
703
|
+
* Filter tickers by market type (spot or perp)
|
|
704
|
+
* @example 'spot'
|
|
705
|
+
* @example 'perp'
|
|
706
|
+
*/
|
|
707
|
+
market?: TickerMarketType;
|
|
708
|
+
/**
|
|
709
|
+
* Whether to include edge products
|
|
710
|
+
* @default false
|
|
711
|
+
*/
|
|
712
|
+
edge?: boolean;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Individual ticker data from v2 endpoint
|
|
717
|
+
*/
|
|
718
|
+
export interface IndexerV2TickerResponse {
|
|
719
|
+
/** Unique product identifier */
|
|
720
|
+
productId: number;
|
|
721
|
+
/** Unique ticker identifier */
|
|
722
|
+
tickerId: string;
|
|
723
|
+
/** Base currency symbol */
|
|
724
|
+
baseCurrency: string;
|
|
725
|
+
/** Quote currency symbol */
|
|
726
|
+
quoteCurrency: string;
|
|
727
|
+
/** Last traded price */
|
|
728
|
+
lastPrice: number;
|
|
729
|
+
/** 24h trading volume in base currency */
|
|
730
|
+
baseVolume: number;
|
|
731
|
+
/** 24h trading volume in quote currency */
|
|
732
|
+
quoteVolume: number;
|
|
733
|
+
/** 24h price change percentage */
|
|
734
|
+
priceChangePercent24h: number;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Response from v2 tickers endpoint
|
|
739
|
+
* Maps ticker IDs to their respective ticker data
|
|
740
|
+
*/
|
|
741
|
+
export type GetIndexerV2TickersResponse = Record<
|
|
742
|
+
string,
|
|
743
|
+
IndexerV2TickerResponse
|
|
744
|
+
>;
|
package/src/types/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './clientTypes';
|
|
2
|
-
export * from './paginatedEventsTypes';
|
|
3
|
-
export * from './serverTypes';
|
|
4
|
-
export * from './serverModelTypes';
|
|
5
1
|
export * from './CandlestickPeriod';
|
|
2
|
+
export * from './clientTypes';
|
|
3
|
+
export * from './collateralEventType';
|
|
6
4
|
export * from './IndexerEventType';
|
|
7
5
|
export * from './IndexerLeaderboardType';
|
|
8
|
-
export * from './collateralEventType';
|
|
9
6
|
export * from './NadoTx';
|
|
7
|
+
export * from './paginatedEventsTypes';
|
|
8
|
+
export * from './serverModelTypes';
|
|
9
|
+
export * from './serverTypes';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Subaccount } from '@nadohq/
|
|
2
|
-
import { BigDecimal } from '@nadohq/utils';
|
|
1
|
+
import { BigDecimal, Subaccount } from '@nadohq/shared';
|
|
3
2
|
import {
|
|
4
3
|
GetIndexerInterestFundingPaymentsParams,
|
|
5
4
|
GetIndexerInterestFundingPaymentsResponse,
|
|
@@ -104,7 +103,7 @@ export type GetIndexerSubaccountMatchEventsResponse =
|
|
|
104
103
|
*/
|
|
105
104
|
|
|
106
105
|
export type GetIndexerPaginatedOrdersParams = BaseSubaccountPaginationParams &
|
|
107
|
-
Pick<GetIndexerOrdersParams, 'productIds' | 'isolated'>;
|
|
106
|
+
Pick<GetIndexerOrdersParams, 'productIds' | 'triggerTypes' | 'isolated'>;
|
|
108
107
|
|
|
109
108
|
export interface GetIndexerPaginatedOrdersResponse {
|
|
110
109
|
orders: IndexerOrder[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { EIP712OrderValues } from '@nadohq/contracts';
|
|
2
1
|
import {
|
|
3
2
|
EngineServerPerpBalance,
|
|
4
3
|
EngineServerPerpProduct,
|
|
5
4
|
EngineServerSpotBalance,
|
|
6
5
|
EngineServerSpotProduct,
|
|
7
6
|
} from '@nadohq/engine-client';
|
|
7
|
+
import { EIP712OrderValues } from '@nadohq/shared';
|
|
8
8
|
import { IndexerEventType } from './IndexerEventType';
|
|
9
9
|
import { NadoTx } from './NadoTx';
|
|
10
10
|
|
|
@@ -78,6 +78,10 @@ export interface IndexerServerEvent {
|
|
|
78
78
|
net_funding_cumulative: string;
|
|
79
79
|
net_entry_unrealized: string;
|
|
80
80
|
net_entry_cumulative: string;
|
|
81
|
+
/**
|
|
82
|
+
* Total traded volume in terms of the primary quote (i.e in terms of USDT) for this product
|
|
83
|
+
*/
|
|
84
|
+
quote_volume_cumulative: string;
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
export interface IndexerServerTx {
|
|
@@ -92,13 +96,13 @@ export interface IndexerServerTx {
|
|
|
92
96
|
|
|
93
97
|
export interface IndexerServerOrder {
|
|
94
98
|
digest: string;
|
|
95
|
-
isolated: boolean;
|
|
96
99
|
subaccount: string;
|
|
97
100
|
product_id: number;
|
|
98
101
|
submission_idx: string;
|
|
99
102
|
amount: string;
|
|
100
103
|
price_x18: string;
|
|
101
104
|
expiration: string;
|
|
105
|
+
appendix: string;
|
|
102
106
|
nonce: string;
|
|
103
107
|
base_filled: string;
|
|
104
108
|
// Includes fee
|
|
@@ -258,8 +262,8 @@ export interface IndexerServerLeaderboardRegistration {
|
|
|
258
262
|
*/
|
|
259
263
|
|
|
260
264
|
export interface IndexerServerNlpSnapshot {
|
|
261
|
-
|
|
262
|
-
|
|
265
|
+
cumulative_burn_quote: string;
|
|
266
|
+
cumulative_mint_quote: string;
|
|
263
267
|
cumulative_pnl: string;
|
|
264
268
|
cumulative_trades: string;
|
|
265
269
|
cumulative_volume: string;
|
package/src/types/serverTypes.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EIP712LeaderboardAuthenticationValues,
|
|
3
3
|
SignedTx,
|
|
4
|
-
} from '@nadohq/
|
|
4
|
+
} from '@nadohq/shared';
|
|
5
5
|
import { IndexerEventType } from './IndexerEventType';
|
|
6
6
|
import { IndexerLeaderboardRankType } from './IndexerLeaderboardType';
|
|
7
7
|
import { NadoWithdrawCollateralTx } from './NadoTx';
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
IndexerServerMarketSnapshot,
|
|
16
16
|
IndexerServerMarketSnapshotInterval,
|
|
17
17
|
IndexerServerMatchEvent,
|
|
18
|
+
IndexerServerNlpSnapshot,
|
|
18
19
|
IndexerServerOraclePrice,
|
|
19
20
|
IndexerServerOrder,
|
|
20
21
|
IndexerServerProductPayment,
|
|
21
22
|
IndexerServerProductSnapshot,
|
|
22
23
|
IndexerServerSnapshotsInterval,
|
|
23
24
|
IndexerServerTx,
|
|
24
|
-
IndexerServerNlpSnapshot,
|
|
25
25
|
} from './serverModelTypes';
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -112,9 +112,15 @@ export interface IndexerServerEventsParams {
|
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
export type IndexerServerTriggerTypeFilter =
|
|
116
|
+
| 'none'
|
|
117
|
+
| 'price_trigger'
|
|
118
|
+
| 'time_trigger';
|
|
119
|
+
|
|
115
120
|
export interface IndexerServerOrdersParams {
|
|
116
121
|
subaccount?: string;
|
|
117
122
|
product_ids?: number[];
|
|
123
|
+
trigger_types?: IndexerServerTriggerTypeFilter[];
|
|
118
124
|
digests?: string[];
|
|
119
125
|
max_time?: number;
|
|
120
126
|
limit?: number;
|
|
@@ -197,11 +203,16 @@ export interface IndexerServerNlpSnapshotsParams {
|
|
|
197
203
|
interval: IndexerServerSnapshotsInterval;
|
|
198
204
|
}
|
|
199
205
|
|
|
206
|
+
export interface IndexerServerDDAQueryParams {
|
|
207
|
+
subaccount: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
200
210
|
// Request
|
|
201
211
|
export interface IndexerServerQueryRequestByType {
|
|
202
212
|
account_snapshots: IndexerServerMultiSubaccountSnapshotsParams;
|
|
203
213
|
backlog: Record<string, never>;
|
|
204
214
|
candlesticks: IndexerServerCandlesticksParams;
|
|
215
|
+
direct_deposit_address: IndexerServerDDAQueryParams;
|
|
205
216
|
edge_candlesticks: IndexerEdgeServerCandlesticksParams;
|
|
206
217
|
edge_market_snapshots: IndexerEdgeServerMarketSnapshotsParams;
|
|
207
218
|
events: IndexerServerEventsParams;
|
|
@@ -225,7 +236,7 @@ export interface IndexerServerQueryRequestByType {
|
|
|
225
236
|
products: IndexerServerProductsParams;
|
|
226
237
|
referral_code: IndexerServerReferralCodeParams;
|
|
227
238
|
subaccounts: IndexerServerListSubaccountsParams;
|
|
228
|
-
|
|
239
|
+
quote_price: Record<string, never>;
|
|
229
240
|
nlp_snapshots: IndexerServerNlpSnapshotsParams;
|
|
230
241
|
}
|
|
231
242
|
|
|
@@ -318,7 +329,7 @@ export interface IndexerServerMatchEventsResponse {
|
|
|
318
329
|
txs: IndexerServerTx[];
|
|
319
330
|
}
|
|
320
331
|
|
|
321
|
-
export interface
|
|
332
|
+
export interface IndexerServerQuotePriceResponse {
|
|
322
333
|
price_x18: string;
|
|
323
334
|
}
|
|
324
335
|
|
|
@@ -379,6 +390,10 @@ export interface IndexerServerNlpSnapshotsResponse {
|
|
|
379
390
|
snapshots: IndexerServerNlpSnapshot[];
|
|
380
391
|
}
|
|
381
392
|
|
|
393
|
+
export interface IndexerServerDDAResponse {
|
|
394
|
+
v1_address: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
382
397
|
export interface IndexerServerBacklogResponse {
|
|
383
398
|
// Total number of transactions stored in the indexer DB
|
|
384
399
|
total_txs: string;
|
|
@@ -399,6 +414,7 @@ export interface IndexerServerQueryResponseByType {
|
|
|
399
414
|
account_snapshots: IndexerServerMultiSubaccountSnapshotsResponse;
|
|
400
415
|
backlog: IndexerServerBacklogResponse;
|
|
401
416
|
candlesticks: IndexerServerCandlesticksResponse;
|
|
417
|
+
direct_deposit_address: IndexerServerDDAResponse;
|
|
402
418
|
edge_candlesticks: IndexerEdgeServerCandlesticksResponse;
|
|
403
419
|
edge_market_snapshots: IndexerEdgeServerMarketSnapshotsResponse;
|
|
404
420
|
events: IndexerServerEventsResponse;
|
|
@@ -422,6 +438,33 @@ export interface IndexerServerQueryResponseByType {
|
|
|
422
438
|
products: IndexerServerProductsResponse;
|
|
423
439
|
referral_code: IndexerServerReferralCodeResponse;
|
|
424
440
|
subaccounts: IndexerServerListSubaccountsResponse;
|
|
425
|
-
|
|
441
|
+
quote_price: IndexerServerQuotePriceResponse;
|
|
426
442
|
nlp_snapshots: IndexerServerNlpSnapshotsResponse;
|
|
427
443
|
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* V2 API Types
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Individual ticker data from v2 indexer endpoint (server format)
|
|
451
|
+
*/
|
|
452
|
+
export interface IndexerServerV2TickerResponse {
|
|
453
|
+
product_id: number;
|
|
454
|
+
ticker_id: string;
|
|
455
|
+
base_currency: string;
|
|
456
|
+
quote_currency: string;
|
|
457
|
+
last_price: number;
|
|
458
|
+
base_volume: number;
|
|
459
|
+
quote_volume: number;
|
|
460
|
+
price_change_percent_24h: number;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Response from v2 tickers endpoint (server format)
|
|
465
|
+
* Maps ticker IDs to their respective ticker data
|
|
466
|
+
*/
|
|
467
|
+
export type IndexerServerV2TickersResponse = Record<
|
|
468
|
+
string,
|
|
469
|
+
IndexerServerV2TickerResponse
|
|
470
|
+
>;
|