@pear-protocol/types 2.11.0 → 2.12.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.d.ts +3 -3
- package/dist/auth/payloads.js +1 -1
- package/dist/baskets/saved/entities.js +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.js +2 -0
- package/dist/common/refinement.d.ts +3 -3
- package/dist/common/trade-legs.js +1 -1
- package/dist/copy/entities.d.ts +186 -0
- package/dist/copy/entities.js +113 -0
- package/dist/copy/index.d.ts +4 -0
- package/dist/copy/index.js +4 -0
- package/dist/copy/payloads.d.ts +14 -0
- package/dist/copy/payloads.js +8 -0
- package/dist/copy/queries.d.ts +13 -0
- package/dist/copy/queries.js +16 -0
- package/dist/copy/responses.d.ts +332 -0
- package/dist/copy/responses.js +91 -0
- package/dist/execution/entities.d.ts +71 -71
- package/dist/execution/entities.js +1 -1
- package/dist/execution/queries.d.ts +2 -2
- package/dist/execution/responses.d.ts +40 -40
- package/dist/ladder/entities.d.ts +22 -17
- package/dist/ladder/queries.d.ts +5 -0
- package/dist/ladder/queries.js +6 -2
- package/dist/ladder/responses.d.ts +63 -48
- package/dist/misc/payloads.d.ts +26 -0
- package/dist/misc/payloads.js +27 -1
- package/dist/misc/responses.d.ts +8 -0
- package/dist/misc/responses.js +7 -1
- package/dist/notification/entities.d.ts +120 -0
- package/dist/notification/entities.js +59 -3
- package/dist/notification/responses.d.ts +60 -0
- package/dist/order/entities.d.ts +3 -3
- package/dist/position/entities.d.ts +1 -1
- package/dist/position/responses.d.ts +3 -1
- package/dist/position/responses.js +2 -0
- package/dist/schedule/entities.d.ts +18 -12
- package/dist/schedule/entities.js +2 -1
- package/dist/schedule/queries.d.ts +2 -2
- package/dist/schedule/responses.d.ts +12 -8
- package/dist/schedule/twap-config.js +1 -1
- package/dist/statistics/entities.d.ts +10 -0
- package/dist/statistics/entities.js +4 -0
- package/dist/statistics/responses.d.ts +10 -0
- package/dist/sync/payloads.d.ts +12 -0
- package/dist/sync/payloads.js +31 -3
- package/dist/tca/responses.d.ts +12 -12
- package/dist/trade/responses.d.ts +100 -100
- package/dist/trade-accounts/entities.d.ts +136 -12
- package/dist/trade-accounts/entities.js +41 -9
- package/dist/trade-accounts/payloads.d.ts +12 -0
- package/dist/trade-accounts/payloads.js +7 -1
- package/dist/trade-accounts/response.d.ts +963 -223
- package/dist/traders/index.d.ts +1 -0
- package/dist/traders/index.js +1 -0
- package/dist/traders/public.d.ts +4967 -0
- package/dist/traders/public.js +128 -0
- package/dist/trigger/common/index.d.ts +3 -2
- package/dist/trigger/common/index.js +1 -0
- package/dist/trigger/entities/index.d.ts +64 -48
- package/dist/trigger/entities/index.js +3 -3
- package/dist/trigger/queries.d.ts +2 -2
- package/dist/trigger/responses.d.ts +40 -30
- package/dist/vaults/entities.d.ts +1 -1
- package/dist/vaults/responses.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Connector } from '../connector';
|
|
3
|
+
import { CopyFollower } from '../copy/entities';
|
|
3
4
|
|
|
4
5
|
const LeaderboardRow = z.object({
|
|
5
6
|
// The row's identity, and the only safe key to render or join by.
|
|
@@ -11,6 +12,9 @@ const LeaderboardRow = z.object({
|
|
|
11
12
|
// one checks ownership or role, never knowledge of the id.
|
|
12
13
|
userId: z.string(),
|
|
13
14
|
connector: Connector,
|
|
15
|
+
// Followers when this board was cached, independent of the performance date range.
|
|
16
|
+
followers: z.array(CopyFollower),
|
|
17
|
+
followerCount: z.number().int().nonnegative(),
|
|
14
18
|
// Every fill inside the window, whatever period its position began in — so unlike the
|
|
15
19
|
// money fields below, this can report trading whose fees and PnL belong to another window.
|
|
16
20
|
volume: z.string(),
|
|
@@ -11,6 +11,16 @@ export declare const LeaderboardResponse: z.ZodObject<{
|
|
|
11
11
|
lighter: "lighter";
|
|
12
12
|
lighter_rhc: "lighter_rhc";
|
|
13
13
|
}>;
|
|
14
|
+
followers: z.ZodArray<z.ZodObject<{
|
|
15
|
+
tradeAccountId: z.ZodUUID;
|
|
16
|
+
status: z.ZodLiteral<"ACTIVE">;
|
|
17
|
+
followedAt: z.ZodString;
|
|
18
|
+
xUserId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
xHandle: z.ZodOptional<z.ZodString>;
|
|
20
|
+
xName: z.ZodOptional<z.ZodString>;
|
|
21
|
+
xAvatarUrl: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
followerCount: z.ZodNumber;
|
|
14
24
|
volume: z.ZodString;
|
|
15
25
|
grossRealizedPnl: z.ZodString;
|
|
16
26
|
grossUpnl: z.ZodString;
|
package/dist/sync/payloads.d.ts
CHANGED
|
@@ -249,6 +249,10 @@ export declare const ApplicableFill: z.ZodObject<{
|
|
|
249
249
|
}>>;
|
|
250
250
|
liquidation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
251
251
|
mark: z.ZodString;
|
|
252
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
253
|
+
CLOSED: "CLOSED";
|
|
254
|
+
REDUCED: "REDUCED";
|
|
255
|
+
}>>;
|
|
252
256
|
}, z.core.$strip>>>;
|
|
253
257
|
original: z.ZodOptional<z.ZodObject<{
|
|
254
258
|
exchangeFillId: z.ZodString;
|
|
@@ -324,6 +328,10 @@ export declare const ApplicablePosition: z.ZodObject<{
|
|
|
324
328
|
}>>;
|
|
325
329
|
liquidation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
326
330
|
mark: z.ZodString;
|
|
331
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
332
|
+
CLOSED: "CLOSED";
|
|
333
|
+
REDUCED: "REDUCED";
|
|
334
|
+
}>>;
|
|
327
335
|
}, z.core.$strip>>>;
|
|
328
336
|
original: z.ZodOptional<z.ZodObject<{
|
|
329
337
|
exchangeFillId: z.ZodString;
|
|
@@ -428,6 +436,10 @@ export declare const CreateApplicablesRequest: z.ZodObject<{
|
|
|
428
436
|
}>>;
|
|
429
437
|
liquidation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
430
438
|
mark: z.ZodString;
|
|
439
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
440
|
+
CLOSED: "CLOSED";
|
|
441
|
+
REDUCED: "REDUCED";
|
|
442
|
+
}>>;
|
|
431
443
|
}, z.core.$strip>>>;
|
|
432
444
|
original: z.ZodOptional<z.ZodObject<{
|
|
433
445
|
exchangeFillId: z.ZodString;
|
package/dist/sync/payloads.js
CHANGED
|
@@ -5,6 +5,8 @@ import { Connector } from '../connector';
|
|
|
5
5
|
import { InstrumentId } from '../instrument';
|
|
6
6
|
import { PositionClosedReason, PositionStatus, PositionOrigin } from '../position/entities';
|
|
7
7
|
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
10
|
const ExchangeFillId = z.string().trim().min(1, "Exchange fill ID must be non-empty");
|
|
9
11
|
const MsTimestamp = z.number().int().positive().describe("Unix timestamp in milliseconds");
|
|
10
12
|
const LiquidationMark = z.object({
|
|
@@ -93,7 +95,12 @@ const ApplicableFill = z.object({
|
|
|
93
95
|
tradeFee: TradeFee,
|
|
94
96
|
builderFee: UnsignedDecimalString,
|
|
95
97
|
closedReason: PositionClosedReason.optional().describe("e.g. NETTED for a synthetic close fill"),
|
|
96
|
-
liquidation: LiquidationMark.
|
|
98
|
+
liquidation: LiquidationMark.unwrap().extend({
|
|
99
|
+
outcome: z.enum([
|
|
100
|
+
"CLOSED",
|
|
101
|
+
"REDUCED"
|
|
102
|
+
]).optional().describe("Position outcome after this reducing slice")
|
|
103
|
+
}).nullable().optional(),
|
|
97
104
|
original: OriginalFillRef.optional()
|
|
98
105
|
});
|
|
99
106
|
const ApplicableMetadata = z.object({
|
|
@@ -114,9 +121,9 @@ const SyncMeta = z.object({
|
|
|
114
121
|
});
|
|
115
122
|
const CreateApplicablesMeta = SyncMeta.extend({
|
|
116
123
|
firstSyncStartedAt: z.number().int().nonnegative().optional().describe("backend-issued timestamp returned before the first fill-history fetch"),
|
|
117
|
-
newestFillTs: z.number().int().nonnegative().refine((timestamp) => timestamp <= Date.now() + WATERMARK_FUTURE_SKEW_MS, "newestFillTs must not be ahead of server time").optional().describe("raw newest fetched fill \u2014 settle-gate source, never trim-advanced"),
|
|
124
|
+
newestFillTs: z.number().int().nonnegative().refine((timestamp) => timestamp <= Date.now() + WATERMARK_FUTURE_SKEW_MS, "newestFillTs must not be ahead of server time").optional().describe("raw newest fetched fill \u2014 settle-gate source, never trim-advanced; present exactly when externalMaxTs is"),
|
|
118
125
|
executionsUpdatedAtEpochMs: z.number().int().nonnegative().describe("verbatim echo of fills/since executionsUpdatedAtEpochMs \u2014 stale-read gate token, not a client clock")
|
|
119
|
-
});
|
|
126
|
+
}).superRefine(refineNewestFillTsPairsWithWatermark);
|
|
120
127
|
const CreateApplicablesBulkFields = z.object({
|
|
121
128
|
executionsUpdatedAtEpochMs: z.string().regex(/^\d+$/, "Must be a non-negative integer millisecond value").transform(Number).describe("mirror of meta.executionsUpdatedAtEpochMs, readable without decompressing the payload")
|
|
122
129
|
});
|
|
@@ -138,5 +145,26 @@ const CreateFundingPaymentsRequest = z.object({
|
|
|
138
145
|
payments: z.array(FundingPaymentEntry),
|
|
139
146
|
meta: SyncMeta
|
|
140
147
|
});
|
|
148
|
+
function refineNewestFillTsPairsWithWatermark(meta, ctx) {
|
|
149
|
+
if (meta.externalMaxTs !== null && meta.newestFillTs === void 0) {
|
|
150
|
+
ctx.addIssue({
|
|
151
|
+
code: "custom",
|
|
152
|
+
message: "newestFillTs is required when externalMaxTs is set",
|
|
153
|
+
path: [
|
|
154
|
+
"newestFillTs"
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (meta.externalMaxTs === null && meta.newestFillTs !== void 0) {
|
|
159
|
+
ctx.addIssue({
|
|
160
|
+
code: "custom",
|
|
161
|
+
message: "newestFillTs must be absent when externalMaxTs is null",
|
|
162
|
+
path: [
|
|
163
|
+
"newestFillTs"
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
__name(refineNewestFillTsPairsWithWatermark, "refineNewestFillTsPairsWithWatermark");
|
|
141
169
|
|
|
142
170
|
export { ApplicableFill, ApplicableMetadata, ApplicablePosition, ConfirmFillsRequest, ConfirmableExternalFill, CreateApplicablesBulkFields, CreateApplicablesMeta, CreateApplicablesRequest, CreateFundingPaymentsRequest, ExternalPosition, FundingPaymentEntry, ReconcileFillsRequest, ReconcileReplacementExternalFill, SyncFillsSinceRequest, SyncFundingSinceRequest, SyncMeta, UnknownExternalFill, WATERMARK_FUTURE_SKEW_MS };
|
package/dist/tca/responses.d.ts
CHANGED
|
@@ -118,19 +118,19 @@ export type TcaExecutionSummaryLegResponse = z.output<typeof TcaExecutionSummary
|
|
|
118
118
|
export declare const TcaExecutionSummaryContextResponse: z.ZodObject<{
|
|
119
119
|
intent: z.ZodEnum<{
|
|
120
120
|
OPEN: "OPEN";
|
|
121
|
-
CLOSE: "CLOSE";
|
|
122
121
|
ADJUST: "ADJUST";
|
|
122
|
+
CLOSE: "CLOSE";
|
|
123
123
|
REVERSE: "REVERSE";
|
|
124
124
|
}>;
|
|
125
125
|
orderType: z.ZodEnum<{
|
|
126
126
|
MARKET: "MARKET";
|
|
127
127
|
}>;
|
|
128
128
|
executionStatus: z.ZodEnum<{
|
|
129
|
+
ACTIVE: "ACTIVE";
|
|
130
|
+
FAILED: "FAILED";
|
|
129
131
|
CANCELLED: "CANCELLED";
|
|
130
132
|
IDLE: "IDLE";
|
|
131
|
-
ACTIVE: "ACTIVE";
|
|
132
133
|
COMPLETED: "COMPLETED";
|
|
133
|
-
FAILED: "FAILED";
|
|
134
134
|
}>;
|
|
135
135
|
positionId: z.ZodOptional<z.ZodUUID>;
|
|
136
136
|
scheduleId: z.ZodOptional<z.ZodUUID>;
|
|
@@ -160,19 +160,19 @@ export declare const TcaExecutionSummaryResponse: z.ZodObject<{
|
|
|
160
160
|
executionContext: z.ZodOptional<z.ZodObject<{
|
|
161
161
|
intent: z.ZodEnum<{
|
|
162
162
|
OPEN: "OPEN";
|
|
163
|
-
CLOSE: "CLOSE";
|
|
164
163
|
ADJUST: "ADJUST";
|
|
164
|
+
CLOSE: "CLOSE";
|
|
165
165
|
REVERSE: "REVERSE";
|
|
166
166
|
}>;
|
|
167
167
|
orderType: z.ZodEnum<{
|
|
168
168
|
MARKET: "MARKET";
|
|
169
169
|
}>;
|
|
170
170
|
executionStatus: z.ZodEnum<{
|
|
171
|
+
ACTIVE: "ACTIVE";
|
|
172
|
+
FAILED: "FAILED";
|
|
171
173
|
CANCELLED: "CANCELLED";
|
|
172
174
|
IDLE: "IDLE";
|
|
173
|
-
ACTIVE: "ACTIVE";
|
|
174
175
|
COMPLETED: "COMPLETED";
|
|
175
|
-
FAILED: "FAILED";
|
|
176
176
|
}>;
|
|
177
177
|
positionId: z.ZodOptional<z.ZodUUID>;
|
|
178
178
|
scheduleId: z.ZodOptional<z.ZodUUID>;
|
|
@@ -215,19 +215,19 @@ export declare const TcaExecutionResponse: z.ZodObject<{
|
|
|
215
215
|
executionContext: z.ZodOptional<z.ZodObject<{
|
|
216
216
|
intent: z.ZodEnum<{
|
|
217
217
|
OPEN: "OPEN";
|
|
218
|
-
CLOSE: "CLOSE";
|
|
219
218
|
ADJUST: "ADJUST";
|
|
219
|
+
CLOSE: "CLOSE";
|
|
220
220
|
REVERSE: "REVERSE";
|
|
221
221
|
}>;
|
|
222
222
|
orderType: z.ZodEnum<{
|
|
223
223
|
MARKET: "MARKET";
|
|
224
224
|
}>;
|
|
225
225
|
executionStatus: z.ZodEnum<{
|
|
226
|
+
ACTIVE: "ACTIVE";
|
|
227
|
+
FAILED: "FAILED";
|
|
226
228
|
CANCELLED: "CANCELLED";
|
|
227
229
|
IDLE: "IDLE";
|
|
228
|
-
ACTIVE: "ACTIVE";
|
|
229
230
|
COMPLETED: "COMPLETED";
|
|
230
|
-
FAILED: "FAILED";
|
|
231
231
|
}>;
|
|
232
232
|
positionId: z.ZodOptional<z.ZodUUID>;
|
|
233
233
|
scheduleId: z.ZodOptional<z.ZodUUID>;
|
|
@@ -438,19 +438,19 @@ export declare const TcaSummaryResponse: z.ZodObject<{
|
|
|
438
438
|
executionContext: z.ZodOptional<z.ZodObject<{
|
|
439
439
|
intent: z.ZodEnum<{
|
|
440
440
|
OPEN: "OPEN";
|
|
441
|
-
CLOSE: "CLOSE";
|
|
442
441
|
ADJUST: "ADJUST";
|
|
442
|
+
CLOSE: "CLOSE";
|
|
443
443
|
REVERSE: "REVERSE";
|
|
444
444
|
}>;
|
|
445
445
|
orderType: z.ZodEnum<{
|
|
446
446
|
MARKET: "MARKET";
|
|
447
447
|
}>;
|
|
448
448
|
executionStatus: z.ZodEnum<{
|
|
449
|
+
ACTIVE: "ACTIVE";
|
|
450
|
+
FAILED: "FAILED";
|
|
449
451
|
CANCELLED: "CANCELLED";
|
|
450
452
|
IDLE: "IDLE";
|
|
451
|
-
ACTIVE: "ACTIVE";
|
|
452
453
|
COMPLETED: "COMPLETED";
|
|
453
|
-
FAILED: "FAILED";
|
|
454
454
|
}>;
|
|
455
455
|
positionId: z.ZodOptional<z.ZodUUID>;
|
|
456
456
|
scheduleId: z.ZodOptional<z.ZodUUID>;
|