@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,50 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const RefineStaticLogicalRules = /* @__PURE__ */ __name((value, context) => {
4
- for (const issue of getStaticLogicalIssues({
5
- conditionType: value.condition.type,
6
- threshold: value.condition.data.threshold
7
- })) {
8
- context.addIssue({
9
- code: "custom",
10
- message: issue.message
11
- });
12
- }
13
- }, "RefineStaticLogicalRules");
14
- function getStaticLogicalIssues(input) {
15
- const { conditionType, threshold } = input;
16
- const issues = [];
17
- switch (conditionType) {
18
- case "notional": {
19
- if (threshold <= 0) {
20
- issues.push({
21
- field: "threshold",
22
- message: "threshold must be greater than 0 for notional static triggers"
23
- });
24
- }
25
- break;
26
- }
27
- case "upnl": {
28
- if (threshold === 0) {
29
- issues.push({
30
- field: "threshold",
31
- message: "threshold must not be 0 for uPnL static triggers"
32
- });
33
- }
34
- break;
35
- }
36
- case "upnl_bps": {
37
- if (threshold === 0) {
38
- issues.push({
39
- field: "threshold",
40
- message: "threshold must not be 0 for uPnL BPS static triggers"
41
- });
42
- }
43
- break;
44
- }
45
- }
46
- return issues;
47
- }
48
- __name(getStaticLogicalIssues, "getStaticLogicalIssues");
49
-
50
- export { RefineStaticLogicalRules, getStaticLogicalIssues };
@@ -1,83 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const RefineTrailingConfig = /* @__PURE__ */ __name((value, ctx) => {
4
- for (const issue of getTrailingDeltaIssues(value)) {
5
- ctx.addIssue({
6
- code: "custom",
7
- message: issue.message
8
- });
9
- }
10
- }, "RefineTrailingConfig");
11
- const RefineTrailingLogicalRules = /* @__PURE__ */ __name((value, ctx) => {
12
- for (const issue of getTrailingLogicalIssues({
13
- conditionType: value.condition.type,
14
- trailing: value.trailing
15
- })) {
16
- ctx.addIssue({
17
- code: "custom",
18
- message: issue.message
19
- });
20
- }
21
- }, "RefineTrailingLogicalRules");
22
- function getTrailingLogicalIssues(input) {
23
- const { trailing } = input;
24
- const issues = [];
25
- switch (input.conditionType) {
26
- case "notional_trailing": {
27
- if (trailing.activationValue != null && trailing.activationValue <= 0) {
28
- issues.push({
29
- field: "activationValue",
30
- message: "activationValue must be greater than 0 for notional trailing"
31
- });
32
- }
33
- break;
34
- }
35
- case "upnl_trailing":
36
- case "upnl_bps_trailing": {
37
- if (trailing.activationValue === 0) {
38
- issues.push({
39
- field: "activationValue",
40
- message: "activationValue must not be 0 for uPnL trailing"
41
- });
42
- }
43
- break;
44
- }
45
- }
46
- if (input.conditionType === "notional_trailing" && trailing.activationValue != null && trailing.mode === "ABSOLUTE_POINTS" && trailing.deltaValue >= trailing.activationValue) {
47
- issues.push({
48
- field: "deltaValue",
49
- message: "deltaValue must be less than activationValue for notional trailing in ABSOLUTE_POINTS mode"
50
- });
51
- }
52
- return issues;
53
- }
54
- __name(getTrailingLogicalIssues, "getTrailingLogicalIssues");
55
- function getTrailingDeltaIssues(trailing) {
56
- const issues = [];
57
- if (trailing.deltaValue <= 0) {
58
- issues.push({
59
- field: "deltaValue",
60
- message: "deltaValue must be greater than 0"
61
- });
62
- return issues;
63
- }
64
- if (trailing.mode !== "RELATIVE_BPS") {
65
- return issues;
66
- }
67
- if (!Number.isInteger(trailing.deltaValue)) {
68
- issues.push({
69
- field: "deltaValue",
70
- message: "deltaValue must be an integer in RELATIVE_BPS mode"
71
- });
72
- }
73
- if (trailing.deltaValue < 1 || trailing.deltaValue > 5e3) {
74
- issues.push({
75
- field: "deltaValue",
76
- message: "deltaValue must be between 1 and 5000 in RELATIVE_BPS mode"
77
- });
78
- }
79
- return issues;
80
- }
81
- __name(getTrailingDeltaIssues, "getTrailingDeltaIssues");
82
-
83
- export { RefineTrailingConfig, RefineTrailingLogicalRules, getTrailingDeltaIssues, getTrailingLogicalIssues };
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- import { CursorResponse } from '../common';
3
- import { Trigger } from './entities';
4
-
5
- const TriggerListResponse = CursorResponse.extend({
6
- triggers: z.array(Trigger)
7
- });
8
- const CreateTriggerResponse = z.object({
9
- trigger: Trigger
10
- });
11
- const CancelTriggerResponse = z.object({
12
- id: z.uuid()
13
- });
14
- const CancelAllTriggersResponse = z.object({
15
- ids: z.array(z.uuid())
16
- });
17
-
18
- export { CancelAllTriggersResponse, CancelTriggerResponse, CreateTriggerResponse, TriggerListResponse };
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const ExternalTriggerSource = z.enum([
4
- "kalshi",
5
- "polymarket"
6
- ]);
7
- const TriggerOutcome = z.object({
8
- id: z.string(),
9
- label: z.string(),
10
- oracle: z.number().nullable()
11
- });
12
- const ExternalTrigger = z.object({
13
- id: z.string(),
14
- category: z.literal("prediction_market"),
15
- source: ExternalTriggerSource,
16
- selectable: z.boolean(),
17
- oracle: z.number().nullable(),
18
- options: z.array(TriggerOutcome),
19
- type: z.enum([
20
- "binary",
21
- "multi"
22
- ]),
23
- title: z.string(),
24
- imageUrl: z.string().nullable()
25
- });
26
-
27
- export { ExternalTrigger, ExternalTriggerSource, TriggerOutcome };
@@ -1,3 +0,0 @@
1
- export * from './entities';
2
- export * from './queries';
3
- export * from './responses';
@@ -1,10 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const SearchTriggersParams = z.object({
4
- category: z.string().optional(),
5
- search: z.string().optional(),
6
- cursor: z.string().optional(),
7
- pageSize: z.number().optional()
8
- });
9
-
10
- export { SearchTriggersParams };
@@ -1,9 +0,0 @@
1
- import { z } from 'zod';
2
- import { ExternalTrigger } from './entities';
3
-
4
- const SearchTriggersResponse = z.object({
5
- triggers: z.array(ExternalTrigger),
6
- nextCursor: z.string().nullable()
7
- });
8
-
9
- export { SearchTriggersResponse };
@@ -1,45 +0,0 @@
1
- import { z } from 'zod';
2
- import { EthereumAddress } from '../common/address';
3
- import { UnsignedDecimalString } from '../common/schema';
4
-
5
- const UserPreferences = z.object({
6
- slippageToleranceBps: z.int().describe("User slippage preference in basis points")
7
- }).describe("User preferences");
8
- const UserProfile = z.object({
9
- id: z.uuid().describe("User UUID"),
10
- displayName: z.string().describe("Public display name"),
11
- role: z.enum([
12
- "basic",
13
- "pro",
14
- "vault"
15
- ]).describe("User role"),
16
- address: z.string().nullable().describe("Linked wallet address (for evm_wallet provider)"),
17
- email: z.string().nullable().describe("Linked email address (for email provider)"),
18
- emailVerified: z.boolean().describe("Whether the email is verified"),
19
- // Nullable rather than optional to match `address` and `email` above. Splitting
20
- // conventions inside one object costs more than following its neighbours.
21
- xHandle: z.string().nullable().describe('Linked X handle, without the leading "@" (for x provider)'),
22
- xName: z.string().nullable().describe("Linked X display name"),
23
- xAvatarUrl: z.string().nullable().describe("Linked X avatar URL"),
24
- // A plain boolean rather than nullable, matching `emailVerified` above: this is the
25
- // owner's own setting, which is known whether or not an X account is linked. With none
26
- // linked it describes what would happen once one is.
27
- xHidden: z.boolean().describe("Whether the leaderboard and public trader profiles withhold the linked X account")
28
- }).describe("User profile of the authenticated user");
29
- const BoundReferralReferee = z.object({
30
- status: z.literal("BOUND").describe("The referee resolves to a V3 user with a permanent binding"),
31
- address: EthereumAddress.optional().describe("Linked EVM wallet address when the referee has one"),
32
- 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"),
33
- tradeCount: z.number().int().nonnegative().describe("Distinct Pear executions with at least one real confirmed fill"),
34
- volumeUsd: UnsignedDecimalString.describe("Post-binding V3 volume from real confirmed Pear fills, in USD")
35
- });
36
- const PendingReferralReferee = z.object({
37
- status: z.literal("PENDING").describe("A verified legacy referee that has no V3 identity yet"),
38
- address: EthereumAddress.describe("The verified legacy wallet, the only fact a pending referee carries")
39
- });
40
- const ReferralReferee = z.discriminatedUnion("status", [
41
- BoundReferralReferee,
42
- PendingReferralReferee
43
- ]).describe("One referral-history entry, shaped by whether the referee is bound to a V3 user yet");
44
-
45
- export { BoundReferralReferee, PendingReferralReferee, ReferralReferee, UserPreferences, UserProfile };
@@ -1,4 +0,0 @@
1
- export * from './entities';
2
- export * from './payloads';
3
- export * from './queries';
4
- export * from './response';
@@ -1,33 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const UpdateUserPreferences = z.object({
4
- slippageToleranceBps: z.int().min(1).max(1e4).optional().describe("User slippage preference in basis points")
5
- }).describe("Payload to update user preferences");
6
- const DISPLAY_NAME_REGEX = /^[\p{L}\p{N} .'-]+$/u;
7
- const DisplayNameSchema = z.preprocess((value) => {
8
- if (typeof value !== "string") return value;
9
- return value.normalize("NFKC").trim().replace(/\s+/g, " ");
10
- }, z.string().min(1, "Display name must be at least 1 character").max(40, "Display name must be at most 40 characters").refine((value) => !/[\u200B-\u200D\uFEFF]/.test(value), {
11
- message: "Display name contains invisible characters"
12
- }).refine((value) => DISPLAY_NAME_REGEX.test(value), {
13
- message: "Display name may only contain letters, numbers, spaces, apostrophes, hyphens, and periods"
14
- }).refine((value) => /[\p{L}\p{N}]/u.test(value), {
15
- message: "Display name must contain at least one letter or number"
16
- }).refine((value) => !/^[ .'-]|[ .'-]$/.test(value), {
17
- message: "Display name cannot start or end with punctuation"
18
- }).refine((value) => !/[ .'-]{2,}/.test(value), {
19
- message: "Display name cannot contain repeated separators"
20
- }));
21
- const UpdateUserDisplayName = z.object({
22
- displayName: DisplayNameSchema
23
- }).describe("Payload to update user display name");
24
- const ReferralCodeSpelling = z.string().min(1).max(32).regex(/^[\x20-\x7E]+$/, "Referral code must contain printable ASCII characters only");
25
- const IssuedReferralCodeSpelling = z.string().trim().min(1).max(32).regex(/^[A-Za-z0-9_-]+$/, "Referral code must contain only letters, digits, hyphens, or underscores");
26
- const CreateReferralCode = z.object({
27
- referralCode: IssuedReferralCodeSpelling
28
- }).describe("Payload to issue a referral code to the authenticated user");
29
- const BindReferralCode = z.object({
30
- referralCode: ReferralCodeSpelling
31
- }).describe("Payload to bind a referral code permanently to the authenticated user");
32
-
33
- export { BindReferralCode, CreateReferralCode, UpdateUserDisplayName, UpdateUserPreferences };
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
- import { CursorFindParams } from '../common/request';
3
-
4
- const ReferralRefereeListParams = CursorFindParams.extend({
5
- limit: z.coerce.number().int().positive().max(100).optional().default(20)
6
- });
7
-
8
- export { ReferralRefereeListParams };
@@ -1,27 +0,0 @@
1
- import { z } from 'zod';
2
- import { CursorResponse } from '../common/response';
3
- import { UnsignedDecimalString } from '../common/schema';
4
- import { UserPreferences, UserProfile, ReferralReferee } from './entities';
5
-
6
- const ProfileResponse = z.object({
7
- profile: UserProfile,
8
- preferences: UserPreferences
9
- });
10
- const UpdateUserPreferencesResponse = z.object({
11
- preferences: UserPreferences
12
- });
13
- const UpdateUserDisplayNameResponse = z.object({
14
- displayName: z.string().describe("Updated user display name")
15
- });
16
- const ReferralStatusResponse = z.object({
17
- ownedCodes: z.array(z.string()).describe("Exact case-sensitive referral codes owned by the authenticated user"),
18
- referrerCode: z.string().optional().describe("Exact case-sensitive code owned by the permanent referrer")
19
- });
20
- const ReferralRefereeListResponse = CursorResponse.extend({
21
- count: z.number().int().nonnegative().describe("Total referees this list yields, counting bound V3 users and pending legacy wallets together"),
22
- pendingCount: z.number().int().nonnegative().describe("Subset of count whose verified legacy wallet has no V3 identity yet, so no binding exists"),
23
- totalVolumeUsd: UnsignedDecimalString.describe("Post-binding V3 volume from real confirmed Pear fills across the complete bound referee set, independent of pagination"),
24
- referees: z.array(ReferralReferee)
25
- });
26
-
27
- export { ProfileResponse, ReferralRefereeListResponse, ReferralStatusResponse, UpdateUserDisplayNameResponse, UpdateUserPreferencesResponse };
@@ -1,96 +0,0 @@
1
- import { z } from 'zod';
2
- import { EthereumAddress } from '../common/address';
3
-
4
- const VaultStatus = z.enum([
5
- "active",
6
- "inactive",
7
- "pending_activation"
8
- ]);
9
- const Vault = z.object({
10
- id: z.string().uuid(),
11
- vaultAddress: EthereumAddress,
12
- ownerAddress: EthereumAddress,
13
- traderAddress: EthereumAddress.nullable(),
14
- agentAddress: EthereumAddress,
15
- status: VaultStatus,
16
- isApproved: z.boolean(),
17
- name: z.string().nullable(),
18
- about: z.string().nullable(),
19
- imageUrl: z.string().nullable(),
20
- transactionHash: z.string().nullable(),
21
- maxWithdrawalPeriodDays: z.number().int(),
22
- createdAt: z.string().datetime(),
23
- updatedAt: z.string().datetime()
24
- });
25
- const Activity = z.object({
26
- id: z.string(),
27
- // Absent columns drop off the wire entirely rather than shipping as present nulls.
28
- vaultAddress: z.string().optional(),
29
- // Mirrors the vault_activity_type Postgres enum; duplicated literally because the SDK cannot import the database package.
30
- type: z.enum([
31
- "vault.create",
32
- "vault.set_trader",
33
- "vault.update_metadata",
34
- "bridge.withdraw_to_evm"
35
- ]),
36
- status: z.enum([
37
- "pending",
38
- "succeeded",
39
- "failed"
40
- ]),
41
- txHash: z.string().optional(),
42
- error: z.string().optional(),
43
- createdAt: z.iso.datetime(),
44
- updatedAt: z.iso.datetime()
45
- });
46
- const VaultEvent = z.object({
47
- id: z.string(),
48
- vaultAddress: EthereumAddress,
49
- eventType: z.enum([
50
- "DEPOSIT",
51
- "WITHDRAWAL"
52
- ]),
53
- userAddress: EthereumAddress,
54
- receiver: EthereumAddress,
55
- assets: z.string(),
56
- shares: z.string(),
57
- fee: z.string(),
58
- withdrawalId: z.string().nullable(),
59
- txHash: z.string(),
60
- blockNumber: z.string(),
61
- logIndex: z.number().int(),
62
- createdAt: z.string().datetime()
63
- });
64
- const NavSnapshot = z.object({
65
- vaultAddress: EthereumAddress,
66
- takenAt: z.string().datetime(),
67
- totalAssets: z.string(),
68
- totalSupply: z.string(),
69
- sharePrice: z.string(),
70
- blockNumber: z.string()
71
- });
72
- const NavBucketPoint = z.object({
73
- bucket: z.iso.datetime(),
74
- totalAssets: z.string(),
75
- totalSupply: z.string(),
76
- sharePrice: z.string(),
77
- blockNumber: z.string()
78
- });
79
- const BulkSnapshotPoint = z.object({
80
- timestamp: z.number(),
81
- createdAt: z.string(),
82
- tvl: z.string().optional(),
83
- sharePrice: z.string().optional(),
84
- accountValue: z.null().optional(),
85
- unrealizedPnl: z.null().optional(),
86
- cumulativeRealizedPnl: z.null().optional(),
87
- leaderSharePct: z.null().optional()
88
- });
89
- const SparklinePoint = z.object({
90
- timestamp: z.number(),
91
- createdAt: z.string(),
92
- tvl: z.string(),
93
- sharePrice: z.string()
94
- });
95
-
96
- export { Activity, BulkSnapshotPoint, NavBucketPoint, NavSnapshot, SparklinePoint, Vault, VaultEvent, VaultStatus };
@@ -1,4 +0,0 @@
1
- export * from './entities';
2
- export * from './payloads';
3
- export * from './queries';
4
- export * from './responses';
@@ -1,65 +0,0 @@
1
- import { z } from 'zod';
2
- import { EthereumAddress } from '../common/address';
3
- import { NavBucket } from './queries';
4
-
5
- const PositiveAmount = z.string().regex(/^\d+(\.\d+)?$/).refine((amount) => /[1-9]/.test(amount), "Amount must be positive");
6
- const LeaderSignedAction = z.object({
7
- signature: z.string().regex(/^0x[0-9a-fA-F]{130}$/),
8
- nonce: z.string().min(1),
9
- deadline: z.number().int().positive()
10
- });
11
- const CreateVault = LeaderSignedAction.extend({
12
- leader: EthereumAddress,
13
- name: z.string().min(1).max(255),
14
- description: z.string(),
15
- imageUri: z.url().optional(),
16
- configId: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
17
- maxWithdrawalPeriodDays: z.number().int().min(1).optional()
18
- }).strict();
19
- const SetTrader = LeaderSignedAction.extend({
20
- traderAddress: EthereumAddress
21
- }).strict();
22
- const UpdateVaultMetadata = LeaderSignedAction.extend({
23
- name: z.string().min(1).max(255),
24
- about: z.string(),
25
- imageUri: z.union([
26
- z.url(),
27
- z.literal("")
28
- ])
29
- }).strict();
30
- const WithdrawToEvm = LeaderSignedAction.extend({
31
- amount: PositiveAmount.refine((amount) => (amount.split(".")[1]?.length ?? 0) <= 6, "USDC supports six decimal places"),
32
- tokenId: z.string().optional()
33
- }).strict();
34
- const AgentApprove = LeaderSignedAction.strict();
35
- const SetUnifiedAccount = LeaderSignedAction.strict();
36
- const BuilderFeeApproval = z.object({
37
- builderAddress: EthereumAddress,
38
- // Typed as the percent literal Hyperliquid's SDK demands; the predicate is the same rule the regex enforced.
39
- maxFeeRate: z.custom((value) => typeof value === "string" && /^\d*\.?\d+%$/.test(value))
40
- });
41
- const SnapshotsBulk = z.object({
42
- vaultAddresses: z.array(EthereumAddress).min(1).max(50),
43
- startDate: z.string().regex(/^\d+$/).refine((value) => Number(value) <= 864e10),
44
- endDate: z.string().regex(/^\d+$/).refine((value) => Number(value) <= 864e10),
45
- bucket: NavBucket,
46
- fields: z.array(z.enum([
47
- "tvl",
48
- "sharePrice",
49
- "accountValue",
50
- "unrealizedPnl",
51
- "cumulativeRealizedPnl",
52
- "leaderSharePct"
53
- ])).min(1)
54
- }).strict().refine((value) => Number(value.startDate) <= Number(value.endDate), "startDate must precede endDate");
55
- const TypedDataPayload = z.object({
56
- domain: z.record(z.string(), z.unknown()),
57
- types: z.record(z.string(), z.array(z.object({
58
- name: z.string(),
59
- type: z.string()
60
- }))),
61
- primaryType: z.string().min(1),
62
- message: z.record(z.string(), z.unknown())
63
- }).strict();
64
-
65
- export { AgentApprove, BuilderFeeApproval, CreateVault, LeaderSignedAction, PositiveAmount, SetTrader, SetUnifiedAccount, SnapshotsBulk, TypedDataPayload, UpdateVaultMetadata, WithdrawToEvm };
@@ -1,66 +0,0 @@
1
- import { z } from 'zod';
2
- import { EthereumAddress } from '../common/address';
3
-
4
- const VaultListParams = z.object({
5
- owner: EthereumAddress.optional(),
6
- trader: EthereumAddress.optional(),
7
- name: z.string().max(200).optional(),
8
- limit: z.coerce.number().int().min(1).max(200).optional(),
9
- cursor: z.uuid().optional()
10
- }).strict();
11
- const NavBucket = z.enum([
12
- "1m",
13
- "5m",
14
- "15m",
15
- "1h",
16
- "1d"
17
- ]);
18
- const SparklineRange = z.enum([
19
- "1h",
20
- "24h",
21
- "7d",
22
- "30d"
23
- ]);
24
- const VaultsOverviewQueryParams = z.object({
25
- page: z.coerce.number().int().min(1).default(1),
26
- pageSize: z.coerce.number().int().min(1).max(100).default(100),
27
- sparklineRange: SparklineRange.default("24h"),
28
- sparklineBucket: NavBucket.default("1h"),
29
- name: z.string().optional()
30
- }).strict();
31
- const VaultStatsQueryParams = z.object({
32
- address: EthereumAddress.optional()
33
- }).strict();
34
- const VaultInvestmentsQueryParams = z.object({
35
- address: EthereumAddress
36
- }).strict();
37
- const NavResolution = z.enum([
38
- "1m",
39
- "5m",
40
- "1h",
41
- "1d"
42
- ]);
43
- const NavStatsWindow = z.enum([
44
- "24h",
45
- "7d",
46
- "30d"
47
- ]);
48
- const NavRangeQueryParams = z.object({
49
- from: z.iso.datetime({
50
- offset: true
51
- }),
52
- to: z.iso.datetime({
53
- offset: true
54
- }),
55
- resolution: NavResolution.default("1m")
56
- }).strict().refine((query) => new Date(query.from) <= new Date(query.to), "from must precede to");
57
- const NavStatsQueryParams = z.object({
58
- window: NavStatsWindow
59
- }).strict();
60
- const VaultEventListParams = z.object({
61
- userAddress: EthereumAddress.optional(),
62
- limit: z.coerce.number().int().min(1).max(1e3).optional(),
63
- offset: z.coerce.number().int().min(0).optional()
64
- }).strict();
65
-
66
- export { NavBucket, NavRangeQueryParams, NavResolution, NavStatsQueryParams, NavStatsWindow, SparklineRange, VaultEventListParams, VaultInvestmentsQueryParams, VaultListParams, VaultStatsQueryParams, VaultsOverviewQueryParams };