@pear-protocol/types 1.27.0 → 1.29.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.
@@ -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.ZodOptional<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.ZodOptional<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,47 @@ 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
+ // Failed bridge transactions can stop before Fun.xyz assigns a transaction hash.
69
+ txHash: z.string().optional(),
70
+ createdTimeMs: z.number(),
71
+ status: z.string(),
72
+ depositAddr: z.string()
73
+ });
74
+ const ListLighterUdaDepositsResult = z.object({
75
+ transactions: z.array(LighterUdaTransaction)
76
+ });
34
77
 
35
- export { CreateApiKeyWithMessageResult, CreateAuthTokenResult, PrepareApproveIntegratorResult, PrepareLighterFastWithdrawResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult, SubmitLighterFastWithdrawResult };
78
+ export { ChangeLighterAccountTierResult, CreateApiKeyWithMessageResult, CreateAuthTokenResult, CreateLighterUdaResult, LighterUdaResolution, LighterUdaTransaction, ListLighterUdaDepositsResult, PrepareApproveIntegratorResult, PrepareLighterFastWithdrawResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult, SubmitLighterFastWithdrawResult };
@@ -156,6 +156,16 @@ export declare const CreateTriggerConditionCloseStatic: z.ZodDiscriminatedUnion<
156
156
  }>;
157
157
  threshold: z.ZodNumber;
158
158
  }, z.core.$strip>;
159
+ }, z.core.$strip>, z.ZodObject<{
160
+ type: z.ZodLiteral<"prediction_market">;
161
+ data: z.ZodObject<{
162
+ source: z.ZodEnum<{
163
+ kalshi: "kalshi";
164
+ polymarket: "polymarket";
165
+ }>;
166
+ marketKey: z.ZodString;
167
+ threshold: z.ZodNumber;
168
+ }, z.core.$strip>;
159
169
  }, z.core.$strip>], "type">;
160
170
  export declare const CreateTriggerConditionCloseTrailing: z.ZodDiscriminatedUnion<[z.ZodObject<{
161
171
  type: z.ZodLiteral<"ratio_trailing">;
@@ -308,6 +318,9 @@ export type CreateTriggerConditionUpnlCloseStatic = Extract<CreateTriggerConditi
308
318
  export type CreateTriggerConditionUpnlBpsCloseStatic = Extract<CreateTriggerConditionCloseStatic, {
309
319
  type: 'upnl_bps';
310
320
  }>;
321
+ export type CreateTriggerConditionPredictionMarketCloseStatic = Extract<CreateTriggerConditionCloseStatic, {
322
+ type: 'prediction_market';
323
+ }>;
311
324
  export type CreateTriggerConditionCloseTrailing = z.output<typeof CreateTriggerConditionCloseTrailing>;
312
325
  export type CreateTriggerConditionRatioCloseTrailing = Extract<CreateTriggerConditionCloseTrailing, {
313
326
  type: 'ratio_trailing';
@@ -123,6 +123,17 @@ const UpnlBpsCloseStatic = z.object({
123
123
  threshold: z.number()
124
124
  })
125
125
  });
126
+ const PredictionMarketCloseStatic = z.object({
127
+ type: z.literal("prediction_market"),
128
+ data: z.object({
129
+ source: z.enum([
130
+ "kalshi",
131
+ "polymarket"
132
+ ]),
133
+ marketKey: z.string().min(1),
134
+ threshold: TriggerThreshold
135
+ })
136
+ });
126
137
  const RatioCloseTrailing = z.object({
127
138
  type: z.literal("ratio_trailing"),
128
139
  data: z.object({
@@ -177,7 +188,8 @@ const CreateTriggerConditionCloseStatic = z.discriminatedUnion("type", [
177
188
  WeightedRatioCloseStatic,
178
189
  NotionalCloseStatic,
179
190
  UpnlCloseStatic,
180
- UpnlBpsCloseStatic
191
+ UpnlBpsCloseStatic,
192
+ PredictionMarketCloseStatic
181
193
  ]);
182
194
  const CreateTriggerConditionCloseTrailing = z.discriminatedUnion("type", [
183
195
  RatioCloseTrailing,
@@ -621,6 +621,16 @@ export declare const CreateTriggerMarketCloseStatic: z.ZodObject<{
621
621
  }>;
622
622
  threshold: z.ZodNumber;
623
623
  }, z.core.$strip>;
624
+ }, z.core.$strip>, z.ZodObject<{
625
+ type: z.ZodLiteral<"prediction_market">;
626
+ data: z.ZodObject<{
627
+ source: z.ZodEnum<{
628
+ kalshi: "kalshi";
629
+ polymarket: "polymarket";
630
+ }>;
631
+ marketKey: z.ZodString;
632
+ threshold: z.ZodNumber;
633
+ }, z.core.$strip>;
624
634
  }, z.core.$strip>], "type">;
625
635
  clientId: z.ZodOptional<z.ZodString>;
626
636
  }, z.core.$strip>;
@@ -776,6 +786,16 @@ export declare const CreateTriggerMarketClose: z.ZodUnion<readonly [z.ZodObject<
776
786
  }>;
777
787
  threshold: z.ZodNumber;
778
788
  }, z.core.$strip>;
789
+ }, z.core.$strip>, z.ZodObject<{
790
+ type: z.ZodLiteral<"prediction_market">;
791
+ data: z.ZodObject<{
792
+ source: z.ZodEnum<{
793
+ kalshi: "kalshi";
794
+ polymarket: "polymarket";
795
+ }>;
796
+ marketKey: z.ZodString;
797
+ threshold: z.ZodNumber;
798
+ }, z.core.$strip>;
779
799
  }, z.core.$strip>], "type">;
780
800
  clientId: z.ZodOptional<z.ZodString>;
781
801
  }, z.core.$strip>, z.ZodObject<{
@@ -1248,6 +1268,16 @@ export declare const CreateTriggerClose: z.ZodUnion<readonly [z.ZodObject<{
1248
1268
  }>;
1249
1269
  threshold: z.ZodNumber;
1250
1270
  }, z.core.$strip>;
1271
+ }, z.core.$strip>, z.ZodObject<{
1272
+ type: z.ZodLiteral<"prediction_market">;
1273
+ data: z.ZodObject<{
1274
+ source: z.ZodEnum<{
1275
+ kalshi: "kalshi";
1276
+ polymarket: "polymarket";
1277
+ }>;
1278
+ marketKey: z.ZodString;
1279
+ threshold: z.ZodNumber;
1280
+ }, z.core.$strip>;
1251
1281
  }, z.core.$strip>], "type">;
1252
1282
  clientId: z.ZodOptional<z.ZodString>;
1253
1283
  }, z.core.$strip>, z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/types",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
4
4
  "description": "Pear Protocol Types definitions",
5
5
  "private": false,
6
6
  "type": "module",