@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.
- package/README.md +2 -0
- package/dist/IndexerBaseClient.cjs +608 -0
- package/dist/IndexerBaseClient.cjs.map +1 -0
- package/dist/IndexerBaseClient.d.cts +183 -0
- package/dist/IndexerBaseClient.d.ts +183 -0
- package/dist/IndexerBaseClient.js +605 -0
- package/dist/IndexerBaseClient.js.map +1 -0
- package/dist/IndexerClient.cjs +368 -0
- package/dist/IndexerClient.cjs.map +1 -0
- package/dist/IndexerClient.d.cts +50 -0
- package/dist/IndexerClient.d.ts +50 -0
- package/dist/IndexerClient.js +348 -0
- package/dist/IndexerClient.js.map +1 -0
- package/dist/dataMappers.cjs +324 -0
- package/dist/dataMappers.cjs.map +1 -0
- package/dist/dataMappers.d.cts +31 -0
- package/dist/dataMappers.d.ts +31 -0
- package/dist/dataMappers.js +296 -0
- package/dist/dataMappers.js.map +1 -0
- package/dist/endpoints.cjs +35 -0
- package/dist/endpoints.cjs.map +1 -0
- package/dist/endpoints.d.cts +5 -0
- package/dist/endpoints.d.ts +5 -0
- package/dist/endpoints.js +10 -0
- package/dist/endpoints.js.map +1 -0
- package/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/types/CandlestickPeriod.cjs +42 -0
- package/dist/types/CandlestickPeriod.cjs.map +1 -0
- package/dist/types/CandlestickPeriod.d.cts +13 -0
- package/dist/types/CandlestickPeriod.d.ts +13 -0
- package/dist/types/CandlestickPeriod.js +17 -0
- package/dist/types/CandlestickPeriod.js.map +1 -0
- package/dist/types/IndexerEventType.cjs +19 -0
- package/dist/types/IndexerEventType.cjs.map +1 -0
- package/dist/types/IndexerEventType.d.cts +3 -0
- package/dist/types/IndexerEventType.d.ts +3 -0
- package/dist/types/IndexerEventType.js +1 -0
- package/dist/types/IndexerEventType.js.map +1 -0
- package/dist/types/IndexerLeaderboardType.cjs +19 -0
- package/dist/types/IndexerLeaderboardType.cjs.map +1 -0
- package/dist/types/IndexerLeaderboardType.d.cts +3 -0
- package/dist/types/IndexerLeaderboardType.d.ts +3 -0
- package/dist/types/IndexerLeaderboardType.js +1 -0
- package/dist/types/IndexerLeaderboardType.js.map +1 -0
- package/dist/types/NadoTx.cjs +19 -0
- package/dist/types/NadoTx.cjs.map +1 -0
- package/dist/types/NadoTx.d.cts +49 -0
- package/dist/types/NadoTx.d.ts +49 -0
- package/dist/types/NadoTx.js +1 -0
- package/dist/types/NadoTx.js.map +1 -0
- package/dist/types/clientTypes.cjs +19 -0
- package/dist/types/clientTypes.cjs.map +1 -0
- package/dist/types/clientTypes.d.cts +467 -0
- package/dist/types/clientTypes.d.ts +467 -0
- package/dist/types/clientTypes.js +1 -0
- package/dist/types/clientTypes.js.map +1 -0
- package/dist/types/collateralEventType.cjs +19 -0
- package/dist/types/collateralEventType.cjs.map +1 -0
- package/dist/types/collateralEventType.d.cts +3 -0
- package/dist/types/collateralEventType.d.ts +3 -0
- package/dist/types/collateralEventType.js +1 -0
- package/dist/types/collateralEventType.js.map +1 -0
- package/dist/types/index.cjs +41 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +13 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/paginatedEventsTypes.cjs +19 -0
- package/dist/types/paginatedEventsTypes.cjs.map +1 -0
- package/dist/types/paginatedEventsTypes.d.cts +115 -0
- package/dist/types/paginatedEventsTypes.d.ts +115 -0
- package/dist/types/paginatedEventsTypes.js +1 -0
- package/dist/types/paginatedEventsTypes.js.map +1 -0
- package/dist/types/serverModelTypes.cjs +19 -0
- package/dist/types/serverModelTypes.cjs.map +1 -0
- package/dist/types/serverModelTypes.d.cts +224 -0
- package/dist/types/serverModelTypes.d.ts +224 -0
- package/dist/types/serverModelTypes.js +1 -0
- package/dist/types/serverModelTypes.js.map +1 -0
- package/dist/types/serverTypes.cjs +19 -0
- package/dist/types/serverTypes.cjs.map +1 -0
- package/dist/types/serverTypes.d.cts +304 -0
- package/dist/types/serverTypes.d.ts +304 -0
- package/dist/types/serverTypes.js +1 -0
- package/dist/types/serverTypes.js.map +1 -0
- package/dist/utils/index.cjs +25 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +12 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/indexerBalanceValue.cjs +43 -0
- package/dist/utils/indexerBalanceValue.cjs.map +1 -0
- package/dist/utils/indexerBalanceValue.d.cts +39 -0
- package/dist/utils/indexerBalanceValue.d.ts +39 -0
- package/dist/utils/indexerBalanceValue.js +16 -0
- package/dist/utils/indexerBalanceValue.js.map +1 -0
- package/package.json +53 -0
- package/src/IndexerBaseClient.ts +851 -0
- package/src/IndexerClient.ts +468 -0
- package/src/dataMappers.ts +362 -0
- package/src/endpoints.ts +7 -0
- package/src/index.ts +4 -0
- package/src/types/CandlestickPeriod.ts +11 -0
- package/src/types/IndexerEventType.ts +9 -0
- package/src/types/IndexerLeaderboardType.ts +2 -0
- package/src/types/NadoTx.ts +63 -0
- package/src/types/clientTypes.ts +679 -0
- package/src/types/collateralEventType.ts +4 -0
- package/src/types/index.ts +9 -0
- package/src/types/paginatedEventsTypes.ts +194 -0
- package/src/types/serverModelTypes.ts +271 -0
- package/src/types/serverTypes.ts +427 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/indexerBalanceValue.ts +46 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Subaccount } from '@nadohq/contracts';
|
|
2
|
+
import { BigDecimal } from '@nadohq/utils';
|
|
3
|
+
import {
|
|
4
|
+
GetIndexerInterestFundingPaymentsParams,
|
|
5
|
+
GetIndexerInterestFundingPaymentsResponse,
|
|
6
|
+
GetIndexerLeaderboardParams,
|
|
7
|
+
GetIndexerLeaderboardResponse,
|
|
8
|
+
GetIndexerMatchEventsParams,
|
|
9
|
+
GetIndexerOrdersParams,
|
|
10
|
+
IndexerEventBalanceStateSnapshot,
|
|
11
|
+
IndexerEventPerpStateSnapshot,
|
|
12
|
+
IndexerEventSpotStateSnapshot,
|
|
13
|
+
IndexerEventWithTx,
|
|
14
|
+
IndexerMatchEvent,
|
|
15
|
+
IndexerOrder,
|
|
16
|
+
} from './clientTypes';
|
|
17
|
+
import { CollateralEventType } from './collateralEventType';
|
|
18
|
+
import { NadoTx } from './NadoTx';
|
|
19
|
+
|
|
20
|
+
export interface IndexerPaginationParams {
|
|
21
|
+
limit: number;
|
|
22
|
+
// Retrieves events inclusive of this start cursor
|
|
23
|
+
startCursor?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface IndexerPaginationMeta {
|
|
27
|
+
hasMore: boolean;
|
|
28
|
+
nextCursor?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type WithPaginationMeta = { meta: IndexerPaginationMeta };
|
|
32
|
+
|
|
33
|
+
type BaseSubaccountPaginationParams = Subaccount &
|
|
34
|
+
IndexerPaginationParams & {
|
|
35
|
+
/**
|
|
36
|
+
* If provided, only events with a timestamp in seconds <= this value will be returned
|
|
37
|
+
* Specifying `startCursor` will supercede this value
|
|
38
|
+
*/
|
|
39
|
+
maxTimestampInclusive?: number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export interface BaseIndexerPaginatedEvent extends Subaccount {
|
|
43
|
+
timestamp: BigDecimal;
|
|
44
|
+
submissionIndex: string;
|
|
45
|
+
tx: NadoTx;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface PaginatedIndexerEventsResponse<
|
|
49
|
+
T extends BaseIndexerPaginatedEvent,
|
|
50
|
+
> extends WithPaginationMeta {
|
|
51
|
+
events: T[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Collateral
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export interface GetIndexerSubaccountCollateralEventsParams
|
|
59
|
+
extends BaseSubaccountPaginationParams {
|
|
60
|
+
eventTypes?: CollateralEventType[];
|
|
61
|
+
// If not given, will return both isolated & non-iso events
|
|
62
|
+
isolated?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IndexerCollateralEvent extends BaseIndexerPaginatedEvent {
|
|
66
|
+
eventType: CollateralEventType;
|
|
67
|
+
// Positive for deposits, negative for withdrawals
|
|
68
|
+
amount: BigDecimal;
|
|
69
|
+
// The collateral balance after the event
|
|
70
|
+
newAmount: BigDecimal;
|
|
71
|
+
snapshot: IndexerEventSpotStateSnapshot;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type GetIndexerSubaccountCollateralEventsResponse =
|
|
75
|
+
PaginatedIndexerEventsResponse<IndexerCollateralEvent>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* VLP
|
|
79
|
+
*/
|
|
80
|
+
export type GetIndexerSubaccountVlpEventsParams =
|
|
81
|
+
BaseSubaccountPaginationParams;
|
|
82
|
+
|
|
83
|
+
export interface IndexerVlpEvent extends BaseIndexerPaginatedEvent {
|
|
84
|
+
vlpDelta: BigDecimal;
|
|
85
|
+
primaryQuoteDelta: BigDecimal;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type GetIndexerSubaccountVlpEventsResponse =
|
|
89
|
+
PaginatedIndexerEventsResponse<IndexerVlpEvent>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Match events
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export type GetIndexerSubaccountMatchEventParams =
|
|
96
|
+
BaseSubaccountPaginationParams &
|
|
97
|
+
Pick<GetIndexerMatchEventsParams, 'productIds' | 'isolated'>;
|
|
98
|
+
|
|
99
|
+
export type GetIndexerSubaccountMatchEventsResponse =
|
|
100
|
+
PaginatedIndexerEventsResponse<IndexerMatchEvent>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Orders
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
export type GetIndexerPaginatedOrdersParams = BaseSubaccountPaginationParams &
|
|
107
|
+
Pick<GetIndexerOrdersParams, 'productIds' | 'isolated'>;
|
|
108
|
+
|
|
109
|
+
export interface GetIndexerPaginatedOrdersResponse {
|
|
110
|
+
orders: IndexerOrder[];
|
|
111
|
+
meta: IndexerPaginationMeta;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Liquidations
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
export type GetIndexerSubaccountLiquidationEventsParams =
|
|
119
|
+
BaseSubaccountPaginationParams;
|
|
120
|
+
|
|
121
|
+
type WithIndexerEvent<
|
|
122
|
+
TData,
|
|
123
|
+
TStateType extends IndexerEventBalanceStateSnapshot,
|
|
124
|
+
> = TData & {
|
|
125
|
+
indexerEvent: IndexerEventWithTx<TStateType>;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export interface IndexerLiquidationEvent extends BaseIndexerPaginatedEvent {
|
|
129
|
+
// Either spot or perp will then be liquidated if the subaccount maint. health is below 0
|
|
130
|
+
// Both spot & perp can be liquidated in the same event from a spread liquidation
|
|
131
|
+
spot?: WithIndexerEvent<
|
|
132
|
+
{
|
|
133
|
+
// The original balance that was liquidated
|
|
134
|
+
// ex. if it was originally a short, amount is negative, but the net delta from the liquidation is positive
|
|
135
|
+
amountLiquidated: BigDecimal;
|
|
136
|
+
},
|
|
137
|
+
IndexerEventSpotStateSnapshot
|
|
138
|
+
>;
|
|
139
|
+
perp?: WithIndexerEvent<
|
|
140
|
+
{
|
|
141
|
+
// The original balance that was liquidated
|
|
142
|
+
// ex. if it was originally a short, amount is negative, but the net delta from the liquidation is positive
|
|
143
|
+
amountLiquidated: BigDecimal;
|
|
144
|
+
},
|
|
145
|
+
IndexerEventPerpStateSnapshot
|
|
146
|
+
>;
|
|
147
|
+
// Quote delta for the subaccount
|
|
148
|
+
// Only the SPOT QUOTE payment made for the liquidation. Does not include the perp vQuote balance change
|
|
149
|
+
quote: WithIndexerEvent<
|
|
150
|
+
{
|
|
151
|
+
balanceDelta: BigDecimal;
|
|
152
|
+
},
|
|
153
|
+
IndexerEventSpotStateSnapshot
|
|
154
|
+
>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export type GetIndexerSubaccountLiquidationEventsResponse =
|
|
158
|
+
PaginatedIndexerEventsResponse<IndexerLiquidationEvent>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Settlement
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
export type GetIndexerSubaccountSettlementEventsParams =
|
|
165
|
+
BaseSubaccountPaginationParams;
|
|
166
|
+
|
|
167
|
+
export interface IndexerSettlementEvent extends BaseIndexerPaginatedEvent {
|
|
168
|
+
// Quote delta for the subaccount being settled
|
|
169
|
+
quoteDelta: BigDecimal;
|
|
170
|
+
snapshot: IndexerEventPerpStateSnapshot;
|
|
171
|
+
isolated: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type GetIndexerSubaccountSettlementEventsResponse =
|
|
175
|
+
PaginatedIndexerEventsResponse<IndexerSettlementEvent>;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Interest / Funding
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
export type GetIndexerSubaccountInterestFundingPaymentsParams =
|
|
182
|
+
BaseSubaccountPaginationParams &
|
|
183
|
+
Pick<GetIndexerInterestFundingPaymentsParams, 'productIds' | 'startCursor'>;
|
|
184
|
+
|
|
185
|
+
export interface GetIndexerPaginatedInterestFundingPaymentsResponse
|
|
186
|
+
extends GetIndexerInterestFundingPaymentsResponse {
|
|
187
|
+
meta: IndexerPaginationMeta;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type GetIndexerPaginatedLeaderboardParams = IndexerPaginationParams &
|
|
191
|
+
Pick<GetIndexerLeaderboardParams, 'contestId' | 'rankType'>;
|
|
192
|
+
|
|
193
|
+
export type GetIndexerPaginatedLeaderboardResponse = WithPaginationMeta &
|
|
194
|
+
GetIndexerLeaderboardResponse;
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { EIP712OrderValues } from '@nadohq/contracts';
|
|
2
|
+
import {
|
|
3
|
+
EngineServerPerpBalance,
|
|
4
|
+
EngineServerPerpProduct,
|
|
5
|
+
EngineServerSpotBalance,
|
|
6
|
+
EngineServerSpotProduct,
|
|
7
|
+
} from '@nadohq/engine-client';
|
|
8
|
+
import { IndexerEventType } from './IndexerEventType';
|
|
9
|
+
import { NadoTx } from './NadoTx';
|
|
10
|
+
|
|
11
|
+
export interface IndexerServerSnapshotsInterval {
|
|
12
|
+
count: number;
|
|
13
|
+
// Currently accepts any granularity, time distance (in seconds) between data points
|
|
14
|
+
granularity: number;
|
|
15
|
+
max_time?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type IndexerServerProduct =
|
|
19
|
+
| {
|
|
20
|
+
spot: EngineServerSpotProduct;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
perp: EngineServerPerpProduct;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type IndexerServerBalance =
|
|
27
|
+
| {
|
|
28
|
+
spot: EngineServerSpotBalance;
|
|
29
|
+
}
|
|
30
|
+
| {
|
|
31
|
+
perp: EngineServerPerpBalance;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Candlesticks
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
export interface IndexerServerCandlestick {
|
|
39
|
+
product_id: number;
|
|
40
|
+
granularity: string;
|
|
41
|
+
submission_idx: string;
|
|
42
|
+
timestamp: string;
|
|
43
|
+
open_x18: string;
|
|
44
|
+
high_x18: string;
|
|
45
|
+
low_x18: string;
|
|
46
|
+
close_x18: string;
|
|
47
|
+
volume: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Product snapshots
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export interface IndexerServerProductSnapshot {
|
|
55
|
+
product_id: number;
|
|
56
|
+
submission_idx: string;
|
|
57
|
+
product: IndexerServerProduct;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Base Events
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
export interface IndexerServerEvent {
|
|
65
|
+
subaccount: string;
|
|
66
|
+
isolated: boolean;
|
|
67
|
+
// The product ID associated with the isolated perp market. This is only used when product_id === QUOTE_PRODUCT_ID and isolated === true
|
|
68
|
+
isolated_product_id: number | null;
|
|
69
|
+
product_id: number;
|
|
70
|
+
submission_idx: string;
|
|
71
|
+
event_type: IndexerEventType;
|
|
72
|
+
pre_balance: IndexerServerBalance;
|
|
73
|
+
post_balance: IndexerServerBalance;
|
|
74
|
+
product: IndexerServerProduct;
|
|
75
|
+
net_interest_unrealized: string;
|
|
76
|
+
net_interest_cumulative: string;
|
|
77
|
+
net_funding_unrealized: string;
|
|
78
|
+
net_funding_cumulative: string;
|
|
79
|
+
net_entry_unrealized: string;
|
|
80
|
+
net_entry_cumulative: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface IndexerServerTx {
|
|
84
|
+
submission_idx: string;
|
|
85
|
+
timestamp: string;
|
|
86
|
+
tx: NadoTx;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Orders
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
export interface IndexerServerOrder {
|
|
94
|
+
digest: string;
|
|
95
|
+
isolated: boolean;
|
|
96
|
+
subaccount: string;
|
|
97
|
+
product_id: number;
|
|
98
|
+
submission_idx: string;
|
|
99
|
+
amount: string;
|
|
100
|
+
price_x18: string;
|
|
101
|
+
expiration: string;
|
|
102
|
+
nonce: string;
|
|
103
|
+
base_filled: string;
|
|
104
|
+
// Includes fee
|
|
105
|
+
quote_filled: string;
|
|
106
|
+
// Includes sequencer fee
|
|
107
|
+
fee: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Match events
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
export interface IndexerServerMatchEvent {
|
|
115
|
+
digest: string;
|
|
116
|
+
isolated: boolean;
|
|
117
|
+
order: EIP712OrderValues;
|
|
118
|
+
base_filled: string;
|
|
119
|
+
// Includes fee
|
|
120
|
+
quote_filled: string;
|
|
121
|
+
// Includes sequencer fee
|
|
122
|
+
fee: string;
|
|
123
|
+
sequencer_fee: string;
|
|
124
|
+
cumulative_fee: string;
|
|
125
|
+
cumulative_base_filled: string;
|
|
126
|
+
cumulative_quote_filled: string;
|
|
127
|
+
submission_idx: string;
|
|
128
|
+
net_entry_unrealized: string;
|
|
129
|
+
net_entry_cumulative: string;
|
|
130
|
+
pre_balance: IndexerServerMatchEventBalances;
|
|
131
|
+
post_balance: IndexerServerMatchEventBalances;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface IndexerServerMatchEventBalances {
|
|
135
|
+
base: IndexerServerBalance;
|
|
136
|
+
// Quote is defined if 0 is included in `product_ids` and the match event is a spot event
|
|
137
|
+
quote?: IndexerServerBalance;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Oracle price
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
export interface IndexerServerOraclePrice {
|
|
145
|
+
product_id: number;
|
|
146
|
+
oracle_price_x18: string;
|
|
147
|
+
update_time: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Market snapshots
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
export interface IndexerServerMarketSnapshotInterval {
|
|
155
|
+
count: number;
|
|
156
|
+
// Currently accepts any granularity, time distance (in seconds) between data points
|
|
157
|
+
granularity: number;
|
|
158
|
+
max_time?: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface IndexerServerMarketSnapshot {
|
|
162
|
+
timestamp: string;
|
|
163
|
+
cumulative_users: string;
|
|
164
|
+
daily_active_users: string;
|
|
165
|
+
tvl: string;
|
|
166
|
+
// Keyed by product ID -> decimal value in string (i.e. no decimal adjustment) necessary
|
|
167
|
+
// Backend serializes hashmaps with string keys
|
|
168
|
+
cumulative_volumes: Record<string, string>;
|
|
169
|
+
cumulative_taker_fees: Record<string, string>;
|
|
170
|
+
cumulative_sequencer_fees: Record<string, string>;
|
|
171
|
+
cumulative_maker_fees: Record<string, string>;
|
|
172
|
+
cumulative_trades: Record<string, string>;
|
|
173
|
+
cumulative_liquidation_amounts: Record<string, string>;
|
|
174
|
+
open_interests: Record<string, string>;
|
|
175
|
+
total_deposits: Record<string, string>;
|
|
176
|
+
total_borrows: Record<string, string>;
|
|
177
|
+
funding_rates: Record<string, string>;
|
|
178
|
+
deposit_rates: Record<string, string>;
|
|
179
|
+
borrow_rates: Record<string, string>;
|
|
180
|
+
cumulative_trade_sizes: Record<string, string>;
|
|
181
|
+
cumulative_inflows: Record<string, string>;
|
|
182
|
+
cumulative_outflows: Record<string, string>;
|
|
183
|
+
oracle_prices: Record<string, string>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Interest / funding
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
export interface IndexerServerProductPayment {
|
|
191
|
+
product_id: number;
|
|
192
|
+
idx: string;
|
|
193
|
+
timestamp: string;
|
|
194
|
+
amount: string;
|
|
195
|
+
balance_amount: string;
|
|
196
|
+
rate_x18: string;
|
|
197
|
+
oracle_price_x18: string;
|
|
198
|
+
isolated: boolean;
|
|
199
|
+
isolated_product_id: number | null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Maker stats
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
export interface IndexerServerMakerData {
|
|
207
|
+
timestamp: string;
|
|
208
|
+
maker_fee: string;
|
|
209
|
+
uptime: string;
|
|
210
|
+
sum_q_min: string;
|
|
211
|
+
q_score: string;
|
|
212
|
+
maker_share: string;
|
|
213
|
+
expected_maker_reward: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface IndexerServerMaker {
|
|
217
|
+
address: string;
|
|
218
|
+
data: IndexerServerMakerData[];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Leaderboard
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
export interface IndexerServerLeaderboardPosition {
|
|
226
|
+
subaccount: string;
|
|
227
|
+
contest_id: number;
|
|
228
|
+
pnl: string;
|
|
229
|
+
pnl_rank: string;
|
|
230
|
+
roi: string;
|
|
231
|
+
roi_rank: string;
|
|
232
|
+
account_value: string;
|
|
233
|
+
volume?: string;
|
|
234
|
+
update_time: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface IndexerServerLeaderboardContest {
|
|
238
|
+
contest_id: number;
|
|
239
|
+
start_time: string;
|
|
240
|
+
end_time: string;
|
|
241
|
+
timeframe: string;
|
|
242
|
+
count: string;
|
|
243
|
+
threshold: string;
|
|
244
|
+
volume_threshold: string;
|
|
245
|
+
product_ids: number[];
|
|
246
|
+
last_updated: string;
|
|
247
|
+
active: boolean;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface IndexerServerLeaderboardRegistration {
|
|
251
|
+
subaccount: string;
|
|
252
|
+
contest_id: number;
|
|
253
|
+
update_time: string;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* VLP
|
|
258
|
+
*/
|
|
259
|
+
|
|
260
|
+
export interface IndexerServerVlpSnapshot {
|
|
261
|
+
cumulative_burn_usdc: string;
|
|
262
|
+
cumulative_mint_usdc: string;
|
|
263
|
+
cumulative_pnl: string;
|
|
264
|
+
cumulative_trades: string;
|
|
265
|
+
cumulative_volume: string;
|
|
266
|
+
depositors: string;
|
|
267
|
+
oracle_price_x18: string;
|
|
268
|
+
submission_idx: string;
|
|
269
|
+
timestamp: string;
|
|
270
|
+
tvl: string;
|
|
271
|
+
}
|