@pear-protocol/types 1.26.1 → 1.28.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.
@@ -81,6 +81,7 @@ export declare const BaseExecution: z.ZodObject<{
81
81
  REJECTED: "REJECTED";
82
82
  }>;
83
83
  error: z.ZodOptional<z.ZodString>;
84
+ errorCode: z.ZodOptional<z.ZodString>;
84
85
  createdAt: z.ZodString;
85
86
  updatedAt: z.ZodString;
86
87
  type: z.ZodLiteral<"MARKET">;
@@ -132,6 +133,7 @@ export declare const MarketOpenExecution: z.ZodObject<{
132
133
  REJECTED: "REJECTED";
133
134
  }>;
134
135
  error: z.ZodOptional<z.ZodString>;
136
+ errorCode: z.ZodOptional<z.ZodString>;
135
137
  createdAt: z.ZodString;
136
138
  updatedAt: z.ZodString;
137
139
  type: z.ZodLiteral<"MARKET">;
@@ -210,6 +212,7 @@ export declare const MarketAdjustExecution: z.ZodObject<{
210
212
  REJECTED: "REJECTED";
211
213
  }>;
212
214
  error: z.ZodOptional<z.ZodString>;
215
+ errorCode: z.ZodOptional<z.ZodString>;
213
216
  createdAt: z.ZodString;
214
217
  updatedAt: z.ZodString;
215
218
  type: z.ZodLiteral<"MARKET">;
@@ -292,6 +295,7 @@ export declare const MarketCloseExecution: z.ZodObject<{
292
295
  REJECTED: "REJECTED";
293
296
  }>;
294
297
  error: z.ZodOptional<z.ZodString>;
298
+ errorCode: z.ZodOptional<z.ZodString>;
295
299
  createdAt: z.ZodString;
296
300
  updatedAt: z.ZodString;
297
301
  type: z.ZodLiteral<"MARKET">;
@@ -349,6 +353,7 @@ export declare const MarketReverseExecution: z.ZodObject<{
349
353
  REJECTED: "REJECTED";
350
354
  }>;
351
355
  error: z.ZodOptional<z.ZodString>;
356
+ errorCode: z.ZodOptional<z.ZodString>;
352
357
  createdAt: z.ZodString;
353
358
  updatedAt: z.ZodString;
354
359
  type: z.ZodLiteral<"MARKET">;
@@ -406,6 +411,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
406
411
  REJECTED: "REJECTED";
407
412
  }>;
408
413
  error: z.ZodOptional<z.ZodString>;
414
+ errorCode: z.ZodOptional<z.ZodString>;
409
415
  createdAt: z.ZodString;
410
416
  updatedAt: z.ZodString;
411
417
  type: z.ZodLiteral<"MARKET">;
@@ -483,6 +489,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
483
489
  REJECTED: "REJECTED";
484
490
  }>;
485
491
  error: z.ZodOptional<z.ZodString>;
492
+ errorCode: z.ZodOptional<z.ZodString>;
486
493
  createdAt: z.ZodString;
487
494
  updatedAt: z.ZodString;
488
495
  type: z.ZodLiteral<"MARKET">;
@@ -564,6 +571,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
564
571
  REJECTED: "REJECTED";
565
572
  }>;
566
573
  error: z.ZodOptional<z.ZodString>;
574
+ errorCode: z.ZodOptional<z.ZodString>;
567
575
  createdAt: z.ZodString;
568
576
  updatedAt: z.ZodString;
569
577
  type: z.ZodLiteral<"MARKET">;
@@ -620,6 +628,7 @@ export declare const MarketExecution: z.ZodDiscriminatedUnion<[z.ZodObject<{
620
628
  REJECTED: "REJECTED";
621
629
  }>;
622
630
  error: z.ZodOptional<z.ZodString>;
631
+ errorCode: z.ZodOptional<z.ZodString>;
623
632
  createdAt: z.ZodString;
624
633
  updatedAt: z.ZodString;
625
634
  type: z.ZodLiteral<"MARKET">;
@@ -677,6 +686,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
677
686
  REJECTED: "REJECTED";
678
687
  }>;
679
688
  error: z.ZodOptional<z.ZodString>;
689
+ errorCode: z.ZodOptional<z.ZodString>;
680
690
  createdAt: z.ZodString;
681
691
  updatedAt: z.ZodString;
682
692
  type: z.ZodLiteral<"MARKET">;
@@ -754,6 +764,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
754
764
  REJECTED: "REJECTED";
755
765
  }>;
756
766
  error: z.ZodOptional<z.ZodString>;
767
+ errorCode: z.ZodOptional<z.ZodString>;
757
768
  createdAt: z.ZodString;
758
769
  updatedAt: z.ZodString;
759
770
  type: z.ZodLiteral<"MARKET">;
@@ -835,6 +846,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
835
846
  REJECTED: "REJECTED";
836
847
  }>;
837
848
  error: z.ZodOptional<z.ZodString>;
849
+ errorCode: z.ZodOptional<z.ZodString>;
838
850
  createdAt: z.ZodString;
839
851
  updatedAt: z.ZodString;
840
852
  type: z.ZodLiteral<"MARKET">;
@@ -891,6 +903,7 @@ export declare const Execution: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion
891
903
  REJECTED: "REJECTED";
892
904
  }>;
893
905
  error: z.ZodOptional<z.ZodString>;
906
+ errorCode: z.ZodOptional<z.ZodString>;
894
907
  createdAt: z.ZodString;
895
908
  updatedAt: z.ZodString;
896
909
  type: z.ZodLiteral<"MARKET">;
@@ -38,6 +38,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
38
38
  REJECTED: "REJECTED";
39
39
  }>;
40
40
  error: z.ZodOptional<z.ZodString>;
41
+ errorCode: z.ZodOptional<z.ZodString>;
41
42
  createdAt: z.ZodString;
42
43
  updatedAt: z.ZodString;
43
44
  type: z.ZodLiteral<"MARKET">;
@@ -115,6 +116,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
115
116
  REJECTED: "REJECTED";
116
117
  }>;
117
118
  error: z.ZodOptional<z.ZodString>;
119
+ errorCode: z.ZodOptional<z.ZodString>;
118
120
  createdAt: z.ZodString;
119
121
  updatedAt: z.ZodString;
120
122
  type: z.ZodLiteral<"MARKET">;
@@ -196,6 +198,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
196
198
  REJECTED: "REJECTED";
197
199
  }>;
198
200
  error: z.ZodOptional<z.ZodString>;
201
+ errorCode: z.ZodOptional<z.ZodString>;
199
202
  createdAt: z.ZodString;
200
203
  updatedAt: z.ZodString;
201
204
  type: z.ZodLiteral<"MARKET">;
@@ -252,6 +255,7 @@ export declare const ExecutionListResponse: z.ZodObject<{
252
255
  REJECTED: "REJECTED";
253
256
  }>;
254
257
  error: z.ZodOptional<z.ZodString>;
258
+ errorCode: z.ZodOptional<z.ZodString>;
255
259
  createdAt: z.ZodString;
256
260
  updatedAt: z.ZodString;
257
261
  type: z.ZodLiteral<"MARKET">;
@@ -312,6 +316,7 @@ export declare const GetExecutionResponse: z.ZodObject<{
312
316
  REJECTED: "REJECTED";
313
317
  }>;
314
318
  error: z.ZodOptional<z.ZodString>;
319
+ errorCode: z.ZodOptional<z.ZodString>;
315
320
  createdAt: z.ZodString;
316
321
  updatedAt: z.ZodString;
317
322
  type: z.ZodLiteral<"MARKET">;
@@ -389,6 +394,7 @@ export declare const GetExecutionResponse: z.ZodObject<{
389
394
  REJECTED: "REJECTED";
390
395
  }>;
391
396
  error: z.ZodOptional<z.ZodString>;
397
+ errorCode: z.ZodOptional<z.ZodString>;
392
398
  createdAt: z.ZodString;
393
399
  updatedAt: z.ZodString;
394
400
  type: z.ZodLiteral<"MARKET">;
@@ -470,6 +476,7 @@ export declare const GetExecutionResponse: z.ZodObject<{
470
476
  REJECTED: "REJECTED";
471
477
  }>;
472
478
  error: z.ZodOptional<z.ZodString>;
479
+ errorCode: z.ZodOptional<z.ZodString>;
473
480
  createdAt: z.ZodString;
474
481
  updatedAt: z.ZodString;
475
482
  type: z.ZodLiteral<"MARKET">;
@@ -526,6 +533,7 @@ export declare const GetExecutionResponse: z.ZodObject<{
526
533
  REJECTED: "REJECTED";
527
534
  }>;
528
535
  error: z.ZodOptional<z.ZodString>;
536
+ errorCode: z.ZodOptional<z.ZodString>;
529
537
  createdAt: z.ZodString;
530
538
  updatedAt: z.ZodString;
531
539
  type: z.ZodLiteral<"MARKET">;
@@ -48,3 +48,45 @@ export declare const SubmitLighterFastWithdrawParams: z.ZodObject<{
48
48
  l1Signature: z.ZodString;
49
49
  }, z.core.$strip>;
50
50
  export type SubmitLighterFastWithdrawParams = z.output<typeof SubmitLighterFastWithdrawParams>;
51
+ /** The Lighter account tiers a user can switch between, spelled the way Lighter spells them. */
52
+ export declare const LighterAccountTier: z.ZodEnum<{
53
+ standard: "standard";
54
+ plus: "plus";
55
+ premium: "premium";
56
+ }>;
57
+ export type LighterAccountTier = z.output<typeof LighterAccountTier>;
58
+ export declare const ChangeLighterAccountTierParams: z.ZodObject<{
59
+ accountIndex: z.ZodNumber;
60
+ apiKeyIndex: z.ZodNumber;
61
+ apiPrivateKey: z.ZodString;
62
+ tier: z.ZodEnum<{
63
+ standard: "standard";
64
+ plus: "plus";
65
+ premium: "premium";
66
+ }>;
67
+ }, z.core.$strip>;
68
+ export type ChangeLighterAccountTierParams = z.output<typeof ChangeLighterAccountTierParams>;
69
+ /**
70
+ * The wallet a Fun.xyz universal deposit address (UDA) is minted for.
71
+ *
72
+ * The bridge mints one address set per (wallet, market, asset) triple and reuses it, so the same
73
+ * request answers for a wallet Lighter has never seen and for one that already holds an account.
74
+ */
75
+ export declare const CreateLighterUdaParams: z.ZodObject<{
76
+ walletAddress: z.ZodString;
77
+ market: z.ZodEnum<{
78
+ spot: "spot";
79
+ perps: "perps";
80
+ }>;
81
+ asset: z.ZodEnum<{
82
+ USDC: "USDC";
83
+ ETH: "ETH";
84
+ }>;
85
+ accountIndex: z.ZodOptional<z.ZodNumber>;
86
+ }, z.core.$strip>;
87
+ export type CreateLighterUdaParams = z.output<typeof CreateLighterUdaParams>;
88
+ /** The wallet whose Fun.xyz bridge transactions are being read. */
89
+ export declare const ListLighterUdaDepositsParams: z.ZodObject<{
90
+ walletAddress: z.ZodString;
91
+ }, z.core.$strip>;
92
+ export type ListLighterUdaDepositsParams = z.output<typeof ListLighterUdaDepositsParams>;
@@ -42,5 +42,32 @@ const SubmitLighterFastWithdrawParams = z.object({
42
42
  txInfo: z.string(),
43
43
  l1Signature: z.string()
44
44
  });
45
+ const LighterAccountTier = z.enum([
46
+ "standard",
47
+ "plus",
48
+ "premium"
49
+ ]);
50
+ const ChangeLighterAccountTierParams = z.object({
51
+ accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
52
+ apiKeyIndex: z.number().int().nonnegative().max(254),
53
+ apiPrivateKey: z.string(),
54
+ tier: LighterAccountTier
55
+ });
56
+ const CreateLighterUdaParams = z.object({
57
+ walletAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/),
58
+ market: z.enum([
59
+ "perps",
60
+ "spot"
61
+ ]),
62
+ asset: z.enum([
63
+ "USDC",
64
+ "ETH"
65
+ ]),
66
+ // Targets a sub-account; absent credits the wallet's master account index.
67
+ accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
68
+ });
69
+ const ListLighterUdaDepositsParams = z.object({
70
+ walletAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/)
71
+ });
45
72
 
46
- export { CreateAuthTokenParams, CreateLighterApiKeyParams, PrepareApproveIntegratorParams, PrepareLighterFastWithdrawParams, SubmitApproveIntegratorParams, SubmitChangePubKeyParams, SubmitLighterFastWithdrawParams };
73
+ export { ChangeLighterAccountTierParams, CreateAuthTokenParams, CreateLighterApiKeyParams, CreateLighterUdaParams, LighterAccountTier, ListLighterUdaDepositsParams, PrepareApproveIntegratorParams, PrepareLighterFastWithdrawParams, SubmitApproveIntegratorParams, SubmitChangePubKeyParams, SubmitLighterFastWithdrawParams };
@@ -35,3 +35,92 @@ export declare const SubmitLighterFastWithdrawResult: z.ZodObject<{
35
35
  txHash: z.ZodString;
36
36
  }, z.core.$strip>;
37
37
  export type SubmitLighterFastWithdrawResult = z.output<typeof SubmitLighterFastWithdrawResult>;
38
+ export declare const ChangeLighterAccountTierResult: z.ZodObject<{
39
+ tier: z.ZodEnum<{
40
+ standard: "standard";
41
+ plus: "plus";
42
+ premium: "premium";
43
+ }>;
44
+ }, z.core.$strip>;
45
+ export type ChangeLighterAccountTierResult = z.output<typeof ChangeLighterAccountTierResult>;
46
+ /**
47
+ * Where the Fun.xyz bridge will credit anything sent to a minted address.
48
+ *
49
+ * `userId` names the wallet this answer is for, and a caller must refuse any resolution whose
50
+ * `userId` is not the wallet it asked about — an answer naming another one describes somebody
51
+ * else's deposit address. `recipientAddr` then names the Lighter account: its index once the
52
+ * account exists, and the literal `l1` while it does not, because the first deposit is what
53
+ * creates it.
54
+ */
55
+ export declare const LighterUdaResolution: z.ZodObject<{
56
+ toChainId: z.ZodString;
57
+ toTokenAddress: z.ZodString;
58
+ actionType: z.ZodString;
59
+ recipientAddr: z.ZodString;
60
+ userId: z.ZodString;
61
+ }, z.core.$strip>;
62
+ export type LighterUdaResolution = z.output<typeof LighterUdaResolution>;
63
+ /**
64
+ * The bridge's answer for one wallet: its deposit addresses, or a refusal to serve it.
65
+ *
66
+ * Reading `status` is what makes the addresses available. A served wallet always names the EVM
67
+ * deposit address and what it credits, and a refusal carries neither — so a caller cannot reach an
68
+ * address without first learning the bridge agreed to serve it. A chain family the bridge cannot
69
+ * currently serve stays absent rather than blank, because a present-but-empty key would read as an
70
+ * address someone could send funds to.
71
+ *
72
+ * The union sits under `uda` rather than at the top level so the response stays an object, matching
73
+ * `RebalanceManualResponse`. A bare top-level union does build, but nestjs-zod publishes it behind a
74
+ * synthetic `root` key that only `cleanupOpenApiDoc` unwraps.
75
+ */
76
+ export declare const CreateLighterUdaResult: z.ZodObject<{
77
+ uda: z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ status: z.ZodLiteral<"blocked">;
79
+ }, z.core.$strip>, z.ZodObject<{
80
+ status: z.ZodLiteral<"served">;
81
+ depositAddr: z.ZodString;
82
+ resolved: z.ZodObject<{
83
+ toChainId: z.ZodString;
84
+ toTokenAddress: z.ZodString;
85
+ actionType: z.ZodString;
86
+ recipientAddr: z.ZodString;
87
+ userId: z.ZodString;
88
+ }, z.core.$strip>;
89
+ solanaAddr: z.ZodOptional<z.ZodString>;
90
+ tronAddr: z.ZodOptional<z.ZodString>;
91
+ btcAddrSegwit: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strip>], "status">;
93
+ }, z.core.$strip>;
94
+ export type CreateLighterUdaResult = z.output<typeof CreateLighterUdaResult>;
95
+ /**
96
+ * One deposit the bridge has seen for a wallet, from source transfer to Lighter credit.
97
+ *
98
+ * `status` stays an open string because the bridge documents only PROCESSING and COMPLETED, and
99
+ * rejecting an undocumented state here would hide a deposit that genuinely happened.
100
+ */
101
+ export declare const LighterUdaTransaction: z.ZodObject<{
102
+ fromChainId: z.ZodString;
103
+ fromTokenAddress: z.ZodString;
104
+ fromAmountBaseUnit: z.ZodString;
105
+ toChainId: z.ZodString;
106
+ toTokenAddress: z.ZodString;
107
+ txHash: z.ZodString;
108
+ createdTimeMs: z.ZodNumber;
109
+ status: z.ZodString;
110
+ depositAddr: z.ZodString;
111
+ }, z.core.$strip>;
112
+ export type LighterUdaTransaction = z.output<typeof LighterUdaTransaction>;
113
+ export declare const ListLighterUdaDepositsResult: z.ZodObject<{
114
+ transactions: z.ZodArray<z.ZodObject<{
115
+ fromChainId: z.ZodString;
116
+ fromTokenAddress: z.ZodString;
117
+ fromAmountBaseUnit: z.ZodString;
118
+ toChainId: z.ZodString;
119
+ toTokenAddress: z.ZodString;
120
+ txHash: z.ZodString;
121
+ createdTimeMs: z.ZodNumber;
122
+ status: z.ZodString;
123
+ depositAddr: z.ZodString;
124
+ }, z.core.$strip>>;
125
+ }, z.core.$strip>;
126
+ export type ListLighterUdaDepositsResult = z.output<typeof ListLighterUdaDepositsResult>;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { LighterAccountTier } from './payloads';
2
3
 
3
4
  const CreateApiKeyWithMessageResult = z.object({
4
5
  privateKey: z.string(),
@@ -31,5 +32,46 @@ const PrepareLighterFastWithdrawResult = z.object({
31
32
  const SubmitLighterFastWithdrawResult = z.object({
32
33
  txHash: z.string()
33
34
  });
35
+ const ChangeLighterAccountTierResult = z.object({
36
+ // The tier Lighter accepted. Its own acknowledgement names no tier, so this echoes the request.
37
+ tier: LighterAccountTier
38
+ });
39
+ const LighterUdaResolution = z.object({
40
+ toChainId: z.string(),
41
+ toTokenAddress: z.string(),
42
+ actionType: z.string(),
43
+ recipientAddr: z.string(),
44
+ userId: z.string()
45
+ });
46
+ const CreateLighterUdaResult = z.object({
47
+ uda: z.discriminatedUnion("status", [
48
+ z.object({
49
+ status: z.literal("blocked")
50
+ }),
51
+ z.object({
52
+ status: z.literal("served"),
53
+ depositAddr: z.string(),
54
+ resolved: LighterUdaResolution,
55
+ // Absent rather than blank on a chain family the bridge does not currently serve.
56
+ solanaAddr: z.string().min(1).optional(),
57
+ tronAddr: z.string().min(1).optional(),
58
+ btcAddrSegwit: z.string().min(1).optional()
59
+ })
60
+ ])
61
+ });
62
+ const LighterUdaTransaction = z.object({
63
+ fromChainId: z.string(),
64
+ fromTokenAddress: z.string(),
65
+ fromAmountBaseUnit: z.string(),
66
+ toChainId: z.string(),
67
+ toTokenAddress: z.string(),
68
+ txHash: z.string(),
69
+ createdTimeMs: z.number(),
70
+ status: z.string(),
71
+ depositAddr: z.string()
72
+ });
73
+ const ListLighterUdaDepositsResult = z.object({
74
+ transactions: z.array(LighterUdaTransaction)
75
+ });
34
76
 
35
- export { CreateApiKeyWithMessageResult, CreateAuthTokenResult, PrepareApproveIntegratorResult, PrepareLighterFastWithdrawResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult, SubmitLighterFastWithdrawResult };
77
+ export { ChangeLighterAccountTierResult, CreateApiKeyWithMessageResult, CreateAuthTokenResult, CreateLighterUdaResult, LighterUdaResolution, LighterUdaTransaction, ListLighterUdaDepositsResult, PrepareApproveIntegratorResult, PrepareLighterFastWithdrawResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult, SubmitLighterFastWithdrawResult };
@@ -24,6 +24,7 @@ export declare const MarketOrder: z.ZodObject<{
24
24
  REJECTED: "REJECTED";
25
25
  }>;
26
26
  error: z.ZodOptional<z.ZodString>;
27
+ errorCode: z.ZodOptional<z.ZodString>;
27
28
  createdAt: z.ZodString;
28
29
  updatedAt: z.ZodString;
29
30
  type: z.ZodLiteral<"MARKET">;
@@ -55,6 +56,7 @@ export declare const Order: z.ZodDiscriminatedUnion<[z.ZodObject<{
55
56
  REJECTED: "REJECTED";
56
57
  }>;
57
58
  error: z.ZodOptional<z.ZodString>;
59
+ errorCode: z.ZodOptional<z.ZodString>;
58
60
  createdAt: z.ZodString;
59
61
  updatedAt: z.ZodString;
60
62
  type: z.ZodLiteral<"MARKET">;
@@ -28,6 +28,10 @@ const BaseOrder = z.object({
28
28
  */
29
29
  error: z.string().optional(),
30
30
  /**
31
+ * Venue-specific error code for the failure, when the venue provided one
32
+ */
33
+ errorCode: z.string().optional(),
34
+ /**
31
35
  * Created at timestamp
32
36
  */
33
37
  createdAt: z.string(),
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export declare const LeaderboardRow: z.ZodObject<{
3
3
  tradeAccountId: z.ZodString;
4
- exchangeIdentifier: z.ZodString;
4
+ userId: z.ZodString;
5
5
  connector: z.ZodEnum<{
6
6
  hyperliquid: "hyperliquid";
7
7
  binance: "binance";
@@ -2,11 +2,14 @@ import { z } from 'zod';
2
2
  import { Connector } from '../connector';
3
3
 
4
4
  const LeaderboardRow = z.object({
5
- // The row's identity. Two accounts may register the same exchange identifier, so this
6
- // is the only field that separates their rows — and the only safe key to render by.
5
+ // The row's identity, and the only safe key to render or join by.
7
6
  tradeAccountId: z.string(),
8
- // Address for Hyperliquid/Lighter, exchange account UID for CEXes.
9
- exchangeIdentifier: z.string(),
7
+ // The trader the account belongs to, so a consumer can group the several rows one person
8
+ // earns across venues. The board deliberately publishes no exchange identifier: a wallet
9
+ // address beside a real name and a PnL deanonymizes a trader for good, and an address is
10
+ // not reversible once scraped. Neither id here is a credential — every route that takes
11
+ // one checks ownership or role, never knowledge of the id.
12
+ userId: z.string(),
10
13
  connector: Connector,
11
14
  // Every fill inside the window, whatever period its position began in — so unlike the
12
15
  // money fields below, this can report trading whose fees and PnL belong to another window.
@@ -46,11 +49,10 @@ const LeaderboardRow = z.object({
46
49
  // window left its open positions unpriced, when every position it opened in the window
47
50
  // closed after it, or when a position recorded no opening size.
48
51
  roi: z.string().optional(),
49
- // The trader's linked X account. Absent for an account whose owner has connected no X
50
- // account, and absent for an anonymous caller: the board itself is public, but pairing a
51
- // real name with a wallet address and a PnL for the open internet is a wider promise than
52
- // the one the user accepted when connecting X. Never null-with-a-key: absence is the
53
- // signal.
52
+ // The trader's linked X account, published to every caller — the board names its traders
53
+ // on the open internet, signed in or not. Absent for an account whose owner has connected
54
+ // no X account, and absent for one who hid the link from the board. Never null-with-a-key:
55
+ // absence is the signal.
54
56
  //
55
57
  // Whatever X reported at the owner's last authorization. Nothing re-reads X in between,
56
58
  // so a trader who renamed and has not signed in since is named by their old handle.
@@ -75,6 +75,7 @@ export declare const LeaderboardQueryParams: z.ZodObject<{
75
75
  }>>;
76
76
  startDate: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<number>, z.ZodTransform<Date, number>>>;
77
77
  endDate: z.ZodOptional<z.ZodPipe<z.ZodCoercedNumber<number>, z.ZodTransform<Date, number>>>;
78
+ includeUnlinkedX: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCodec<z.ZodString, z.ZodBoolean>]>>>;
78
79
  limit: z.ZodDefault<z.ZodCoercedNumber<number>>;
79
80
  }, z.core.$strip>;
80
81
  export type LeaderboardQueryParamsInput = z.input<typeof LeaderboardQueryParams>;
@@ -71,6 +71,20 @@ const LeaderboardQueryParams = z.object({
71
71
  // is settled and reproducible, and only there is unrealized PnL omitted: it is a value as
72
72
  // of now, and now is outside such a window.
73
73
  endDate: UnixSeconds.optional(),
74
+ // Whether an account whose owner linked no X account may hold a row. Off by default,
75
+ // because a trader who has not linked X does not qualify for the campaign the board
76
+ // feeds. Eligibility turns on linking, so admission does too: a trader who linked X
77
+ // and then withheld the handle keeps their rank and loses only their name.
78
+ // The gate is on the account, not on the viewer: it applies before the top-N cut, so
79
+ // it selects who makes the board rather than thinning the rows that came back, and
80
+ // every caller is served exactly the same board.
81
+ //
82
+ // Deliberately not `z.coerce.boolean()`, which reads the string "false" as true and
83
+ // would leave the default impossible to restore explicitly from a URL.
84
+ includeUnlinkedX: z.union([
85
+ z.boolean(),
86
+ z.stringbool()
87
+ ]).optional().default(false),
74
88
  limit: z.coerce.number().int().positive().max(LEADERBOARD_MAX_LIMIT).default(LEADERBOARD_MAX_LIMIT)
75
89
  }).refine((data) => !data.startDate || !data.endDate || data.startDate < data.endDate, {
76
90
  message: "startDate must be before endDate"
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  export declare const LeaderboardResponse: z.ZodObject<{
3
3
  data: z.ZodArray<z.ZodObject<{
4
4
  tradeAccountId: z.ZodString;
5
- exchangeIdentifier: z.ZodString;
5
+ userId: z.ZodString;
6
6
  connector: z.ZodEnum<{
7
7
  hyperliquid: "hyperliquid";
8
8
  binance: "binance";
@@ -36,6 +36,7 @@ export declare const CreateTradeOpenResponse: z.ZodObject<{
36
36
  REJECTED: "REJECTED";
37
37
  }>;
38
38
  error: z.ZodOptional<z.ZodString>;
39
+ errorCode: z.ZodOptional<z.ZodString>;
39
40
  createdAt: z.ZodString;
40
41
  updatedAt: z.ZodString;
41
42
  type: z.ZodLiteral<"MARKET">;
@@ -113,6 +114,7 @@ export declare const CreateTradeOpenResponse: z.ZodObject<{
113
114
  REJECTED: "REJECTED";
114
115
  }>;
115
116
  error: z.ZodOptional<z.ZodString>;
117
+ errorCode: z.ZodOptional<z.ZodString>;
116
118
  createdAt: z.ZodString;
117
119
  updatedAt: z.ZodString;
118
120
  type: z.ZodLiteral<"MARKET">;
@@ -194,6 +196,7 @@ export declare const CreateTradeOpenResponse: z.ZodObject<{
194
196
  REJECTED: "REJECTED";
195
197
  }>;
196
198
  error: z.ZodOptional<z.ZodString>;
199
+ errorCode: z.ZodOptional<z.ZodString>;
197
200
  createdAt: z.ZodString;
198
201
  updatedAt: z.ZodString;
199
202
  type: z.ZodLiteral<"MARKET">;
@@ -250,6 +253,7 @@ export declare const CreateTradeOpenResponse: z.ZodObject<{
250
253
  REJECTED: "REJECTED";
251
254
  }>;
252
255
  error: z.ZodOptional<z.ZodString>;
256
+ errorCode: z.ZodOptional<z.ZodString>;
253
257
  createdAt: z.ZodString;
254
258
  updatedAt: z.ZodString;
255
259
  type: z.ZodLiteral<"MARKET">;
@@ -310,6 +314,7 @@ export declare const CreateTradeAdjustResponse: z.ZodObject<{
310
314
  REJECTED: "REJECTED";
311
315
  }>;
312
316
  error: z.ZodOptional<z.ZodString>;
317
+ errorCode: z.ZodOptional<z.ZodString>;
313
318
  createdAt: z.ZodString;
314
319
  updatedAt: z.ZodString;
315
320
  type: z.ZodLiteral<"MARKET">;
@@ -387,6 +392,7 @@ export declare const CreateTradeAdjustResponse: z.ZodObject<{
387
392
  REJECTED: "REJECTED";
388
393
  }>;
389
394
  error: z.ZodOptional<z.ZodString>;
395
+ errorCode: z.ZodOptional<z.ZodString>;
390
396
  createdAt: z.ZodString;
391
397
  updatedAt: z.ZodString;
392
398
  type: z.ZodLiteral<"MARKET">;
@@ -468,6 +474,7 @@ export declare const CreateTradeAdjustResponse: z.ZodObject<{
468
474
  REJECTED: "REJECTED";
469
475
  }>;
470
476
  error: z.ZodOptional<z.ZodString>;
477
+ errorCode: z.ZodOptional<z.ZodString>;
471
478
  createdAt: z.ZodString;
472
479
  updatedAt: z.ZodString;
473
480
  type: z.ZodLiteral<"MARKET">;
@@ -524,6 +531,7 @@ export declare const CreateTradeAdjustResponse: z.ZodObject<{
524
531
  REJECTED: "REJECTED";
525
532
  }>;
526
533
  error: z.ZodOptional<z.ZodString>;
534
+ errorCode: z.ZodOptional<z.ZodString>;
527
535
  createdAt: z.ZodString;
528
536
  updatedAt: z.ZodString;
529
537
  type: z.ZodLiteral<"MARKET">;
@@ -584,6 +592,7 @@ export declare const CreateTradeCloseResponse: z.ZodObject<{
584
592
  REJECTED: "REJECTED";
585
593
  }>;
586
594
  error: z.ZodOptional<z.ZodString>;
595
+ errorCode: z.ZodOptional<z.ZodString>;
587
596
  createdAt: z.ZodString;
588
597
  updatedAt: z.ZodString;
589
598
  type: z.ZodLiteral<"MARKET">;
@@ -661,6 +670,7 @@ export declare const CreateTradeCloseResponse: z.ZodObject<{
661
670
  REJECTED: "REJECTED";
662
671
  }>;
663
672
  error: z.ZodOptional<z.ZodString>;
673
+ errorCode: z.ZodOptional<z.ZodString>;
664
674
  createdAt: z.ZodString;
665
675
  updatedAt: z.ZodString;
666
676
  type: z.ZodLiteral<"MARKET">;
@@ -742,6 +752,7 @@ export declare const CreateTradeCloseResponse: z.ZodObject<{
742
752
  REJECTED: "REJECTED";
743
753
  }>;
744
754
  error: z.ZodOptional<z.ZodString>;
755
+ errorCode: z.ZodOptional<z.ZodString>;
745
756
  createdAt: z.ZodString;
746
757
  updatedAt: z.ZodString;
747
758
  type: z.ZodLiteral<"MARKET">;
@@ -798,6 +809,7 @@ export declare const CreateTradeCloseResponse: z.ZodObject<{
798
809
  REJECTED: "REJECTED";
799
810
  }>;
800
811
  error: z.ZodOptional<z.ZodString>;
812
+ errorCode: z.ZodOptional<z.ZodString>;
801
813
  createdAt: z.ZodString;
802
814
  updatedAt: z.ZodString;
803
815
  type: z.ZodLiteral<"MARKET">;
@@ -858,6 +870,7 @@ export declare const CreateTradeReverseResponse: z.ZodObject<{
858
870
  REJECTED: "REJECTED";
859
871
  }>;
860
872
  error: z.ZodOptional<z.ZodString>;
873
+ errorCode: z.ZodOptional<z.ZodString>;
861
874
  createdAt: z.ZodString;
862
875
  updatedAt: z.ZodString;
863
876
  type: z.ZodLiteral<"MARKET">;
@@ -935,6 +948,7 @@ export declare const CreateTradeReverseResponse: z.ZodObject<{
935
948
  REJECTED: "REJECTED";
936
949
  }>;
937
950
  error: z.ZodOptional<z.ZodString>;
951
+ errorCode: z.ZodOptional<z.ZodString>;
938
952
  createdAt: z.ZodString;
939
953
  updatedAt: z.ZodString;
940
954
  type: z.ZodLiteral<"MARKET">;
@@ -1016,6 +1030,7 @@ export declare const CreateTradeReverseResponse: z.ZodObject<{
1016
1030
  REJECTED: "REJECTED";
1017
1031
  }>;
1018
1032
  error: z.ZodOptional<z.ZodString>;
1033
+ errorCode: z.ZodOptional<z.ZodString>;
1019
1034
  createdAt: z.ZodString;
1020
1035
  updatedAt: z.ZodString;
1021
1036
  type: z.ZodLiteral<"MARKET">;
@@ -1072,6 +1087,7 @@ export declare const CreateTradeReverseResponse: z.ZodObject<{
1072
1087
  REJECTED: "REJECTED";
1073
1088
  }>;
1074
1089
  error: z.ZodOptional<z.ZodString>;
1090
+ errorCode: z.ZodOptional<z.ZodString>;
1075
1091
  createdAt: z.ZodString;
1076
1092
  updatedAt: z.ZodString;
1077
1093
  type: z.ZodLiteral<"MARKET">;
@@ -1132,6 +1148,7 @@ export declare const CreateTradeCloseAllResponse: z.ZodObject<{
1132
1148
  REJECTED: "REJECTED";
1133
1149
  }>;
1134
1150
  error: z.ZodOptional<z.ZodString>;
1151
+ errorCode: z.ZodOptional<z.ZodString>;
1135
1152
  createdAt: z.ZodString;
1136
1153
  updatedAt: z.ZodString;
1137
1154
  type: z.ZodLiteral<"MARKET">;
@@ -1209,6 +1226,7 @@ export declare const CreateTradeCloseAllResponse: z.ZodObject<{
1209
1226
  REJECTED: "REJECTED";
1210
1227
  }>;
1211
1228
  error: z.ZodOptional<z.ZodString>;
1229
+ errorCode: z.ZodOptional<z.ZodString>;
1212
1230
  createdAt: z.ZodString;
1213
1231
  updatedAt: z.ZodString;
1214
1232
  type: z.ZodLiteral<"MARKET">;
@@ -1290,6 +1308,7 @@ export declare const CreateTradeCloseAllResponse: z.ZodObject<{
1290
1308
  REJECTED: "REJECTED";
1291
1309
  }>;
1292
1310
  error: z.ZodOptional<z.ZodString>;
1311
+ errorCode: z.ZodOptional<z.ZodString>;
1293
1312
  createdAt: z.ZodString;
1294
1313
  updatedAt: z.ZodString;
1295
1314
  type: z.ZodLiteral<"MARKET">;
@@ -1346,6 +1365,7 @@ export declare const CreateTradeCloseAllResponse: z.ZodObject<{
1346
1365
  REJECTED: "REJECTED";
1347
1366
  }>;
1348
1367
  error: z.ZodOptional<z.ZodString>;
1368
+ errorCode: z.ZodOptional<z.ZodString>;
1349
1369
  createdAt: z.ZodString;
1350
1370
  updatedAt: z.ZodString;
1351
1371
  type: z.ZodLiteral<"MARKET">;
@@ -19,9 +19,25 @@ export declare const UserProfile: z.ZodObject<{
19
19
  }, z.core.$strip>;
20
20
  export type UserPreferences = z.infer<typeof UserPreferences>;
21
21
  export type UserProfile = z.infer<typeof UserProfile>;
22
- export declare const ReferralReferee: z.ZodObject<{
22
+ export declare const BoundReferralReferee: z.ZodObject<{
23
+ status: z.ZodLiteral<"BOUND">;
23
24
  address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
24
25
  referredAt: z.ZodOptional<z.ZodNumber>;
25
26
  tradeCount: z.ZodNumber;
26
27
  }, z.core.$strip>;
28
+ export declare const PendingReferralReferee: z.ZodObject<{
29
+ status: z.ZodLiteral<"PENDING">;
30
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
31
+ }, z.core.$strip>;
32
+ export declare const ReferralReferee: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
+ status: z.ZodLiteral<"BOUND">;
34
+ address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
35
+ referredAt: z.ZodOptional<z.ZodNumber>;
36
+ tradeCount: z.ZodNumber;
37
+ }, z.core.$strip>, z.ZodObject<{
38
+ status: z.ZodLiteral<"PENDING">;
39
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
40
+ }, z.core.$strip>], "status">;
41
+ export type BoundReferralReferee = z.infer<typeof BoundReferralReferee>;
42
+ export type PendingReferralReferee = z.infer<typeof PendingReferralReferee>;
27
43
  export type ReferralReferee = z.infer<typeof ReferralReferee>;
@@ -24,10 +24,19 @@ const UserProfile = z.object({
24
24
  // linked it describes what would happen once one is.
25
25
  xHidden: z.boolean().describe("Whether the leaderboard withholds the linked X account")
26
26
  }).describe("User profile of the authenticated user");
27
- const ReferralReferee = z.object({
27
+ const BoundReferralReferee = z.object({
28
+ status: z.literal("BOUND").describe("The referee resolves to a V3 user with a permanent binding"),
28
29
  address: EthereumAddress.optional().describe("Linked EVM wallet address when the referee has one"),
29
- referredAt: z.number().int().nonnegative().optional().describe("V3 attribution time in epoch milliseconds; not the original legacy on-chain referral time"),
30
+ referredAt: z.number().int().nonnegative().optional().describe("V3 attribution time in epoch milliseconds; not the original legacy on-chain referral time, and absent on a historical binding without a recoverable date"),
30
31
  tradeCount: z.number().int().nonnegative().describe("Distinct Pear executions with at least one real confirmed fill")
31
32
  });
33
+ const PendingReferralReferee = z.object({
34
+ status: z.literal("PENDING").describe("A verified legacy referee that has no V3 identity yet"),
35
+ address: EthereumAddress.describe("The verified legacy wallet, the only fact a pending referee carries")
36
+ });
37
+ const ReferralReferee = z.discriminatedUnion("status", [
38
+ BoundReferralReferee,
39
+ PendingReferralReferee
40
+ ]).describe("One referral-history entry, shaped by whether the referee is bound to a V3 user yet");
32
41
 
33
- export { ReferralReferee, UserPreferences, UserProfile };
42
+ export { BoundReferralReferee, PendingReferralReferee, ReferralReferee, UserPreferences, UserProfile };
@@ -39,10 +39,15 @@ export declare const ReferralRefereeListResponse: z.ZodObject<{
39
39
  limit: z.ZodNumber;
40
40
  nextCursor: z.ZodOptional<z.ZodString>;
41
41
  count: z.ZodNumber;
42
- referees: z.ZodArray<z.ZodObject<{
42
+ pendingCount: z.ZodNumber;
43
+ referees: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
44
+ status: z.ZodLiteral<"BOUND">;
43
45
  address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
44
46
  referredAt: z.ZodOptional<z.ZodNumber>;
45
47
  tradeCount: z.ZodNumber;
46
- }, z.core.$strip>>;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ status: z.ZodLiteral<"PENDING">;
50
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
51
+ }, z.core.$strip>], "status">>;
47
52
  }, z.core.$strip>;
48
53
  export type ReferralRefereeListResponse = z.infer<typeof ReferralRefereeListResponse>;
@@ -17,7 +17,8 @@ const ReferralStatusResponse = z.object({
17
17
  referrerCode: z.string().optional().describe("Exact case-sensitive code owned by the permanent referrer")
18
18
  });
19
19
  const ReferralRefereeListResponse = CursorResponse.extend({
20
- count: z.number().int().nonnegative().describe("Total V3 users permanently bound to the authenticated referrer"),
20
+ count: z.number().int().nonnegative().describe("Total referees this list yields, counting bound V3 users and pending legacy wallets together"),
21
+ pendingCount: z.number().int().nonnegative().describe("Subset of count whose verified legacy wallet has no V3 identity yet, so no binding exists"),
21
22
  referees: z.array(ReferralReferee)
22
23
  });
23
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "1.26.1",
3
+ "version": "1.28.0",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",