@pear-protocol/types 2.12.0 → 2.13.0
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/payloads.js +2 -2
- package/dist/auth/response.js +2 -2
- package/dist/statistics/entities.d.ts +1 -0
- package/dist/statistics/entities.js +4 -0
- package/dist/statistics/responses.d.ts +1 -0
- package/dist/traders/public.d.ts +91 -1
- package/dist/traders/public.js +41 -3
- package/dist/users/entities.js +1 -1
- package/package.json +1 -1
package/dist/auth/payloads.js
CHANGED
|
@@ -25,8 +25,8 @@ const StartXLinkRequest = z.object({
|
|
|
25
25
|
returnTo: z.string().optional().describe("Page to send the browser back to once the link finishes, normally the page the user is on. Must be on the calling origin; defaults to that origin.")
|
|
26
26
|
}).describe("Start of the X account link flow");
|
|
27
27
|
const SetXVisibilityRequest = z.object({
|
|
28
|
-
xHidden: z.boolean().describe("True to withhold the linked X account from the leaderboard, false to publish it. The wanted state rather than a flip, so a retry lands on the same result and two tabs cannot disagree. Named to match `xHidden` on the user profile - one name for one value.")
|
|
29
|
-
}).describe("
|
|
28
|
+
xHidden: z.boolean().describe("True to withhold the linked X account from the leaderboard and public trader profiles, false to publish it. The wanted state rather than a flip, so a retry lands on the same result and two tabs cannot disagree. Named to match `xHidden` on the user profile - one name for one value.")
|
|
29
|
+
}).describe("Visibility of the X account on the leaderboard and public trader profiles");
|
|
30
30
|
const PkceValue = z.string().regex(/^[A-Za-z0-9_-]{43}$/, "Must be 43 base64url characters");
|
|
31
31
|
const StartXLoginRequest = z.object({
|
|
32
32
|
returnTo: z.string().optional().describe("Page to send the browser back to once the sign-in finishes, normally the page the user is on. Must be on the calling origin; defaults to that origin. Any fragment is dropped - the flow returns its ticket there."),
|
package/dist/auth/response.js
CHANGED
|
@@ -38,8 +38,8 @@ const StartXLinkResponse = z.object({
|
|
|
38
38
|
authorizeUrl: z.string().describe("X authorization URL to send the browser to. Expires with the flow's state.")
|
|
39
39
|
}).describe("Start of the X account link flow");
|
|
40
40
|
const SetXVisibilityResponse = z.object({
|
|
41
|
-
xHidden: z.boolean().describe("The stored state, read back from the write: true when the leaderboard
|
|
42
|
-
}).describe("
|
|
41
|
+
xHidden: z.boolean().describe("The stored state, read back from the write: true when the leaderboard and public trader profiles withhold the X account. A confirmation of what was asked for, not a value the caller could not otherwise know.")
|
|
42
|
+
}).describe("Visibility of the X account on the leaderboard and public trader profiles after the write");
|
|
43
43
|
const DisconnectXResponse = z.void().describe("Successful X account disconnect response");
|
|
44
44
|
const StartXLoginResponse = z.object({
|
|
45
45
|
authorizeUrl: z.string().describe("X authorization URL to send the browser to. Expires with the flow's state.")
|
|
@@ -10,8 +10,12 @@ const LeaderboardRow = z.object({
|
|
|
10
10
|
// address beside a real name and a PnL deanonymizes a trader for good, and an address is
|
|
11
11
|
// not reversible once scraped. Neither id here is a credential — every route that takes
|
|
12
12
|
// one checks ownership or role, never knowledge of the id.
|
|
13
|
+
// This guarantee applies to private routes. Shared public profiles are addressable by
|
|
14
|
+
// tradeAccountId and omit the exchange identifier, including when the owner shows X identity.
|
|
13
15
|
userId: z.string(),
|
|
14
16
|
connector: Connector,
|
|
17
|
+
// Current owner consent; venue support and admission availability also apply.
|
|
18
|
+
copyingEnabled: z.boolean().describe("Whether the owner allows new copy subscriptions; venue support and admission availability also apply"),
|
|
15
19
|
// Followers when this board was cached, independent of the performance date range.
|
|
16
20
|
followers: z.array(CopyFollower),
|
|
17
21
|
followerCount: z.number().int().nonnegative(),
|
package/dist/traders/public.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ export declare const PublicTraderParams: z.ZodObject<{
|
|
|
4
4
|
tradeAccountId: z.ZodUUID;
|
|
5
5
|
}, z.core.$strip>;
|
|
6
6
|
export type PublicTraderParams = z.output<typeof PublicTraderParams>;
|
|
7
|
+
/** Public closed-history filters; refuse steps and every unsupported private option. */
|
|
8
|
+
export declare const PublicTraderClosedPositionsParams: z.ZodObject<{
|
|
9
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<number>>>;
|
|
10
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
11
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
12
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
13
|
+
positionId: z.ZodOptional<z.ZodUUID>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type PublicTraderClosedPositionsParamsInput = z.input<typeof PublicTraderClosedPositionsParams>;
|
|
16
|
+
export type PublicTraderClosedPositionsParams = z.output<typeof PublicTraderClosedPositionsParams>;
|
|
7
17
|
export declare const PublicOpenPosition: z.ZodObject<{
|
|
8
18
|
status: z.ZodLiteral<"OPEN">;
|
|
9
19
|
connector: z.ZodEnum<{
|
|
@@ -39,6 +49,82 @@ export declare const PublicOpenPosition: z.ZodObject<{
|
|
|
39
49
|
}, z.core.$strip>>;
|
|
40
50
|
}, z.core.$strip>;
|
|
41
51
|
export type PublicOpenPosition = z.output<typeof PublicOpenPosition>;
|
|
52
|
+
/** Public closed-history fields follow the existing public vault history contract. */
|
|
53
|
+
export declare const PublicClosedPosition: z.ZodObject<{
|
|
54
|
+
status: z.ZodLiteral<"CLOSED">;
|
|
55
|
+
connector: z.ZodEnum<{
|
|
56
|
+
hyperliquid: "hyperliquid";
|
|
57
|
+
binance: "binance";
|
|
58
|
+
bybit: "bybit";
|
|
59
|
+
okx: "okx";
|
|
60
|
+
lighter: "lighter";
|
|
61
|
+
lighter_rhc: "lighter_rhc";
|
|
62
|
+
}>;
|
|
63
|
+
positionId: z.ZodUUID;
|
|
64
|
+
closedReason: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
NETTED: "NETTED";
|
|
66
|
+
USER: "USER";
|
|
67
|
+
LIQUIDATED: "LIQUIDATED";
|
|
68
|
+
}>>;
|
|
69
|
+
closedAt: z.ZodString;
|
|
70
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
71
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
72
|
+
openedAt: z.ZodString;
|
|
73
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
74
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
75
|
+
side: z.ZodEnum<{
|
|
76
|
+
LONG: "LONG";
|
|
77
|
+
SHORT: "SHORT";
|
|
78
|
+
}>;
|
|
79
|
+
asset: z.ZodString;
|
|
80
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
81
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
82
|
+
entryNotional: z.ZodString;
|
|
83
|
+
entryVwap: z.ZodOptional<z.ZodString>;
|
|
84
|
+
exitVwap: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export type PublicClosedPosition = z.output<typeof PublicClosedPosition>;
|
|
88
|
+
/** Preserve the reader's cursor even when a page contains fewer composed positions than its limit. */
|
|
89
|
+
export declare const PublicTraderClosedPositionsResponse: z.ZodObject<{
|
|
90
|
+
limit: z.ZodNumber;
|
|
91
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
92
|
+
positions: z.ZodArray<z.ZodObject<{
|
|
93
|
+
status: z.ZodLiteral<"CLOSED">;
|
|
94
|
+
connector: z.ZodEnum<{
|
|
95
|
+
hyperliquid: "hyperliquid";
|
|
96
|
+
binance: "binance";
|
|
97
|
+
bybit: "bybit";
|
|
98
|
+
okx: "okx";
|
|
99
|
+
lighter: "lighter";
|
|
100
|
+
lighter_rhc: "lighter_rhc";
|
|
101
|
+
}>;
|
|
102
|
+
positionId: z.ZodUUID;
|
|
103
|
+
closedReason: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
NETTED: "NETTED";
|
|
105
|
+
USER: "USER";
|
|
106
|
+
LIQUIDATED: "LIQUIDATED";
|
|
107
|
+
}>>;
|
|
108
|
+
closedAt: z.ZodString;
|
|
109
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
110
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
111
|
+
openedAt: z.ZodString;
|
|
112
|
+
hasProvisionalFills: z.ZodBoolean;
|
|
113
|
+
legs: z.ZodArray<z.ZodObject<{
|
|
114
|
+
side: z.ZodEnum<{
|
|
115
|
+
LONG: "LONG";
|
|
116
|
+
SHORT: "SHORT";
|
|
117
|
+
}>;
|
|
118
|
+
asset: z.ZodString;
|
|
119
|
+
grossPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
120
|
+
netPnl: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>;
|
|
121
|
+
entryNotional: z.ZodString;
|
|
122
|
+
entryVwap: z.ZodOptional<z.ZodString>;
|
|
123
|
+
exitVwap: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type PublicTraderClosedPositionsResponse = z.output<typeof PublicTraderClosedPositionsResponse>;
|
|
42
128
|
export declare const PublicTrigger: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
129
|
type: z.ZodLiteral<"MARKET">;
|
|
44
130
|
id: z.ZodUUID;
|
|
@@ -2485,7 +2571,11 @@ export declare const PublicTraderResponse: z.ZodObject<{
|
|
|
2485
2571
|
lighter: "lighter";
|
|
2486
2572
|
lighter_rhc: "lighter_rhc";
|
|
2487
2573
|
}>;
|
|
2488
|
-
|
|
2574
|
+
copyingEnabled: z.ZodBoolean;
|
|
2575
|
+
xHandle: z.ZodOptional<z.ZodString>;
|
|
2576
|
+
xName: z.ZodOptional<z.ZodString>;
|
|
2577
|
+
xAvatarUrl: z.ZodOptional<z.ZodString>;
|
|
2578
|
+
xUserId: z.ZodOptional<z.ZodString>;
|
|
2489
2579
|
followers: z.ZodArray<z.ZodObject<{
|
|
2490
2580
|
tradeAccountId: z.ZodUUID;
|
|
2491
2581
|
status: z.ZodLiteral<"ACTIVE">;
|
package/dist/traders/public.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CursorResponse } from '../common';
|
|
2
3
|
import { Connector } from '../connector';
|
|
3
4
|
import { CopyFollower } from '../copy/entities';
|
|
4
5
|
import { Ladder } from '../ladder/entities';
|
|
5
|
-
import { OpenPosition, OpenPositionLeg } from '../position/entities';
|
|
6
|
+
import { OpenPosition, OpenPositionLeg, ClosedPosition, ClosedPositionLeg } from '../position/entities';
|
|
7
|
+
import { ClosedPositionListParams } from '../position/queries';
|
|
6
8
|
import { TWAPOpen, TWAPClose } from '../schedule/entities';
|
|
7
9
|
import { TriggerMarketOpen, TriggerMarketAdjust, TriggerMarketClose, TriggerTWAPAdjust, TriggerTWAPClose } from '../trigger/entities';
|
|
8
10
|
|
|
9
11
|
const PublicTraderParams = z.object({
|
|
10
12
|
tradeAccountId: z.uuid()
|
|
11
13
|
});
|
|
14
|
+
const PublicTraderClosedPositionsParams = z.object({
|
|
15
|
+
limit: ClosedPositionListParams.shape.limit,
|
|
16
|
+
cursor: ClosedPositionListParams.shape.cursor,
|
|
17
|
+
startDate: ClosedPositionListParams.shape.startDate,
|
|
18
|
+
endDate: ClosedPositionListParams.shape.endDate,
|
|
19
|
+
positionId: ClosedPositionListParams.shape.positionId
|
|
20
|
+
}).strict();
|
|
12
21
|
const PublicOpenPosition = OpenPosition.pick({
|
|
13
22
|
positionId: true,
|
|
14
23
|
status: true,
|
|
@@ -25,6 +34,30 @@ const PublicOpenPosition = OpenPosition.pick({
|
|
|
25
34
|
remaining: true
|
|
26
35
|
}))
|
|
27
36
|
});
|
|
37
|
+
const PublicClosedPosition = ClosedPosition.pick({
|
|
38
|
+
positionId: true,
|
|
39
|
+
status: true,
|
|
40
|
+
connector: true,
|
|
41
|
+
openedAt: true,
|
|
42
|
+
closedAt: true,
|
|
43
|
+
closedReason: true,
|
|
44
|
+
grossPnl: true,
|
|
45
|
+
netPnl: true,
|
|
46
|
+
hasProvisionalFills: true
|
|
47
|
+
}).extend({
|
|
48
|
+
legs: z.array(ClosedPositionLeg.pick({
|
|
49
|
+
asset: true,
|
|
50
|
+
side: true,
|
|
51
|
+
entryVwap: true,
|
|
52
|
+
exitVwap: true,
|
|
53
|
+
entryNotional: true,
|
|
54
|
+
grossPnl: true,
|
|
55
|
+
netPnl: true
|
|
56
|
+
}))
|
|
57
|
+
});
|
|
58
|
+
const PublicTraderClosedPositionsResponse = CursorResponse.extend({
|
|
59
|
+
positions: z.array(PublicClosedPosition)
|
|
60
|
+
});
|
|
28
61
|
const triggerFields = {
|
|
29
62
|
id: true,
|
|
30
63
|
connector: true,
|
|
@@ -115,7 +148,12 @@ const PublicLadder = Ladder.pick({
|
|
|
115
148
|
});
|
|
116
149
|
const PublicTraderResponse = z.object({
|
|
117
150
|
connector: Connector.describe("Exchange connector type"),
|
|
118
|
-
|
|
151
|
+
copyingEnabled: z.boolean().describe("Whether the owner allows new copy subscriptions; venue support and admission availability also apply"),
|
|
152
|
+
// Omit X identity when the owner hides it or has not linked an account.
|
|
153
|
+
xHandle: z.string().optional().describe("Public X handle at the last authorization; absent when hidden or unlinked"),
|
|
154
|
+
xName: z.string().optional().describe("Public X display name; absent when hidden or unlinked"),
|
|
155
|
+
xAvatarUrl: z.string().optional().describe("Public X avatar URL; absent when hidden or unlinked"),
|
|
156
|
+
xUserId: z.string().optional().describe("Immutable X numeric user ID; absent when hidden or unlinked"),
|
|
119
157
|
// Followers are complete; the latest-20 limit applies only to trading records.
|
|
120
158
|
followers: z.array(CopyFollower),
|
|
121
159
|
followerCount: z.number().int().nonnegative(),
|
|
@@ -125,4 +163,4 @@ const PublicTraderResponse = z.object({
|
|
|
125
163
|
ladders: z.array(PublicLadder)
|
|
126
164
|
});
|
|
127
165
|
|
|
128
|
-
export { PublicLadder, PublicOpenPosition, PublicSchedule, PublicTraderParams, PublicTraderResponse, PublicTrigger };
|
|
166
|
+
export { PublicClosedPosition, PublicLadder, PublicOpenPosition, PublicSchedule, PublicTraderClosedPositionsParams, PublicTraderClosedPositionsResponse, PublicTraderParams, PublicTraderResponse, PublicTrigger };
|
package/dist/users/entities.js
CHANGED
|
@@ -24,7 +24,7 @@ const UserProfile = z.object({
|
|
|
24
24
|
// A plain boolean rather than nullable, matching `emailVerified` above: this is the
|
|
25
25
|
// owner's own setting, which is known whether or not an X account is linked. With none
|
|
26
26
|
// linked it describes what would happen once one is.
|
|
27
|
-
xHidden: z.boolean().describe("Whether the leaderboard
|
|
27
|
+
xHidden: z.boolean().describe("Whether the leaderboard and public trader profiles withhold the linked X account")
|
|
28
28
|
}).describe("User profile of the authenticated user");
|
|
29
29
|
const BoundReferralReferee = z.object({
|
|
30
30
|
status: z.literal("BOUND").describe("The referee resolves to a V3 user with a permanent binding"),
|