@pear-protocol/types 1.9.0 → 1.11.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/entities.d.ts +2 -0
- package/dist/auth/entities.js +1 -1
- package/dist/auth/payloads.d.ts +4 -0
- package/dist/auth/payloads.js +6 -1
- package/dist/auth/response.d.ts +42 -0
- package/dist/auth/response.js +27 -1
- package/dist/common/array.d.ts +1 -1
- package/dist/trigger/common/index.d.ts +1 -0
- package/dist/trigger/common/index.js +1 -1
- package/dist/trigger/payloads/index.d.ts +256 -8
- package/dist/trigger/payloads/index.js +19 -7
- package/package.json +1 -1
package/dist/auth/entities.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const LoginMethod: z.ZodEnum<{
|
|
3
3
|
email: "email";
|
|
4
4
|
evm_wallet: "evm_wallet";
|
|
5
|
+
oauth: "oauth";
|
|
5
6
|
}>;
|
|
6
7
|
export declare const AuthenticatedUser: z.ZodObject<{
|
|
7
8
|
id: z.ZodUUID;
|
|
@@ -14,6 +15,7 @@ export declare const AuthenticatedUser: z.ZodObject<{
|
|
|
14
15
|
loginMethod: z.ZodEnum<{
|
|
15
16
|
email: "email";
|
|
16
17
|
evm_wallet: "evm_wallet";
|
|
18
|
+
oauth: "oauth";
|
|
17
19
|
}>;
|
|
18
20
|
}, z.core.$strip>;
|
|
19
21
|
export type LoginMethod = z.infer<typeof LoginMethod>;
|
package/dist/auth/entities.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
const LoginMethod = z.enum(["email", "evm_wallet"]).describe("Authentication provider used for the current session");
|
|
3
|
+
const LoginMethod = z.enum(["email", "evm_wallet", "oauth"]).describe("Authentication provider used for the current session");
|
|
4
4
|
const AuthenticatedUser = z.object({
|
|
5
5
|
id: z.uuid().describe("User UUID"),
|
|
6
6
|
role: z.enum(["basic", "pro", "admin"]).describe("User role"),
|
package/dist/auth/payloads.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ export declare const ResendVerificationForRegisterRequest: z.ZodObject<{
|
|
|
59
59
|
export declare const LogoutRequest: z.ZodObject<{
|
|
60
60
|
refreshToken: z.ZodString;
|
|
61
61
|
}, z.core.$strip>;
|
|
62
|
+
export declare const OauthInteractionConfirmRequest: z.ZodObject<{
|
|
63
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
62
65
|
export type RequestNonceRequest = z.infer<typeof RequestNonceRequest>;
|
|
63
66
|
export type WalletLoginRequest = z.infer<typeof WalletLoginRequest>;
|
|
64
67
|
export type EmailRegisterRequest = z.infer<typeof EmailRegisterRequest>;
|
|
@@ -68,6 +71,7 @@ export type EmailLoginRequest = z.infer<typeof EmailLoginRequest>;
|
|
|
68
71
|
export type LoginRequest = z.infer<typeof LoginRequest>;
|
|
69
72
|
export type RefreshTokenRequest = z.infer<typeof RefreshTokenRequest>;
|
|
70
73
|
export type LogoutRequest = z.infer<typeof LogoutRequest>;
|
|
74
|
+
export type OauthInteractionConfirmRequest = z.infer<typeof OauthInteractionConfirmRequest>;
|
|
71
75
|
export type VerifyEmailRequest = z.infer<typeof VerifyEmailRequest>;
|
|
72
76
|
export type ResendVerificationForRegisterRequest = z.infer<typeof ResendVerificationForRegisterRequest>;
|
|
73
77
|
export type ChangePasswordRequest = z.infer<typeof ChangePasswordRequest>;
|
package/dist/auth/payloads.js
CHANGED
|
@@ -55,5 +55,10 @@ const ResendVerificationForRegisterRequest = z.object({
|
|
|
55
55
|
const LogoutRequest = z.object({
|
|
56
56
|
refreshToken: z.string().min(1, "Refresh token is required").describe("Refresh token to revoke")
|
|
57
57
|
}).describe("Logout and revoke refresh token");
|
|
58
|
+
const OauthInteractionConfirmRequest = z.object({
|
|
59
|
+
scopes: z.array(z.string()).default([]).describe(
|
|
60
|
+
"The scope set the user granted at consent (opaque to the AS; empty resolves to the read-only fail-safe)"
|
|
61
|
+
)
|
|
62
|
+
}).describe("Consent confirmation body \u2014 the granted scope set");
|
|
58
63
|
|
|
59
|
-
export { ChangePasswordRequest, EmailLoginRequest, EmailRegisterRequest, ForgotPasswordRequest, LinkEmailRequest, LinkWalletRequest, LoginRequest, LogoutRequest, RefreshTokenRequest, RequestNonceRequest, ResendVerificationForRegisterRequest, ResetPasswordRequest, VerifyEmailRequest, WalletLoginRequest };
|
|
64
|
+
export { ChangePasswordRequest, EmailLoginRequest, EmailRegisterRequest, ForgotPasswordRequest, LinkEmailRequest, LinkWalletRequest, LoginRequest, LogoutRequest, OauthInteractionConfirmRequest, RefreshTokenRequest, RequestNonceRequest, ResendVerificationForRegisterRequest, ResetPasswordRequest, VerifyEmailRequest, WalletLoginRequest };
|
package/dist/auth/response.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const LoginResponse: z.ZodObject<{
|
|
|
13
13
|
loginMethod: z.ZodEnum<{
|
|
14
14
|
email: "email";
|
|
15
15
|
evm_wallet: "evm_wallet";
|
|
16
|
+
oauth: "oauth";
|
|
16
17
|
}>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
}, z.core.$strip>;
|
|
@@ -48,8 +49,44 @@ export declare const MeResponse: z.ZodObject<{
|
|
|
48
49
|
loginMethod: z.ZodEnum<{
|
|
49
50
|
email: "email";
|
|
50
51
|
evm_wallet: "evm_wallet";
|
|
52
|
+
oauth: "oauth";
|
|
51
53
|
}>;
|
|
52
54
|
}, z.core.$strip>;
|
|
55
|
+
export declare const OauthGrant: z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
59
|
+
connectedAt: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export declare const OauthGrantsResponse: z.ZodObject<{
|
|
62
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
66
|
+
connectedAt: z.ZodString;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const OauthInteractionClient: z.ZodObject<{
|
|
70
|
+
clientId: z.ZodString;
|
|
71
|
+
clientName: z.ZodOptional<z.ZodString>;
|
|
72
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export declare const OauthInteractionDetailsResponse: z.ZodObject<{
|
|
75
|
+
uid: z.ZodString;
|
|
76
|
+
prompt: z.ZodObject<{
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
details: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
81
|
+
client: z.ZodObject<{
|
|
82
|
+
clientId: z.ZodString;
|
|
83
|
+
clientName: z.ZodOptional<z.ZodString>;
|
|
84
|
+
redirectUris: z.ZodArray<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export declare const OauthInteractionRedirectResponse: z.ZodObject<{
|
|
88
|
+
returnTo: z.ZodString;
|
|
89
|
+
}, z.core.$strip>;
|
|
53
90
|
export type RequestNonceResponse = z.infer<typeof RequestNonceResponse>;
|
|
54
91
|
export type LoginResponse = z.infer<typeof LoginResponse>;
|
|
55
92
|
export type RefreshSessionResponse = z.infer<typeof RefreshSessionResponse>;
|
|
@@ -59,8 +96,13 @@ export type RegisterEmailResponse = z.infer<typeof RegisterEmailResponse>;
|
|
|
59
96
|
export type LinkEmailResponse = z.infer<typeof LinkEmailResponse>;
|
|
60
97
|
export type LinkWalletResponse = z.infer<typeof LinkWalletResponse>;
|
|
61
98
|
export type MeResponse = z.infer<typeof MeResponse>;
|
|
99
|
+
export type OauthGrant = z.infer<typeof OauthGrant>;
|
|
100
|
+
export type OauthGrantsResponse = z.infer<typeof OauthGrantsResponse>;
|
|
62
101
|
export type ResendVerificationResponse = z.infer<typeof ResendVerificationResponse>;
|
|
63
102
|
export type VerifyEmailResponse = z.infer<typeof VerifyEmailResponse>;
|
|
64
103
|
export type ChangePasswordResponse = z.infer<typeof ChangePasswordResponse>;
|
|
65
104
|
export type ForgotPasswordResponse = z.infer<typeof ForgotPasswordResponse>;
|
|
66
105
|
export type ResetPasswordResponse = z.infer<typeof ResetPasswordResponse>;
|
|
106
|
+
export type OauthInteractionClient = z.infer<typeof OauthInteractionClient>;
|
|
107
|
+
export type OauthInteractionDetailsResponse = z.infer<typeof OauthInteractionDetailsResponse>;
|
|
108
|
+
export type OauthInteractionRedirectResponse = z.infer<typeof OauthInteractionRedirectResponse>;
|
package/dist/auth/response.js
CHANGED
|
@@ -28,5 +28,31 @@ const RequestNonceResponse = z.object({
|
|
|
28
28
|
expiresAt: z.number().int().positive().describe("Unix timestamp when nonce expires")
|
|
29
29
|
}).describe("Nonce response for wallet authentication");
|
|
30
30
|
const MeResponse = AuthenticatedUser.describe("Current authenticated user info");
|
|
31
|
+
const OauthGrant = z.object({
|
|
32
|
+
id: z.string().describe("OAuth grant id \u2014 used to revoke this grant"),
|
|
33
|
+
name: z.string().describe("Human-readable client name, falling back to the client id when unnamed"),
|
|
34
|
+
scopes: z.array(z.string()).describe("The granted scope set (opaque; the client interprets it)"),
|
|
35
|
+
connectedAt: z.string().describe("ISO timestamp when the grant was created")
|
|
36
|
+
}).describe("One active OAuth grant the user has authorized");
|
|
37
|
+
const OauthGrantsResponse = z.object({
|
|
38
|
+
grants: z.array(OauthGrant).describe("The user active OAuth grants, newest first")
|
|
39
|
+
}).describe("List of the user active OAuth grants");
|
|
40
|
+
const OauthInteractionClient = z.object({
|
|
41
|
+
clientId: z.string().describe("OAuth client identifier"),
|
|
42
|
+
clientName: z.string().optional().describe("Human-readable client name"),
|
|
43
|
+
redirectUris: z.array(z.string()).describe("Registered redirect URIs for the client")
|
|
44
|
+
}).describe("OAuth client info for an interaction");
|
|
45
|
+
const OauthInteractionDetailsResponse = z.object({
|
|
46
|
+
uid: z.string().describe("Interaction session identifier"),
|
|
47
|
+
prompt: z.object({
|
|
48
|
+
name: z.string().describe('Prompt name the interaction is currently awaiting, e.g. "login" or "consent"'),
|
|
49
|
+
details: z.record(z.string(), z.unknown()).describe("Prompt-specific details from the AS")
|
|
50
|
+
}).describe("Prompt the interaction is currently awaiting"),
|
|
51
|
+
params: z.record(z.string(), z.unknown()).describe("Original authorization request params"),
|
|
52
|
+
client: OauthInteractionClient
|
|
53
|
+
}).describe("OAuth interaction details for the current prompt");
|
|
54
|
+
const OauthInteractionRedirectResponse = z.object({
|
|
55
|
+
returnTo: z.string().describe("Provider URL to redirect the browser back to")
|
|
56
|
+
}).describe("OAuth interaction redirect target after login/confirm/abort");
|
|
31
57
|
|
|
32
|
-
export { ChangePasswordResponse, ForgotPasswordResponse, LinkEmailResponse, LinkWalletResponse, LoginResponse, LogoutResponse, MeResponse, RefreshSessionResponse, RefreshTokenResponse, RegisterEmailResponse, RequestNonceResponse, ResendVerificationResponse, ResetPasswordResponse, VerifyEmailResponse };
|
|
58
|
+
export { ChangePasswordResponse, ForgotPasswordResponse, LinkEmailResponse, LinkWalletResponse, LoginResponse, LogoutResponse, MeResponse, OauthGrant, OauthGrantsResponse, OauthInteractionClient, OauthInteractionDetailsResponse, OauthInteractionRedirectResponse, RefreshSessionResponse, RefreshTokenResponse, RegisterEmailResponse, RequestNonceResponse, ResendVerificationResponse, ResetPasswordResponse, VerifyEmailResponse };
|
package/dist/common/array.d.ts
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* @param val - The value to normalize.
|
|
8
8
|
* @returns The normalized value.
|
|
9
9
|
*/
|
|
10
|
-
export declare function normalizeArray<TInput>(val: TInput): (TInput & any[]) |
|
|
10
|
+
export declare function normalizeArray<TInput>(val: TInput): string[] | (TInput & any[]) | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
const TriggerIntent = z.enum(["OPEN", "CLOSE"]);
|
|
3
|
+
const TriggerIntent = z.enum(["OPEN", "ADJUST", "CLOSE"]);
|
|
4
4
|
const TriggerStatus = z.enum(["ACTIVE", "TRIGGERED", "CANCELLED"]);
|
|
5
5
|
const TriggerCancelledReason = z.enum([
|
|
6
6
|
"POSITION_CLOSED",
|
|
@@ -332,7 +332,7 @@ export declare const CreateTriggerMarketOpen: z.ZodObject<{
|
|
|
332
332
|
USD: "USD";
|
|
333
333
|
}>;
|
|
334
334
|
amount: z.ZodString;
|
|
335
|
-
}, z.core.$
|
|
335
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
336
336
|
symbol: z.ZodString;
|
|
337
337
|
side: z.ZodEnum<{
|
|
338
338
|
BUY: "BUY";
|
|
@@ -343,10 +343,134 @@ export declare const CreateTriggerMarketOpen: z.ZodObject<{
|
|
|
343
343
|
USD: "USD";
|
|
344
344
|
}>;
|
|
345
345
|
amount: z.ZodString;
|
|
346
|
-
}, z.core.$
|
|
347
|
-
}, z.core.$
|
|
346
|
+
}, z.core.$strict>>;
|
|
347
|
+
}, z.core.$strict>;
|
|
348
348
|
clientId: z.ZodOptional<z.ZodString>;
|
|
349
|
-
}, z.core.$
|
|
349
|
+
}, z.core.$strict>;
|
|
350
|
+
export declare const CreateTriggerMarketAdjust: z.ZodObject<{
|
|
351
|
+
intent: z.ZodLiteral<"ADJUST">;
|
|
352
|
+
type: z.ZodLiteral<"MARKET">;
|
|
353
|
+
positionId: z.ZodUUID;
|
|
354
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
355
|
+
type: z.ZodLiteral<"ratio">;
|
|
356
|
+
data: z.ZodObject<{
|
|
357
|
+
priceSource: z.ZodEnum<{
|
|
358
|
+
mid: "mid";
|
|
359
|
+
mark: "mark";
|
|
360
|
+
}>;
|
|
361
|
+
symbol_a: z.ZodString;
|
|
362
|
+
symbol_b: z.ZodString;
|
|
363
|
+
track: z.ZodEnum<{
|
|
364
|
+
PEAK: "PEAK";
|
|
365
|
+
TROUGH: "TROUGH";
|
|
366
|
+
}>;
|
|
367
|
+
threshold: z.ZodNumber;
|
|
368
|
+
}, z.core.$strip>;
|
|
369
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
370
|
+
type: z.ZodLiteral<"price">;
|
|
371
|
+
data: z.ZodObject<{
|
|
372
|
+
priceSource: z.ZodEnum<{
|
|
373
|
+
mid: "mid";
|
|
374
|
+
mark: "mark";
|
|
375
|
+
}>;
|
|
376
|
+
symbol: z.ZodString;
|
|
377
|
+
track: z.ZodEnum<{
|
|
378
|
+
PEAK: "PEAK";
|
|
379
|
+
TROUGH: "TROUGH";
|
|
380
|
+
}>;
|
|
381
|
+
threshold: z.ZodNumber;
|
|
382
|
+
}, z.core.$strip>;
|
|
383
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
384
|
+
type: z.ZodLiteral<"weighted_ratio">;
|
|
385
|
+
data: z.ZodObject<{
|
|
386
|
+
priceSource: z.ZodEnum<{
|
|
387
|
+
mid: "mid";
|
|
388
|
+
mark: "mark";
|
|
389
|
+
}>;
|
|
390
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
391
|
+
symbol: z.ZodString;
|
|
392
|
+
side: z.ZodEnum<{
|
|
393
|
+
BUY: "BUY";
|
|
394
|
+
SELL: "SELL";
|
|
395
|
+
}>;
|
|
396
|
+
weight: z.ZodNumber;
|
|
397
|
+
}, z.core.$strip>>;
|
|
398
|
+
track: z.ZodEnum<{
|
|
399
|
+
PEAK: "PEAK";
|
|
400
|
+
TROUGH: "TROUGH";
|
|
401
|
+
}>;
|
|
402
|
+
threshold: z.ZodNumber;
|
|
403
|
+
}, z.core.$strip>;
|
|
404
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
405
|
+
type: z.ZodLiteral<"funding_rate">;
|
|
406
|
+
data: z.ZodObject<{
|
|
407
|
+
connector: z.ZodEnum<{
|
|
408
|
+
hyperliquid: "hyperliquid";
|
|
409
|
+
binance: "binance";
|
|
410
|
+
bybit: "bybit";
|
|
411
|
+
okx: "okx";
|
|
412
|
+
lighter: "lighter";
|
|
413
|
+
}>;
|
|
414
|
+
symbol: z.ZodString;
|
|
415
|
+
track: z.ZodEnum<{
|
|
416
|
+
PEAK: "PEAK";
|
|
417
|
+
TROUGH: "TROUGH";
|
|
418
|
+
}>;
|
|
419
|
+
threshold: z.ZodNumber;
|
|
420
|
+
}, z.core.$strip>;
|
|
421
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
422
|
+
type: z.ZodLiteral<"prediction_market">;
|
|
423
|
+
data: z.ZodObject<{
|
|
424
|
+
source: z.ZodEnum<{
|
|
425
|
+
kalshi: "kalshi";
|
|
426
|
+
polymarket: "polymarket";
|
|
427
|
+
}>;
|
|
428
|
+
marketKey: z.ZodString;
|
|
429
|
+
track: z.ZodEnum<{
|
|
430
|
+
PEAK: "PEAK";
|
|
431
|
+
TROUGH: "TROUGH";
|
|
432
|
+
}>;
|
|
433
|
+
threshold: z.ZodNumber;
|
|
434
|
+
}, z.core.$strip>;
|
|
435
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
436
|
+
type: z.ZodLiteral<"btc_dominance">;
|
|
437
|
+
data: z.ZodObject<{
|
|
438
|
+
source: z.ZodLiteral<"coingecko">;
|
|
439
|
+
track: z.ZodEnum<{
|
|
440
|
+
PEAK: "PEAK";
|
|
441
|
+
TROUGH: "TROUGH";
|
|
442
|
+
}>;
|
|
443
|
+
threshold: z.ZodNumber;
|
|
444
|
+
}, z.core.$strip>;
|
|
445
|
+
}, z.core.$strip>], "type">;
|
|
446
|
+
payload: z.ZodObject<{
|
|
447
|
+
type: z.ZodLiteral<"MARKET">;
|
|
448
|
+
legs: z.ZodTuple<[z.ZodObject<{
|
|
449
|
+
symbol: z.ZodString;
|
|
450
|
+
side: z.ZodEnum<{
|
|
451
|
+
BUY: "BUY";
|
|
452
|
+
SELL: "SELL";
|
|
453
|
+
}>;
|
|
454
|
+
mode: z.ZodEnum<{
|
|
455
|
+
QUANTITY: "QUANTITY";
|
|
456
|
+
USD: "USD";
|
|
457
|
+
}>;
|
|
458
|
+
amount: z.ZodString;
|
|
459
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
460
|
+
symbol: z.ZodString;
|
|
461
|
+
side: z.ZodEnum<{
|
|
462
|
+
BUY: "BUY";
|
|
463
|
+
SELL: "SELL";
|
|
464
|
+
}>;
|
|
465
|
+
mode: z.ZodEnum<{
|
|
466
|
+
QUANTITY: "QUANTITY";
|
|
467
|
+
USD: "USD";
|
|
468
|
+
}>;
|
|
469
|
+
amount: z.ZodString;
|
|
470
|
+
}, z.core.$strict>>;
|
|
471
|
+
}, z.core.$strict>;
|
|
472
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
473
|
+
}, z.core.$strict>;
|
|
350
474
|
export declare const CreateTriggerMarketCloseStatic: z.ZodObject<{
|
|
351
475
|
intent: z.ZodLiteral<"CLOSE">;
|
|
352
476
|
type: z.ZodLiteral<"MARKET">;
|
|
@@ -828,7 +952,7 @@ export declare const CreateTriggerOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
828
952
|
USD: "USD";
|
|
829
953
|
}>;
|
|
830
954
|
amount: z.ZodString;
|
|
831
|
-
}, z.core.$
|
|
955
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
832
956
|
symbol: z.ZodString;
|
|
833
957
|
side: z.ZodEnum<{
|
|
834
958
|
BUY: "BUY";
|
|
@@ -839,10 +963,133 @@ export declare const CreateTriggerOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
839
963
|
USD: "USD";
|
|
840
964
|
}>;
|
|
841
965
|
amount: z.ZodString;
|
|
842
|
-
}, z.core.$
|
|
843
|
-
}, z.core.$
|
|
966
|
+
}, z.core.$strict>>;
|
|
967
|
+
}, z.core.$strict>;
|
|
968
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
969
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
970
|
+
intent: z.ZodLiteral<"ADJUST">;
|
|
971
|
+
type: z.ZodLiteral<"MARKET">;
|
|
972
|
+
positionId: z.ZodUUID;
|
|
973
|
+
condition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
974
|
+
type: z.ZodLiteral<"ratio">;
|
|
975
|
+
data: z.ZodObject<{
|
|
976
|
+
priceSource: z.ZodEnum<{
|
|
977
|
+
mid: "mid";
|
|
978
|
+
mark: "mark";
|
|
979
|
+
}>;
|
|
980
|
+
symbol_a: z.ZodString;
|
|
981
|
+
symbol_b: z.ZodString;
|
|
982
|
+
track: z.ZodEnum<{
|
|
983
|
+
PEAK: "PEAK";
|
|
984
|
+
TROUGH: "TROUGH";
|
|
985
|
+
}>;
|
|
986
|
+
threshold: z.ZodNumber;
|
|
987
|
+
}, z.core.$strip>;
|
|
988
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
989
|
+
type: z.ZodLiteral<"price">;
|
|
990
|
+
data: z.ZodObject<{
|
|
991
|
+
priceSource: z.ZodEnum<{
|
|
992
|
+
mid: "mid";
|
|
993
|
+
mark: "mark";
|
|
994
|
+
}>;
|
|
995
|
+
symbol: z.ZodString;
|
|
996
|
+
track: z.ZodEnum<{
|
|
997
|
+
PEAK: "PEAK";
|
|
998
|
+
TROUGH: "TROUGH";
|
|
999
|
+
}>;
|
|
1000
|
+
threshold: z.ZodNumber;
|
|
1001
|
+
}, z.core.$strip>;
|
|
1002
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1003
|
+
type: z.ZodLiteral<"weighted_ratio">;
|
|
1004
|
+
data: z.ZodObject<{
|
|
1005
|
+
priceSource: z.ZodEnum<{
|
|
1006
|
+
mid: "mid";
|
|
1007
|
+
mark: "mark";
|
|
1008
|
+
}>;
|
|
1009
|
+
basket: z.ZodArray<z.ZodObject<{
|
|
1010
|
+
symbol: z.ZodString;
|
|
1011
|
+
side: z.ZodEnum<{
|
|
1012
|
+
BUY: "BUY";
|
|
1013
|
+
SELL: "SELL";
|
|
1014
|
+
}>;
|
|
1015
|
+
weight: z.ZodNumber;
|
|
1016
|
+
}, z.core.$strip>>;
|
|
1017
|
+
track: z.ZodEnum<{
|
|
1018
|
+
PEAK: "PEAK";
|
|
1019
|
+
TROUGH: "TROUGH";
|
|
1020
|
+
}>;
|
|
1021
|
+
threshold: z.ZodNumber;
|
|
1022
|
+
}, z.core.$strip>;
|
|
1023
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1024
|
+
type: z.ZodLiteral<"funding_rate">;
|
|
1025
|
+
data: z.ZodObject<{
|
|
1026
|
+
connector: z.ZodEnum<{
|
|
1027
|
+
hyperliquid: "hyperliquid";
|
|
1028
|
+
binance: "binance";
|
|
1029
|
+
bybit: "bybit";
|
|
1030
|
+
okx: "okx";
|
|
1031
|
+
lighter: "lighter";
|
|
1032
|
+
}>;
|
|
1033
|
+
symbol: z.ZodString;
|
|
1034
|
+
track: z.ZodEnum<{
|
|
1035
|
+
PEAK: "PEAK";
|
|
1036
|
+
TROUGH: "TROUGH";
|
|
1037
|
+
}>;
|
|
1038
|
+
threshold: z.ZodNumber;
|
|
1039
|
+
}, z.core.$strip>;
|
|
1040
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1041
|
+
type: z.ZodLiteral<"prediction_market">;
|
|
1042
|
+
data: z.ZodObject<{
|
|
1043
|
+
source: z.ZodEnum<{
|
|
1044
|
+
kalshi: "kalshi";
|
|
1045
|
+
polymarket: "polymarket";
|
|
1046
|
+
}>;
|
|
1047
|
+
marketKey: z.ZodString;
|
|
1048
|
+
track: z.ZodEnum<{
|
|
1049
|
+
PEAK: "PEAK";
|
|
1050
|
+
TROUGH: "TROUGH";
|
|
1051
|
+
}>;
|
|
1052
|
+
threshold: z.ZodNumber;
|
|
1053
|
+
}, z.core.$strip>;
|
|
1054
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1055
|
+
type: z.ZodLiteral<"btc_dominance">;
|
|
1056
|
+
data: z.ZodObject<{
|
|
1057
|
+
source: z.ZodLiteral<"coingecko">;
|
|
1058
|
+
track: z.ZodEnum<{
|
|
1059
|
+
PEAK: "PEAK";
|
|
1060
|
+
TROUGH: "TROUGH";
|
|
1061
|
+
}>;
|
|
1062
|
+
threshold: z.ZodNumber;
|
|
1063
|
+
}, z.core.$strip>;
|
|
1064
|
+
}, z.core.$strip>], "type">;
|
|
1065
|
+
payload: z.ZodObject<{
|
|
1066
|
+
type: z.ZodLiteral<"MARKET">;
|
|
1067
|
+
legs: z.ZodTuple<[z.ZodObject<{
|
|
1068
|
+
symbol: z.ZodString;
|
|
1069
|
+
side: z.ZodEnum<{
|
|
1070
|
+
BUY: "BUY";
|
|
1071
|
+
SELL: "SELL";
|
|
1072
|
+
}>;
|
|
1073
|
+
mode: z.ZodEnum<{
|
|
1074
|
+
QUANTITY: "QUANTITY";
|
|
1075
|
+
USD: "USD";
|
|
1076
|
+
}>;
|
|
1077
|
+
amount: z.ZodString;
|
|
1078
|
+
}, z.core.$strict>], z.ZodObject<{
|
|
1079
|
+
symbol: z.ZodString;
|
|
1080
|
+
side: z.ZodEnum<{
|
|
1081
|
+
BUY: "BUY";
|
|
1082
|
+
SELL: "SELL";
|
|
1083
|
+
}>;
|
|
1084
|
+
mode: z.ZodEnum<{
|
|
1085
|
+
QUANTITY: "QUANTITY";
|
|
1086
|
+
USD: "USD";
|
|
1087
|
+
}>;
|
|
1088
|
+
amount: z.ZodString;
|
|
1089
|
+
}, z.core.$strict>>;
|
|
1090
|
+
}, z.core.$strict>;
|
|
844
1091
|
clientId: z.ZodOptional<z.ZodString>;
|
|
845
|
-
}, z.core.$
|
|
1092
|
+
}, z.core.$strict>], "intent">;
|
|
846
1093
|
export declare const CreateTriggerClose: z.ZodUnion<readonly [z.ZodObject<{
|
|
847
1094
|
intent: z.ZodLiteral<"CLOSE">;
|
|
848
1095
|
type: z.ZodLiteral<"MARKET">;
|
|
@@ -994,6 +1241,7 @@ export declare const CreateTriggerClose: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
994
1241
|
clientId: z.ZodOptional<z.ZodString>;
|
|
995
1242
|
}, z.core.$strip>]>;
|
|
996
1243
|
export type CreateTriggerMarketOpen = z.output<typeof CreateTriggerMarketOpen>;
|
|
1244
|
+
export type CreateTriggerMarketAdjust = z.output<typeof CreateTriggerMarketAdjust>;
|
|
997
1245
|
export type CreateTriggerMarketCloseStatic = z.output<typeof CreateTriggerMarketCloseStatic>;
|
|
998
1246
|
export type CreateTriggerMarketCloseTrailing = z.output<typeof CreateTriggerMarketCloseTrailing>;
|
|
999
1247
|
export type CreateTriggerMarketClose = z.output<typeof CreateTriggerMarketClose>;
|
|
@@ -8,6 +8,10 @@ import { RefineTrailingConfig, RefineTrailingLogicalRules } from '../refinement/
|
|
|
8
8
|
import { CreateTriggerConditionAttachStatic, CreateTriggerConditionAttachTrailing, CreateTriggerConditionOpen, CreateTriggerConditionCloseStatic, CreateTriggerConditionCloseTrailing } from './conditions';
|
|
9
9
|
import { MAX_ATTACH_TRIGGERS } from './config';
|
|
10
10
|
|
|
11
|
+
const CreateTriggerMarketPayload = z.object({
|
|
12
|
+
type: z.literal("MARKET"),
|
|
13
|
+
legs: z.tuple([TradeLegPostOnly.strict()]).rest(TradeLegPostOnly.strict()).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to make up the exposure")
|
|
14
|
+
}).strict();
|
|
11
15
|
const TrailingConfig = z.object({
|
|
12
16
|
mode: TrailingMode,
|
|
13
17
|
deltaValue: z.number(),
|
|
@@ -39,15 +43,23 @@ const CreateTriggerMarketOpen = z.object({
|
|
|
39
43
|
});
|
|
40
44
|
}
|
|
41
45
|
}).optional(),
|
|
42
|
-
payload:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
payload: CreateTriggerMarketPayload,
|
|
47
|
+
/**
|
|
48
|
+
* Attribution route code (client_ids.code)
|
|
49
|
+
*/
|
|
50
|
+
clientId: ClientIdCode
|
|
51
|
+
}).strict();
|
|
52
|
+
const CreateTriggerMarketAdjust = z.object({
|
|
53
|
+
intent: z.literal("ADJUST"),
|
|
54
|
+
type: z.literal("MARKET"),
|
|
55
|
+
positionId: z.uuid(),
|
|
56
|
+
condition: CreateTriggerConditionOpen,
|
|
57
|
+
payload: CreateTriggerMarketPayload,
|
|
46
58
|
/**
|
|
47
59
|
* Attribution route code (client_ids.code)
|
|
48
60
|
*/
|
|
49
61
|
clientId: ClientIdCode
|
|
50
|
-
});
|
|
62
|
+
}).strict();
|
|
51
63
|
const CreateTriggerMarketCloseStatic = z.object({
|
|
52
64
|
intent: z.literal("CLOSE"),
|
|
53
65
|
type: z.literal("MARKET"),
|
|
@@ -71,10 +83,10 @@ const CreateTriggerMarketCloseTrailing = z.object({
|
|
|
71
83
|
clientId: ClientIdCode
|
|
72
84
|
}).superRefine(RefineTrailingLogicalRules);
|
|
73
85
|
const CreateTriggerMarketClose = z.union([CreateTriggerMarketCloseStatic, CreateTriggerMarketCloseTrailing]);
|
|
74
|
-
const CreateTriggerOpen = z.discriminatedUnion("
|
|
86
|
+
const CreateTriggerOpen = z.discriminatedUnion("intent", [CreateTriggerMarketOpen, CreateTriggerMarketAdjust]);
|
|
75
87
|
const CreateTriggerClose = CreateTriggerMarketClose;
|
|
76
88
|
function isAttachTriggerMarketCloseTrailing(attachedTrigger) {
|
|
77
89
|
return "trailing" in attachedTrigger && attachedTrigger.trailing !== void 0;
|
|
78
90
|
}
|
|
79
91
|
|
|
80
|
-
export { AttachTriggerMarketClose, AttachTriggerMarketCloseStatic, AttachTriggerMarketCloseTrailing, CreateTriggerClose, CreateTriggerMarketClose, CreateTriggerMarketCloseStatic, CreateTriggerMarketCloseTrailing, CreateTriggerMarketOpen, CreateTriggerOpen, TrailingConfig, isAttachTriggerMarketCloseTrailing };
|
|
92
|
+
export { AttachTriggerMarketClose, AttachTriggerMarketCloseStatic, AttachTriggerMarketCloseTrailing, CreateTriggerClose, CreateTriggerMarketAdjust, CreateTriggerMarketClose, CreateTriggerMarketCloseStatic, CreateTriggerMarketCloseTrailing, CreateTriggerMarketOpen, CreateTriggerOpen, TrailingConfig, isAttachTriggerMarketCloseTrailing };
|