@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,115 @@
|
|
|
1
|
+
import { GetIndexerMatchEventsParams, IndexerMatchEvent, IndexerEventSpotStateSnapshot, GetIndexerOrdersParams, IndexerOrder, IndexerEventPerpStateSnapshot, IndexerEventBalanceStateSnapshot, IndexerEventWithTx, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardResponse } from './clientTypes.cjs';
|
|
2
|
+
import { Subaccount } from '@nadohq/contracts';
|
|
3
|
+
import { BigDecimal } from '@nadohq/utils';
|
|
4
|
+
import { CollateralEventType } from './collateralEventType.cjs';
|
|
5
|
+
import { NadoTx } from './NadoTx.cjs';
|
|
6
|
+
import './serverTypes.cjs';
|
|
7
|
+
import './serverModelTypes.cjs';
|
|
8
|
+
import './CandlestickPeriod.cjs';
|
|
9
|
+
import './IndexerEventType.cjs';
|
|
10
|
+
import './IndexerLeaderboardType.cjs';
|
|
11
|
+
import 'viem';
|
|
12
|
+
import '@nadohq/engine-client';
|
|
13
|
+
|
|
14
|
+
interface IndexerPaginationParams {
|
|
15
|
+
limit: number;
|
|
16
|
+
startCursor?: string;
|
|
17
|
+
}
|
|
18
|
+
interface IndexerPaginationMeta {
|
|
19
|
+
hasMore: boolean;
|
|
20
|
+
nextCursor?: string;
|
|
21
|
+
}
|
|
22
|
+
type WithPaginationMeta = {
|
|
23
|
+
meta: IndexerPaginationMeta;
|
|
24
|
+
};
|
|
25
|
+
type BaseSubaccountPaginationParams = Subaccount & IndexerPaginationParams & {
|
|
26
|
+
/**
|
|
27
|
+
* If provided, only events with a timestamp in seconds <= this value will be returned
|
|
28
|
+
* Specifying `startCursor` will supercede this value
|
|
29
|
+
*/
|
|
30
|
+
maxTimestampInclusive?: number;
|
|
31
|
+
};
|
|
32
|
+
interface BaseIndexerPaginatedEvent extends Subaccount {
|
|
33
|
+
timestamp: BigDecimal;
|
|
34
|
+
submissionIndex: string;
|
|
35
|
+
tx: NadoTx;
|
|
36
|
+
}
|
|
37
|
+
interface PaginatedIndexerEventsResponse<T extends BaseIndexerPaginatedEvent> extends WithPaginationMeta {
|
|
38
|
+
events: T[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Collateral
|
|
42
|
+
*/
|
|
43
|
+
interface GetIndexerSubaccountCollateralEventsParams extends BaseSubaccountPaginationParams {
|
|
44
|
+
eventTypes?: CollateralEventType[];
|
|
45
|
+
isolated?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface IndexerCollateralEvent extends BaseIndexerPaginatedEvent {
|
|
48
|
+
eventType: CollateralEventType;
|
|
49
|
+
amount: BigDecimal;
|
|
50
|
+
newAmount: BigDecimal;
|
|
51
|
+
snapshot: IndexerEventSpotStateSnapshot;
|
|
52
|
+
}
|
|
53
|
+
type GetIndexerSubaccountCollateralEventsResponse = PaginatedIndexerEventsResponse<IndexerCollateralEvent>;
|
|
54
|
+
/**
|
|
55
|
+
* VLP
|
|
56
|
+
*/
|
|
57
|
+
type GetIndexerSubaccountVlpEventsParams = BaseSubaccountPaginationParams;
|
|
58
|
+
interface IndexerVlpEvent extends BaseIndexerPaginatedEvent {
|
|
59
|
+
vlpDelta: BigDecimal;
|
|
60
|
+
primaryQuoteDelta: BigDecimal;
|
|
61
|
+
}
|
|
62
|
+
type GetIndexerSubaccountVlpEventsResponse = PaginatedIndexerEventsResponse<IndexerVlpEvent>;
|
|
63
|
+
/**
|
|
64
|
+
* Match events
|
|
65
|
+
*/
|
|
66
|
+
type GetIndexerSubaccountMatchEventParams = BaseSubaccountPaginationParams & Pick<GetIndexerMatchEventsParams, 'productIds' | 'isolated'>;
|
|
67
|
+
type GetIndexerSubaccountMatchEventsResponse = PaginatedIndexerEventsResponse<IndexerMatchEvent>;
|
|
68
|
+
/**
|
|
69
|
+
* Orders
|
|
70
|
+
*/
|
|
71
|
+
type GetIndexerPaginatedOrdersParams = BaseSubaccountPaginationParams & Pick<GetIndexerOrdersParams, 'productIds' | 'isolated'>;
|
|
72
|
+
interface GetIndexerPaginatedOrdersResponse {
|
|
73
|
+
orders: IndexerOrder[];
|
|
74
|
+
meta: IndexerPaginationMeta;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Liquidations
|
|
78
|
+
*/
|
|
79
|
+
type GetIndexerSubaccountLiquidationEventsParams = BaseSubaccountPaginationParams;
|
|
80
|
+
type WithIndexerEvent<TData, TStateType extends IndexerEventBalanceStateSnapshot> = TData & {
|
|
81
|
+
indexerEvent: IndexerEventWithTx<TStateType>;
|
|
82
|
+
};
|
|
83
|
+
interface IndexerLiquidationEvent extends BaseIndexerPaginatedEvent {
|
|
84
|
+
spot?: WithIndexerEvent<{
|
|
85
|
+
amountLiquidated: BigDecimal;
|
|
86
|
+
}, IndexerEventSpotStateSnapshot>;
|
|
87
|
+
perp?: WithIndexerEvent<{
|
|
88
|
+
amountLiquidated: BigDecimal;
|
|
89
|
+
}, IndexerEventPerpStateSnapshot>;
|
|
90
|
+
quote: WithIndexerEvent<{
|
|
91
|
+
balanceDelta: BigDecimal;
|
|
92
|
+
}, IndexerEventSpotStateSnapshot>;
|
|
93
|
+
}
|
|
94
|
+
type GetIndexerSubaccountLiquidationEventsResponse = PaginatedIndexerEventsResponse<IndexerLiquidationEvent>;
|
|
95
|
+
/**
|
|
96
|
+
* Settlement
|
|
97
|
+
*/
|
|
98
|
+
type GetIndexerSubaccountSettlementEventsParams = BaseSubaccountPaginationParams;
|
|
99
|
+
interface IndexerSettlementEvent extends BaseIndexerPaginatedEvent {
|
|
100
|
+
quoteDelta: BigDecimal;
|
|
101
|
+
snapshot: IndexerEventPerpStateSnapshot;
|
|
102
|
+
isolated: boolean;
|
|
103
|
+
}
|
|
104
|
+
type GetIndexerSubaccountSettlementEventsResponse = PaginatedIndexerEventsResponse<IndexerSettlementEvent>;
|
|
105
|
+
/**
|
|
106
|
+
* Interest / Funding
|
|
107
|
+
*/
|
|
108
|
+
type GetIndexerSubaccountInterestFundingPaymentsParams = BaseSubaccountPaginationParams & Pick<GetIndexerInterestFundingPaymentsParams, 'productIds' | 'startCursor'>;
|
|
109
|
+
interface GetIndexerPaginatedInterestFundingPaymentsResponse extends GetIndexerInterestFundingPaymentsResponse {
|
|
110
|
+
meta: IndexerPaginationMeta;
|
|
111
|
+
}
|
|
112
|
+
type GetIndexerPaginatedLeaderboardParams = IndexerPaginationParams & Pick<GetIndexerLeaderboardParams, 'contestId' | 'rankType'>;
|
|
113
|
+
type GetIndexerPaginatedLeaderboardResponse = WithPaginationMeta & GetIndexerLeaderboardResponse;
|
|
114
|
+
|
|
115
|
+
export type { BaseIndexerPaginatedEvent, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountVlpEventsParams, GetIndexerSubaccountVlpEventsResponse, IndexerCollateralEvent, IndexerLiquidationEvent, IndexerPaginationMeta, IndexerPaginationParams, IndexerSettlementEvent, IndexerVlpEvent, PaginatedIndexerEventsResponse, WithPaginationMeta };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { GetIndexerMatchEventsParams, IndexerMatchEvent, IndexerEventSpotStateSnapshot, GetIndexerOrdersParams, IndexerOrder, IndexerEventPerpStateSnapshot, IndexerEventBalanceStateSnapshot, IndexerEventWithTx, GetIndexerInterestFundingPaymentsParams, GetIndexerInterestFundingPaymentsResponse, GetIndexerLeaderboardParams, GetIndexerLeaderboardResponse } from './clientTypes.js';
|
|
2
|
+
import { Subaccount } from '@nadohq/contracts';
|
|
3
|
+
import { BigDecimal } from '@nadohq/utils';
|
|
4
|
+
import { CollateralEventType } from './collateralEventType.js';
|
|
5
|
+
import { NadoTx } from './NadoTx.js';
|
|
6
|
+
import './serverTypes.js';
|
|
7
|
+
import './serverModelTypes.js';
|
|
8
|
+
import './CandlestickPeriod.js';
|
|
9
|
+
import './IndexerEventType.js';
|
|
10
|
+
import './IndexerLeaderboardType.js';
|
|
11
|
+
import 'viem';
|
|
12
|
+
import '@nadohq/engine-client';
|
|
13
|
+
|
|
14
|
+
interface IndexerPaginationParams {
|
|
15
|
+
limit: number;
|
|
16
|
+
startCursor?: string;
|
|
17
|
+
}
|
|
18
|
+
interface IndexerPaginationMeta {
|
|
19
|
+
hasMore: boolean;
|
|
20
|
+
nextCursor?: string;
|
|
21
|
+
}
|
|
22
|
+
type WithPaginationMeta = {
|
|
23
|
+
meta: IndexerPaginationMeta;
|
|
24
|
+
};
|
|
25
|
+
type BaseSubaccountPaginationParams = Subaccount & IndexerPaginationParams & {
|
|
26
|
+
/**
|
|
27
|
+
* If provided, only events with a timestamp in seconds <= this value will be returned
|
|
28
|
+
* Specifying `startCursor` will supercede this value
|
|
29
|
+
*/
|
|
30
|
+
maxTimestampInclusive?: number;
|
|
31
|
+
};
|
|
32
|
+
interface BaseIndexerPaginatedEvent extends Subaccount {
|
|
33
|
+
timestamp: BigDecimal;
|
|
34
|
+
submissionIndex: string;
|
|
35
|
+
tx: NadoTx;
|
|
36
|
+
}
|
|
37
|
+
interface PaginatedIndexerEventsResponse<T extends BaseIndexerPaginatedEvent> extends WithPaginationMeta {
|
|
38
|
+
events: T[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Collateral
|
|
42
|
+
*/
|
|
43
|
+
interface GetIndexerSubaccountCollateralEventsParams extends BaseSubaccountPaginationParams {
|
|
44
|
+
eventTypes?: CollateralEventType[];
|
|
45
|
+
isolated?: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface IndexerCollateralEvent extends BaseIndexerPaginatedEvent {
|
|
48
|
+
eventType: CollateralEventType;
|
|
49
|
+
amount: BigDecimal;
|
|
50
|
+
newAmount: BigDecimal;
|
|
51
|
+
snapshot: IndexerEventSpotStateSnapshot;
|
|
52
|
+
}
|
|
53
|
+
type GetIndexerSubaccountCollateralEventsResponse = PaginatedIndexerEventsResponse<IndexerCollateralEvent>;
|
|
54
|
+
/**
|
|
55
|
+
* VLP
|
|
56
|
+
*/
|
|
57
|
+
type GetIndexerSubaccountVlpEventsParams = BaseSubaccountPaginationParams;
|
|
58
|
+
interface IndexerVlpEvent extends BaseIndexerPaginatedEvent {
|
|
59
|
+
vlpDelta: BigDecimal;
|
|
60
|
+
primaryQuoteDelta: BigDecimal;
|
|
61
|
+
}
|
|
62
|
+
type GetIndexerSubaccountVlpEventsResponse = PaginatedIndexerEventsResponse<IndexerVlpEvent>;
|
|
63
|
+
/**
|
|
64
|
+
* Match events
|
|
65
|
+
*/
|
|
66
|
+
type GetIndexerSubaccountMatchEventParams = BaseSubaccountPaginationParams & Pick<GetIndexerMatchEventsParams, 'productIds' | 'isolated'>;
|
|
67
|
+
type GetIndexerSubaccountMatchEventsResponse = PaginatedIndexerEventsResponse<IndexerMatchEvent>;
|
|
68
|
+
/**
|
|
69
|
+
* Orders
|
|
70
|
+
*/
|
|
71
|
+
type GetIndexerPaginatedOrdersParams = BaseSubaccountPaginationParams & Pick<GetIndexerOrdersParams, 'productIds' | 'isolated'>;
|
|
72
|
+
interface GetIndexerPaginatedOrdersResponse {
|
|
73
|
+
orders: IndexerOrder[];
|
|
74
|
+
meta: IndexerPaginationMeta;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Liquidations
|
|
78
|
+
*/
|
|
79
|
+
type GetIndexerSubaccountLiquidationEventsParams = BaseSubaccountPaginationParams;
|
|
80
|
+
type WithIndexerEvent<TData, TStateType extends IndexerEventBalanceStateSnapshot> = TData & {
|
|
81
|
+
indexerEvent: IndexerEventWithTx<TStateType>;
|
|
82
|
+
};
|
|
83
|
+
interface IndexerLiquidationEvent extends BaseIndexerPaginatedEvent {
|
|
84
|
+
spot?: WithIndexerEvent<{
|
|
85
|
+
amountLiquidated: BigDecimal;
|
|
86
|
+
}, IndexerEventSpotStateSnapshot>;
|
|
87
|
+
perp?: WithIndexerEvent<{
|
|
88
|
+
amountLiquidated: BigDecimal;
|
|
89
|
+
}, IndexerEventPerpStateSnapshot>;
|
|
90
|
+
quote: WithIndexerEvent<{
|
|
91
|
+
balanceDelta: BigDecimal;
|
|
92
|
+
}, IndexerEventSpotStateSnapshot>;
|
|
93
|
+
}
|
|
94
|
+
type GetIndexerSubaccountLiquidationEventsResponse = PaginatedIndexerEventsResponse<IndexerLiquidationEvent>;
|
|
95
|
+
/**
|
|
96
|
+
* Settlement
|
|
97
|
+
*/
|
|
98
|
+
type GetIndexerSubaccountSettlementEventsParams = BaseSubaccountPaginationParams;
|
|
99
|
+
interface IndexerSettlementEvent extends BaseIndexerPaginatedEvent {
|
|
100
|
+
quoteDelta: BigDecimal;
|
|
101
|
+
snapshot: IndexerEventPerpStateSnapshot;
|
|
102
|
+
isolated: boolean;
|
|
103
|
+
}
|
|
104
|
+
type GetIndexerSubaccountSettlementEventsResponse = PaginatedIndexerEventsResponse<IndexerSettlementEvent>;
|
|
105
|
+
/**
|
|
106
|
+
* Interest / Funding
|
|
107
|
+
*/
|
|
108
|
+
type GetIndexerSubaccountInterestFundingPaymentsParams = BaseSubaccountPaginationParams & Pick<GetIndexerInterestFundingPaymentsParams, 'productIds' | 'startCursor'>;
|
|
109
|
+
interface GetIndexerPaginatedInterestFundingPaymentsResponse extends GetIndexerInterestFundingPaymentsResponse {
|
|
110
|
+
meta: IndexerPaginationMeta;
|
|
111
|
+
}
|
|
112
|
+
type GetIndexerPaginatedLeaderboardParams = IndexerPaginationParams & Pick<GetIndexerLeaderboardParams, 'contestId' | 'rankType'>;
|
|
113
|
+
type GetIndexerPaginatedLeaderboardResponse = WithPaginationMeta & GetIndexerLeaderboardResponse;
|
|
114
|
+
|
|
115
|
+
export type { BaseIndexerPaginatedEvent, GetIndexerPaginatedInterestFundingPaymentsResponse, GetIndexerPaginatedLeaderboardParams, GetIndexerPaginatedLeaderboardResponse, GetIndexerPaginatedOrdersParams, GetIndexerPaginatedOrdersResponse, GetIndexerSubaccountCollateralEventsParams, GetIndexerSubaccountCollateralEventsResponse, GetIndexerSubaccountInterestFundingPaymentsParams, GetIndexerSubaccountLiquidationEventsParams, GetIndexerSubaccountLiquidationEventsResponse, GetIndexerSubaccountMatchEventParams, GetIndexerSubaccountMatchEventsResponse, GetIndexerSubaccountSettlementEventsParams, GetIndexerSubaccountSettlementEventsResponse, GetIndexerSubaccountVlpEventsParams, GetIndexerSubaccountVlpEventsResponse, IndexerCollateralEvent, IndexerLiquidationEvent, IndexerPaginationMeta, IndexerPaginationParams, IndexerSettlementEvent, IndexerVlpEvent, PaginatedIndexerEventsResponse, WithPaginationMeta };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=paginatedEventsTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/types/serverModelTypes.ts
|
|
17
|
+
var serverModelTypes_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(serverModelTypes_exports);
|
|
19
|
+
//# sourceMappingURL=serverModelTypes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/serverModelTypes.ts"],"sourcesContent":["import { EIP712OrderValues } from '@nadohq/contracts';\nimport {\n EngineServerPerpBalance,\n EngineServerPerpProduct,\n EngineServerSpotBalance,\n EngineServerSpotProduct,\n} from '@nadohq/engine-client';\nimport { IndexerEventType } from './IndexerEventType';\nimport { NadoTx } from './NadoTx';\n\nexport interface IndexerServerSnapshotsInterval {\n count: number;\n // Currently accepts any granularity, time distance (in seconds) between data points\n granularity: number;\n max_time?: string;\n}\n\nexport type IndexerServerProduct =\n | {\n spot: EngineServerSpotProduct;\n }\n | {\n perp: EngineServerPerpProduct;\n };\n\nexport type IndexerServerBalance =\n | {\n spot: EngineServerSpotBalance;\n }\n | {\n perp: EngineServerPerpBalance;\n };\n\n/**\n * Candlesticks\n */\n\nexport interface IndexerServerCandlestick {\n product_id: number;\n granularity: string;\n submission_idx: string;\n timestamp: string;\n open_x18: string;\n high_x18: string;\n low_x18: string;\n close_x18: string;\n volume: string;\n}\n\n/**\n * Product snapshots\n */\n\nexport interface IndexerServerProductSnapshot {\n product_id: number;\n submission_idx: string;\n product: IndexerServerProduct;\n}\n\n/**\n * Base Events\n */\n\nexport interface IndexerServerEvent {\n subaccount: string;\n isolated: boolean;\n // The product ID associated with the isolated perp market. This is only used when product_id === QUOTE_PRODUCT_ID and isolated === true\n isolated_product_id: number | null;\n product_id: number;\n submission_idx: string;\n event_type: IndexerEventType;\n pre_balance: IndexerServerBalance;\n post_balance: IndexerServerBalance;\n product: IndexerServerProduct;\n net_interest_unrealized: string;\n net_interest_cumulative: string;\n net_funding_unrealized: string;\n net_funding_cumulative: string;\n net_entry_unrealized: string;\n net_entry_cumulative: string;\n}\n\nexport interface IndexerServerTx {\n submission_idx: string;\n timestamp: string;\n tx: NadoTx;\n}\n\n/**\n * Orders\n */\n\nexport interface IndexerServerOrder {\n digest: string;\n isolated: boolean;\n subaccount: string;\n product_id: number;\n submission_idx: string;\n amount: string;\n price_x18: string;\n expiration: string;\n nonce: string;\n base_filled: string;\n // Includes fee\n quote_filled: string;\n // Includes sequencer fee\n fee: string;\n}\n\n/**\n * Match events\n */\n\nexport interface IndexerServerMatchEvent {\n digest: string;\n isolated: boolean;\n order: EIP712OrderValues;\n base_filled: string;\n // Includes fee\n quote_filled: string;\n // Includes sequencer fee\n fee: string;\n sequencer_fee: string;\n cumulative_fee: string;\n cumulative_base_filled: string;\n cumulative_quote_filled: string;\n submission_idx: string;\n net_entry_unrealized: string;\n net_entry_cumulative: string;\n pre_balance: IndexerServerMatchEventBalances;\n post_balance: IndexerServerMatchEventBalances;\n}\n\nexport interface IndexerServerMatchEventBalances {\n base: IndexerServerBalance;\n // Quote is defined if 0 is included in `product_ids` and the match event is a spot event\n quote?: IndexerServerBalance;\n}\n\n/**\n * Oracle price\n */\n\nexport interface IndexerServerOraclePrice {\n product_id: number;\n oracle_price_x18: string;\n update_time: number;\n}\n\n/**\n * Market snapshots\n */\n\nexport interface IndexerServerMarketSnapshotInterval {\n count: number;\n // Currently accepts any granularity, time distance (in seconds) between data points\n granularity: number;\n max_time?: string;\n}\n\nexport interface IndexerServerMarketSnapshot {\n timestamp: string;\n cumulative_users: string;\n daily_active_users: string;\n tvl: string;\n // Keyed by product ID -> decimal value in string (i.e. no decimal adjustment) necessary\n // Backend serializes hashmaps with string keys\n cumulative_volumes: Record<string, string>;\n cumulative_taker_fees: Record<string, string>;\n cumulative_sequencer_fees: Record<string, string>;\n cumulative_maker_fees: Record<string, string>;\n cumulative_trades: Record<string, string>;\n cumulative_liquidation_amounts: Record<string, string>;\n open_interests: Record<string, string>;\n total_deposits: Record<string, string>;\n total_borrows: Record<string, string>;\n funding_rates: Record<string, string>;\n deposit_rates: Record<string, string>;\n borrow_rates: Record<string, string>;\n cumulative_trade_sizes: Record<string, string>;\n cumulative_inflows: Record<string, string>;\n cumulative_outflows: Record<string, string>;\n oracle_prices: Record<string, string>;\n}\n\n/**\n * Interest / funding\n */\n\nexport interface IndexerServerProductPayment {\n product_id: number;\n idx: string;\n timestamp: string;\n amount: string;\n balance_amount: string;\n rate_x18: string;\n oracle_price_x18: string;\n isolated: boolean;\n isolated_product_id: number | null;\n}\n\n/**\n * Maker stats\n */\n\nexport interface IndexerServerMakerData {\n timestamp: string;\n maker_fee: string;\n uptime: string;\n sum_q_min: string;\n q_score: string;\n maker_share: string;\n expected_maker_reward: string;\n}\n\nexport interface IndexerServerMaker {\n address: string;\n data: IndexerServerMakerData[];\n}\n\n/**\n * Leaderboard\n */\n\nexport interface IndexerServerLeaderboardPosition {\n subaccount: string;\n contest_id: number;\n pnl: string;\n pnl_rank: string;\n roi: string;\n roi_rank: string;\n account_value: string;\n volume?: string;\n update_time: string;\n}\n\nexport interface IndexerServerLeaderboardContest {\n contest_id: number;\n start_time: string;\n end_time: string;\n timeframe: string;\n count: string;\n threshold: string;\n volume_threshold: string;\n product_ids: number[];\n last_updated: string;\n active: boolean;\n}\n\nexport interface IndexerServerLeaderboardRegistration {\n subaccount: string;\n contest_id: number;\n update_time: string;\n}\n\n/**\n * VLP\n */\n\nexport interface IndexerServerVlpSnapshot {\n cumulative_burn_usdc: string;\n cumulative_mint_usdc: string;\n cumulative_pnl: string;\n cumulative_trades: string;\n cumulative_volume: string;\n depositors: string;\n oracle_price_x18: string;\n submission_idx: string;\n timestamp: string;\n tvl: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { EIP712OrderValues } from '@nadohq/contracts';
|
|
2
|
+
import { EngineServerSpotBalance, EngineServerPerpBalance, EngineServerSpotProduct, EngineServerPerpProduct } from '@nadohq/engine-client';
|
|
3
|
+
import { IndexerEventType } from './IndexerEventType.cjs';
|
|
4
|
+
import { NadoTx } from './NadoTx.cjs';
|
|
5
|
+
|
|
6
|
+
interface IndexerServerSnapshotsInterval {
|
|
7
|
+
count: number;
|
|
8
|
+
granularity: number;
|
|
9
|
+
max_time?: string;
|
|
10
|
+
}
|
|
11
|
+
type IndexerServerProduct = {
|
|
12
|
+
spot: EngineServerSpotProduct;
|
|
13
|
+
} | {
|
|
14
|
+
perp: EngineServerPerpProduct;
|
|
15
|
+
};
|
|
16
|
+
type IndexerServerBalance = {
|
|
17
|
+
spot: EngineServerSpotBalance;
|
|
18
|
+
} | {
|
|
19
|
+
perp: EngineServerPerpBalance;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Candlesticks
|
|
23
|
+
*/
|
|
24
|
+
interface IndexerServerCandlestick {
|
|
25
|
+
product_id: number;
|
|
26
|
+
granularity: string;
|
|
27
|
+
submission_idx: string;
|
|
28
|
+
timestamp: string;
|
|
29
|
+
open_x18: string;
|
|
30
|
+
high_x18: string;
|
|
31
|
+
low_x18: string;
|
|
32
|
+
close_x18: string;
|
|
33
|
+
volume: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Product snapshots
|
|
37
|
+
*/
|
|
38
|
+
interface IndexerServerProductSnapshot {
|
|
39
|
+
product_id: number;
|
|
40
|
+
submission_idx: string;
|
|
41
|
+
product: IndexerServerProduct;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Base Events
|
|
45
|
+
*/
|
|
46
|
+
interface IndexerServerEvent {
|
|
47
|
+
subaccount: string;
|
|
48
|
+
isolated: boolean;
|
|
49
|
+
isolated_product_id: number | null;
|
|
50
|
+
product_id: number;
|
|
51
|
+
submission_idx: string;
|
|
52
|
+
event_type: IndexerEventType;
|
|
53
|
+
pre_balance: IndexerServerBalance;
|
|
54
|
+
post_balance: IndexerServerBalance;
|
|
55
|
+
product: IndexerServerProduct;
|
|
56
|
+
net_interest_unrealized: string;
|
|
57
|
+
net_interest_cumulative: string;
|
|
58
|
+
net_funding_unrealized: string;
|
|
59
|
+
net_funding_cumulative: string;
|
|
60
|
+
net_entry_unrealized: string;
|
|
61
|
+
net_entry_cumulative: string;
|
|
62
|
+
}
|
|
63
|
+
interface IndexerServerTx {
|
|
64
|
+
submission_idx: string;
|
|
65
|
+
timestamp: string;
|
|
66
|
+
tx: NadoTx;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Orders
|
|
70
|
+
*/
|
|
71
|
+
interface IndexerServerOrder {
|
|
72
|
+
digest: string;
|
|
73
|
+
isolated: boolean;
|
|
74
|
+
subaccount: string;
|
|
75
|
+
product_id: number;
|
|
76
|
+
submission_idx: string;
|
|
77
|
+
amount: string;
|
|
78
|
+
price_x18: string;
|
|
79
|
+
expiration: string;
|
|
80
|
+
nonce: string;
|
|
81
|
+
base_filled: string;
|
|
82
|
+
quote_filled: string;
|
|
83
|
+
fee: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Match events
|
|
87
|
+
*/
|
|
88
|
+
interface IndexerServerMatchEvent {
|
|
89
|
+
digest: string;
|
|
90
|
+
isolated: boolean;
|
|
91
|
+
order: EIP712OrderValues;
|
|
92
|
+
base_filled: string;
|
|
93
|
+
quote_filled: string;
|
|
94
|
+
fee: string;
|
|
95
|
+
sequencer_fee: string;
|
|
96
|
+
cumulative_fee: string;
|
|
97
|
+
cumulative_base_filled: string;
|
|
98
|
+
cumulative_quote_filled: string;
|
|
99
|
+
submission_idx: string;
|
|
100
|
+
net_entry_unrealized: string;
|
|
101
|
+
net_entry_cumulative: string;
|
|
102
|
+
pre_balance: IndexerServerMatchEventBalances;
|
|
103
|
+
post_balance: IndexerServerMatchEventBalances;
|
|
104
|
+
}
|
|
105
|
+
interface IndexerServerMatchEventBalances {
|
|
106
|
+
base: IndexerServerBalance;
|
|
107
|
+
quote?: IndexerServerBalance;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Oracle price
|
|
111
|
+
*/
|
|
112
|
+
interface IndexerServerOraclePrice {
|
|
113
|
+
product_id: number;
|
|
114
|
+
oracle_price_x18: string;
|
|
115
|
+
update_time: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Market snapshots
|
|
119
|
+
*/
|
|
120
|
+
interface IndexerServerMarketSnapshotInterval {
|
|
121
|
+
count: number;
|
|
122
|
+
granularity: number;
|
|
123
|
+
max_time?: string;
|
|
124
|
+
}
|
|
125
|
+
interface IndexerServerMarketSnapshot {
|
|
126
|
+
timestamp: string;
|
|
127
|
+
cumulative_users: string;
|
|
128
|
+
daily_active_users: string;
|
|
129
|
+
tvl: string;
|
|
130
|
+
cumulative_volumes: Record<string, string>;
|
|
131
|
+
cumulative_taker_fees: Record<string, string>;
|
|
132
|
+
cumulative_sequencer_fees: Record<string, string>;
|
|
133
|
+
cumulative_maker_fees: Record<string, string>;
|
|
134
|
+
cumulative_trades: Record<string, string>;
|
|
135
|
+
cumulative_liquidation_amounts: Record<string, string>;
|
|
136
|
+
open_interests: Record<string, string>;
|
|
137
|
+
total_deposits: Record<string, string>;
|
|
138
|
+
total_borrows: Record<string, string>;
|
|
139
|
+
funding_rates: Record<string, string>;
|
|
140
|
+
deposit_rates: Record<string, string>;
|
|
141
|
+
borrow_rates: Record<string, string>;
|
|
142
|
+
cumulative_trade_sizes: Record<string, string>;
|
|
143
|
+
cumulative_inflows: Record<string, string>;
|
|
144
|
+
cumulative_outflows: Record<string, string>;
|
|
145
|
+
oracle_prices: Record<string, string>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Interest / funding
|
|
149
|
+
*/
|
|
150
|
+
interface IndexerServerProductPayment {
|
|
151
|
+
product_id: number;
|
|
152
|
+
idx: string;
|
|
153
|
+
timestamp: string;
|
|
154
|
+
amount: string;
|
|
155
|
+
balance_amount: string;
|
|
156
|
+
rate_x18: string;
|
|
157
|
+
oracle_price_x18: string;
|
|
158
|
+
isolated: boolean;
|
|
159
|
+
isolated_product_id: number | null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Maker stats
|
|
163
|
+
*/
|
|
164
|
+
interface IndexerServerMakerData {
|
|
165
|
+
timestamp: string;
|
|
166
|
+
maker_fee: string;
|
|
167
|
+
uptime: string;
|
|
168
|
+
sum_q_min: string;
|
|
169
|
+
q_score: string;
|
|
170
|
+
maker_share: string;
|
|
171
|
+
expected_maker_reward: string;
|
|
172
|
+
}
|
|
173
|
+
interface IndexerServerMaker {
|
|
174
|
+
address: string;
|
|
175
|
+
data: IndexerServerMakerData[];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Leaderboard
|
|
179
|
+
*/
|
|
180
|
+
interface IndexerServerLeaderboardPosition {
|
|
181
|
+
subaccount: string;
|
|
182
|
+
contest_id: number;
|
|
183
|
+
pnl: string;
|
|
184
|
+
pnl_rank: string;
|
|
185
|
+
roi: string;
|
|
186
|
+
roi_rank: string;
|
|
187
|
+
account_value: string;
|
|
188
|
+
volume?: string;
|
|
189
|
+
update_time: string;
|
|
190
|
+
}
|
|
191
|
+
interface IndexerServerLeaderboardContest {
|
|
192
|
+
contest_id: number;
|
|
193
|
+
start_time: string;
|
|
194
|
+
end_time: string;
|
|
195
|
+
timeframe: string;
|
|
196
|
+
count: string;
|
|
197
|
+
threshold: string;
|
|
198
|
+
volume_threshold: string;
|
|
199
|
+
product_ids: number[];
|
|
200
|
+
last_updated: string;
|
|
201
|
+
active: boolean;
|
|
202
|
+
}
|
|
203
|
+
interface IndexerServerLeaderboardRegistration {
|
|
204
|
+
subaccount: string;
|
|
205
|
+
contest_id: number;
|
|
206
|
+
update_time: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* VLP
|
|
210
|
+
*/
|
|
211
|
+
interface IndexerServerVlpSnapshot {
|
|
212
|
+
cumulative_burn_usdc: string;
|
|
213
|
+
cumulative_mint_usdc: string;
|
|
214
|
+
cumulative_pnl: string;
|
|
215
|
+
cumulative_trades: string;
|
|
216
|
+
cumulative_volume: string;
|
|
217
|
+
depositors: string;
|
|
218
|
+
oracle_price_x18: string;
|
|
219
|
+
submission_idx: string;
|
|
220
|
+
timestamp: string;
|
|
221
|
+
tvl: string;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export type { IndexerServerBalance, IndexerServerCandlestick, IndexerServerEvent, IndexerServerLeaderboardContest, IndexerServerLeaderboardPosition, IndexerServerLeaderboardRegistration, IndexerServerMaker, IndexerServerMakerData, IndexerServerMarketSnapshot, IndexerServerMarketSnapshotInterval, IndexerServerMatchEvent, IndexerServerMatchEventBalances, IndexerServerOraclePrice, IndexerServerOrder, IndexerServerProduct, IndexerServerProductPayment, IndexerServerProductSnapshot, IndexerServerSnapshotsInterval, IndexerServerTx, IndexerServerVlpSnapshot };
|