@nadohq/indexer-client 0.1.0-alpha.3 → 0.1.0-alpha.31
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 +73 -62
- package/dist/IndexerBaseClient.cjs.map +1 -1
- package/dist/IndexerBaseClient.d.cts +8 -4
- package/dist/IndexerBaseClient.d.ts +8 -4
- package/dist/IndexerBaseClient.js +26 -14
- 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 +62 -13
- package/dist/types/clientTypes.d.ts +62 -13
- 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 +28 -5
- package/dist/types/serverTypes.d.ts +28 -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 +41 -20
- 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 +73 -14
- 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 +38 -5
- package/src/utils/indexerBalanceValue.ts +1 -1
package/src/index.ts
CHANGED
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;
|
|
@@ -678,8 +678,67 @@ export interface GetIndexerBacklogResponse {
|
|
|
678
678
|
txsPerSecond: BigDecimal | null;
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
-
export
|
|
681
|
+
export interface GetIndexerSubaccountDDAParams {
|
|
682
|
+
subaccount: Subaccount;
|
|
683
|
+
}
|
|
682
684
|
|
|
683
685
|
export interface GetIndexerSubaccountDDAResponse {
|
|
684
|
-
address:
|
|
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;
|
|
685
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;
|
|
@@ -230,7 +236,7 @@ export interface IndexerServerQueryRequestByType {
|
|
|
230
236
|
products: IndexerServerProductsParams;
|
|
231
237
|
referral_code: IndexerServerReferralCodeParams;
|
|
232
238
|
subaccounts: IndexerServerListSubaccountsParams;
|
|
233
|
-
|
|
239
|
+
quote_price: Record<string, never>;
|
|
234
240
|
nlp_snapshots: IndexerServerNlpSnapshotsParams;
|
|
235
241
|
}
|
|
236
242
|
|
|
@@ -323,7 +329,7 @@ export interface IndexerServerMatchEventsResponse {
|
|
|
323
329
|
txs: IndexerServerTx[];
|
|
324
330
|
}
|
|
325
331
|
|
|
326
|
-
export interface
|
|
332
|
+
export interface IndexerServerQuotePriceResponse {
|
|
327
333
|
price_x18: string;
|
|
328
334
|
}
|
|
329
335
|
|
|
@@ -432,6 +438,33 @@ export interface IndexerServerQueryResponseByType {
|
|
|
432
438
|
products: IndexerServerProductsResponse;
|
|
433
439
|
referral_code: IndexerServerReferralCodeResponse;
|
|
434
440
|
subaccounts: IndexerServerListSubaccountsResponse;
|
|
435
|
-
|
|
441
|
+
quote_price: IndexerServerQuotePriceResponse;
|
|
436
442
|
nlp_snapshots: IndexerServerNlpSnapshotsResponse;
|
|
437
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
|
+
>;
|