@pear-protocol/types 2.20.0 → 2.22.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.
Files changed (172) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/fee/entities.d.ts +1 -0
  3. package/dist/fee/responses.d.ts +26 -0
  4. package/dist/index.js +7355 -3
  5. package/dist/rewards/entities.d.ts +28 -0
  6. package/dist/rewards/payloads.d.ts +7 -0
  7. package/dist/rewards/responses.d.ts +73 -0
  8. package/dist/statistics/queries.d.ts +25 -0
  9. package/dist/statistics/responses.d.ts +120 -0
  10. package/dist/sync/responses.d.ts +1 -0
  11. package/dist/users/entities.d.ts +4 -0
  12. package/dist/users/response.d.ts +3 -0
  13. package/package.json +4 -3
  14. package/dist/auth/api-keys.js +0 -44
  15. package/dist/auth/entities.js +0 -25
  16. package/dist/auth/index.js +0 -4
  17. package/dist/auth/payloads.js +0 -84
  18. package/dist/auth/response.js +0 -82
  19. package/dist/baskets/recommended/entities.js +0 -22
  20. package/dist/baskets/recommended/index.js +0 -2
  21. package/dist/baskets/recommended/responses.js +0 -8
  22. package/dist/baskets/saved/entities.js +0 -23
  23. package/dist/baskets/saved/payloads.js +0 -18
  24. package/dist/baskets/saved/responses.js +0 -14
  25. package/dist/bundle.js +0 -36
  26. package/dist/common/address.js +0 -5
  27. package/dist/common/array.js +0 -17
  28. package/dist/common/client-id.js +0 -5
  29. package/dist/common/hex-string.js +0 -5
  30. package/dist/common/index.js +0 -4
  31. package/dist/common/refinement.js +0 -64
  32. package/dist/common/request.js +0 -24
  33. package/dist/common/response.js +0 -28
  34. package/dist/common/schema.js +0 -18
  35. package/dist/common/trade-legs.js +0 -50
  36. package/dist/connector/index.js +0 -12
  37. package/dist/copy/entities.js +0 -151
  38. package/dist/copy/index.js +0 -5
  39. package/dist/copy/payloads.js +0 -8
  40. package/dist/copy/performance.js +0 -63
  41. package/dist/copy/queries.js +0 -20
  42. package/dist/copy/responses.js +0 -89
  43. package/dist/execution/entities.js +0 -196
  44. package/dist/execution/index.js +0 -3
  45. package/dist/execution/queries.js +0 -18
  46. package/dist/execution/responses.js +0 -12
  47. package/dist/fee/entities.js +0 -34
  48. package/dist/fee/index.js +0 -3
  49. package/dist/fee/queries.js +0 -12
  50. package/dist/fee/responses.js +0 -29
  51. package/dist/fill/entities.js +0 -82
  52. package/dist/fill/index.js +0 -3
  53. package/dist/fill/queries.js +0 -14
  54. package/dist/fill/responses.js +0 -23
  55. package/dist/funding/entities.js +0 -16
  56. package/dist/funding/index.js +0 -3
  57. package/dist/funding/queries.js +0 -8
  58. package/dist/funding/responses.js +0 -11
  59. package/dist/instrument/entities.js +0 -102
  60. package/dist/instrument/index.js +0 -3
  61. package/dist/instrument/queries.js +0 -15
  62. package/dist/instrument/responses.js +0 -20
  63. package/dist/instrument-precision/index.js +0 -56
  64. package/dist/ladder/entities.js +0 -24
  65. package/dist/ladder/index.js +0 -4
  66. package/dist/ladder/payloads.js +0 -96
  67. package/dist/ladder/queries.js +0 -12
  68. package/dist/ladder/responses.js +0 -18
  69. package/dist/leverage/index.js +0 -2
  70. package/dist/leverage/payloads.js +0 -14
  71. package/dist/leverage/response.js +0 -5
  72. package/dist/margin/index.js +0 -2
  73. package/dist/margin/payloads.js +0 -20
  74. package/dist/margin/response.js +0 -11
  75. package/dist/market/entities.js +0 -52
  76. package/dist/market/index.js +0 -4
  77. package/dist/market/payloads.js +0 -11
  78. package/dist/market/queries.js +0 -19
  79. package/dist/market/responses.js +0 -18
  80. package/dist/misc/index.js +0 -2
  81. package/dist/misc/payloads.js +0 -99
  82. package/dist/misc/responses.js +0 -85
  83. package/dist/notification/entities.js +0 -274
  84. package/dist/notification/index.js +0 -4
  85. package/dist/notification/payloads.js +0 -15
  86. package/dist/notification/queries.js +0 -29
  87. package/dist/notification/responses.js +0 -20
  88. package/dist/order/entities.js +0 -81
  89. package/dist/order/index.js +0 -1
  90. package/dist/portfolio/entities.js +0 -77
  91. package/dist/portfolio/index.js +0 -3
  92. package/dist/portfolio/queries.js +0 -34
  93. package/dist/portfolio/responses.js +0 -33
  94. package/dist/position/entities.js +0 -433
  95. package/dist/position/index.js +0 -3
  96. package/dist/position/queries.js +0 -109
  97. package/dist/position/responses.js +0 -41
  98. package/dist/price/entities.js +0 -10
  99. package/dist/price/index.js +0 -3
  100. package/dist/price/queries.js +0 -8
  101. package/dist/price/responses.js +0 -15
  102. package/dist/realtime/channels.js +0 -16
  103. package/dist/realtime/frames.js +0 -140
  104. package/dist/realtime/index.js +0 -6
  105. package/dist/realtime/messages.js +0 -118
  106. package/dist/realtime/public-events.js +0 -92
  107. package/dist/realtime/user-events.js +0 -32
  108. package/dist/realtime/vault-events.js +0 -42
  109. package/dist/rebalance/entities.js +0 -86
  110. package/dist/rebalance/index.js +0 -4
  111. package/dist/rebalance/payloads.js +0 -56
  112. package/dist/rebalance/queries.js +0 -14
  113. package/dist/rebalance/responses.js +0 -41
  114. package/dist/schedule/entities.js +0 -239
  115. package/dist/schedule/index.js +0 -5
  116. package/dist/schedule/payloads.js +0 -85
  117. package/dist/schedule/queries.js +0 -30
  118. package/dist/schedule/randomization.js +0 -15
  119. package/dist/schedule/responses.js +0 -22
  120. package/dist/schedule/twap-config.js +0 -29
  121. package/dist/statistics/entities.js +0 -105
  122. package/dist/statistics/index.js +0 -3
  123. package/dist/statistics/queries.js +0 -93
  124. package/dist/statistics/responses.js +0 -17
  125. package/dist/sync/index.js +0 -2
  126. package/dist/sync/payloads.js +0 -136
  127. package/dist/sync/responses.js +0 -26
  128. package/dist/tca/entities.js +0 -9
  129. package/dist/tca/index.js +0 -3
  130. package/dist/tca/queries.js +0 -14
  131. package/dist/tca/responses.js +0 -126
  132. package/dist/trade/entities.js +0 -101
  133. package/dist/trade/index.js +0 -4
  134. package/dist/trade/payloads.js +0 -84
  135. package/dist/trade/queries.js +0 -9
  136. package/dist/trade/responses.js +0 -25
  137. package/dist/trade-accounts/entities.js +0 -61
  138. package/dist/trade-accounts/index.js +0 -4
  139. package/dist/trade-accounts/payloads.js +0 -132
  140. package/dist/trade-accounts/queries.js +0 -7
  141. package/dist/trade-accounts/response.js +0 -79
  142. package/dist/traders/index.js +0 -2
  143. package/dist/traders/performance.js +0 -21
  144. package/dist/traders/public.js +0 -192
  145. package/dist/trigger/common/index.js +0 -39
  146. package/dist/trigger/entities/conditions.js +0 -174
  147. package/dist/trigger/entities/index.js +0 -257
  148. package/dist/trigger/index.js +0 -9
  149. package/dist/trigger/oracle.js +0 -22
  150. package/dist/trigger/payloads/conditions.js +0 -213
  151. package/dist/trigger/payloads/config.js +0 -3
  152. package/dist/trigger/payloads/index.js +0 -173
  153. package/dist/trigger/queries.js +0 -16
  154. package/dist/trigger/refinement/index.js +0 -2
  155. package/dist/trigger/refinement/static.refinement.js +0 -50
  156. package/dist/trigger/refinement/trailing.refinement.js +0 -83
  157. package/dist/trigger/responses.js +0 -18
  158. package/dist/triggers/entities.js +0 -27
  159. package/dist/triggers/index.js +0 -3
  160. package/dist/triggers/queries.js +0 -10
  161. package/dist/triggers/responses.js +0 -9
  162. package/dist/users/entities.js +0 -45
  163. package/dist/users/index.js +0 -4
  164. package/dist/users/payloads.js +0 -33
  165. package/dist/users/queries.js +0 -8
  166. package/dist/users/response.js +0 -27
  167. package/dist/vaults/entities.js +0 -96
  168. package/dist/vaults/index.js +0 -4
  169. package/dist/vaults/payloads.js +0 -65
  170. package/dist/vaults/queries.js +0 -66
  171. package/dist/vaults/responses.js +0 -368
  172. /package/dist/{baskets/saved/index.js → rewards/index.d.ts} +0 -0
@@ -1,368 +0,0 @@
1
- import { z } from 'zod';
2
- import { EthereumAddress } from '../common/address';
3
- import { Vault, VaultStatus, BulkSnapshotPoint, SparklinePoint, Activity, NavBucketPoint, NavSnapshot, VaultEvent } from './entities';
4
- import { NavStatsWindow } from './queries';
5
-
6
- var __defProp = Object.defineProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- const VaultResponse = z.object({
9
- vault: Vault
10
- });
11
- const VaultListResponse = z.object({
12
- vaults: z.array(Vault)
13
- });
14
- const CreatedVaultCompleted = z.object({
15
- success: z.literal(true),
16
- vaultAddress: EthereumAddress,
17
- agentAddress: EthereumAddress,
18
- ownerAddress: EthereumAddress,
19
- status: VaultStatus,
20
- maxWithdrawalPeriodDays: z.number().int(),
21
- txHash: z.string()
22
- });
23
- const CreatedVaultInProgress = z.object({
24
- success: z.literal(false),
25
- status: z.literal("in_progress"),
26
- activityId: z.string()
27
- });
28
- const CreatedVaultResult = z.discriminatedUnion("success", [
29
- CreatedVaultCompleted,
30
- CreatedVaultInProgress
31
- ]);
32
- const CreatedVaultResponse = z.object({
33
- result: CreatedVaultResult
34
- });
35
- const SetTraderCompleted = z.object({
36
- success: z.literal(true),
37
- vault: Vault
38
- });
39
- const SetTraderInProgress = z.object({
40
- success: z.literal(false),
41
- status: z.literal("in_progress"),
42
- activityId: z.string()
43
- });
44
- const SetTraderResult = z.discriminatedUnion("success", [
45
- SetTraderCompleted,
46
- SetTraderInProgress
47
- ]);
48
- const SetTraderResponse = z.object({
49
- result: SetTraderResult
50
- });
51
- const UpdateVaultMetadataCompleted = z.object({
52
- success: z.literal(true),
53
- vault: Vault
54
- });
55
- const UpdateVaultMetadataInProgress = z.object({
56
- success: z.literal(false),
57
- status: z.literal("in_progress"),
58
- activityId: z.string()
59
- });
60
- const UpdateVaultMetadataResult = z.discriminatedUnion("success", [
61
- UpdateVaultMetadataCompleted,
62
- UpdateVaultMetadataInProgress
63
- ]);
64
- const UpdateVaultMetadataResponse = z.object({
65
- result: UpdateVaultMetadataResult
66
- });
67
- const BulkSnapshotsResponse = z.object({
68
- snapshots: z.record(z.string(), z.array(BulkSnapshotPoint))
69
- });
70
- const InvestorEntry = z.object({
71
- address: z.string(),
72
- depositAmount: z.string(),
73
- shares: z.string(),
74
- currentValue: z.string(),
75
- unrealizedPnl: z.number()
76
- });
77
- const VaultStatsResponse = z.object({
78
- tvl: z.string(),
79
- totalSupply: z.string(),
80
- sharePrice: z.string(),
81
- withdrawalFeeBps: z.number(),
82
- leaderInvestment: z.object({
83
- depositAmount: z.string(),
84
- currentValue: z.string(),
85
- shares: z.string(),
86
- percentageOfTVL: z.number()
87
- }),
88
- totalPnl: z.number(),
89
- totalPnlPercentage: z.number().nullable(),
90
- thirtyDayPnl: z.number(),
91
- apr: z.number().nullable(),
92
- maxDrawdown: z.number().nullable(),
93
- // Recorded traded volume (USD) from the confirmed fills ledger; omitted when the vault has no trading account mapping.
94
- tradedVolume: z.number().optional(),
95
- winRate: z.number().nullable(),
96
- profitFactor: z.number().nullable(),
97
- unrealizedPnl: z.number(),
98
- userStats: z.object({
99
- allTimePnl: z.number(),
100
- depositAmount: z.string(),
101
- currentValue: z.string(),
102
- shares: z.string(),
103
- unrealizedPnl: z.number()
104
- }).optional(),
105
- investors: z.array(InvestorEntry)
106
- });
107
- const VaultOverviewResponse = z.object({
108
- items: z.array(z.object({
109
- vaultAddress: EthereumAddress,
110
- agentAddress: EthereumAddress,
111
- leaderAddress: EthereumAddress,
112
- name: z.string().nullable(),
113
- imageUrl: z.string().nullable(),
114
- latest: z.object({
115
- tvl: z.string(),
116
- sharePrice: z.string(),
117
- accountValue: z.string().nullable(),
118
- openInterest: z.string().nullable(),
119
- unrealizedPnl: z.string().nullable(),
120
- cumulativeRealizedPnl: z.string().nullable(),
121
- investorCount: z.number(),
122
- createdAt: z.string()
123
- }).nullable(),
124
- sparkline: z.array(SparklinePoint)
125
- })),
126
- page: z.number(),
127
- pageSize: z.number(),
128
- total: z.number()
129
- });
130
- const VaultInvestmentsResponse = z.object({
131
- totals: z.object({
132
- totalInvested: z.number(),
133
- totalCurrentValue: z.number(),
134
- totalPnl: z.number(),
135
- totalUnrealizedPnl: z.number()
136
- }),
137
- investments: z.array(z.object({
138
- vaultAddress: EthereumAddress,
139
- name: z.string().nullable(),
140
- imageUrl: z.string().nullable(),
141
- isLeader: z.boolean(),
142
- depositAmount: z.string(),
143
- currentValue: z.string(),
144
- allTimePnl: z.number(),
145
- unrealizedPnl: z.number(),
146
- shares: z.string()
147
- })),
148
- partial: z.boolean(),
149
- failedVaults: z.array(z.object({
150
- vaultAddress: EthereumAddress,
151
- name: z.string().nullable(),
152
- reason: z.string()
153
- }))
154
- });
155
- const ActivityResponse = z.object({
156
- vaultAddress: z.string(),
157
- activity: z.array(Activity)
158
- });
159
- const ActivityItemResponse = z.object({
160
- activity: Activity
161
- });
162
- const AgentApproveSent = z.object({
163
- success: z.literal(true),
164
- transactionHash: z.string(),
165
- tokenAddress: z.string(),
166
- spender: z.string(),
167
- amount: z.string()
168
- });
169
- const AgentApproveSkipped = z.object({
170
- success: z.literal(false),
171
- status: z.literal("already_approved"),
172
- tokenAddress: z.string(),
173
- spender: z.string(),
174
- allowance: z.string()
175
- });
176
- const AgentApproveResult = z.discriminatedUnion("success", [
177
- AgentApproveSent,
178
- AgentApproveSkipped
179
- ]);
180
- const AgentApproveResponse = z.object({
181
- result: AgentApproveResult
182
- });
183
- const UnifiedAccountResponse = z.object({
184
- success: z.boolean(),
185
- agentAddress: z.string()
186
- });
187
- const NavRangeResponse = z.object({
188
- points: z.array(NavBucketPoint)
189
- });
190
- const NavStatsResponse = z.object({
191
- window: NavStatsWindow,
192
- samples: z.number().int().nonnegative(),
193
- returnPct: z.number().nullable(),
194
- sharePriceMin: z.string().nullable(),
195
- sharePriceMax: z.string().nullable(),
196
- sharePriceFirst: z.string().nullable(),
197
- sharePriceLast: z.string().nullable()
198
- });
199
- const NavSnapshotResponse = z.object({
200
- snapshot: NavSnapshot
201
- });
202
- const WithdrawCompleted = z.object({
203
- success: z.literal(true),
204
- amount: z.string(),
205
- token: z.string(),
206
- tokenId: z.string(),
207
- destination: z.string(),
208
- vaultAddress: z.string(),
209
- activityId: z.string(),
210
- bridgeStatus: z.string(),
211
- bridgeSettleMs: z.number(),
212
- transferTxHash: z.string()
213
- });
214
- const WithdrawInProgress = z.object({
215
- success: z.literal(false),
216
- status: z.literal("in_progress"),
217
- amount: z.string(),
218
- token: z.string(),
219
- tokenId: z.string(),
220
- destination: z.string(),
221
- vaultAddress: z.string(),
222
- activityId: z.string()
223
- });
224
- const WithdrawToEvmResult = z.discriminatedUnion("success", [
225
- WithdrawCompleted,
226
- WithdrawInProgress
227
- ]);
228
- const WithdrawToEvmResponse = z.object({
229
- result: WithdrawToEvmResult
230
- });
231
- const VaultEventListResponse = z.object({
232
- events: z.array(VaultEvent)
233
- });
234
- const VaultRequestIssue = z.object({
235
- path: z.string(),
236
- message: z.string(),
237
- code: z.string()
238
- });
239
- const createRefusal = /* @__PURE__ */ __name((code) => z.object({
240
- error: z.literal(code),
241
- details: z.string().optional()
242
- }), "createRefusal");
243
- const VaultServiceError = z.discriminatedUnion("error", [
244
- // Authentication and authorization.
245
- z.object({
246
- error: z.literal("UNAUTHORIZED"),
247
- reason: z.string()
248
- }),
249
- z.object({
250
- error: z.literal("NOT_OWNER"),
251
- vaultAddress: z.string()
252
- }),
253
- // Request validation.
254
- z.object({
255
- error: z.literal("INVALID_REQUEST"),
256
- issues: z.array(VaultRequestIssue)
257
- }),
258
- // Lookups.
259
- z.object({
260
- error: z.literal("VAULT_NOT_FOUND"),
261
- vaultAddress: z.string()
262
- }),
263
- z.object({
264
- error: z.literal("VAULT_TRADE_ACCOUNT_UNAVAILABLE"),
265
- vaultAddress: z.string()
266
- }),
267
- z.object({
268
- error: z.literal("ACTIVITY_NOT_FOUND"),
269
- activityId: z.string()
270
- }),
271
- z.object({
272
- error: z.literal("NAV_UNAVAILABLE"),
273
- vaultAddress: z.string()
274
- }),
275
- // Admission ceilings.
276
- z.object({
277
- error: z.literal("RATE_LIMITED"),
278
- reason: z.string(),
279
- retryAfterSeconds: z.number()
280
- }),
281
- z.object({
282
- error: z.literal("VAULT_CREATE_CEILING"),
283
- retryAfterSeconds: z.number()
284
- }),
285
- // Provider failures; `incidentId` correlates the response with the full server-side log line.
286
- z.object({
287
- error: z.literal("HL_SET_ABSTRACTION_FAILED"),
288
- incidentId: z.string()
289
- }),
290
- // On-chain reads and workflow-answered refusals.
291
- z.object({
292
- error: z.literal("EVM_OPERATION_FAILED"),
293
- vaultAddress: z.string(),
294
- reason: z.string()
295
- }),
296
- z.object({
297
- error: z.literal("HL_APPROVE_AGENT_FAILED"),
298
- vaultAddress: z.string()
299
- }),
300
- // Create-vault refusals translated from the workflow's terminal reasons.
301
- createRefusal("DEPLOYER_NOT_WHITELISTED"),
302
- createRefusal("INVALID_CONFIG"),
303
- createRefusal("CONFIG_DISABLED"),
304
- createRefusal("AGENT_ALREADY_ASSIGNED"),
305
- createRefusal("EMPTY_NAME"),
306
- createRefusal("INVALID_ADDRESS"),
307
- createRefusal("DEPLOY_REVERTED"),
308
- createRefusal("VAULT_EVENT_MISSING"),
309
- createRefusal("DEPLOYER_INSUFFICIENT_FUNDS"),
310
- // Ambiguous post-dispatch outcomes; `activityId` anchors a support lookup.
311
- z.object({
312
- error: z.literal("CREATE_VAULT_OPERATION_FAILED"),
313
- activityId: z.string()
314
- }),
315
- z.object({
316
- error: z.literal("SET_TRADER_OPERATION_FAILED"),
317
- activityId: z.string()
318
- }),
319
- z.object({
320
- error: z.literal("UPDATE_METADATA_OPERATION_FAILED"),
321
- activityId: z.string()
322
- }),
323
- z.object({
324
- error: z.literal("VAULT_NOT_FOUND_AFTER_SET_TRADER"),
325
- activityId: z.string()
326
- }),
327
- // Bridge withdraw family.
328
- z.object({
329
- error: z.literal("UNSUPPORTED_TOKEN"),
330
- reason: z.string()
331
- }),
332
- z.object({
333
- error: z.literal("WITHDRAW_IN_PROGRESS"),
334
- activityId: z.string()
335
- }),
336
- z.object({
337
- error: z.literal("BRIDGE_OPERATION_FAILED"),
338
- activityId: z.string()
339
- }),
340
- z.object({
341
- error: z.literal("BRIDGE_SEND_REJECTED"),
342
- activityId: z.string()
343
- }),
344
- z.object({
345
- error: z.literal("BRIDGE_VAULT_NOT_FOUND"),
346
- activityId: z.string()
347
- }),
348
- z.object({
349
- error: z.literal("BRIDGE_INVALID_AMOUNT"),
350
- activityId: z.string()
351
- }),
352
- z.object({
353
- error: z.literal("BRIDGE_NONCE_EXPIRED"),
354
- activityId: z.string()
355
- }),
356
- // Custody refusals: Privy refused to sign the action, so the venue never saw it.
357
- createRefusal("CUSTODY_REFUSED"),
358
- z.object({
359
- error: z.literal("SET_TRADER_CUSTODY_REFUSED"),
360
- vaultAddress: z.string()
361
- }),
362
- z.object({
363
- error: z.literal("BRIDGE_CUSTODY_REFUSED"),
364
- activityId: z.string()
365
- })
366
- ]);
367
-
368
- export { ActivityItemResponse, ActivityResponse, AgentApproveResponse, AgentApproveResult, BulkSnapshotsResponse, CreatedVaultResponse, CreatedVaultResult, NavRangeResponse, NavSnapshotResponse, NavStatsResponse, SetTraderResponse, SetTraderResult, UnifiedAccountResponse, UpdateVaultMetadataResponse, UpdateVaultMetadataResult, VaultEventListResponse, VaultInvestmentsResponse, VaultListResponse, VaultOverviewResponse, VaultRequestIssue, VaultResponse, VaultServiceError, VaultStatsResponse, WithdrawToEvmResponse, WithdrawToEvmResult };