@0xmonaco/core 1.0.38-develop.ebf8e8c → 1.0.39-develop.71e039b
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.
|
@@ -170,8 +170,6 @@ export declare const perpRoutes: {
|
|
|
170
170
|
readonly close: (positionId: string) => string;
|
|
171
171
|
readonly batchCloseAll: () => string;
|
|
172
172
|
readonly risk: (positionId: string) => string;
|
|
173
|
-
readonly addMargin: (positionId: string) => string;
|
|
174
|
-
readonly reduceMargin: (positionId: string) => string;
|
|
175
173
|
readonly attachTpSl: (positionId: string) => string;
|
|
176
174
|
readonly history: (params?: {
|
|
177
175
|
positionId?: string;
|
package/dist/api/perp/routes.js
CHANGED
|
@@ -94,8 +94,6 @@ export const perpRoutes = {
|
|
|
94
94
|
close: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/close`,
|
|
95
95
|
batchCloseAll: () => `${API_V1}/positions/batch-close-all`,
|
|
96
96
|
risk: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/risk`,
|
|
97
|
-
addMargin: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/margin/add`,
|
|
98
|
-
reduceMargin: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/margin/reduce`,
|
|
99
97
|
attachTpSl: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}/tp-sl`,
|
|
100
98
|
history: (params) => withQuery(`${API_V1}/positions/history`, params),
|
|
101
99
|
pnlHistory: (positionId, params) => withQuery(`${API_V1}/positions/${encodeSegment(positionId)}/pnl/history`, params),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AttachPositionTpSlRequest, AttachPositionTpSlResponse, BatchCloseAllRequest, BatchCloseAllResponse, ClosePositionRequest, ClosePositionResponse, GetPositionPnlHistoryParams, GetPositionPnlHistoryResponse, GetPositionResponse, ListPositionHistoryParams, ListPositionHistoryResponse, ListPositionsParams, ListPositionsResponse, PositionRisk, PositionsAPI } from "@0xmonaco/types";
|
|
2
2
|
import { BaseAPI } from "../base";
|
|
3
3
|
export declare class PositionsAPIImpl extends BaseAPI implements PositionsAPI {
|
|
4
4
|
listPositions(params?: ListPositionsParams): Promise<ListPositionsResponse>;
|
|
@@ -6,8 +6,6 @@ export declare class PositionsAPIImpl extends BaseAPI implements PositionsAPI {
|
|
|
6
6
|
closePosition(positionId: string, request: ClosePositionRequest): Promise<ClosePositionResponse>;
|
|
7
7
|
batchCloseAllPositions(request?: BatchCloseAllRequest): Promise<BatchCloseAllResponse>;
|
|
8
8
|
getPositionRisk(positionId: string): Promise<PositionRisk>;
|
|
9
|
-
addPositionMargin(positionId: string, request: AddPositionMarginRequest): Promise<PositionMarginResponse>;
|
|
10
|
-
reducePositionMargin(positionId: string, request: ReducePositionMarginRequest): Promise<PositionMarginResponse>;
|
|
11
9
|
attachPositionTpSl(positionId: string, request: AttachPositionTpSlRequest): Promise<AttachPositionTpSlResponse>;
|
|
12
10
|
listPositionHistory(params?: ListPositionHistoryParams): Promise<ListPositionHistoryResponse>;
|
|
13
11
|
getPositionPnlHistory(positionId: string, params: GetPositionPnlHistoryParams): Promise<GetPositionPnlHistoryResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AttachPositionTpSlSchema, BatchCloseAllSchema, ClosePositionSchema, GetPositionPnlHistorySchema, GetPositionRiskSchema, GetPositionSchema, ListPositionHistorySchema, ListPositionsSchema, validate, } from "@0xmonaco/types";
|
|
2
2
|
import { BaseAPI } from "../base";
|
|
3
3
|
import { perpRoutes } from "../perp";
|
|
4
4
|
export class PositionsAPIImpl extends BaseAPI {
|
|
@@ -40,25 +40,6 @@ export class PositionsAPIImpl extends BaseAPI {
|
|
|
40
40
|
validate(GetPositionRiskSchema, { positionId });
|
|
41
41
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.risk(positionId));
|
|
42
42
|
}
|
|
43
|
-
async addPositionMargin(positionId, request) {
|
|
44
|
-
validate(AddPositionMarginSchema, { positionId, request });
|
|
45
|
-
return await this.makeAuthenticatedRequest(perpRoutes.positions.addMargin(positionId), {
|
|
46
|
-
method: "POST",
|
|
47
|
-
body: JSON.stringify({
|
|
48
|
-
amount: request.amount,
|
|
49
|
-
asset: request.asset,
|
|
50
|
-
}),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
async reducePositionMargin(positionId, request) {
|
|
54
|
-
validate(ReducePositionMarginSchema, { positionId, request });
|
|
55
|
-
return await this.makeAuthenticatedRequest(perpRoutes.positions.reduceMargin(positionId), {
|
|
56
|
-
method: "POST",
|
|
57
|
-
body: JSON.stringify({
|
|
58
|
-
amount: request.amount,
|
|
59
|
-
}),
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
43
|
async attachPositionTpSl(positionId, request) {
|
|
63
44
|
validate(AttachPositionTpSlSchema, { positionId, request });
|
|
64
45
|
return await this.makeAuthenticatedRequest(perpRoutes.positions.attachTpSl(positionId), {
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** operationId → the @0xmonaco/core client method that covers it. */
|
|
2
2
|
export declare const COVERED: {
|
|
3
|
-
add_position_margin: string;
|
|
4
3
|
attach_position_tp_sl: string;
|
|
5
4
|
batch_cancel_all: string;
|
|
6
5
|
batch_cancel_all_by_pair: string;
|
|
@@ -84,7 +83,6 @@ export declare const COVERED: {
|
|
|
84
83
|
list_sub_accounts_with_balances: string;
|
|
85
84
|
list_trading_pairs: string;
|
|
86
85
|
mint_tokens: string;
|
|
87
|
-
reduce_position_margin: string;
|
|
88
86
|
refresh_session: string;
|
|
89
87
|
replace_order: string;
|
|
90
88
|
revoke_delegated_agent: string;
|
package/dist/coverage.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** operationId → the @0xmonaco/core client method that covers it. */
|
|
2
2
|
export const COVERED = {
|
|
3
|
-
add_position_margin: "addPositionMargin",
|
|
4
3
|
attach_position_tp_sl: "attachPositionTpSl",
|
|
5
4
|
batch_cancel_all: "batchCancelAll",
|
|
6
5
|
batch_cancel_all_by_pair: "batchCancelAll (with tradingPairId)",
|
|
@@ -84,7 +83,6 @@ export const COVERED = {
|
|
|
84
83
|
list_sub_accounts_with_balances: "subAccounts.list",
|
|
85
84
|
list_trading_pairs: "getPaginatedTradingPairs",
|
|
86
85
|
mint_tokens: "faucet.mint",
|
|
87
|
-
reduce_position_margin: "reducePositionMargin",
|
|
88
86
|
refresh_session: "refreshSession",
|
|
89
87
|
replace_order: "replaceOrder",
|
|
90
88
|
revoke_delegated_agent: "revokeDelegatedAgent",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39-develop.71e039b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"viem": "^2.45.2"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@0xmonaco/contracts": "1.0.
|
|
27
|
-
"@0xmonaco/types": "1.0.
|
|
26
|
+
"@0xmonaco/contracts": "1.0.39-develop.71e039b",
|
|
27
|
+
"@0xmonaco/types": "1.0.39-develop.71e039b",
|
|
28
28
|
"@noble/curves": "^1.9.1",
|
|
29
29
|
"@noble/hashes": "^1.8.0",
|
|
30
30
|
"http-status-codes": "^2.3.0"
|