@0xmonaco/core 0.8.14 → 0.8.16
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 +42 -48
- package/dist/api/applications/api.js +4 -4
- package/dist/api/auth/api.d.ts +1 -1
- package/dist/api/auth/api.js +10 -10
- package/dist/api/base.d.ts +2 -2
- package/dist/api/base.js +2 -2
- package/dist/api/delegated-agents/api.js +12 -12
- package/dist/api/faucet/api.d.ts +1 -1
- package/dist/api/faucet/api.js +1 -1
- package/dist/api/fees/api.d.ts +13 -13
- package/dist/api/fees/api.js +18 -18
- package/dist/api/margin-accounts/api.js +23 -23
- package/dist/api/market/api.js +16 -16
- package/dist/api/orderbook/api.js +13 -13
- package/dist/api/perp/routes.d.ts +57 -53
- package/dist/api/perp/routes.js +1 -0
- package/dist/api/positions/api.js +19 -19
- package/dist/api/profile/api.d.ts +23 -23
- package/dist/api/profile/api.js +46 -46
- package/dist/api/sub-accounts/api.d.ts +2 -2
- package/dist/api/sub-accounts/api.js +2 -2
- package/dist/api/trades/api.d.ts +11 -11
- package/dist/api/trades/api.js +10 -10
- package/dist/api/trading/api.d.ts +6 -6
- package/dist/api/trading/api.js +69 -69
- package/dist/api/vault/api.js +4 -4
- package/dist/api/whitelist/api.d.ts +2 -2
- package/dist/api/whitelist/api.js +2 -2
- package/dist/api/withdrawals/api.d.ts +3 -2
- package/dist/api/withdrawals/api.js +7 -2
- package/dist/coverage.d.ts +1 -0
- package/dist/coverage.js +1 -0
- package/dist/sdk.js +3 -3
- package/package.json +3 -3
package/dist/api/market/api.js
CHANGED
|
@@ -12,20 +12,20 @@ export class MarketAPIImpl extends BaseAPI {
|
|
|
12
12
|
if (params?.page !== undefined) {
|
|
13
13
|
searchParams.append("page", params.page.toString());
|
|
14
14
|
}
|
|
15
|
-
if (params?.
|
|
16
|
-
searchParams.append("
|
|
15
|
+
if (params?.pageSize !== undefined) {
|
|
16
|
+
searchParams.append("pageSize", params.pageSize.toString());
|
|
17
17
|
}
|
|
18
|
-
if (params?.
|
|
19
|
-
searchParams.append("
|
|
18
|
+
if (params?.marketType) {
|
|
19
|
+
searchParams.append("marketType", params.marketType);
|
|
20
20
|
}
|
|
21
|
-
if (params?.
|
|
22
|
-
searchParams.append("
|
|
21
|
+
if (params?.baseToken) {
|
|
22
|
+
searchParams.append("baseToken", params.baseToken);
|
|
23
23
|
}
|
|
24
|
-
if (params?.
|
|
25
|
-
searchParams.append("
|
|
24
|
+
if (params?.quoteToken) {
|
|
25
|
+
searchParams.append("quoteToken", params.quoteToken);
|
|
26
26
|
}
|
|
27
|
-
if (params?.
|
|
28
|
-
searchParams.append("
|
|
27
|
+
if (params?.isActive !== undefined) {
|
|
28
|
+
searchParams.append("isActive", params.isActive.toString());
|
|
29
29
|
}
|
|
30
30
|
if (params?.category) {
|
|
31
31
|
searchParams.append("category", params.category);
|
|
@@ -37,14 +37,14 @@ export class MarketAPIImpl extends BaseAPI {
|
|
|
37
37
|
async getTradingPair(tradingPairId) {
|
|
38
38
|
validate(GetMarketMetadataSchema, { tradingPairId });
|
|
39
39
|
const response = await this.makePublicRequest(perpRoutes.market.getTradingPair(tradingPairId));
|
|
40
|
-
return response.
|
|
40
|
+
return response.tradingPair;
|
|
41
41
|
}
|
|
42
42
|
async getTradingPairBySymbol(symbol, marketType) {
|
|
43
43
|
// Backend endpoint expects UUID, not symbol, so we fetch all pairs and filter.
|
|
44
|
-
// An optional
|
|
44
|
+
// An optional marketType narrows the listing so a symbol present in both
|
|
45
45
|
// SPOT and MARGIN resolves unambiguously instead of returning the first match.
|
|
46
|
-
const response = await this.getPaginatedTradingPairs({
|
|
47
|
-
return response.
|
|
46
|
+
const response = await this.getPaginatedTradingPairs({ pageSize: 100, marketType: marketType });
|
|
47
|
+
return response.tradingPairs.find((pair) => pair.symbol === symbol);
|
|
48
48
|
}
|
|
49
49
|
async getCandlesticks(tradingPairId, interval, params) {
|
|
50
50
|
// Validate inputs using the trading pair ID schema
|
|
@@ -57,10 +57,10 @@ export class MarketAPIImpl extends BaseAPI {
|
|
|
57
57
|
});
|
|
58
58
|
const searchParams = new URLSearchParams();
|
|
59
59
|
if (params?.startTime !== undefined) {
|
|
60
|
-
searchParams.append("
|
|
60
|
+
searchParams.append("startTime", params.startTime.toString());
|
|
61
61
|
}
|
|
62
62
|
if (params?.endTime !== undefined) {
|
|
63
|
-
searchParams.append("
|
|
63
|
+
searchParams.append("endTime", params.endTime.toString());
|
|
64
64
|
}
|
|
65
65
|
if (params?.limit !== undefined) {
|
|
66
66
|
searchParams.append("limit", params.limit.toString());
|
|
@@ -5,34 +5,34 @@ export class OrderbookAPIImpl extends BaseAPI {
|
|
|
5
5
|
const params = new URLSearchParams();
|
|
6
6
|
params.set("levels", String(depth));
|
|
7
7
|
if (tradingMode)
|
|
8
|
-
params.set("
|
|
8
|
+
params.set("tradingMode", tradingMode);
|
|
9
9
|
if (magnitude !== undefined)
|
|
10
10
|
params.set("magnitude", String(magnitude));
|
|
11
11
|
if (denomination)
|
|
12
12
|
params.set("denomination", denomination.toLowerCase());
|
|
13
13
|
const response = await this.makePublicRequest(`/api/v1/orderbook/${encodeURIComponent(tradingPairId)}?${params.toString()}`);
|
|
14
14
|
return {
|
|
15
|
-
// `
|
|
16
|
-
tradingPairId: response.
|
|
17
|
-
tradingMode: response.
|
|
15
|
+
// `tradingPairId` is the pair UUID; `symbol` is the display string.
|
|
16
|
+
tradingPairId: response.tradingPairId,
|
|
17
|
+
tradingMode: response.tradingMode,
|
|
18
18
|
bids: response.data.bids.map((level) => ({
|
|
19
19
|
price: level.price,
|
|
20
20
|
quantity: level.quantity,
|
|
21
|
-
orderCount: level.
|
|
21
|
+
orderCount: level.orderCount,
|
|
22
22
|
})),
|
|
23
23
|
asks: response.data.asks.map((level) => ({
|
|
24
24
|
price: level.price,
|
|
25
25
|
quantity: level.quantity,
|
|
26
|
-
orderCount: level.
|
|
26
|
+
orderCount: level.orderCount,
|
|
27
27
|
})),
|
|
28
|
-
bestBid: response.data.
|
|
29
|
-
bestAsk: response.data.
|
|
30
|
-
bidVolume: response.data.
|
|
31
|
-
askVolume: response.data.
|
|
32
|
-
baseDecimals: response.
|
|
33
|
-
quoteDecimals: response.
|
|
28
|
+
bestBid: response.data.bestBid,
|
|
29
|
+
bestAsk: response.data.bestAsk,
|
|
30
|
+
bidVolume: response.data.bidVolume,
|
|
31
|
+
askVolume: response.data.askVolume,
|
|
32
|
+
baseDecimals: response.baseDecimals,
|
|
33
|
+
quoteDecimals: response.quoteDecimals,
|
|
34
34
|
timestamp: response.timestamp,
|
|
35
|
-
sequence: response.
|
|
35
|
+
sequence: response.sequenceNumber,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -3,11 +3,11 @@ export declare const perpRoutes: {
|
|
|
3
3
|
readonly create: () => string;
|
|
4
4
|
readonly list: (params?: {
|
|
5
5
|
page?: number;
|
|
6
|
-
|
|
6
|
+
pageSize?: number;
|
|
7
7
|
status?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
tradingPair?: string;
|
|
9
|
+
tradingMode?: string;
|
|
10
|
+
marginAccountId?: string;
|
|
11
11
|
}) => string;
|
|
12
12
|
readonly get: (orderId: string) => string;
|
|
13
13
|
readonly replace: (orderId: string) => string;
|
|
@@ -18,11 +18,11 @@ export declare const perpRoutes: {
|
|
|
18
18
|
readonly batchCreate: () => string;
|
|
19
19
|
readonly batchReplace: () => string;
|
|
20
20
|
readonly listConditional: (params?: {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
marginAccountId?: string;
|
|
22
|
+
tradingPairId?: string;
|
|
23
23
|
state?: string;
|
|
24
24
|
page?: number;
|
|
25
|
-
|
|
25
|
+
pageSize?: number;
|
|
26
26
|
}) => string;
|
|
27
27
|
readonly cancelConditional: (conditionalOrderId: string) => string;
|
|
28
28
|
};
|
|
@@ -35,20 +35,24 @@ export declare const perpRoutes: {
|
|
|
35
35
|
readonly withdrawals: {
|
|
36
36
|
readonly initiate: () => string;
|
|
37
37
|
readonly byIndex: (withdrawalIndex: number) => string;
|
|
38
|
+
readonly list: (params?: {
|
|
39
|
+
page?: number;
|
|
40
|
+
pageSize?: number;
|
|
41
|
+
}) => string;
|
|
38
42
|
};
|
|
39
43
|
readonly market: {
|
|
40
44
|
readonly listTradingPairs: (params?: {
|
|
41
45
|
page?: number;
|
|
42
46
|
limit?: number;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
marketType?: string;
|
|
48
|
+
baseToken?: string;
|
|
49
|
+
quoteToken?: string;
|
|
50
|
+
isActive?: boolean;
|
|
47
51
|
}) => string;
|
|
48
52
|
readonly getTradingPair: (tradingPairId: string) => string;
|
|
49
53
|
readonly getCandles: (tradingPairId: string, interval: string, params?: {
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
startTime?: number;
|
|
55
|
+
endTime?: number;
|
|
52
56
|
limit?: number;
|
|
53
57
|
}) => string;
|
|
54
58
|
readonly getMarketMetadata: (tradingPairId: string) => string;
|
|
@@ -58,17 +62,17 @@ export declare const perpRoutes: {
|
|
|
58
62
|
readonly getIndexPrice: (tradingPairId: string) => string;
|
|
59
63
|
readonly getFundingState: (tradingPairId: string) => string;
|
|
60
64
|
readonly listFundingHistory: (tradingPairId: string, params?: {
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
startTime?: string;
|
|
66
|
+
endTime?: string;
|
|
63
67
|
page?: number;
|
|
64
|
-
|
|
68
|
+
pageSize?: number;
|
|
65
69
|
}) => string;
|
|
66
70
|
readonly getOpenInterest: (tradingPairId: string) => string;
|
|
67
71
|
readonly getScreener: (params?: {
|
|
68
72
|
page?: number;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
pageSize?: number;
|
|
74
|
+
marketType?: string;
|
|
75
|
+
isActive?: boolean;
|
|
72
76
|
category?: string;
|
|
73
77
|
}) => string;
|
|
74
78
|
readonly getMarketStats: () => string;
|
|
@@ -76,7 +80,7 @@ export declare const perpRoutes: {
|
|
|
76
80
|
readonly orderbook: {
|
|
77
81
|
readonly get: (tradingPairId: string, params?: {
|
|
78
82
|
levels?: number;
|
|
79
|
-
|
|
83
|
+
tradingMode?: string;
|
|
80
84
|
magnitude?: string | number;
|
|
81
85
|
denomination?: string;
|
|
82
86
|
}) => string;
|
|
@@ -88,42 +92,42 @@ export declare const perpRoutes: {
|
|
|
88
92
|
}) => string;
|
|
89
93
|
readonly byId: (tradeId: string) => string;
|
|
90
94
|
readonly user: (params?: {
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
marginAccountId?: string;
|
|
96
|
+
tradingPairId?: string;
|
|
93
97
|
page?: number;
|
|
94
|
-
|
|
98
|
+
pageSize?: number;
|
|
95
99
|
}) => string;
|
|
96
100
|
};
|
|
97
101
|
readonly applications: {
|
|
98
102
|
readonly orders: (params?: {
|
|
99
103
|
page?: number;
|
|
100
|
-
|
|
104
|
+
pageSize?: number;
|
|
101
105
|
status?: string;
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
userId?: string;
|
|
107
|
+
tradingPairId?: string;
|
|
104
108
|
side?: string;
|
|
105
|
-
|
|
109
|
+
orderType?: string;
|
|
106
110
|
}) => string;
|
|
107
111
|
readonly users: (params?: {
|
|
108
112
|
page?: number;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
pageSize?: number;
|
|
114
|
+
isActive?: boolean;
|
|
115
|
+
accountType?: string;
|
|
112
116
|
address?: string;
|
|
113
117
|
}) => string;
|
|
114
118
|
readonly movements: (params?: {
|
|
115
119
|
page?: number;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
pageSize?: number;
|
|
121
|
+
userId?: string;
|
|
122
|
+
transactionType?: string;
|
|
123
|
+
entryType?: string;
|
|
124
|
+
assetId?: string;
|
|
121
125
|
}) => string;
|
|
122
126
|
readonly balances: (params?: {
|
|
123
127
|
page?: number;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
pageSize?: number;
|
|
129
|
+
userId?: string;
|
|
130
|
+
assetId?: string;
|
|
127
131
|
}) => string;
|
|
128
132
|
readonly stats: (params?: {
|
|
129
133
|
since?: string;
|
|
@@ -143,11 +147,11 @@ export declare const perpRoutes: {
|
|
|
143
147
|
};
|
|
144
148
|
readonly positions: {
|
|
145
149
|
readonly list: (params?: {
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
marginAccountId?: string;
|
|
151
|
+
tradingPairId?: string;
|
|
148
152
|
status?: string;
|
|
149
153
|
page?: number;
|
|
150
|
-
|
|
154
|
+
pageSize?: number;
|
|
151
155
|
}) => string;
|
|
152
156
|
readonly get: (positionId: string) => string;
|
|
153
157
|
readonly close: (positionId: string) => string;
|
|
@@ -157,25 +161,25 @@ export declare const perpRoutes: {
|
|
|
157
161
|
readonly reduceMargin: (positionId: string) => string;
|
|
158
162
|
readonly attachTpSl: (positionId: string) => string;
|
|
159
163
|
readonly history: (params?: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
positionId?: string;
|
|
165
|
+
marginAccountId?: string;
|
|
166
|
+
tradingPairId?: string;
|
|
163
167
|
page?: number;
|
|
164
|
-
|
|
168
|
+
pageSize?: number;
|
|
165
169
|
}) => string;
|
|
166
170
|
};
|
|
167
171
|
readonly marginAccounts: {
|
|
168
172
|
readonly list: (params?: {
|
|
169
173
|
page?: number;
|
|
170
|
-
|
|
174
|
+
pageSize?: number;
|
|
171
175
|
state?: string;
|
|
172
|
-
|
|
176
|
+
tradingPairId?: string;
|
|
173
177
|
}) => string;
|
|
174
178
|
readonly parentSummary: (params?: {
|
|
175
|
-
|
|
179
|
+
tradingPairId?: string;
|
|
176
180
|
}) => string;
|
|
177
181
|
readonly summary: (marginAccountId: string, params?: {
|
|
178
|
-
|
|
182
|
+
tradingPairId?: string;
|
|
179
183
|
}) => string;
|
|
180
184
|
readonly availableCollateral: (params?: {
|
|
181
185
|
asset?: string;
|
|
@@ -186,14 +190,14 @@ export declare const perpRoutes: {
|
|
|
186
190
|
readonly transferOut: (marginAccountId: string) => string;
|
|
187
191
|
readonly transferOutParent: () => string;
|
|
188
192
|
readonly movements: (marginAccountId: string, params?: {
|
|
189
|
-
|
|
193
|
+
movementType?: string;
|
|
190
194
|
page?: number;
|
|
191
|
-
|
|
195
|
+
pageSize?: number;
|
|
192
196
|
}) => string;
|
|
193
197
|
readonly parentMovements: (params?: {
|
|
194
|
-
|
|
198
|
+
movementType?: string;
|
|
195
199
|
page?: number;
|
|
196
|
-
|
|
200
|
+
pageSize?: number;
|
|
197
201
|
}) => string;
|
|
198
202
|
readonly simulateParentMarginOrderRisk: () => string;
|
|
199
203
|
readonly simulateOrderRisk: (marginAccountId: string) => string;
|
package/dist/api/perp/routes.js
CHANGED
|
@@ -38,6 +38,7 @@ export const perpRoutes = {
|
|
|
38
38
|
withdrawals: {
|
|
39
39
|
initiate: () => `${API_V1}/withdrawals`,
|
|
40
40
|
byIndex: (withdrawalIndex) => `${API_V1}/withdrawals/${encodeSegment(String(withdrawalIndex))}`,
|
|
41
|
+
list: (params) => withQuery(`${API_V1}/withdrawals`, params),
|
|
41
42
|
},
|
|
42
43
|
market: {
|
|
43
44
|
listTradingPairs: (params) => withQuery(`${API_V1}/market/pairs`, params),
|
|
@@ -17,9 +17,9 @@ export class PositionsAPIImpl extends BaseAPI {
|
|
|
17
17
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.close(positionId), {
|
|
18
18
|
method: "POST",
|
|
19
19
|
body: JSON.stringify({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
closeType: request.closeType,
|
|
21
|
+
limitPrice: request.limitPrice,
|
|
22
|
+
slippageToleranceBps: request.slippageToleranceBps,
|
|
23
23
|
quantity: request.quantity,
|
|
24
24
|
}),
|
|
25
25
|
});
|
|
@@ -31,8 +31,8 @@ export class PositionsAPIImpl extends BaseAPI {
|
|
|
31
31
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.batchCloseAll(), {
|
|
32
32
|
method: "POST",
|
|
33
33
|
body: JSON.stringify({
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
tradingPairId: request?.tradingPairId,
|
|
35
|
+
slippageToleranceBps: request?.slippageToleranceBps,
|
|
36
36
|
}),
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -64,26 +64,26 @@ export class PositionsAPIImpl extends BaseAPI {
|
|
|
64
64
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.attachTpSl(positionId), {
|
|
65
65
|
method: "POST",
|
|
66
66
|
body: JSON.stringify({
|
|
67
|
-
|
|
67
|
+
takeProfit: request.takeProfit
|
|
68
68
|
? {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
triggerPrice: request.takeProfit.triggerPrice,
|
|
70
|
+
orderType: request.takeProfit.orderType,
|
|
71
|
+
limitPrice: request.takeProfit.limitPrice,
|
|
72
72
|
quantity: request.takeProfit.quantity,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
timeInForce: request.takeProfit.timeInForce,
|
|
74
|
+
slippageToleranceBps: request.takeProfit.slippageToleranceBps,
|
|
75
|
+
expiresAt: request.takeProfit.expiresAt,
|
|
76
76
|
}
|
|
77
77
|
: undefined,
|
|
78
|
-
|
|
78
|
+
stopLoss: request.stopLoss
|
|
79
79
|
? {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
triggerPrice: request.stopLoss.triggerPrice,
|
|
81
|
+
orderType: request.stopLoss.orderType,
|
|
82
|
+
limitPrice: request.stopLoss.limitPrice,
|
|
83
83
|
quantity: request.stopLoss.quantity,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
timeInForce: request.stopLoss.timeInForce,
|
|
85
|
+
slippageToleranceBps: request.stopLoss.slippageToleranceBps,
|
|
86
|
+
expiresAt: request.stopLoss.expiresAt,
|
|
87
87
|
}
|
|
88
88
|
: undefined,
|
|
89
89
|
}),
|
|
@@ -39,8 +39,8 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
39
39
|
* console.log(`User ID: ${profile.id}`);
|
|
40
40
|
* console.log(`Address: ${profile.address}`);
|
|
41
41
|
* console.log(`Username: ${profile.username}`);
|
|
42
|
-
* console.log(`Account type: ${profile.
|
|
43
|
-
* console.log(`Can withdraw: ${profile.
|
|
42
|
+
* console.log(`Account type: ${profile.accountType}`);
|
|
43
|
+
* console.log(`Can withdraw: ${profile.canWithdraw}`);
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
getProfile(): Promise<UserProfile>;
|
|
@@ -53,27 +53,27 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
53
53
|
* @param params - Optional query parameters for pagination and filtering
|
|
54
54
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
55
55
|
* @param params.limit - Number of items per page (default: 20, max: 100)
|
|
56
|
-
* @param params.
|
|
57
|
-
* @param params.
|
|
58
|
-
* @param params.
|
|
56
|
+
* @param params.entryType - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
|
|
57
|
+
* @param params.transactionType - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)
|
|
58
|
+
* @param params.assetId - Filter by asset ID (UUID)
|
|
59
59
|
* @returns Promise resolving to paginated movements response
|
|
60
60
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```typescript
|
|
64
|
-
* // Get first page with default
|
|
64
|
+
* // Get first page with default pageSize (20)
|
|
65
65
|
* const movements = await profileAPI.getPaginatedUserMovements();
|
|
66
66
|
* console.log(`Total movements: ${movements.total}`);
|
|
67
67
|
*
|
|
68
|
-
* // Get second page with custom
|
|
69
|
-
* const page2 = await profileAPI.getPaginatedUserMovements({ page: 2,
|
|
70
|
-
* console.log(`Page ${page2.page} of ${page2.
|
|
68
|
+
* // Get second page with custom pageSize
|
|
69
|
+
* const page2 = await profileAPI.getPaginatedUserMovements({ page: 2, pageSize: 50 });
|
|
70
|
+
* console.log(`Page ${page2.page} of ${page2.totalPages}`);
|
|
71
71
|
*
|
|
72
72
|
* // Filter by entry type and transaction type
|
|
73
|
-
* const deposits = await profileAPI.getPaginatedUserMovements({
|
|
73
|
+
* const deposits = await profileAPI.getPaginatedUserMovements({ entryType: "CREDIT", transactionType: "DEPOSIT" });
|
|
74
74
|
*
|
|
75
75
|
* // Filter by asset
|
|
76
|
-
* const usdcMovements = await profileAPI.getPaginatedUserMovements({
|
|
76
|
+
* const usdcMovements = await profileAPI.getPaginatedUserMovements({ assetId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
getPaginatedUserMovements(params?: GetUserMovementsParams): Promise<GetPaginatedUserMovementsResponse>;
|
|
@@ -85,7 +85,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
85
85
|
*
|
|
86
86
|
* @param params - Optional query parameters for pagination
|
|
87
87
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
88
|
-
* @param params.
|
|
88
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 100)
|
|
89
89
|
* @returns Promise resolving to paginated balances response
|
|
90
90
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
91
91
|
*
|
|
@@ -95,11 +95,11 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
95
95
|
* const balances = await profileAPI.getUserBalances();
|
|
96
96
|
* console.log(`Total balances: ${balances.total}`);
|
|
97
97
|
* balances.balances.forEach(balance => {
|
|
98
|
-
* console.log(`${balance.symbol}: ${balance.
|
|
98
|
+
* console.log(`${balance.symbol}: ${balance.availableBalance}`);
|
|
99
99
|
* });
|
|
100
100
|
*
|
|
101
101
|
* // Get page 2 with 50 items per page
|
|
102
|
-
* const nextBalances = await profileAPI.getUserBalances({ page: 2,
|
|
102
|
+
* const nextBalances = await profileAPI.getUserBalances({ page: 2, pageSize: 50 });
|
|
103
103
|
* console.log(`Returned ${nextBalances.balances.length} balances`);
|
|
104
104
|
* ```
|
|
105
105
|
*/
|
|
@@ -107,7 +107,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
107
107
|
/**
|
|
108
108
|
* Get the current user's balance for a specific asset.
|
|
109
109
|
*
|
|
110
|
-
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{
|
|
110
|
+
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{assetId} endpoint.
|
|
111
111
|
* Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
|
|
112
112
|
*
|
|
113
113
|
* @param assetId - The asset identifier (UUID)
|
|
@@ -118,9 +118,9 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
118
118
|
* ```typescript
|
|
119
119
|
* // Get balance for a specific asset
|
|
120
120
|
* const balance = await profileAPI.getUserBalanceByAssetId('123e4567-e89b-12d3-a456-426614174000');
|
|
121
|
-
* console.log(`${balance.symbol}: ${balance.
|
|
122
|
-
* console.log(`Locked: ${balance.
|
|
123
|
-
* console.log(`Total: ${balance.
|
|
121
|
+
* console.log(`${balance.symbol}: ${balance.availableBalance}`);
|
|
122
|
+
* console.log(`Locked: ${balance.lockedBalance}`);
|
|
123
|
+
* console.log(`Total: ${balance.totalBalance}`);
|
|
124
124
|
* ```
|
|
125
125
|
*/
|
|
126
126
|
getUserBalanceByAssetId(assetId: string): Promise<AccountBalance>;
|
|
@@ -139,7 +139,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
139
139
|
* const stats = await profileAPI.getPortfolioStats("30d");
|
|
140
140
|
* console.log(`PnL: ${stats.pnl}`);
|
|
141
141
|
* console.log(`Volume: ${stats.volume}`);
|
|
142
|
-
* console.log(`Total equity: ${stats.
|
|
142
|
+
* console.log(`Total equity: ${stats.totalEquity}`);
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
145
|
getPortfolioStats(period: PortfolioPeriod): Promise<PortfolioStats>;
|
|
@@ -171,8 +171,8 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
171
171
|
*
|
|
172
172
|
* @param params - Optional query parameters for pagination and filtering
|
|
173
173
|
* @param params.page - Page number (starts from 1, default: 1)
|
|
174
|
-
* @param params.
|
|
175
|
-
* @param params.
|
|
174
|
+
* @param params.pageSize - Number of items per page (default: 20, max: 100)
|
|
175
|
+
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
176
176
|
* @returns Promise resolving to paginated trades response
|
|
177
177
|
* @throws {ValidationError} When the provided params fail client-side validation
|
|
178
178
|
* @throws {APIError} When the request fails or user is not authenticated
|
|
@@ -184,7 +184,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
184
184
|
* console.log(`Total trades: ${trades.total}`);
|
|
185
185
|
*
|
|
186
186
|
* // Filter by trading pair
|
|
187
|
-
* const pairTrades = await profileAPI.getUserTrades({
|
|
187
|
+
* const pairTrades = await profileAPI.getUserTrades({ tradingPairId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
190
190
|
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
@@ -200,7 +200,7 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
|
|
|
200
200
|
*
|
|
201
201
|
* @example
|
|
202
202
|
* ```typescript
|
|
203
|
-
* const funding = await profileAPI.listFundingPayments({
|
|
203
|
+
* const funding = await profileAPI.listFundingPayments({ tradingPairId: "550e8400-e29b-41d4-a716-446655440000" });
|
|
204
204
|
* console.log(`Total funding payments: ${funding.total}`);
|
|
205
205
|
* ```
|
|
206
206
|
*/
|