@0xmonaco/types 1.1.5 → 1.1.6
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 +1 -3
- package/dist/analytics/builders.d.ts +135 -0
- package/dist/analytics/builders.js +11 -0
- package/dist/analytics/index.d.ts +153 -0
- package/dist/analytics/index.js +27 -0
- package/dist/analytics/wallets.d.ts +197 -0
- package/dist/analytics/wallets.js +16 -0
- package/dist/applications/requests.d.ts +5 -5
- package/dist/buildercodes/index.d.ts +13 -11
- package/dist/buildercodes/responses.d.ts +1 -0
- package/dist/buildercodes/responses.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/margin-accounts/index.d.ts +7 -2
- package/dist/market/index.d.ts +0 -20
- package/dist/profile/index.d.ts +10 -17
- package/dist/rfq/responses.d.ts +36 -0
- package/dist/rfq/responses.js +29 -0
- package/dist/sdk/index.d.ts +4 -1
- package/dist/trading/index.d.ts +7 -3
- package/dist/trading/orders.d.ts +11 -0
- package/dist/trading/responses.d.ts +9 -3
- package/dist/validation/margin-accounts.d.ts +2 -2
- package/dist/validation/margin-accounts.js +5 -5
- package/dist/validation/trading.d.ts +15 -0
- package/dist/validation/trading.js +34 -42
- package/dist/websocket/base.d.ts +40 -10
- package/dist/websocket/client.d.ts +32 -4
- package/dist/websocket/depth.d.ts +142 -0
- package/dist/websocket/depth.js +13 -0
- package/dist/websocket/events/orderbook-events.d.ts +41 -1
- package/dist/websocket/events/rfq-events.d.ts +30 -1
- package/dist/websocket/events/trade-events.d.ts +37 -0
- package/dist/websocket/index.d.ts +1 -0
- package/dist/websocket/index.js +1 -0
- package/dist/websocket/snapshots.d.ts +23 -1
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +16 -0
- package/dist/wire/schema.d.ts +2344 -276
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -170,7 +170,7 @@ interface TradingAPI extends BaseAPI {
|
|
|
170
170
|
type OrderSide = "BUY" | "SELL";
|
|
171
171
|
type OrderType = "LIMIT" | "MARKET";
|
|
172
172
|
type OrderStatus = "SUBMITTED" | "PARTIALLY_FILLED" | "FILLED" | "SETTLED_ON_CHAIN" | "SETTLED" | "CANCELLED" | "REJECTED" | "EXPIRED";
|
|
173
|
-
type TradingMode = "SPOT";
|
|
173
|
+
type TradingMode = "SPOT" | "MARGIN";
|
|
174
174
|
type TimeInForce = "GTC" | "IOC" | "FOK"; // GTC: Good Till Cancel, IOC: Immediate or Cancel, FOK: Fill or Kill
|
|
175
175
|
|
|
176
176
|
// Trading response types
|
|
@@ -237,8 +237,6 @@ interface TradingPair {
|
|
|
237
237
|
marketType: TradingMode;
|
|
238
238
|
category: string;
|
|
239
239
|
isActive: boolean;
|
|
240
|
-
makerFeeBps: number;
|
|
241
|
-
takerFeeBps: number;
|
|
242
240
|
minOrderSize: string;
|
|
243
241
|
maxOrderSize: string;
|
|
244
242
|
quantityStepSize: string;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder Analytics Types
|
|
3
|
+
*
|
|
4
|
+
* The public builder directory, lookup, figures and leaderboard. A builder is
|
|
5
|
+
* an application, or a display group that shows several applications as one.
|
|
6
|
+
* Builders the explorer does not display are left out of every list, and a
|
|
7
|
+
* lookup of one fails with 404 exactly as an unknown key.
|
|
8
|
+
*
|
|
9
|
+
* Fees here are the builder's own add-ons (taker plus maker), never the
|
|
10
|
+
* protocol taker fee. USD amounts are decimal strings (USDC 1:1).
|
|
11
|
+
*/
|
|
12
|
+
import type { AnalyticsWindow, AnalyticsWindowParams } from "./index";
|
|
13
|
+
/** A builder's kind. */
|
|
14
|
+
export type BuilderKind = "application" | "group";
|
|
15
|
+
/** The display group an application is shown under. */
|
|
16
|
+
export interface BuilderGroupRef {
|
|
17
|
+
/** Display group UUID; `getBuilder(id)` answers the group. */
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
/** The group's display code; `null` when it has none. */
|
|
21
|
+
code?: string | null;
|
|
22
|
+
}
|
|
23
|
+
/** One application behind a builder. */
|
|
24
|
+
export interface BuilderApplication {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
/** On-chain client id the application's deposits carry. */
|
|
28
|
+
clientId: string;
|
|
29
|
+
/** Whether the application can place new orders. */
|
|
30
|
+
active: boolean;
|
|
31
|
+
/** Archived applications are left out of the directory but keep their figures. */
|
|
32
|
+
archived: boolean;
|
|
33
|
+
/** Taker add-on the application charges, in basis points. */
|
|
34
|
+
additionalTakerFeeBps: number;
|
|
35
|
+
/** Maker add-on the application charges, in basis points. */
|
|
36
|
+
additionalMakerFeeBps: number;
|
|
37
|
+
/** Whether this is the exchange's default application: the one a sign-in that names no client id is placed under. */
|
|
38
|
+
isDefault: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** A builder's identity. */
|
|
41
|
+
export interface Builder {
|
|
42
|
+
/** Application UUID, or display group UUID when `kind` is `group`. */
|
|
43
|
+
id: string;
|
|
44
|
+
kind: BuilderKind | (string & {});
|
|
45
|
+
name: string;
|
|
46
|
+
/** Short display code (also a lookup key); `null` when unset. */
|
|
47
|
+
code?: string | null;
|
|
48
|
+
/** Display color, `#rrggbb` or `#rrggbbaa`; `null` when unset. */
|
|
49
|
+
color?: string | null;
|
|
50
|
+
verified: boolean;
|
|
51
|
+
/** For an application shown under a display group: that group; `null` otherwise. */
|
|
52
|
+
group?: BuilderGroupRef | null;
|
|
53
|
+
/**
|
|
54
|
+
* The application itself, or the group's displayed applications. Builder
|
|
55
|
+
* attribution on other responses may send this empty.
|
|
56
|
+
*/
|
|
57
|
+
applications: BuilderApplication[];
|
|
58
|
+
}
|
|
59
|
+
/** A builder's figures over a window or one bucket. */
|
|
60
|
+
export interface BuilderFigures {
|
|
61
|
+
/** Taker volume in USD of the trades the builder's applications took. */
|
|
62
|
+
volumeUsd: string;
|
|
63
|
+
/** The spot part of `volumeUsd`. */
|
|
64
|
+
spotVolumeUsd: string;
|
|
65
|
+
/** The perpetual (margin) part of `volumeUsd`. */
|
|
66
|
+
perpVolumeUsd: string;
|
|
67
|
+
/** Trades the builder's applications took. */
|
|
68
|
+
tradesCount: number;
|
|
69
|
+
/** The builder's add-on revenue: `takerFeesUsd` plus `makerFeesUsd`. */
|
|
70
|
+
feesUsd: string;
|
|
71
|
+
/** Taker add-ons on the trades it took. */
|
|
72
|
+
takerFeesUsd: string;
|
|
73
|
+
/** Maker add-ons on the trades it made, whoever took them. */
|
|
74
|
+
makerFeesUsd: string;
|
|
75
|
+
/** USDC deposited through the builder's applications, in USD (1:1); other tokens are unvalued. */
|
|
76
|
+
depositsUsd: string;
|
|
77
|
+
/** USDC withdrawals the builder's applications initiated, in USD (1:1); attributed by the initiating application. */
|
|
78
|
+
withdrawalsUsd: string;
|
|
79
|
+
/** `depositsUsd` less `withdrawalsUsd`; negative when more left than arrived. */
|
|
80
|
+
netFlowUsd: string;
|
|
81
|
+
}
|
|
82
|
+
/** Every displayed builder, by name. */
|
|
83
|
+
export interface ListBuildersResponse {
|
|
84
|
+
builders: Builder[];
|
|
85
|
+
}
|
|
86
|
+
/** One builder. */
|
|
87
|
+
export interface GetBuilderResponse {
|
|
88
|
+
builder: Builder;
|
|
89
|
+
}
|
|
90
|
+
/** A builder's figures over a window. */
|
|
91
|
+
export interface GetBuilderTotalsResponse extends BuilderFigures {
|
|
92
|
+
window: AnalyticsWindow;
|
|
93
|
+
builder: Builder;
|
|
94
|
+
/** Distinct taker wallets that traded through the builder, each once. */
|
|
95
|
+
activeTakers: number;
|
|
96
|
+
/** Wallets whose first trade through one of its applications fell in the window, once per (application, wallet). */
|
|
97
|
+
newTraders: number;
|
|
98
|
+
}
|
|
99
|
+
/** A builder's figures for one bucket. */
|
|
100
|
+
export interface BuilderSeriesPoint extends BuilderFigures {
|
|
101
|
+
/** Bucket start as Unix milliseconds (UTC; weeks start Monday). */
|
|
102
|
+
bucketStart: number;
|
|
103
|
+
activeTakers: number;
|
|
104
|
+
newTraders: number;
|
|
105
|
+
}
|
|
106
|
+
/** A builder's figures per bucket over a window. */
|
|
107
|
+
export interface GetBuilderSeriesResponse {
|
|
108
|
+
window: AnalyticsWindow;
|
|
109
|
+
builder: Builder;
|
|
110
|
+
/** One point per bucket, oldest first; a bucket without trades carries zeros. */
|
|
111
|
+
points: BuilderSeriesPoint[];
|
|
112
|
+
}
|
|
113
|
+
/** Parameters for {@link AnalyticsAPI.listBuilderLeaderboard}. */
|
|
114
|
+
export interface ListBuilderLeaderboardParams extends AnalyticsWindowParams {
|
|
115
|
+
/** Builders to return, largest volume first (1-100, default 25). */
|
|
116
|
+
limit?: number;
|
|
117
|
+
}
|
|
118
|
+
/** One builder's row on the leaderboard; a display group ranks as one. A builder that only took deposits ranks with zero volume. */
|
|
119
|
+
export interface BuilderLeaderboardRow extends BuilderFigures {
|
|
120
|
+
builder: Builder;
|
|
121
|
+
newTraders: number;
|
|
122
|
+
/**
|
|
123
|
+
* Distinct taker wallets that traded through the builder, each once. With
|
|
124
|
+
* `window: "all"`, every wallet that ever traded through it. `null` for a
|
|
125
|
+
* window counted in hours that starts before the 90 days its hourly sets
|
|
126
|
+
* are kept.
|
|
127
|
+
*/
|
|
128
|
+
activeTakers?: number | null;
|
|
129
|
+
}
|
|
130
|
+
/** Displayed builders ranked by volume over a window. */
|
|
131
|
+
export interface ListBuilderLeaderboardResponse {
|
|
132
|
+
window: AnalyticsWindow;
|
|
133
|
+
/** Largest volume first (ties by builder id), up to `limit`. */
|
|
134
|
+
rows: BuilderLeaderboardRow[];
|
|
135
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder Analytics Types
|
|
3
|
+
*
|
|
4
|
+
* The public builder directory, lookup, figures and leaderboard. A builder is
|
|
5
|
+
* an application, or a display group that shows several applications as one.
|
|
6
|
+
* Builders the explorer does not display are left out of every list, and a
|
|
7
|
+
* lookup of one fails with 404 exactly as an unknown key.
|
|
8
|
+
*
|
|
9
|
+
* Fees here are the builder's own add-ons (taker plus maker), never the
|
|
10
|
+
* protocol taker fee. USD amounts are decimal strings (USDC 1:1).
|
|
11
|
+
*/
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public explorer analytics: protocol totals and series over a
|
|
5
|
+
* window, per-market volume, and the treasury's all-time net fees; and the
|
|
6
|
+
* builder directory, figures and leaderboard (see `./builders`).
|
|
7
|
+
*
|
|
8
|
+
* Windows: `window` is `24h`, `7d`, `30d`, `all` or `custom`, ending at
|
|
9
|
+
* `endTime` (default now). The server picks the bucket size from the window's
|
|
10
|
+
* length (hour up to 2.5 days, day up to 45 days, week beyond) and counts
|
|
11
|
+
* every bucket whose start lies in `[startTime, endTime]`; buckets are UTC and
|
|
12
|
+
* weeks start Monday.
|
|
13
|
+
*
|
|
14
|
+
* Volume, trade counts and the spot/perp split count the builders the
|
|
15
|
+
* explorer displays only. Fees, active takers, new traders and per-market
|
|
16
|
+
* volume count every trade. USD amounts are decimal strings (USDC 1:1).
|
|
17
|
+
*
|
|
18
|
+
* Custody: deposits, withdrawals, net flow and total value locked count USDC
|
|
19
|
+
* only (1:1); other tokens are unvalued. A withdrawal counts when initiated.
|
|
20
|
+
* TVL is the USDC custody (deposits less initiated withdrawals, never below
|
|
21
|
+
* zero) at a point, `null` before any custody was folded.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: These endpoints are **public (unauthenticated)** and rate limited per
|
|
24
|
+
* client IP.
|
|
25
|
+
*/
|
|
26
|
+
import type { BaseAPI } from "../api";
|
|
27
|
+
import type { GetBuilderResponse, GetBuilderSeriesResponse, GetBuilderTotalsResponse, ListBuilderLeaderboardParams, ListBuilderLeaderboardResponse, ListBuildersResponse } from "./builders";
|
|
28
|
+
import type { WalletCustodyAnalyticsAPI } from "./wallets";
|
|
29
|
+
export * from "./builders";
|
|
30
|
+
export * from "./wallets";
|
|
31
|
+
/** A window key. */
|
|
32
|
+
export type AnalyticsWindowKey = "24h" | "7d" | "30d" | "all" | "custom";
|
|
33
|
+
/** A bucket size. */
|
|
34
|
+
export type AnalyticsGranularity = "hour" | "day" | "week";
|
|
35
|
+
/** The window a request covers. */
|
|
36
|
+
export interface AnalyticsWindowParams {
|
|
37
|
+
/** Window key (default `24h`). */
|
|
38
|
+
window?: AnalyticsWindowKey;
|
|
39
|
+
/** Custom window start as Unix milliseconds; required with `custom`, rejected otherwise. */
|
|
40
|
+
startTime?: number;
|
|
41
|
+
/** Window end as Unix milliseconds (default now); any window may end in the past, but one counted in hours (2.5 days or shorter) must start within the last 90 days. */
|
|
42
|
+
endTime?: number;
|
|
43
|
+
}
|
|
44
|
+
/** The window a response covers, as the server resolved it. */
|
|
45
|
+
export interface AnalyticsWindow {
|
|
46
|
+
/** Window start as Unix milliseconds; buckets starting at or after it count. */
|
|
47
|
+
startTime: number;
|
|
48
|
+
/** Window end as Unix milliseconds; buckets starting at or before it count (the bucket holding it is usually partial). */
|
|
49
|
+
endTime: number;
|
|
50
|
+
/** Bucket size the window is counted in. */
|
|
51
|
+
granularity: AnalyticsGranularity | (string & {});
|
|
52
|
+
}
|
|
53
|
+
/** Protocol figures over a window or one bucket. */
|
|
54
|
+
export interface ProtocolFigures {
|
|
55
|
+
/** Taker volume in USD routed by the displayed builders; hidden builders' trades are not counted. */
|
|
56
|
+
volumeUsd: string;
|
|
57
|
+
/** The spot part of `volumeUsd` (displayed builders only). */
|
|
58
|
+
spotVolumeUsd: string;
|
|
59
|
+
/** The perpetual (margin) part of `volumeUsd` (displayed builders only). */
|
|
60
|
+
perpVolumeUsd: string;
|
|
61
|
+
/** Trades routed by the displayed builders. */
|
|
62
|
+
tradesCount: number;
|
|
63
|
+
/** Protocol taker fees in USD over every trade, all builders included; excludes builder add-ons and maker fees. */
|
|
64
|
+
protocolFeesUsd: string;
|
|
65
|
+
/** Distinct taker wallets that traded (each once), all builders included. */
|
|
66
|
+
activeTakers: number;
|
|
67
|
+
/** Wallets whose first trade through a builder fell inside, once per (builder, wallet), all builders included. */
|
|
68
|
+
newTraders: number;
|
|
69
|
+
}
|
|
70
|
+
/** USDC custody flow over a window or one bucket, in USD (1:1). */
|
|
71
|
+
export interface CustodyFlows {
|
|
72
|
+
/** USDC deposited. */
|
|
73
|
+
depositsUsd: string;
|
|
74
|
+
/** USDC withdrawals initiated. */
|
|
75
|
+
withdrawalsUsd: string;
|
|
76
|
+
/** `depositsUsd` less `withdrawalsUsd`; negative when more left than arrived. */
|
|
77
|
+
netFlowUsd: string;
|
|
78
|
+
}
|
|
79
|
+
/** Protocol totals over a window. */
|
|
80
|
+
export interface GetProtocolTotalsResponse extends ProtocolFigures, CustodyFlows {
|
|
81
|
+
window: AnalyticsWindow;
|
|
82
|
+
/** Total value locked in USD at the end of the window (the end of the bucket holding `endTime`); `null` before any custody was folded. */
|
|
83
|
+
tvlUsd?: string | null;
|
|
84
|
+
/** Total value locked in USD at the start of the window; `tvlUsd` less this is the window's change. `null` before any custody was folded. */
|
|
85
|
+
openingTvlUsd?: string | null;
|
|
86
|
+
/** Distinct wallets that took a trade, received a deposit or were paid out a withdrawal initiated in the window (by payout address), each once. */
|
|
87
|
+
activeAccounts: number;
|
|
88
|
+
}
|
|
89
|
+
/** Protocol figures for one bucket. */
|
|
90
|
+
export interface ProtocolSeriesPoint extends ProtocolFigures, CustodyFlows {
|
|
91
|
+
/** Bucket start as Unix milliseconds (UTC; weeks start Monday). */
|
|
92
|
+
bucketStart: number;
|
|
93
|
+
/** Total value locked in USD at the end of the bucket, carried across buckets without movement; `null` before any custody was folded. */
|
|
94
|
+
tvlUsd?: string | null;
|
|
95
|
+
}
|
|
96
|
+
/** Protocol figures per bucket over a window. */
|
|
97
|
+
export interface GetProtocolSeriesResponse {
|
|
98
|
+
window: AnalyticsWindow;
|
|
99
|
+
/** One point per bucket, oldest first; a bucket without trades carries zeros. */
|
|
100
|
+
points: ProtocolSeriesPoint[];
|
|
101
|
+
}
|
|
102
|
+
/** Parameters for {@link AnalyticsAPI.listMarketVolumes}. */
|
|
103
|
+
export interface ListMarketVolumesParams extends AnalyticsWindowParams {
|
|
104
|
+
/** Markets to return, largest volume first (1-100, default 25). */
|
|
105
|
+
limit?: number;
|
|
106
|
+
}
|
|
107
|
+
/** One market's figures over a window, all builders included. Resolve the symbol from the trading pairs listing. */
|
|
108
|
+
export interface MarketVolume {
|
|
109
|
+
tradingPairId: string;
|
|
110
|
+
/** Taker volume in USD over every trade in the market. */
|
|
111
|
+
volumeUsd: string;
|
|
112
|
+
/** Protocol taker fees in USD. */
|
|
113
|
+
protocolFeesUsd: string;
|
|
114
|
+
/** Trades in the market. */
|
|
115
|
+
tradesCount: number;
|
|
116
|
+
}
|
|
117
|
+
/** Volume per market over a window. */
|
|
118
|
+
export interface ListMarketVolumesResponse {
|
|
119
|
+
window: AnalyticsWindow;
|
|
120
|
+
/** Markets that traded, largest volume first, up to `limit`. */
|
|
121
|
+
markets: MarketVolume[];
|
|
122
|
+
}
|
|
123
|
+
/** The treasury's all-time net fees (not windowed). */
|
|
124
|
+
export interface GetTreasuryNetFeesResponse {
|
|
125
|
+
/** Net protocol fees in USD: the treasury's net protocol fee (taker fees less maker rebates) plus the insurance fund's liquidation fees, less BuilderCodes payouts and TraderCodes rewards; negative when payouts exceed fees. */
|
|
126
|
+
netFeesUsd: string;
|
|
127
|
+
/** When the first counted fee landed, as Unix milliseconds; null before any. */
|
|
128
|
+
countingSince?: number | null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Analytics API interface. Every endpoint is public (no auth required); each
|
|
132
|
+
* client IP has a read budget.
|
|
133
|
+
*/
|
|
134
|
+
export interface AnalyticsAPI extends BaseAPI, WalletCustodyAnalyticsAPI {
|
|
135
|
+
/** Protocol totals over a window. */
|
|
136
|
+
getProtocolTotals(params?: AnalyticsWindowParams): Promise<GetProtocolTotalsResponse>;
|
|
137
|
+
/** Protocol figures per bucket over a window, oldest first, one point per bucket. */
|
|
138
|
+
getProtocolSeries(params?: AnalyticsWindowParams): Promise<GetProtocolSeriesResponse>;
|
|
139
|
+
/** Volume per market over a window, every trade counted, largest first. */
|
|
140
|
+
listMarketVolumes(params?: ListMarketVolumesParams): Promise<ListMarketVolumesResponse>;
|
|
141
|
+
/** The treasury's all-time net fees. */
|
|
142
|
+
getTreasuryNetFees(): Promise<GetTreasuryNetFeesResponse>;
|
|
143
|
+
/** Every displayed builder, by name; archived applications left out. */
|
|
144
|
+
listBuilders(): Promise<ListBuildersResponse>;
|
|
145
|
+
/** One builder by application or group uuid, code, or client id; 404 when no displayed builder answers to it. */
|
|
146
|
+
getBuilder(builder: string): Promise<GetBuilderResponse>;
|
|
147
|
+
/** One builder's figures over a window. */
|
|
148
|
+
getBuilderTotals(builder: string, params?: AnalyticsWindowParams): Promise<GetBuilderTotalsResponse>;
|
|
149
|
+
/** One builder's figures per bucket over a window, oldest first. */
|
|
150
|
+
getBuilderSeries(builder: string, params?: AnalyticsWindowParams): Promise<GetBuilderSeriesResponse>;
|
|
151
|
+
/** Displayed builders ranked by volume over a window, a display group as one row. */
|
|
152
|
+
listBuilderLeaderboard(params?: ListBuilderLeaderboardParams): Promise<ListBuilderLeaderboardResponse>;
|
|
153
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public explorer analytics: protocol totals and series over a
|
|
5
|
+
* window, per-market volume, and the treasury's all-time net fees; and the
|
|
6
|
+
* builder directory, figures and leaderboard (see `./builders`).
|
|
7
|
+
*
|
|
8
|
+
* Windows: `window` is `24h`, `7d`, `30d`, `all` or `custom`, ending at
|
|
9
|
+
* `endTime` (default now). The server picks the bucket size from the window's
|
|
10
|
+
* length (hour up to 2.5 days, day up to 45 days, week beyond) and counts
|
|
11
|
+
* every bucket whose start lies in `[startTime, endTime]`; buckets are UTC and
|
|
12
|
+
* weeks start Monday.
|
|
13
|
+
*
|
|
14
|
+
* Volume, trade counts and the spot/perp split count the builders the
|
|
15
|
+
* explorer displays only. Fees, active takers, new traders and per-market
|
|
16
|
+
* volume count every trade. USD amounts are decimal strings (USDC 1:1).
|
|
17
|
+
*
|
|
18
|
+
* Custody: deposits, withdrawals, net flow and total value locked count USDC
|
|
19
|
+
* only (1:1); other tokens are unvalued. A withdrawal counts when initiated.
|
|
20
|
+
* TVL is the USDC custody (deposits less initiated withdrawals, never below
|
|
21
|
+
* zero) at a point, `null` before any custody was folded.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: These endpoints are **public (unauthenticated)** and rate limited per
|
|
24
|
+
* client IP.
|
|
25
|
+
*/
|
|
26
|
+
export * from "./builders";
|
|
27
|
+
export * from "./wallets";
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet, custody and vault feed analytics types (0XM-3627).
|
|
3
|
+
*
|
|
4
|
+
* Wallet figures are all-time taker volume. A wallet summary folds its
|
|
5
|
+
* per-application rows through the explorer's builder display rules: a display
|
|
6
|
+
* group's applications are one row under the group, and what hidden builders
|
|
7
|
+
* carried is reported in `unattributed`.
|
|
8
|
+
*
|
|
9
|
+
* Custody counts a withdrawal when it is initiated, not when it is paid out
|
|
10
|
+
* on-chain; `pendingWithdrawalsRaw` is the initiated-but-unexecuted remainder,
|
|
11
|
+
* still physically in the vault. Only USDC is valued (1:1), and only USDC
|
|
12
|
+
* counts toward total value locked.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: These endpoints are **public (unauthenticated)** and rate limited per
|
|
15
|
+
* client IP.
|
|
16
|
+
*/
|
|
17
|
+
import type { LiquidationHistoryEvent } from "../market";
|
|
18
|
+
import type { Builder } from "./builders";
|
|
19
|
+
/** Parameters for {@link WalletCustodyAnalyticsAPI.listWalletLeaderboard}. */
|
|
20
|
+
export interface ListWalletLeaderboardParams {
|
|
21
|
+
/** Wallets to return, largest volume first (1-100, default 25). */
|
|
22
|
+
limit?: number;
|
|
23
|
+
}
|
|
24
|
+
/** One wallet's all-time taker figures. */
|
|
25
|
+
export interface WalletVolume {
|
|
26
|
+
/** Wallet address, lowercase. */
|
|
27
|
+
wallet: string;
|
|
28
|
+
/** All-time taker volume in USD (USDC 1:1). */
|
|
29
|
+
volumeUsd: string;
|
|
30
|
+
tradesCount: number;
|
|
31
|
+
/** First taker trade as Unix milliseconds. */
|
|
32
|
+
firstTradedAt: number;
|
|
33
|
+
/** Latest taker trade as Unix milliseconds. */
|
|
34
|
+
lastTradedAt: number;
|
|
35
|
+
}
|
|
36
|
+
/** Wallets by all-time taker volume, every builder counted. */
|
|
37
|
+
export interface ListWalletLeaderboardResponse {
|
|
38
|
+
/** Largest volume first (ties by wallet), up to `limit`. */
|
|
39
|
+
wallets: WalletVolume[];
|
|
40
|
+
}
|
|
41
|
+
/** A wallet's figures through one displayed builder. */
|
|
42
|
+
export interface WalletBuilderVolume {
|
|
43
|
+
/** The builder the figures are reported under; `applications` is empty. */
|
|
44
|
+
builder: Builder;
|
|
45
|
+
volumeUsd: string;
|
|
46
|
+
tradesCount: number;
|
|
47
|
+
firstTradedAt: number;
|
|
48
|
+
lastTradedAt: number;
|
|
49
|
+
}
|
|
50
|
+
/** What a wallet traded through builders the explorer does not display. */
|
|
51
|
+
export interface WithheldVolume {
|
|
52
|
+
volumeUsd: string;
|
|
53
|
+
tradesCount: number;
|
|
54
|
+
}
|
|
55
|
+
/** One wallet's summary. */
|
|
56
|
+
export interface GetWalletSummaryResponse {
|
|
57
|
+
/** The wallet, lowercase. */
|
|
58
|
+
wallet: string;
|
|
59
|
+
/** All-time totals over every builder; null when the wallet never took a trade. */
|
|
60
|
+
totals?: WalletVolume | null;
|
|
61
|
+
/** Per displayed builder, largest volume first. */
|
|
62
|
+
builders: WalletBuilderVolume[];
|
|
63
|
+
/** What hidden builders carried; null when they carried nothing. */
|
|
64
|
+
unattributed?: WithheldVolume | null;
|
|
65
|
+
liquidationsCount: number;
|
|
66
|
+
/** Sum of each event's size times its event-time mark, in each market's quote units (every market is USDC-quoted today). */
|
|
67
|
+
liquidationsNotional: string;
|
|
68
|
+
}
|
|
69
|
+
/** Parameters for {@link WalletCustodyAnalyticsAPI.listWalletLiquidations}. */
|
|
70
|
+
export interface ListWalletLiquidationsParams {
|
|
71
|
+
/** Events per page (1-1000, default 50). */
|
|
72
|
+
pageSize?: number;
|
|
73
|
+
/** Cursor from the previous page; bound to the wallet. */
|
|
74
|
+
pageToken?: string;
|
|
75
|
+
}
|
|
76
|
+
/** One wallet's liquidation events, every market. */
|
|
77
|
+
export interface ListWalletLiquidationsResponse {
|
|
78
|
+
/** Newest first. */
|
|
79
|
+
events: LiquidationHistoryEvent[];
|
|
80
|
+
pageSize: number;
|
|
81
|
+
/** Cursor for the next page; empty when the walk is finished. */
|
|
82
|
+
nextPageToken: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* What the vault holds of one token. Amounts are raw token units. Custody is
|
|
86
|
+
* folded into the aux database while `pendingWithdrawalsRaw` is read from core,
|
|
87
|
+
* so the two can disagree briefly while the fold lags.
|
|
88
|
+
*/
|
|
89
|
+
export interface TokenCustody {
|
|
90
|
+
/** Asset UUID; null for a token with custody flow and no listed asset. */
|
|
91
|
+
assetId?: string | null;
|
|
92
|
+
symbol?: string | null;
|
|
93
|
+
name?: string | null;
|
|
94
|
+
decimals?: number | null;
|
|
95
|
+
iconUrl?: string | null;
|
|
96
|
+
/** Token contract address, lowercase. */
|
|
97
|
+
contractAddress: string;
|
|
98
|
+
depositedRaw: string;
|
|
99
|
+
/** All-time initiated withdrawals. */
|
|
100
|
+
withdrawnRaw: string;
|
|
101
|
+
depositsCount: number;
|
|
102
|
+
withdrawalsCount: number;
|
|
103
|
+
/** Deposits less initiated withdrawals; null when not positive. */
|
|
104
|
+
custodyRaw?: string | null;
|
|
105
|
+
/** Initiated but not yet executed on-chain; the vault's physical balance is `custodyRaw` plus this. */
|
|
106
|
+
pendingWithdrawalsRaw: string;
|
|
107
|
+
/** `1` for USDC, null for every other token. */
|
|
108
|
+
referencePriceUsd?: string | null;
|
|
109
|
+
/** `custodyRaw` in USD; null without a price or a positive custody. */
|
|
110
|
+
custodyUsd?: string | null;
|
|
111
|
+
/** Whether `custodyUsd` is summed into `tvlUsd` (USDC only). */
|
|
112
|
+
countsTowardTvl: boolean;
|
|
113
|
+
}
|
|
114
|
+
/** Custody per token and total value locked. */
|
|
115
|
+
export interface ListTokenCustodyResponse {
|
|
116
|
+
/** Listed assets by symbol, then unlisted tokens with custody flow. */
|
|
117
|
+
tokens: TokenCustody[];
|
|
118
|
+
tvlUsd: string;
|
|
119
|
+
}
|
|
120
|
+
/** One token's custody. */
|
|
121
|
+
export interface GetTokenCustodyResponse {
|
|
122
|
+
token: TokenCustody;
|
|
123
|
+
}
|
|
124
|
+
/** Parameters for the vault deposit and withdrawal feeds. */
|
|
125
|
+
export interface VaultFeedParams {
|
|
126
|
+
/** Rows per page (1-1000, default 50). */
|
|
127
|
+
pageSize?: number;
|
|
128
|
+
/** Cursor from the previous page; bound to `token` and `wallet`. */
|
|
129
|
+
pageToken?: string;
|
|
130
|
+
/** Only this token's rows: an asset symbol (any case), asset UUID or contract address. A token nothing answers to lists nothing. */
|
|
131
|
+
token?: string;
|
|
132
|
+
/** Only rows whose destination (the credited account, or a withdrawal's payout address) is this wallet. */
|
|
133
|
+
wallet?: string;
|
|
134
|
+
}
|
|
135
|
+
/** One deposit into the vault. */
|
|
136
|
+
export interface VaultDeposit {
|
|
137
|
+
/** On-chain deposit index; the feed's order. */
|
|
138
|
+
onChainIndex: number;
|
|
139
|
+
txHash: string;
|
|
140
|
+
blockNumber: number;
|
|
141
|
+
/** Token contract address, lowercase. */
|
|
142
|
+
token: string;
|
|
143
|
+
assetId?: string | null;
|
|
144
|
+
symbol?: string | null;
|
|
145
|
+
amountRaw: string;
|
|
146
|
+
/** Account credited, lowercase. */
|
|
147
|
+
destination: string;
|
|
148
|
+
targetAccountType: string;
|
|
149
|
+
/** When the deposit was processed, as Unix milliseconds. */
|
|
150
|
+
depositedAt: number;
|
|
151
|
+
/** The displayed builder it came through; null when hidden or none. */
|
|
152
|
+
builder?: Builder | null;
|
|
153
|
+
}
|
|
154
|
+
/** Deposits, newest first. */
|
|
155
|
+
export interface ListVaultDepositsResponse {
|
|
156
|
+
deposits: VaultDeposit[];
|
|
157
|
+
pageSize: number;
|
|
158
|
+
nextPageToken: string;
|
|
159
|
+
}
|
|
160
|
+
/** One withdrawal from the vault, from initiation on. */
|
|
161
|
+
export interface VaultWithdrawal {
|
|
162
|
+
/** Withdrawal index, allocated in request order; the feed's order. */
|
|
163
|
+
withdrawalIndex: number;
|
|
164
|
+
token: string;
|
|
165
|
+
assetId?: string | null;
|
|
166
|
+
symbol?: string | null;
|
|
167
|
+
amountRaw: string;
|
|
168
|
+
destination: string;
|
|
169
|
+
status: "pending" | "confirmed" | "executed" | (string & {});
|
|
170
|
+
/** When the withdrawal was initiated, as Unix milliseconds. */
|
|
171
|
+
initiatedAt: number;
|
|
172
|
+
/** The displayed builder it came through; null when hidden. */
|
|
173
|
+
builder?: Builder | null;
|
|
174
|
+
}
|
|
175
|
+
/** Withdrawals, newest first. */
|
|
176
|
+
export interface ListVaultWithdrawalsResponse {
|
|
177
|
+
withdrawals: VaultWithdrawal[];
|
|
178
|
+
pageSize: number;
|
|
179
|
+
nextPageToken: string;
|
|
180
|
+
}
|
|
181
|
+
/** The wallet, custody and vault feed reads of the analytics API. */
|
|
182
|
+
export interface WalletCustodyAnalyticsAPI {
|
|
183
|
+
/** Wallets by all-time taker volume, largest first, every builder counted. */
|
|
184
|
+
listWalletLeaderboard(params?: ListWalletLeaderboardParams): Promise<ListWalletLeaderboardResponse>;
|
|
185
|
+
/** One wallet's totals, per displayed builder, and its liquidation count. A wallet that never traded answers with empty figures. */
|
|
186
|
+
getWalletSummary(wallet: string): Promise<GetWalletSummaryResponse>;
|
|
187
|
+
/** One wallet's liquidation events, newest first, every market. */
|
|
188
|
+
listWalletLiquidations(wallet: string, params?: ListWalletLiquidationsParams): Promise<ListWalletLiquidationsResponse>;
|
|
189
|
+
/** Custody per token and the total value locked. */
|
|
190
|
+
listTokenCustody(): Promise<ListTokenCustodyResponse>;
|
|
191
|
+
/** One token's custody, by symbol, asset UUID or contract address. */
|
|
192
|
+
getTokenCustody(token: string): Promise<GetTokenCustodyResponse>;
|
|
193
|
+
/** Vault deposits, newest first. */
|
|
194
|
+
listVaultDeposits(params?: VaultFeedParams): Promise<ListVaultDepositsResponse>;
|
|
195
|
+
/** Vault withdrawals, newest first, every status. */
|
|
196
|
+
listVaultWithdrawals(params?: VaultFeedParams): Promise<ListVaultWithdrawalsResponse>;
|
|
197
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet, custody and vault feed analytics types (0XM-3627).
|
|
3
|
+
*
|
|
4
|
+
* Wallet figures are all-time taker volume. A wallet summary folds its
|
|
5
|
+
* per-application rows through the explorer's builder display rules: a display
|
|
6
|
+
* group's applications are one row under the group, and what hidden builders
|
|
7
|
+
* carried is reported in `unattributed`.
|
|
8
|
+
*
|
|
9
|
+
* Custody counts a withdrawal when it is initiated, not when it is paid out
|
|
10
|
+
* on-chain; `pendingWithdrawalsRaw` is the initiated-but-unexecuted remainder,
|
|
11
|
+
* still physically in the vault. Only USDC is valued (1:1), and only USDC
|
|
12
|
+
* counts toward total value locked.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: These endpoints are **public (unauthenticated)** and rate limited per
|
|
15
|
+
* client IP.
|
|
16
|
+
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Query parameters for listing application orders.
|
|
9
9
|
*/
|
|
10
10
|
export interface ListAppOrdersParams {
|
|
11
|
-
/** Public client ID of the application to list (required). An unknown or
|
|
11
|
+
/** Public client ID of the application to list (required). An unknown, inactive or hidden one is a `404`. */
|
|
12
12
|
clientId: string;
|
|
13
13
|
/** Items per page, 1 to 1000 (default 20). Rejected if larger. */
|
|
14
14
|
pageSize?: number;
|
|
@@ -40,7 +40,7 @@ export interface ListAppOrdersParams {
|
|
|
40
40
|
* Query parameters for listing application users.
|
|
41
41
|
*/
|
|
42
42
|
export interface ListAppUsersParams {
|
|
43
|
-
/** Public client ID of the application to list (required). An unknown or
|
|
43
|
+
/** Public client ID of the application to list (required). An unknown, inactive or hidden one is a `404`. */
|
|
44
44
|
clientId: string;
|
|
45
45
|
/** Items per page, 1 to 1000 (default 20). Rejected if larger. */
|
|
46
46
|
pageSize?: number;
|
|
@@ -69,7 +69,7 @@ export interface ListAppUsersParams {
|
|
|
69
69
|
* Query parameters for listing application movements.
|
|
70
70
|
*/
|
|
71
71
|
export interface ListAppMovementsParams {
|
|
72
|
-
/** Public client ID of the application to list (required). An unknown or
|
|
72
|
+
/** Public client ID of the application to list (required). An unknown, inactive or hidden one is a `404`. */
|
|
73
73
|
clientId: string;
|
|
74
74
|
/** Items per page, 1 to 1000 (default 20). Rejected if larger. */
|
|
75
75
|
pageSize?: number;
|
|
@@ -99,7 +99,7 @@ export interface ListAppMovementsParams {
|
|
|
99
99
|
* Query parameters for listing application balances.
|
|
100
100
|
*/
|
|
101
101
|
export interface ListAppBalancesParams {
|
|
102
|
-
/** Public client ID of the application to list (required). An unknown or
|
|
102
|
+
/** Public client ID of the application to list (required). An unknown, inactive or hidden one is a `404`. */
|
|
103
103
|
clientId: string;
|
|
104
104
|
/** Items per page, 1 to 1000 (default 20). Rejected if larger. */
|
|
105
105
|
pageSize?: number;
|
|
@@ -126,7 +126,7 @@ export interface ListAppBalancesParams {
|
|
|
126
126
|
* Query parameters for application stats.
|
|
127
127
|
*/
|
|
128
128
|
export interface GetAppStatsParams {
|
|
129
|
-
/** Public client ID of the application to list (required). An unknown or
|
|
129
|
+
/** Public client ID of the application to list (required). An unknown, inactive or hidden one is a `404`. */
|
|
130
130
|
clientId: string;
|
|
131
131
|
/** ISO 8601 datetime to filter stats from (e.g. 2026-01-01T00:00:00Z). Omit for all-time. */
|
|
132
132
|
since?: string;
|
|
@@ -56,18 +56,20 @@ export interface BuildercodesAPI extends BaseAPI {
|
|
|
56
56
|
* Throws 403 when the session is a delegated agent — a permanent
|
|
57
57
|
* restriction on that session type, not a rollout state. No program switch
|
|
58
58
|
* gates the claim, so a balance already credited stays claimable. Throws 409 when the payout balance is insufficient for the
|
|
59
|
-
* requested amount
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* twice
|
|
67
|
-
*
|
|
68
|
-
*
|
|
59
|
+
* requested amount, or 409 `IDEMPOTENCY_KEY_CONFLICT` when `idempotencyKey`
|
|
60
|
+
* already names a different claim. Throws 503 when the matching engine is
|
|
61
|
+
* unreachable, restarting, or slow to answer — an UNKNOWN outcome, not a
|
|
62
|
+
* rejection: the claim is admitted to the sequencer before its reply is
|
|
63
|
+
* sent, so it may still commit. With an `idempotencyKey`, retrying the same
|
|
64
|
+
* key and claim within 15 minutes returns the first claim's result without
|
|
65
|
+
* moving money again, and the 5xx stays `retryable`. Without one a blind
|
|
66
|
+
* retry can claim twice: do not retry automatically, because a balance read
|
|
67
|
+
* cannot settle it while an admitted claim may still be queued, and the
|
|
68
|
+
* ambiguous failure is thrown with `retryable: false`. Two pre-admission
|
|
69
|
+
* rejections stay retryable because they committed nothing: a maintenance
|
|
70
|
+
* block (`OPERATIONS_BLOCKED`) and a sequencer overload (`OVERLOADED`).
|
|
69
71
|
*
|
|
70
|
-
* @param params - Payout token address
|
|
72
|
+
* @param params - Payout token address, raw-unit amount to claim, and an optional idempotencyKey
|
|
71
73
|
* @returns Promise resolving to the post-claim payout and trading balances
|
|
72
74
|
*/
|
|
73
75
|
claimBuildercodeRewards(params: ClaimBuildercodeRewardsParams): Promise<ClaimBuildercodeRewardsResponse>;
|
|
@@ -196,6 +196,7 @@ export declare const GetBuildercodeRewardsBalanceResponseSchema: z.ZodObject<{
|
|
|
196
196
|
export declare const ClaimBuildercodeRewardsParamsSchema: z.ZodObject<{
|
|
197
197
|
token: z.ZodString;
|
|
198
198
|
amount: z.ZodString;
|
|
199
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
199
200
|
}, z.core.$strip>;
|
|
200
201
|
/** Schema for the claim-BuilderCodes-rewards response. */
|
|
201
202
|
export declare const ClaimBuildercodeRewardsResponseSchema: z.ZodObject<{
|