@0xmonaco/types 1.0.70 → 1.0.73-develop.af0f5d0
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/dist/auth/index.d.ts +4 -2
- package/dist/auth/responses.d.ts +3 -1
- package/dist/buildercodes/index.d.ts +7 -3
- package/dist/buildercodes/index.js +1 -1
- package/dist/buildercodes/responses.d.ts +59 -3
- package/dist/buildercodes/responses.js +38 -3
- package/dist/copy-trading/index.d.ts +54 -6
- package/dist/copy-trading/index.js +1 -1
- package/dist/copy-trading/responses.d.ts +43 -0
- package/dist/copy-trading/responses.js +49 -0
- package/dist/delegated-agents/index.d.ts +16 -4
- package/dist/fees/index.d.ts +3 -0
- package/dist/fees/responses.js +4 -4
- package/dist/margin-accounts/index.d.ts +114 -10
- package/dist/pitpass/index.d.ts +21 -6
- package/dist/pitpass/index.js +1 -1
- package/dist/pitpass/responses.d.ts +46 -0
- package/dist/pitpass/responses.js +56 -1
- package/dist/portfolio/index.d.ts +36 -14
- package/dist/trading/orders.d.ts +1 -1
- package/dist/trading/responses.d.ts +18 -6
- package/dist/validation/copy-trading.d.ts +11 -0
- package/dist/validation/copy-trading.js +15 -0
- package/dist/validation/margin-accounts.d.ts +34 -0
- package/dist/validation/margin-accounts.js +40 -0
- package/dist/websocket/events/liquidation-events.d.ts +3 -3
- package/dist/websocket/events/orders-events.d.ts +6 -0
- package/dist/websocket/events/position-events.d.ts +24 -17
- package/dist/websocket/events/twap-order-events.d.ts +7 -0
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +10 -0
- package/dist/wire/schema.d.ts +1446 -105
- package/package.json +2 -2
package/dist/auth/index.d.ts
CHANGED
|
@@ -77,8 +77,10 @@ export interface AuthAPI extends BaseAPI {
|
|
|
77
77
|
*/
|
|
78
78
|
verifySignature(address: string, signature: string, nonce: string, clientId: string, session: SessionCredentials, referralCode?: string): Promise<AuthState>;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
* active session key (set via {@link setSessionKeypair}).
|
|
80
|
+
* Refreshes the current session's expiry. The request is signed with the
|
|
81
|
+
* active session key (set via {@link setSessionKeypair}). For a delegated
|
|
82
|
+
* session, the returned expiry is capped by the active delegation and may
|
|
83
|
+
* move earlier if the owner shortened that delegation.
|
|
82
84
|
* @returns Promise resolving to the new expiry
|
|
83
85
|
*/
|
|
84
86
|
refreshSession(): Promise<SessionRefreshResponse>;
|
package/dist/auth/responses.d.ts
CHANGED
|
@@ -78,7 +78,9 @@ export interface SessionCredentials {
|
|
|
78
78
|
privateKey: string;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* Response to a session refresh request
|
|
81
|
+
* Response to a session refresh request with the resulting expiry. For a
|
|
82
|
+
* delegated session, this remains capped by the active delegation and may move earlier
|
|
83
|
+
* if the owner shortened that delegation.
|
|
82
84
|
*/
|
|
83
85
|
export interface SessionRefreshResponse {
|
|
84
86
|
/** Unix timestamp when the session expires after refresh */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* per-trade revenue share.
|
|
6
6
|
*/
|
|
7
7
|
import type { BaseAPI } from "../api";
|
|
8
|
-
import type { ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse } from "./responses";
|
|
8
|
+
import type { ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, ListBuilderFeeChangesParams, ListBuilderFeeChangesResponse, SetBuilderFeeParams, SetBuilderFeeResponse } from "./responses";
|
|
9
9
|
/**
|
|
10
10
|
* BuilderCodes payout API interface.
|
|
11
11
|
*
|
|
@@ -18,6 +18,10 @@ import type { ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, Ge
|
|
|
18
18
|
export interface BuildercodesAPI extends BaseAPI {
|
|
19
19
|
/** Read this authenticated frontend's enrollment, payout address, and live budget. */
|
|
20
20
|
getConfig(): Promise<GetBuildercodesConfigResponse>;
|
|
21
|
+
/** Set this frontend's stored builder fee in basis points. */
|
|
22
|
+
setBuilderFee(params: SetBuilderFeeParams): Promise<SetBuilderFeeResponse>;
|
|
23
|
+
/** List this frontend's builder-fee audit log, newest first. */
|
|
24
|
+
listBuilderFeeChanges(params?: ListBuilderFeeChangesParams): Promise<ListBuilderFeeChangesResponse>;
|
|
21
25
|
/** List this authenticated frontend's per-trade BuilderCodes credits, optionally of one payout `kind`. */
|
|
22
26
|
listPayouts(params?: ListBuildercodePayoutsParams): Promise<ListBuildercodePayoutsResponse>;
|
|
23
27
|
/** Summarize this authenticated frontend's BuilderCodes credits by token, and by token and payout kind. */
|
|
@@ -67,5 +71,5 @@ export interface BuildercodesAPI extends BaseAPI {
|
|
|
67
71
|
*/
|
|
68
72
|
claimBuildercodeRewards(params: ClaimBuildercodeRewardsParams): Promise<ClaimBuildercodeRewardsResponse>;
|
|
69
73
|
}
|
|
70
|
-
export type { BuildercodePayout, BuildercodePayoutKind, BuildercodePayoutTokenKindTotal, BuildercodePayoutTokenTotal, BuildercodeRewardsBalance, ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, } from "./responses";
|
|
71
|
-
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
|
|
74
|
+
export type { BuildercodePayout, BuildercodePayoutKind, BuildercodePayoutTokenKindTotal, BuildercodePayoutTokenTotal, BuildercodeRewardsBalance, BuilderFeeActorType, BuilderFeeChange, ClaimBuildercodeRewardsParams, ClaimBuildercodeRewardsResponse, GetBuildercodePayoutSummaryResponse, GetBuildercodeRewardsBalanceResponse, GetBuildercodesConfigResponse, ListBuildercodePayoutsParams, ListBuildercodePayoutsResponse, ListBuilderFeeChangesParams, ListBuilderFeeChangesResponse, SetBuilderFeeParams, SetBuilderFeeResponse, } from "./responses";
|
|
75
|
+
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, BuilderFeeActorTypeSchema, BuilderFeeChangeSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, ListBuilderFeeChangesParamsSchema, ListBuilderFeeChangesResponseSchema, SetBuilderFeeParamsSchema, SetBuilderFeeResponseSchema, } from "./responses";
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* Types for the BuilderCodes API: reading and claiming an enrolled frontend's
|
|
5
5
|
* per-trade revenue share.
|
|
6
6
|
*/
|
|
7
|
-
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, } from "./responses";
|
|
7
|
+
export { BuildercodePayoutKindSchema, BuildercodePayoutSchema, BuildercodePayoutTokenKindTotalSchema, BuildercodePayoutTokenTotalSchema, BuildercodeRewardsBalanceSchema, BuilderFeeActorTypeSchema, BuilderFeeChangeSchema, ClaimBuildercodeRewardsParamsSchema, ClaimBuildercodeRewardsResponseSchema, GetBuildercodePayoutSummaryResponseSchema, GetBuildercodeRewardsBalanceResponseSchema, GetBuildercodesConfigResponseSchema, ListBuildercodePayoutsParamsSchema, ListBuildercodePayoutsResponseSchema, ListBuilderFeeChangesParamsSchema, ListBuilderFeeChangesResponseSchema, SetBuilderFeeParamsSchema, SetBuilderFeeResponseSchema, } from "./responses";
|
|
@@ -12,11 +12,61 @@ export declare const GetBuildercodesConfigResponseSchema: z.ZodObject<{
|
|
|
12
12
|
payoutAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
13
|
buildercodesEnabled: z.ZodBoolean;
|
|
14
14
|
buildercodesBudgetBps: z.ZodNumber;
|
|
15
|
+
builderFeeEnabled: z.ZodBoolean;
|
|
16
|
+
builderFeeBps: z.ZodNumber;
|
|
17
|
+
builderFeeCapBps: z.ZodNumber;
|
|
18
|
+
changesRemaining: z.ZodNumber;
|
|
19
|
+
nextChangeAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
/** Schema for changing this frontend's builder fee. */
|
|
22
|
+
export declare const SetBuilderFeeParamsSchema: z.ZodObject<{
|
|
23
|
+
bps: z.ZodNumber;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
/** Schema returned after setting this frontend's builder fee. */
|
|
26
|
+
export declare const SetBuilderFeeResponseSchema: z.ZodObject<{
|
|
27
|
+
builderFeeBps: z.ZodNumber;
|
|
28
|
+
previousBuilderFeeBps: z.ZodNumber;
|
|
29
|
+
changesRemaining: z.ZodNumber;
|
|
30
|
+
nextChangeAllowedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
/** Builder-fee change actor exposed by the audit log. */
|
|
33
|
+
export declare const BuilderFeeActorTypeSchema: z.ZodEnum<{
|
|
34
|
+
BUILDER: "BUILDER";
|
|
35
|
+
ADMIN: "ADMIN";
|
|
36
|
+
}>;
|
|
37
|
+
/** One builder-fee audit-log entry. */
|
|
38
|
+
export declare const BuilderFeeChangeSchema: z.ZodObject<{
|
|
39
|
+
actorType: z.ZodEnum<{
|
|
40
|
+
BUILDER: "BUILDER";
|
|
41
|
+
ADMIN: "ADMIN";
|
|
42
|
+
}>;
|
|
43
|
+
actor: z.ZodString;
|
|
44
|
+
oldBps: z.ZodNumber;
|
|
45
|
+
newBps: z.ZodNumber;
|
|
46
|
+
createdAt: z.ZodString;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
/** Cursor pagination accepted by the builder-fee change log. */
|
|
49
|
+
export declare const ListBuilderFeeChangesParamsSchema: z.ZodObject<{
|
|
50
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
/** Schema for one page of builder-fee changes, newest first. */
|
|
54
|
+
export declare const ListBuilderFeeChangesResponseSchema: z.ZodObject<{
|
|
55
|
+
changes: z.ZodArray<z.ZodObject<{
|
|
56
|
+
actorType: z.ZodEnum<{
|
|
57
|
+
BUILDER: "BUILDER";
|
|
58
|
+
ADMIN: "ADMIN";
|
|
59
|
+
}>;
|
|
60
|
+
actor: z.ZodString;
|
|
61
|
+
oldBps: z.ZodNumber;
|
|
62
|
+
newBps: z.ZodNumber;
|
|
63
|
+
createdAt: z.ZodString;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
nextPageToken: z.ZodString;
|
|
15
66
|
}, z.core.$strip>;
|
|
16
67
|
/**
|
|
17
|
-
* The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE`
|
|
18
|
-
*
|
|
19
|
-
* fee, paid by the taker. Both land in the same claimable balance.
|
|
68
|
+
* The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` records
|
|
69
|
+
* Monaco revenue share; `BUILDER_FEE` records builder fees charged to takers.
|
|
20
70
|
*/
|
|
21
71
|
export declare const BuildercodePayoutKindSchema: z.ZodEnum<{
|
|
22
72
|
REVENUE_SHARE: "REVENUE_SHARE";
|
|
@@ -127,6 +177,12 @@ export declare const ClaimBuildercodeRewardsResponseSchema: z.ZodObject<{
|
|
|
127
177
|
export type ClaimBuildercodeRewardsParams = z.infer<typeof ClaimBuildercodeRewardsParamsSchema>;
|
|
128
178
|
export type ClaimBuildercodeRewardsResponse = z.infer<typeof ClaimBuildercodeRewardsResponseSchema>;
|
|
129
179
|
export type GetBuildercodesConfigResponse = z.infer<typeof GetBuildercodesConfigResponseSchema>;
|
|
180
|
+
export type SetBuilderFeeParams = z.infer<typeof SetBuilderFeeParamsSchema>;
|
|
181
|
+
export type SetBuilderFeeResponse = z.infer<typeof SetBuilderFeeResponseSchema>;
|
|
182
|
+
export type BuilderFeeActorType = z.infer<typeof BuilderFeeActorTypeSchema>;
|
|
183
|
+
export type BuilderFeeChange = z.infer<typeof BuilderFeeChangeSchema>;
|
|
184
|
+
export type ListBuilderFeeChangesParams = z.infer<typeof ListBuilderFeeChangesParamsSchema>;
|
|
185
|
+
export type ListBuilderFeeChangesResponse = z.infer<typeof ListBuilderFeeChangesResponseSchema>;
|
|
130
186
|
export type ListBuildercodePayoutsParams = z.infer<typeof ListBuildercodePayoutsParamsSchema>;
|
|
131
187
|
export type BuildercodePayoutKind = z.infer<typeof BuildercodePayoutKindSchema>;
|
|
132
188
|
export type BuildercodePayout = z.infer<typeof BuildercodePayoutSchema>;
|
|
@@ -16,11 +16,46 @@ export const GetBuildercodesConfigResponseSchema = z.object({
|
|
|
16
16
|
payoutAddress: z.string().nullable().optional(),
|
|
17
17
|
buildercodesEnabled: z.boolean(),
|
|
18
18
|
buildercodesBudgetBps: z.number().int().min(0).max(10_000),
|
|
19
|
+
builderFeeEnabled: z.boolean(),
|
|
20
|
+
builderFeeBps: z.number().int().min(0).max(100),
|
|
21
|
+
builderFeeCapBps: z.number().int().min(0).max(100),
|
|
22
|
+
changesRemaining: z.number().int().min(0).max(2),
|
|
23
|
+
nextChangeAllowedAt: z.string().nullable().optional(),
|
|
24
|
+
});
|
|
25
|
+
/** Schema for changing this frontend's builder fee. */
|
|
26
|
+
export const SetBuilderFeeParamsSchema = z.object({
|
|
27
|
+
bps: z.number().int().min(0).max(100),
|
|
28
|
+
});
|
|
29
|
+
/** Schema returned after setting this frontend's builder fee. */
|
|
30
|
+
export const SetBuilderFeeResponseSchema = z.object({
|
|
31
|
+
builderFeeBps: z.number().int().min(0).max(100),
|
|
32
|
+
previousBuilderFeeBps: z.number().int().min(0).max(100),
|
|
33
|
+
changesRemaining: z.number().int().min(0).max(2),
|
|
34
|
+
nextChangeAllowedAt: z.string().nullable().optional(),
|
|
35
|
+
});
|
|
36
|
+
/** Builder-fee change actor exposed by the audit log. */
|
|
37
|
+
export const BuilderFeeActorTypeSchema = z.enum(["BUILDER", "ADMIN"]);
|
|
38
|
+
/** One builder-fee audit-log entry. */
|
|
39
|
+
export const BuilderFeeChangeSchema = z.object({
|
|
40
|
+
actorType: BuilderFeeActorTypeSchema,
|
|
41
|
+
actor: z.string(),
|
|
42
|
+
oldBps: z.number().int().min(0).max(100),
|
|
43
|
+
newBps: z.number().int().min(0).max(100),
|
|
44
|
+
createdAt: z.string(),
|
|
45
|
+
});
|
|
46
|
+
/** Cursor pagination accepted by the builder-fee change log. */
|
|
47
|
+
export const ListBuilderFeeChangesParamsSchema = z.object({
|
|
48
|
+
pageSize: z.number().int().min(1).max(100).optional(),
|
|
49
|
+
pageToken: z.string().optional(),
|
|
50
|
+
});
|
|
51
|
+
/** Schema for one page of builder-fee changes, newest first. */
|
|
52
|
+
export const ListBuilderFeeChangesResponseSchema = z.object({
|
|
53
|
+
changes: z.array(BuilderFeeChangeSchema),
|
|
54
|
+
nextPageToken: z.string(),
|
|
19
55
|
});
|
|
20
56
|
/**
|
|
21
|
-
* The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE`
|
|
22
|
-
*
|
|
23
|
-
* fee, paid by the taker. Both land in the same claimable balance.
|
|
57
|
+
* The payout stream a BuilderCodes credit belongs to. `REVENUE_SHARE` records
|
|
58
|
+
* Monaco revenue share; `BUILDER_FEE` records builder fees charged to takers.
|
|
24
59
|
*/
|
|
25
60
|
export const BuildercodePayoutKindSchema = z.enum(["REVENUE_SHARE", "BUILDER_FEE"]);
|
|
26
61
|
/** Pagination and filter accepted by the per-trade payout history endpoint. */
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* into it. Leaders are addressed by their custom TraderCode handle.
|
|
7
7
|
*/
|
|
8
8
|
import type { BaseAPI } from "../api";
|
|
9
|
-
import type { ListLeadTraderClosedTradesParams, ListLeadTradersParams, ListMyFollowersParams, ListMyFollowsParams, PreviewFollowParams, UpsertFollowParams, UpsertLeadTraderParams } from "../validation/copy-trading";
|
|
10
|
-
import type { GetFollowResponse, GetLeadTraderResponse, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse } from "./responses";
|
|
9
|
+
import type { AddFollowPositionMarginParams, ListLeadTraderClosedTradesParams, ListLeadTradersParams, ListMyFollowersParams, ListMyFollowsParams, PreviewFollowParams, UpsertFollowParams, UpsertLeadTraderParams } from "../validation/copy-trading";
|
|
10
|
+
import type { AddFollowPositionMarginResponse, CloseAllCopyPositionsResponse, CloseFollowPositionsResponse, GetFollowResponse, GetLeadTraderResponse, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse } from "./responses";
|
|
11
11
|
/**
|
|
12
12
|
* Copy trading API.
|
|
13
13
|
*
|
|
@@ -65,10 +65,58 @@ export interface CopyTradingAPI extends BaseAPI {
|
|
|
65
65
|
upsertFollow(params: UpsertFollowParams): Promise<UpsertFollowResponse>;
|
|
66
66
|
/**
|
|
67
67
|
* Stop one of your follows: the leader's fills stop being mirrored. An exit
|
|
68
|
-
* is never
|
|
69
|
-
* cannot stop a follow (403)
|
|
68
|
+
* is never refused for the state of the account or the platform. Only
|
|
69
|
+
* ownership applies, a delegated agent session cannot stop a follow (403),
|
|
70
|
+
* and stops have a rate limit of their own (429 past it).
|
|
70
71
|
*/
|
|
71
72
|
stopFollow(followId: string): Promise<StopFollowResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Close every position in one of your follows' copy accounts at market
|
|
75
|
+
* (reduce-only, immediate-or-cancel) and cancel the resting orders and
|
|
76
|
+
* conditional orders (TP/SL) on its copy risk buckets, keeping the follow:
|
|
77
|
+
* the leader's next trades keep mirroring. `stopFollow` is the
|
|
78
|
+
* close-and-stop path. Proceeds stay in the copy account. Not a flatten
|
|
79
|
+
* guarantee: a thin or halted market can leave part of a position open
|
|
80
|
+
* (`positionsNotClosed`), and a leader trade after the close opens copies
|
|
81
|
+
* again. Never gated by copy trading being off or an operations block; only
|
|
82
|
+
* a delegated agent session is refused (403). Both close methods share a
|
|
83
|
+
* small per-account rate limit (about one per second, burst 5; 429 with
|
|
84
|
+
* Retry-After). 404 for a follow that is not yours; 409 for a stopped
|
|
85
|
+
* follow or one whose stop is in progress; 400 when the close was refused;
|
|
86
|
+
* 503 when it cannot run right now. The response is sent once the batch is
|
|
87
|
+
* durably logged; fills arrive on the order, position and copy channels.
|
|
88
|
+
*/
|
|
89
|
+
closeFollowPositions(followId: string): Promise<CloseFollowPositionsResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Close the copy positions of every live follow of yours, as
|
|
92
|
+
* `closeFollowPositions` does for one, keeping the follows. Follows whose
|
|
93
|
+
* stop is in progress are listed in `stoppingFollowIds`; a follow whose
|
|
94
|
+
* close could not run is listed in `failedFollows` with a fixed reason
|
|
95
|
+
* while the others still close.
|
|
96
|
+
*/
|
|
97
|
+
closeAllCopyPositions(): Promise<CloseAllCopyPositionsResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Add margin to one of your copy positions: moves `amount` (quote units)
|
|
100
|
+
* from the follow's copy account into the margin of its isolated copy
|
|
101
|
+
* position on `tradingPairId`. The position's margin rises by exactly
|
|
102
|
+
* `amount` and the copy account's remaining collateral falls by the same;
|
|
103
|
+
* your margin account is never touched. It lowers the position's leverage
|
|
104
|
+
* and moves its liquidation price away, and opens no exposure, so it works
|
|
105
|
+
* while copy trading is switched off and on a `CLOSE_ONLY` follow. There
|
|
106
|
+
* is no margin reduction: a follow exits by being stopped.
|
|
107
|
+
*
|
|
108
|
+
* Master account sessions only (a delegated agent or a sub-account gets
|
|
109
|
+
* 403); 404 for a follow that is not yours; 409 while the follow is
|
|
110
|
+
* stopping or once it is stopped; 400 `COPY_TRADING_REJECTED` when the add
|
|
111
|
+
* is refused (no isolated copy position on the pair, the copy position is
|
|
112
|
+
* being liquidated or is in bad debt, more than the copy account can put
|
|
113
|
+
* in); 429
|
|
114
|
+
* over the movement budget withdrawals and collateral transfers share.
|
|
115
|
+
*
|
|
116
|
+
* Not idempotent: a retry after a timeout whose first attempt landed adds
|
|
117
|
+
* the amount twice, so read the follow before retrying.
|
|
118
|
+
*/
|
|
119
|
+
addFollowPositionMargin(params: AddFollowPositionMarginParams): Promise<AddFollowPositionMarginResponse>;
|
|
72
120
|
/** List your follows, newest first. Cursor paged, up to 1000 per page. */
|
|
73
121
|
listMyFollows(params?: ListMyFollowsParams): Promise<ListMyFollowsResponse>;
|
|
74
122
|
/**
|
|
@@ -91,5 +139,5 @@ export interface CopyTradingAPI extends BaseAPI {
|
|
|
91
139
|
*/
|
|
92
140
|
previewFollow(params: PreviewFollowParams): Promise<PreviewFollowResponse>;
|
|
93
141
|
}
|
|
94
|
-
export type { ClosedTrade, ClosedTradeAction, CopySkip, Follow, Follower, GetFollowResponse, GetLeadTraderResponse, LeadTraderFollowSummary, LeadTraderListing, LeadTraderOpenPosition, LeadTraderProfile, LeadTraderRef, LeadTraderSort, LeadTraderStats, LeadTraderStatsWindow, LeadTraderStatus, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse, } from "./responses";
|
|
95
|
-
export { ClosedTradeSchema, CopySkipSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
142
|
+
export type { AddFollowPositionMarginResponse, CloseAllCopyPositionsResponse, ClosedTrade, ClosedTradeAction, CloseFollowPositionsResponse, CopySkip, Follow, FollowCloseFailure, Follower, GetFollowResponse, GetLeadTraderResponse, LeadTraderFollowSummary, LeadTraderListing, LeadTraderOpenPosition, LeadTraderProfile, LeadTraderRef, LeadTraderSort, LeadTraderStats, LeadTraderStatsWindow, LeadTraderStatus, ListFollowLeaderPositionsResponse, ListLeadTraderClosedTradesResponse, ListLeadTraderOpenPositionsResponse, ListLeadTradersResponse, ListMyFollowersResponse, ListMyFollowsResponse, PreviewFollowResponse, StopFollowResponse, UpsertFollowResponse, UpsertLeadTraderResponse, } from "./responses";
|
|
143
|
+
export { AddFollowPositionMarginResponseSchema, CloseAllCopyPositionsResponseSchema, ClosedTradeSchema, CloseFollowPositionsResponseSchema, CopySkipSchema, FollowCloseFailureSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* bucket in their margin account) and every fill the leader makes is mirrored
|
|
6
6
|
* into it. Leaders are addressed by their custom TraderCode handle.
|
|
7
7
|
*/
|
|
8
|
-
export { ClosedTradeSchema, CopySkipSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
8
|
+
export { AddFollowPositionMarginResponseSchema, CloseAllCopyPositionsResponseSchema, ClosedTradeSchema, CloseFollowPositionsResponseSchema, CopySkipSchema, FollowCloseFailureSchema, FollowerSchema, FollowSchema, GetFollowResponseSchema, GetLeadTraderResponseSchema, LeadTraderFollowSummarySchema, LeadTraderListingSchema, LeadTraderOpenPositionSchema, LeadTraderProfileSchema, LeadTraderRefSchema, LeadTraderStatsSchema, ListFollowLeaderPositionsResponseSchema, ListLeadTraderClosedTradesResponseSchema, ListLeadTraderOpenPositionsResponseSchema, ListLeadTradersResponseSchema, ListMyFollowersResponseSchema, ListMyFollowsResponseSchema, PreviewFollowResponseSchema, StopFollowResponseSchema, UpsertFollowResponseSchema, UpsertLeadTraderResponseSchema, } from "./responses";
|
|
@@ -349,6 +349,45 @@ export declare const PreviewFollowResponseSchema: z.ZodObject<{
|
|
|
349
349
|
export declare const StopFollowResponseSchema: z.ZodObject<{
|
|
350
350
|
followId: z.ZodString;
|
|
351
351
|
}, z.core.$strip>;
|
|
352
|
+
/**
|
|
353
|
+
* One follow's copy positions closing: a batch acknowledgement, sent once the
|
|
354
|
+
* batch is durably logged. The closes are reduce-only and immediate-or-cancel;
|
|
355
|
+
* each one's fills arrive on the order, position and copy channels. Not a
|
|
356
|
+
* flatten guarantee: `positionsNotClosed` counts what a thin or halted market
|
|
357
|
+
* left open.
|
|
358
|
+
*/
|
|
359
|
+
export declare const CloseFollowPositionsResponseSchema: z.ZodObject<{
|
|
360
|
+
followId: z.ZodString;
|
|
361
|
+
closeOrdersPlaced: z.ZodNumber;
|
|
362
|
+
positionsNotClosed: z.ZodNumber;
|
|
363
|
+
}, z.core.$strip>;
|
|
364
|
+
/** A follow whose close could not run. */
|
|
365
|
+
export declare const FollowCloseFailureSchema: z.ZodObject<{
|
|
366
|
+
followId: z.ZodString;
|
|
367
|
+
reason: z.ZodString;
|
|
368
|
+
}, z.core.$strip>;
|
|
369
|
+
/** Result of closing all your copy positions. */
|
|
370
|
+
export declare const CloseAllCopyPositionsResponseSchema: z.ZodObject<{
|
|
371
|
+
follows: z.ZodArray<z.ZodObject<{
|
|
372
|
+
followId: z.ZodString;
|
|
373
|
+
closeOrdersPlaced: z.ZodNumber;
|
|
374
|
+
positionsNotClosed: z.ZodNumber;
|
|
375
|
+
}, z.core.$strip>>;
|
|
376
|
+
stoppingFollowIds: z.ZodArray<z.ZodString>;
|
|
377
|
+
failedFollows: z.ZodArray<z.ZodObject<{
|
|
378
|
+
followId: z.ZodString;
|
|
379
|
+
reason: z.ZodString;
|
|
380
|
+
}, z.core.$strip>>;
|
|
381
|
+
}, z.core.$strip>;
|
|
382
|
+
/** Result of adding margin to one of your copy positions. */
|
|
383
|
+
export declare const AddFollowPositionMarginResponseSchema: z.ZodObject<{
|
|
384
|
+
followId: z.ZodString;
|
|
385
|
+
tradingPairId: z.ZodString;
|
|
386
|
+
riskBucketId: z.ZodString;
|
|
387
|
+
positionId: z.ZodString;
|
|
388
|
+
positionMargin: z.ZodString;
|
|
389
|
+
copyAccountAvailable: z.ZodString;
|
|
390
|
+
}, z.core.$strip>;
|
|
352
391
|
export type LeadTraderRef = z.infer<typeof LeadTraderRefSchema>;
|
|
353
392
|
export type LeadTraderProfile = z.infer<typeof LeadTraderProfileSchema>;
|
|
354
393
|
export type LeadTraderFollowSummary = z.infer<typeof LeadTraderFollowSummarySchema>;
|
|
@@ -370,4 +409,8 @@ export type GetFollowResponse = z.infer<typeof GetFollowResponseSchema>;
|
|
|
370
409
|
export type ListFollowLeaderPositionsResponse = z.infer<typeof ListFollowLeaderPositionsResponseSchema>;
|
|
371
410
|
export type UpsertFollowResponse = z.infer<typeof UpsertFollowResponseSchema>;
|
|
372
411
|
export type StopFollowResponse = z.infer<typeof StopFollowResponseSchema>;
|
|
412
|
+
export type CloseFollowPositionsResponse = z.infer<typeof CloseFollowPositionsResponseSchema>;
|
|
413
|
+
export type FollowCloseFailure = z.infer<typeof FollowCloseFailureSchema>;
|
|
414
|
+
export type CloseAllCopyPositionsResponse = z.infer<typeof CloseAllCopyPositionsResponseSchema>;
|
|
373
415
|
export type PreviewFollowResponse = z.infer<typeof PreviewFollowResponseSchema>;
|
|
416
|
+
export type AddFollowPositionMarginResponse = z.infer<typeof AddFollowPositionMarginResponseSchema>;
|
|
@@ -266,3 +266,52 @@ export const StopFollowResponseSchema = z.object({
|
|
|
266
266
|
/** The stopped follow's id. */
|
|
267
267
|
followId: z.string(),
|
|
268
268
|
});
|
|
269
|
+
/**
|
|
270
|
+
* One follow's copy positions closing: a batch acknowledgement, sent once the
|
|
271
|
+
* batch is durably logged. The closes are reduce-only and immediate-or-cancel;
|
|
272
|
+
* each one's fills arrive on the order, position and copy channels. Not a
|
|
273
|
+
* flatten guarantee: `positionsNotClosed` counts what a thin or halted market
|
|
274
|
+
* left open.
|
|
275
|
+
*/
|
|
276
|
+
export const CloseFollowPositionsResponseSchema = z.object({
|
|
277
|
+
/** The follow's id. */
|
|
278
|
+
followId: z.string(),
|
|
279
|
+
/** Close orders placed (each may fill in part). */
|
|
280
|
+
closeOrdersPlaced: z.number(),
|
|
281
|
+
/** Copy positions still open after the batch (for example a thin or halted market). */
|
|
282
|
+
positionsNotClosed: z.number(),
|
|
283
|
+
});
|
|
284
|
+
/** A follow whose close could not run. */
|
|
285
|
+
export const FollowCloseFailureSchema = z.object({
|
|
286
|
+
/** The follow's id. */
|
|
287
|
+
followId: z.string(),
|
|
288
|
+
/** Why the close could not run, as a fixed sentence; retry the close. */
|
|
289
|
+
reason: z.string(),
|
|
290
|
+
});
|
|
291
|
+
/** Result of closing all your copy positions. */
|
|
292
|
+
export const CloseAllCopyPositionsResponseSchema = z.object({
|
|
293
|
+
/**
|
|
294
|
+
* Every live follow whose stop is not in progress and whose close ran,
|
|
295
|
+
* including one with nothing to close (0 orders placed, 0 positions not closed).
|
|
296
|
+
*/
|
|
297
|
+
follows: z.array(CloseFollowPositionsResponseSchema),
|
|
298
|
+
/** Follows whose stop is in progress: their stop closes their positions. */
|
|
299
|
+
stoppingFollowIds: z.array(z.string()),
|
|
300
|
+
/** Follows whose close could not run; the other follows still closed. */
|
|
301
|
+
failedFollows: z.array(FollowCloseFailureSchema),
|
|
302
|
+
});
|
|
303
|
+
/** Result of adding margin to one of your copy positions. */
|
|
304
|
+
export const AddFollowPositionMarginResponseSchema = z.object({
|
|
305
|
+
/** The follow's id. */
|
|
306
|
+
followId: z.string(),
|
|
307
|
+
/** Trading pair of the copy position. */
|
|
308
|
+
tradingPairId: z.string(),
|
|
309
|
+
/** The copy position's isolated risk bucket. */
|
|
310
|
+
riskBucketId: z.string(),
|
|
311
|
+
/** The copy position's id. */
|
|
312
|
+
positionId: z.string(),
|
|
313
|
+
/** The copy position's margin after the add, in quote units. */
|
|
314
|
+
positionMargin: z.string(),
|
|
315
|
+
/** What the copy account can still put into this position after the add, in quote units. */
|
|
316
|
+
copyAccountAvailable: z.string(),
|
|
317
|
+
});
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { BaseAPI } from "../api";
|
|
3
|
-
export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_ORDER" | "create_order" | "cancel_order" | "replace_order";
|
|
3
|
+
export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_ORDER" | "READ" | "MANAGE_RISK_BUCKETS" | "create_order" | "cancel_order" | "replace_order" | "read" | "manage_risk_buckets";
|
|
4
4
|
export interface UpsertDelegatedAgentRequest {
|
|
5
5
|
agentAddress: string;
|
|
6
6
|
name?: string;
|
|
7
|
+
/** Delegation expiry (ISO 8601); ends reads, trading, and session refresh. Omit for the default of 14 days from now; at most 180 days ahead. */
|
|
7
8
|
expiresAt?: string;
|
|
8
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Required. An empty list permits no order actions. Every delegated session may read the owner's
|
|
11
|
+
* data, so a list of only `READ` (or none) is a read-only key.
|
|
12
|
+
*/
|
|
9
13
|
allowedActions: DelegatedAgentAction[];
|
|
10
|
-
/** Required.
|
|
14
|
+
/** Required. Each listed scope must match: a listed market AND a listed account. Both empty deny all orders. */
|
|
11
15
|
allowedTradingPairIds: string[];
|
|
12
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The margin accounts the agent is bound to (a sub-account's own key). Omit or send [] to leave the
|
|
18
|
+
* account unrestricted.
|
|
19
|
+
*/
|
|
13
20
|
allowedMarginAccountIds?: string[];
|
|
14
21
|
/** Omit or send [] for unrestricted order types. */
|
|
15
22
|
allowedOrderTypes?: Array<"LIMIT" | "MARKET">;
|
|
@@ -19,6 +26,8 @@ export interface UpsertDelegatedAgentRequest {
|
|
|
19
26
|
maxOrderNotional?: string;
|
|
20
27
|
/** @deprecated Unsupported: setting this field causes the server to reject the request. */
|
|
21
28
|
maxOpenOrders?: number;
|
|
29
|
+
/** Up to 20 IP addresses or CIDR ranges the agent may create its delegated session from. Omit for any. */
|
|
30
|
+
ipAllowlist?: string[];
|
|
22
31
|
}
|
|
23
32
|
export interface DelegatedAgent {
|
|
24
33
|
id: string;
|
|
@@ -37,6 +46,8 @@ export interface DelegatedAgent {
|
|
|
37
46
|
maxOrderNotional?: string;
|
|
38
47
|
/** @deprecated Legacy data only; no concurrent open-order cap is enforced. */
|
|
39
48
|
maxOpenOrders?: number;
|
|
49
|
+
/** Normalized IP addresses and CIDR ranges; empty allows any address. */
|
|
50
|
+
ipAllowlist?: string[];
|
|
40
51
|
}
|
|
41
52
|
export interface ListDelegatedAgentsResponse {
|
|
42
53
|
agents: DelegatedAgent[];
|
|
@@ -61,6 +72,7 @@ export interface CreateDelegatedSessionRequest {
|
|
|
61
72
|
sessionPublicKey: string;
|
|
62
73
|
}
|
|
63
74
|
export interface CreateDelegatedSessionResponse {
|
|
75
|
+
/** Unix seconds; bounded by delegation expiry. Revocation may end access sooner. */
|
|
64
76
|
expiresAt: number;
|
|
65
77
|
delegationId: string;
|
|
66
78
|
ownerUserId: string;
|
package/dist/fees/index.d.ts
CHANGED
|
@@ -41,6 +41,9 @@ export interface FeesAPI extends BaseAPI {
|
|
|
41
41
|
* spot/perp breakdown), the volume still needed to reach the next tier, and the
|
|
42
42
|
* requested pair's six-row fee schedule (threshold plus maker/taker bps).
|
|
43
43
|
*
|
|
44
|
+
* The tier and volumes are wallet-wide: the caller's wallet total across every
|
|
45
|
+
* application it trades through, so they read the same from any application.
|
|
46
|
+
*
|
|
44
47
|
* @param params - Parameters for the lookup
|
|
45
48
|
* @param params.tradingPairId - Trading pair whose fee schedule to return
|
|
46
49
|
* @returns Promise resolving to the caller's tier and the pair's schedule
|
package/dist/fees/responses.js
CHANGED
|
@@ -126,13 +126,13 @@ export const FeeTierScheduleRowSchema = z.object({
|
|
|
126
126
|
* Zod schema for the "my fee tier" response
|
|
127
127
|
*/
|
|
128
128
|
export const GetMyFeeTierResponseSchema = z.object({
|
|
129
|
-
/** Caller's resolved tier (1–6) from stored weighted 14-day volume */
|
|
129
|
+
/** Caller's resolved tier (1–6) from their wallet's stored weighted 14-day volume */
|
|
130
130
|
currentTierLevel: z.number().int(),
|
|
131
|
-
/** Caller's weighted 14-day volume (perp + 2.5× spot) */
|
|
131
|
+
/** Caller's weighted 14-day volume (perp + 2.5× spot), summed across every application the wallet trades through */
|
|
132
132
|
weightedVolume14d: z.string(),
|
|
133
|
-
/** Caller's rolling 14-day spot volume */
|
|
133
|
+
/** Caller's rolling 14-day spot volume, summed across every application the wallet trades through */
|
|
134
134
|
spotVolume14d: z.string(),
|
|
135
|
-
/** Caller's rolling 14-day perp volume */
|
|
135
|
+
/** Caller's rolling 14-day perp volume, summed across every application the wallet trades through */
|
|
136
136
|
perpVolume14d: z.string(),
|
|
137
137
|
/** Additional weighted volume needed to reach the next tier; absent at tier 6 */
|
|
138
138
|
volumeToNextTier: z.string().nullable().optional(),
|