@pear-protocol/types 2.21.0 → 2.22.1

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 (169) 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/users/entities.d.ts +4 -0
  9. package/dist/users/response.d.ts +2 -0
  10. package/package.json +3 -2
  11. package/dist/auth/api-keys.js +0 -44
  12. package/dist/auth/entities.js +0 -25
  13. package/dist/auth/index.js +0 -4
  14. package/dist/auth/payloads.js +0 -84
  15. package/dist/auth/response.js +0 -82
  16. package/dist/baskets/recommended/entities.js +0 -22
  17. package/dist/baskets/recommended/index.js +0 -2
  18. package/dist/baskets/recommended/responses.js +0 -8
  19. package/dist/baskets/saved/entities.js +0 -23
  20. package/dist/baskets/saved/payloads.js +0 -18
  21. package/dist/baskets/saved/responses.js +0 -14
  22. package/dist/bundle.js +0 -36
  23. package/dist/common/address.js +0 -5
  24. package/dist/common/array.js +0 -17
  25. package/dist/common/client-id.js +0 -5
  26. package/dist/common/hex-string.js +0 -5
  27. package/dist/common/index.js +0 -4
  28. package/dist/common/refinement.js +0 -64
  29. package/dist/common/request.js +0 -24
  30. package/dist/common/response.js +0 -28
  31. package/dist/common/schema.js +0 -18
  32. package/dist/common/trade-legs.js +0 -50
  33. package/dist/connector/index.js +0 -12
  34. package/dist/copy/entities.js +0 -151
  35. package/dist/copy/index.js +0 -5
  36. package/dist/copy/payloads.js +0 -8
  37. package/dist/copy/performance.js +0 -63
  38. package/dist/copy/queries.js +0 -20
  39. package/dist/copy/responses.js +0 -89
  40. package/dist/execution/entities.js +0 -196
  41. package/dist/execution/index.js +0 -3
  42. package/dist/execution/queries.js +0 -18
  43. package/dist/execution/responses.js +0 -12
  44. package/dist/fee/entities.js +0 -34
  45. package/dist/fee/index.js +0 -3
  46. package/dist/fee/queries.js +0 -12
  47. package/dist/fee/responses.js +0 -29
  48. package/dist/fill/entities.js +0 -82
  49. package/dist/fill/index.js +0 -3
  50. package/dist/fill/queries.js +0 -14
  51. package/dist/fill/responses.js +0 -23
  52. package/dist/funding/entities.js +0 -16
  53. package/dist/funding/index.js +0 -3
  54. package/dist/funding/queries.js +0 -8
  55. package/dist/funding/responses.js +0 -11
  56. package/dist/instrument/entities.js +0 -102
  57. package/dist/instrument/index.js +0 -3
  58. package/dist/instrument/queries.js +0 -15
  59. package/dist/instrument/responses.js +0 -20
  60. package/dist/instrument-precision/index.js +0 -56
  61. package/dist/ladder/entities.js +0 -24
  62. package/dist/ladder/index.js +0 -4
  63. package/dist/ladder/payloads.js +0 -96
  64. package/dist/ladder/queries.js +0 -12
  65. package/dist/ladder/responses.js +0 -18
  66. package/dist/leverage/index.js +0 -2
  67. package/dist/leverage/payloads.js +0 -14
  68. package/dist/leverage/response.js +0 -5
  69. package/dist/margin/index.js +0 -2
  70. package/dist/margin/payloads.js +0 -20
  71. package/dist/margin/response.js +0 -11
  72. package/dist/market/entities.js +0 -52
  73. package/dist/market/index.js +0 -4
  74. package/dist/market/payloads.js +0 -11
  75. package/dist/market/queries.js +0 -19
  76. package/dist/market/responses.js +0 -18
  77. package/dist/misc/index.js +0 -2
  78. package/dist/misc/payloads.js +0 -99
  79. package/dist/misc/responses.js +0 -85
  80. package/dist/notification/entities.js +0 -274
  81. package/dist/notification/index.js +0 -4
  82. package/dist/notification/payloads.js +0 -15
  83. package/dist/notification/queries.js +0 -29
  84. package/dist/notification/responses.js +0 -20
  85. package/dist/order/entities.js +0 -81
  86. package/dist/order/index.js +0 -1
  87. package/dist/portfolio/entities.js +0 -77
  88. package/dist/portfolio/index.js +0 -3
  89. package/dist/portfolio/queries.js +0 -34
  90. package/dist/portfolio/responses.js +0 -33
  91. package/dist/position/entities.js +0 -433
  92. package/dist/position/index.js +0 -3
  93. package/dist/position/queries.js +0 -109
  94. package/dist/position/responses.js +0 -41
  95. package/dist/price/entities.js +0 -10
  96. package/dist/price/index.js +0 -3
  97. package/dist/price/queries.js +0 -8
  98. package/dist/price/responses.js +0 -15
  99. package/dist/realtime/channels.js +0 -16
  100. package/dist/realtime/frames.js +0 -140
  101. package/dist/realtime/index.js +0 -6
  102. package/dist/realtime/messages.js +0 -118
  103. package/dist/realtime/public-events.js +0 -92
  104. package/dist/realtime/user-events.js +0 -32
  105. package/dist/realtime/vault-events.js +0 -42
  106. package/dist/rebalance/entities.js +0 -86
  107. package/dist/rebalance/index.js +0 -4
  108. package/dist/rebalance/payloads.js +0 -56
  109. package/dist/rebalance/queries.js +0 -14
  110. package/dist/rebalance/responses.js +0 -41
  111. package/dist/schedule/entities.js +0 -239
  112. package/dist/schedule/index.js +0 -5
  113. package/dist/schedule/payloads.js +0 -85
  114. package/dist/schedule/queries.js +0 -30
  115. package/dist/schedule/randomization.js +0 -15
  116. package/dist/schedule/responses.js +0 -22
  117. package/dist/schedule/twap-config.js +0 -29
  118. package/dist/statistics/entities.js +0 -105
  119. package/dist/statistics/index.js +0 -3
  120. package/dist/statistics/queries.js +0 -111
  121. package/dist/statistics/responses.js +0 -67
  122. package/dist/sync/index.js +0 -2
  123. package/dist/sync/payloads.js +0 -136
  124. package/dist/sync/responses.js +0 -28
  125. package/dist/tca/entities.js +0 -9
  126. package/dist/tca/index.js +0 -3
  127. package/dist/tca/queries.js +0 -14
  128. package/dist/tca/responses.js +0 -126
  129. package/dist/trade/entities.js +0 -101
  130. package/dist/trade/index.js +0 -4
  131. package/dist/trade/payloads.js +0 -84
  132. package/dist/trade/queries.js +0 -9
  133. package/dist/trade/responses.js +0 -25
  134. package/dist/trade-accounts/entities.js +0 -61
  135. package/dist/trade-accounts/index.js +0 -4
  136. package/dist/trade-accounts/payloads.js +0 -132
  137. package/dist/trade-accounts/queries.js +0 -7
  138. package/dist/trade-accounts/response.js +0 -79
  139. package/dist/traders/index.js +0 -2
  140. package/dist/traders/performance.js +0 -21
  141. package/dist/traders/public.js +0 -192
  142. package/dist/trigger/common/index.js +0 -39
  143. package/dist/trigger/entities/conditions.js +0 -174
  144. package/dist/trigger/entities/index.js +0 -257
  145. package/dist/trigger/index.js +0 -9
  146. package/dist/trigger/oracle.js +0 -22
  147. package/dist/trigger/payloads/conditions.js +0 -213
  148. package/dist/trigger/payloads/config.js +0 -3
  149. package/dist/trigger/payloads/index.js +0 -173
  150. package/dist/trigger/queries.js +0 -16
  151. package/dist/trigger/refinement/index.js +0 -2
  152. package/dist/trigger/refinement/static.refinement.js +0 -50
  153. package/dist/trigger/refinement/trailing.refinement.js +0 -83
  154. package/dist/trigger/responses.js +0 -18
  155. package/dist/triggers/entities.js +0 -27
  156. package/dist/triggers/index.js +0 -3
  157. package/dist/triggers/queries.js +0 -10
  158. package/dist/triggers/responses.js +0 -9
  159. package/dist/users/entities.js +0 -45
  160. package/dist/users/index.js +0 -4
  161. package/dist/users/payloads.js +0 -33
  162. package/dist/users/queries.js +0 -8
  163. package/dist/users/response.js +0 -28
  164. package/dist/vaults/entities.js +0 -96
  165. package/dist/vaults/index.js +0 -4
  166. package/dist/vaults/payloads.js +0 -65
  167. package/dist/vaults/queries.js +0 -66
  168. package/dist/vaults/responses.js +0 -368
  169. /package/dist/{baskets/saved/index.js → rewards/index.d.ts} +0 -0
@@ -1,101 +0,0 @@
1
- import { z } from 'zod';
2
- import { SignedDecimalString, UnsignedDecimalString } from '../common/schema';
3
- import { Connector } from '../connector';
4
- import { FillStatus } from '../fill';
5
- import { InstrumentId } from '../instrument';
6
-
7
- const TradePositionState = z.object({
8
- signedQuantity: SignedDecimalString,
9
- basis: z.discriminatedUnion("kind", [
10
- z.object({
11
- kind: z.literal("FLAT")
12
- }),
13
- z.object({
14
- kind: z.literal("PRICED"),
15
- entryPrice: UnsignedDecimalString
16
- }),
17
- z.object({
18
- kind: z.literal("UNPRICED")
19
- })
20
- ])
21
- });
22
- const TradeRealization = z.discriminatedUnion("kind", [
23
- z.object({
24
- kind: z.literal("PRICED"),
25
- quantity: UnsignedDecimalString,
26
- entryPrice: UnsignedDecimalString,
27
- exitPrice: UnsignedDecimalString,
28
- grossPnl: SignedDecimalString
29
- }),
30
- z.object({
31
- kind: z.literal("UNPRICED"),
32
- quantity: UnsignedDecimalString
33
- })
34
- ]);
35
- const TradePositionEffect = z.discriminatedUnion("kind", [
36
- z.object({
37
- kind: z.literal("OPEN"),
38
- openedQuantity: UnsignedDecimalString
39
- }),
40
- z.object({
41
- kind: z.literal("INCREASE"),
42
- increasedQuantity: UnsignedDecimalString
43
- }),
44
- z.object({
45
- kind: z.literal("REDUCE"),
46
- reducedQuantity: UnsignedDecimalString,
47
- realization: TradeRealization
48
- }),
49
- z.object({
50
- kind: z.literal("CLOSE"),
51
- reducedQuantity: UnsignedDecimalString,
52
- realization: TradeRealization
53
- }),
54
- z.object({
55
- kind: z.literal("FLIP"),
56
- reducedQuantity: UnsignedDecimalString,
57
- openedQuantity: UnsignedDecimalString,
58
- realization: TradeRealization
59
- })
60
- ]);
61
- const TradeFill = z.object({
62
- id: z.uuid(),
63
- positionId: z.uuid(),
64
- symbol: InstrumentId,
65
- connector: Connector,
66
- side: z.enum([
67
- "BUY",
68
- "SELL"
69
- ]),
70
- quantity: UnsignedDecimalString,
71
- price: UnsignedDecimalString,
72
- /** Fee polarity is a charge: `+` is paid, `-` is a rebate — the opposite of `grossPnl`/`netCashflow`, where `+` is a gain. */
73
- tradeFee: SignedDecimalString.optional(),
74
- /** Same polarity as `tradeFee`: `+` is a charge paid to Pear. */
75
- pearFee: SignedDecimalString.optional(),
76
- /** Microsecond-precision UTC instant, rendered exactly like the group's `at`. */
77
- timestamp: z.iso.datetime(),
78
- /** RECONCILED rows are superseded and never listed, so only these two states can appear. */
79
- settlement: FillStatus.extract([
80
- "PROVISIONAL",
81
- "CONFIRMED"
82
- ]),
83
- executionId: z.uuid().optional(),
84
- positionEffect: TradePositionEffect,
85
- basisBefore: TradePositionState,
86
- basisAfter: TradePositionState
87
- });
88
- const TradeGroup = z.object({
89
- id: z.string().regex(/^(execution|fill):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),
90
- executionId: z.uuid().optional(),
91
- scheduleId: z.uuid().optional(),
92
- triggerId: z.uuid().optional(),
93
- connector: Connector,
94
- /** Earliest fill instant in the group at microsecond precision; the cursor key. */
95
- at: z.iso.datetime(),
96
- /** Priced realized PnL minus every fee in the group; `+` is a gain. */
97
- netCashflow: SignedDecimalString,
98
- trades: z.array(TradeFill)
99
- });
100
-
101
- export { TradeFill, TradeGroup, TradePositionEffect, TradePositionState, TradeRealization };
@@ -1,4 +0,0 @@
1
- export * from './entities';
2
- export * from './payloads';
3
- export * from './queries';
4
- export * from './responses';
@@ -1,84 +0,0 @@
1
- import { z } from 'zod';
2
- import { ClientIdCode } from '../common/client-id';
3
- import { RefineMinimumOneSymbol, RefineUniqueSymbols } from '../common/refinement';
4
- import { TradeLegPostOnlyWithMaxImpactPrice, TradeLegWithMaxImpactPrice } from '../common/trade-legs';
5
- import { AttachTriggerMarketClose } from '../trigger';
6
-
7
- const CreateMarketOpen = z.object({
8
- type: z.literal("MARKET"),
9
- /**
10
- * Requested legs
11
- */
12
- legs: z.tuple([
13
- TradeLegPostOnlyWithMaxImpactPrice
14
- ]).rest(TradeLegPostOnlyWithMaxImpactPrice).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to make up the exposure"),
15
- /**
16
- * Optional absolute deadline (epoch ms); the engine refuses to plan the open after this time.
17
- * The floor rejects an epoch-seconds timestamp sent by mistake, which would always be expired.
18
- */
19
- expiresAt: z.number().int().min(1e12).optional(),
20
- /**
21
- * Close trigger to attach to the execution
22
- */
23
- trigger: AttachTriggerMarketClose.optional(),
24
- /**
25
- * Attribution route code (client_ids.code)
26
- */
27
- clientId: ClientIdCode
28
- });
29
- const CreateMarketAdjust = z.object({
30
- type: z.literal("MARKET"),
31
- /**
32
- * Requested legs
33
- */
34
- legs: z.tuple([
35
- TradeLegWithMaxImpactPrice
36
- ]).rest(TradeLegWithMaxImpactPrice).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to modify the position"),
37
- /**
38
- * Optional absolute deadline (epoch ms); the engine refuses to plan the adjust after this time.
39
- * The floor rejects an epoch-seconds timestamp sent by mistake, which would always be expired.
40
- */
41
- expiresAt: z.number().int().min(1e12).optional(),
42
- /**
43
- * Attribution route code (client_ids.code)
44
- */
45
- clientId: ClientIdCode
46
- });
47
- const CreateMarketClose = z.object({
48
- type: z.literal("MARKET"),
49
- /**
50
- * Attribution route code (client_ids.code)
51
- */
52
- clientId: ClientIdCode
53
- });
54
- const CreateMarketReverse = z.object({
55
- type: z.literal("MARKET"),
56
- /**
57
- * Attribution route code (client_ids.code)
58
- */
59
- clientId: ClientIdCode
60
- });
61
- const CreateMarketCloseAll = z.object({
62
- type: z.literal("MARKET"),
63
- /**
64
- * Attribution route code (client_ids.code)
65
- */
66
- clientId: ClientIdCode
67
- });
68
- const CreateTradeOpen = z.discriminatedUnion("type", [
69
- CreateMarketOpen
70
- ]);
71
- const CreateTradeAdjust = z.discriminatedUnion("type", [
72
- CreateMarketAdjust
73
- ]);
74
- const CreateTradeClose = z.discriminatedUnion("type", [
75
- CreateMarketClose
76
- ]);
77
- const CreateTradeReverse = z.discriminatedUnion("type", [
78
- CreateMarketReverse
79
- ]);
80
- const CreateTradeCloseAll = z.discriminatedUnion("type", [
81
- CreateMarketCloseAll
82
- ]);
83
-
84
- export { CreateMarketAdjust, CreateMarketClose, CreateMarketCloseAll, CreateMarketOpen, CreateMarketReverse, CreateTradeAdjust, CreateTradeClose, CreateTradeCloseAll, CreateTradeOpen, CreateTradeReverse };
@@ -1,9 +0,0 @@
1
- import { z } from 'zod';
2
- import { CursorFindParams } from '../common';
3
-
4
- const TradeListParams = CursorFindParams.extend({
5
- /** Groups contain every fill in an execution, so keep pages bounded. */
6
- limit: z.coerce.number().int().positive().max(100).optional().default(20)
7
- });
8
-
9
- export { TradeListParams };
@@ -1,25 +0,0 @@
1
- import { z } from 'zod';
2
- import { CursorResponse } from '../common';
3
- import { Execution } from '../execution/entities';
4
- import { TradeGroup } from './entities';
5
-
6
- const CreateTradeOpenResponse = z.object({
7
- execution: Execution
8
- });
9
- const CreateTradeAdjustResponse = z.object({
10
- execution: Execution
11
- });
12
- const CreateTradeCloseResponse = z.object({
13
- execution: Execution
14
- });
15
- const CreateTradeReverseResponse = z.object({
16
- execution: Execution
17
- });
18
- const CreateTradeCloseAllResponse = z.object({
19
- executions: z.array(Execution)
20
- });
21
- const TradeListResponse = CursorResponse.extend({
22
- groups: z.array(TradeGroup)
23
- });
24
-
25
- export { CreateTradeAdjustResponse, CreateTradeCloseAllResponse, CreateTradeCloseResponse, CreateTradeOpenResponse, CreateTradeReverseResponse, TradeListResponse };
@@ -1,61 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const HyperliquidMetadata = z.object({
4
- agentWalletAddress: z.string(),
5
- isSubaccount: z.boolean(),
6
- mainAccountAddress: z.string()
7
- });
8
- const LighterMetadata = z.object({
9
- l1_address: z.string(),
10
- isSubaccount: z.boolean()
11
- });
12
- const commonFields = {
13
- id: z.uuid().describe("Trade account UUID"),
14
- alias: z.string().describe("User-defined trade account alias"),
15
- kind: z.enum([
16
- "eoa",
17
- "vault"
18
- ]).describe("Whether the account trades an EOA or a Pear vault"),
19
- exchangeIdentifier: z.string().describe("User identifier on the exchange"),
20
- createdAt: z.string().describe("Creation timestamp (ISO 8601)"),
21
- updatedAt: z.string().describe("Last update timestamp (ISO 8601)"),
22
- deletedAt: z.string().describe("Deletion timestamp (ISO 8601)").optional()
23
- };
24
- const NoConnectorMetadata = z.never().optional();
25
- const HyperliquidTradeAccount = z.object({
26
- ...commonFields,
27
- connector: z.literal("hyperliquid").describe("Exchange connector type"),
28
- metadata: HyperliquidMetadata.optional().describe("Connector-specific metadata")
29
- });
30
- const LighterTradeAccount = z.object({
31
- ...commonFields,
32
- connector: z.literal("lighter").describe("Exchange connector type"),
33
- metadata: LighterMetadata.optional().describe("Connector-specific metadata")
34
- });
35
- const BinanceTradeAccount = z.object({
36
- ...commonFields,
37
- connector: z.literal("binance").describe("Exchange connector type"),
38
- metadata: NoConnectorMetadata.describe("Connector-specific metadata")
39
- });
40
- const BybitTradeAccount = z.object({
41
- ...commonFields,
42
- connector: z.literal("bybit").describe("Exchange connector type"),
43
- metadata: NoConnectorMetadata.describe("Connector-specific metadata")
44
- });
45
- const OkxTradeAccount = z.object({
46
- ...commonFields,
47
- connector: z.literal("okx").describe("Exchange connector type"),
48
- metadata: NoConnectorMetadata.describe("Connector-specific metadata")
49
- });
50
- const TradeAccount = z.discriminatedUnion("connector", [
51
- HyperliquidTradeAccount,
52
- LighterTradeAccount,
53
- LighterTradeAccount.extend({
54
- connector: z.literal("lighter_rhc")
55
- }),
56
- BinanceTradeAccount,
57
- BybitTradeAccount,
58
- OkxTradeAccount
59
- ]);
60
-
61
- export { TradeAccount };
@@ -1,4 +0,0 @@
1
- export * from './entities';
2
- export * from './payloads';
3
- export * from './queries';
4
- export * from './response';
@@ -1,132 +0,0 @@
1
- import { z } from 'zod';
2
- import { EthereumAddress } from '../common/address';
3
- import { HexString } from '../common/hex-string';
4
-
5
- const CreateHyperliquidCredentials = z.object({
6
- signer_key: HexString
7
- });
8
- const CreateHyperliquidMetadata = z.object({
9
- agentWalletAddress: EthereumAddress,
10
- isSubaccount: z.boolean(),
11
- mainAccountAddress: EthereumAddress
12
- });
13
- const BinanceApiKeyPair = z.object({
14
- api_key: z.string().min(1, "API key is required"),
15
- api_secret: z.string().min(1, "API secret is required")
16
- });
17
- const CreateBinanceCredentials = z.object({
18
- read: BinanceApiKeyPair,
19
- write: BinanceApiKeyPair
20
- });
21
- const CreateBybitCredentials = z.object({
22
- api_key: z.string().min(1, "API key is required"),
23
- api_secret: z.string().min(1, "API secret is required")
24
- });
25
- const CreateOkxCredentials = z.object({
26
- api_key: z.string().min(1, "API key is required"),
27
- api_secret: z.string().min(1, "API secret is required"),
28
- api_pass: z.string().min(1, "API passphrase is required")
29
- });
30
- const CreateLighterCredentials = z.object({
31
- api_private_key: z.string().min(1, "API private key is required"),
32
- api_key_index: z.number().int().min(4, "API key slots 0-3 are reserved; use 4-254").max(254, "API key index must be <= 254")
33
- });
34
- const CreateLighterMetadata = z.object({
35
- l1_address: EthereumAddress
36
- });
37
- const AccountAlias = z.string().min(1, "Alias is required").max(100, "Alias must be 100 characters or less");
38
- const CreateHyperliquidAccount = z.object({
39
- connector: z.literal("hyperliquid"),
40
- alias: AccountAlias,
41
- exchangeIdentifier: EthereumAddress,
42
- credentials: CreateHyperliquidCredentials,
43
- metadata: CreateHyperliquidMetadata
44
- });
45
- const CreateBinanceAccount = z.object({
46
- connector: z.literal("binance"),
47
- alias: AccountAlias,
48
- credentials: CreateBinanceCredentials,
49
- metadata: z.void({}).transform(() => void 0)
50
- });
51
- const CreateBybitAccount = z.object({
52
- connector: z.literal("bybit"),
53
- alias: AccountAlias,
54
- credentials: CreateBybitCredentials,
55
- metadata: z.void({}).transform(() => void 0)
56
- });
57
- const CreateOkxAccount = z.object({
58
- connector: z.literal("okx"),
59
- alias: AccountAlias,
60
- credentials: CreateOkxCredentials,
61
- metadata: z.void({}).transform(() => void 0)
62
- });
63
- const CreateLighterAccount = z.object({
64
- connector: z.literal("lighter"),
65
- alias: AccountAlias,
66
- exchangeIdentifier: z.string().regex(/^\d+$/, "Exchange identifier must be the numeric Lighter account index"),
67
- credentials: CreateLighterCredentials,
68
- metadata: CreateLighterMetadata
69
- });
70
- const CreateLighterRhcAccount = CreateLighterAccount.extend({
71
- connector: z.literal("lighter_rhc")
72
- });
73
- const UpdateHyperliquidAccount = z.object({
74
- connector: z.literal("hyperliquid"),
75
- alias: AccountAlias.optional(),
76
- credentials: CreateHyperliquidCredentials.optional(),
77
- metadata: CreateHyperliquidMetadata.optional()
78
- });
79
- const UpdateBinanceAccount = z.object({
80
- connector: z.literal("binance"),
81
- alias: AccountAlias.optional(),
82
- credentials: CreateBinanceCredentials.optional(),
83
- metadata: z.void({}).transform(() => void 0)
84
- });
85
- const UpdateBybitAccount = z.object({
86
- connector: z.literal("bybit"),
87
- alias: AccountAlias.optional(),
88
- credentials: CreateBybitCredentials.optional(),
89
- metadata: z.void({}).transform(() => void 0)
90
- });
91
- const UpdateOkxAccount = z.object({
92
- connector: z.literal("okx"),
93
- alias: AccountAlias.optional(),
94
- credentials: CreateOkxCredentials.optional(),
95
- metadata: z.void({}).transform(() => void 0)
96
- });
97
- const UpdateLighterAccount = z.object({
98
- connector: z.literal("lighter"),
99
- alias: AccountAlias.optional(),
100
- credentials: CreateLighterCredentials.optional(),
101
- metadata: CreateLighterMetadata.optional()
102
- });
103
- const UpdateLighterRhcAccount = UpdateLighterAccount.extend({
104
- connector: z.literal("lighter_rhc")
105
- });
106
- const CreateTradeAccount = z.discriminatedUnion("connector", [
107
- CreateHyperliquidAccount,
108
- CreateBinanceAccount,
109
- CreateBybitAccount,
110
- CreateOkxAccount,
111
- CreateLighterAccount,
112
- CreateLighterRhcAccount
113
- ]);
114
- const CreateVaultTradeAccount = z.object({
115
- vaultAddress: EthereumAddress,
116
- alias: AccountAlias,
117
- /**
118
- * Optional caller-supplied key. Reusing it attaches a transport retry to the first attempt;
119
- * omitting it starts a new create attempt.
120
- */
121
- idempotencyKey: z.string().min(1).max(128).optional()
122
- });
123
- const UpdateTradeAccount = z.discriminatedUnion("connector", [
124
- UpdateHyperliquidAccount,
125
- UpdateBinanceAccount,
126
- UpdateBybitAccount,
127
- UpdateOkxAccount,
128
- UpdateLighterAccount,
129
- UpdateLighterRhcAccount
130
- ]);
131
-
132
- export { CreateTradeAccount, CreateVaultTradeAccount, UpdateTradeAccount };
@@ -1,7 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const TradeAccountListParams = z.object({
4
- includeDeleted: z.coerce.boolean().optional().default(false)
5
- });
6
-
7
- export { TradeAccountListParams };
@@ -1,79 +0,0 @@
1
- import { z } from 'zod';
2
- import { TradeAccount } from './entities';
3
-
4
- const TradeAccountResponse = z.object({
5
- account: TradeAccount
6
- });
7
- const TradeAccountListResponse = z.object({
8
- accounts: z.array(TradeAccount)
9
- });
10
- const VaultTradeAccountStatus = z.discriminatedUnion("exists", [
11
- z.object({
12
- exists: z.literal(false)
13
- }),
14
- z.object({
15
- exists: z.literal(true),
16
- tradeAccountId: z.string(),
17
- account: TradeAccount
18
- })
19
- ]);
20
- const VaultTradeAccountStatusResponse = z.object({
21
- status: VaultTradeAccountStatus
22
- });
23
- const HyperliquidCredentialsResponse = z.object({
24
- connector: z.literal("hyperliquid"),
25
- account: TradeAccount,
26
- credentials: z.object({
27
- signer_key: z.string()
28
- })
29
- });
30
- const BinanceApiKeyPairResponse = z.object({
31
- api_key: z.string(),
32
- api_secret: z.string()
33
- });
34
- const BinanceCredentialsResponse = z.object({
35
- connector: z.literal("binance"),
36
- account: TradeAccount,
37
- credentials: z.object({
38
- read: BinanceApiKeyPairResponse,
39
- write: BinanceApiKeyPairResponse
40
- })
41
- });
42
- const BybitCredentialsResponse = z.object({
43
- connector: z.literal("bybit"),
44
- account: TradeAccount,
45
- credentials: z.object({
46
- api_key: z.string(),
47
- api_secret: z.string()
48
- })
49
- });
50
- const OkxCredentialsResponse = z.object({
51
- connector: z.literal("okx"),
52
- account: TradeAccount,
53
- credentials: z.object({
54
- api_key: z.string(),
55
- api_secret: z.string(),
56
- api_pass: z.string()
57
- })
58
- });
59
- const LighterCredentialsResponse = z.object({
60
- connector: z.literal("lighter"),
61
- account: TradeAccount,
62
- credentials: z.object({
63
- api_private_key: z.string(),
64
- api_key_index: z.number()
65
- })
66
- });
67
- const LighterRhcCredentialsResponse = LighterCredentialsResponse.extend({
68
- connector: z.literal("lighter_rhc")
69
- });
70
- const ExchangeCredentialsResponse = z.discriminatedUnion("connector", [
71
- HyperliquidCredentialsResponse,
72
- BinanceCredentialsResponse,
73
- BybitCredentialsResponse,
74
- OkxCredentialsResponse,
75
- LighterCredentialsResponse,
76
- LighterRhcCredentialsResponse
77
- ]);
78
-
79
- export { ExchangeCredentialsResponse, TradeAccountListResponse, TradeAccountResponse, VaultTradeAccountStatus, VaultTradeAccountStatusResponse };
@@ -1,2 +0,0 @@
1
- export * from './performance';
2
- export * from './public';
@@ -1,21 +0,0 @@
1
- import { z } from 'zod';
2
- import { SignedDecimalString } from '../common/schema';
3
-
4
- const TraderPerformanceQuery = z.object({
5
- range: z.enum([
6
- "24h",
7
- "7d",
8
- "30d"
9
- ]).default("24h")
10
- }).strict();
11
- const TraderPerformancePoint = z.object({
12
- at: z.string().datetime(),
13
- equityUsd: SignedDecimalString.optional(),
14
- pnlUsd: SignedDecimalString.optional(),
15
- roiPercent: SignedDecimalString.optional()
16
- });
17
- const TraderPerformanceResponse = z.object({
18
- points: z.array(TraderPerformancePoint)
19
- });
20
-
21
- export { TraderPerformancePoint, TraderPerformanceQuery, TraderPerformanceResponse };