@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,24 +0,0 @@
1
- import { z } from 'zod';
2
- import { Connector } from '../connector';
3
- import { Trigger } from '../trigger';
4
- import { AttachTriggerMarketCloseList } from '../trigger/payloads';
5
- import { LadderConfig } from './payloads';
6
-
7
- const LadderStatus = z.enum([
8
- "ACTIVE",
9
- "COMPLETED",
10
- "CANCELLED"
11
- ]);
12
- const Ladder = z.object({
13
- id: z.uuid(),
14
- connector: Connector,
15
- positionKey: z.string(),
16
- config: LadderConfig,
17
- status: LadderStatus,
18
- attachTriggers: AttachTriggerMarketCloseList.optional(),
19
- triggers: z.array(Trigger),
20
- createdAt: z.string(),
21
- updatedAt: z.string()
22
- });
23
-
24
- export { Ladder, LadderStatus };
@@ -1,4 +0,0 @@
1
- export * from './entities';
2
- export * from './payloads';
3
- export * from './queries';
4
- export * from './responses';
@@ -1,96 +0,0 @@
1
- import { z } from 'zod';
2
- import { ClientIdCode } from '../common/client-id';
3
- import { RefineMinimumTwoSymbols, RefineUniqueSymbols, RefineWeightingSum, RefineTwoUniqueSymbols, RefineMinimumOneSymbol } from '../common/refinement';
4
- import { AssetWeight, Side } from '../common/schema';
5
- import { TradeLegPostOnly } from '../common/trade-legs';
6
- import { InstrumentId } from '../instrument';
7
- import { MetricTrack } from '../trigger/common';
8
- import { AttachTriggerMarketCloseList } from '../trigger/payloads';
9
-
10
- const LadderThreshold = z.number().positive({
11
- message: "Threshold must be greater than 0"
12
- });
13
- const LadderConfig = z.object({
14
- thresholdStart: LadderThreshold,
15
- thresholdEnd: LadderThreshold,
16
- levels: z.int().min(2).max(50),
17
- weighting: z.literal("EQUAL").default("EQUAL")
18
- }).refine((config) => config.thresholdStart !== config.thresholdEnd, {
19
- message: "thresholds must differ"
20
- });
21
- const PriceSource = z.enum([
22
- "mid",
23
- "mark"
24
- ], {
25
- message: "Price source must be mid or mark"
26
- });
27
- const WeightedRatioBasketItem = z.object({
28
- symbol: InstrumentId,
29
- side: Side,
30
- weight: AssetWeight
31
- });
32
- const WeightedRatioBasket = z.array(WeightedRatioBasketItem).superRefine(RefineMinimumTwoSymbols).superRefine(RefineUniqueSymbols).superRefine(RefineWeightingSum);
33
- const LadderRatioOpen = z.object({
34
- type: z.literal("ratio"),
35
- data: z.object({
36
- priceSource: PriceSource,
37
- symbol_a: InstrumentId,
38
- symbol_b: InstrumentId,
39
- track: MetricTrack
40
- }).superRefine(RefineTwoUniqueSymbols)
41
- });
42
- const LadderPriceOpen = z.object({
43
- type: z.literal("price"),
44
- data: z.object({
45
- priceSource: PriceSource,
46
- symbol: InstrumentId,
47
- track: MetricTrack
48
- })
49
- });
50
- const LadderWeightedRatioOpen = z.object({
51
- type: z.literal("weighted_ratio"),
52
- data: z.object({
53
- priceSource: PriceSource,
54
- basket: WeightedRatioBasket,
55
- track: MetricTrack
56
- })
57
- });
58
- const LadderConditionOpen = z.discriminatedUnion("type", [
59
- LadderRatioOpen,
60
- LadderPriceOpen,
61
- LadderWeightedRatioOpen
62
- ]);
63
- const LadderAttachTriggers = AttachTriggerMarketCloseList.superRefine((attachTriggers, ctx) => {
64
- attachTriggers.forEach((attachTrigger, index) => {
65
- if (attachTrigger.condition.type === "notional" || attachTrigger.condition.type === "notional_trailing") {
66
- ctx.addIssue({
67
- code: "custom",
68
- path: [
69
- index,
70
- "condition",
71
- "type"
72
- ],
73
- message: "Ladder brackets cannot use notional conditions; use upnl or upnl_bps."
74
- });
75
- }
76
- });
77
- });
78
- const CreateLadderMarketOpen = z.object({
79
- type: z.literal("MARKET"),
80
- intent: z.literal("OPEN"),
81
- clientId: ClientIdCode,
82
- condition: LadderConditionOpen,
83
- config: LadderConfig,
84
- attachTriggers: LadderAttachTriggers.optional(),
85
- payload: z.object({
86
- type: z.literal("MARKET"),
87
- legs: z.tuple([
88
- TradeLegPostOnly
89
- ]).rest(TradeLegPostOnly).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols)
90
- })
91
- }).strict();
92
- const CreateLadder = z.discriminatedUnion("type", [
93
- CreateLadderMarketOpen
94
- ]);
95
-
96
- export { CreateLadder, CreateLadderMarketOpen, LadderConditionOpen, LadderConfig };
@@ -1,12 +0,0 @@
1
- import { z } from 'zod';
2
- import { normalizeArray, CursorFindParams } from '../common';
3
- import { Connector } from '../connector';
4
- import { LadderStatus } from './entities';
5
-
6
- const StatusArray = z.preprocess((arg) => normalizeArray(arg), z.array(LadderStatus));
7
- const LadderListParams = CursorFindParams.extend({
8
- connector: Connector.optional(),
9
- status: StatusArray.optional()
10
- });
11
-
12
- export { LadderListParams };
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- import { CursorResponse } from '../common';
3
- import { Ladder } from './entities';
4
-
5
- const CreateLadderResponse = z.object({
6
- ladder: Ladder
7
- });
8
- const LadderResponse = z.object({
9
- ladder: Ladder
10
- });
11
- const LadderListResponse = CursorResponse.extend({
12
- ladders: z.array(Ladder)
13
- });
14
- const CancelLadderResponse = z.object({
15
- id: z.uuid()
16
- });
17
-
18
- export { CancelLadderResponse, CreateLadderResponse, LadderListResponse, LadderResponse };
@@ -1,2 +0,0 @@
1
- export * from './payloads';
2
- export * from './response';
@@ -1,14 +0,0 @@
1
- import { z } from 'zod';
2
- import { InstrumentId } from '../instrument/entities';
3
-
4
- const MarginMode = z.enum([
5
- "cross",
6
- "isolated"
7
- ]);
8
- const SetLeverage = z.object({
9
- symbol: InstrumentId,
10
- leverage: z.int().positive(),
11
- marginMode: MarginMode.optional()
12
- });
13
-
14
- export { MarginMode, SetLeverage };
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const SetLeverageResponse = z.object({});
4
-
5
- export { SetLeverageResponse };
@@ -1,2 +0,0 @@
1
- export * from './payloads';
2
- export * from './response';
@@ -1,20 +0,0 @@
1
- import { z } from 'zod';
2
- import { SignedDecimalString } from '../common/schema';
3
- import { InstrumentId } from '../instrument/entities';
4
-
5
- const AdjustIsolatedMargin = z.object({
6
- symbol: InstrumentId,
7
- /**
8
- * Signed margin movement in USD: `"+50"` adds 50 to the position, `"-50"` removes 50 from it.
9
- * The sign is required, so a movement can never mean the opposite of what was intended.
10
- */
11
- amount: SignedDecimalString.refine((amount) => Number(amount) !== 0, "Amount must not be zero"),
12
- /**
13
- * Optional caller-supplied idempotency key, scoped to the trade account. A retry carrying the
14
- * same key attaches to the first attempt and receives its outcome instead of moving the margin
15
- * again. Omitted, the server mints one; either way it is returned as `adjustmentId`.
16
- */
17
- idempotencyKey: z.string().min(1).max(128).optional()
18
- });
19
-
20
- export { AdjustIsolatedMargin };
@@ -1,11 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- const AdjustIsolatedMarginResponse = z.object({
4
- /**
5
- * The caller's `idempotencyKey` when supplied, otherwise a server-minted UUID. Reusing it as the
6
- * request key replays this movement's outcome.
7
- */
8
- adjustmentId: z.string().min(1).max(128)
9
- });
10
-
11
- export { AdjustIsolatedMarginResponse };
@@ -1,52 +0,0 @@
1
- import { z } from 'zod';
2
- import { Side } from '../common/schema';
3
- import { Connector } from '../connector';
4
- import { InstrumentTradeability, InstrumentId } from '../instrument';
5
-
6
- const Market = z.object({
7
- connector: Connector,
8
- instrumentId: InstrumentId,
9
- displaySymbol: z.string(),
10
- base: z.string(),
11
- quote: z.string(),
12
- price: z.string(),
13
- volume24h: z.string(),
14
- change24h: z.string(),
15
- openInterest: z.string(),
16
- fundingRate: z.string(),
17
- tradeability: InstrumentTradeability,
18
- updatedAt: z.number()
19
- });
20
- const BasketMarketLeg = z.object({
21
- id: InstrumentId,
22
- symbol: z.string().min(1),
23
- side: Side
24
- });
25
- const BasketMarket = z.object({
26
- connector: Connector,
27
- basketKey: z.string(),
28
- displaySymbol: z.string(),
29
- legs: z.array(BasketMarketLeg),
30
- price: z.string(),
31
- priceChange24h: z.string(),
32
- weightRatio: z.string(),
33
- weightRatioChange24h: z.string(),
34
- netFunding: z.string(),
35
- volume24h: z.string(),
36
- openInterest: z.string(),
37
- tradeability: InstrumentTradeability,
38
- updatedAt: z.number(),
39
- hasMaterializedStats: z.boolean()
40
- });
41
- const MarketBasketPositionCounts = z.object({
42
- basketKey: z.string(),
43
- opened: z.number(),
44
- traders: z.number()
45
- });
46
- const MarketTotals = z.object({
47
- markets: z.number(),
48
- volume24h: z.string(),
49
- openInterest: z.string()
50
- });
51
-
52
- export { BasketMarket, Market, MarketBasketPositionCounts, MarketTotals };
@@ -1,4 +0,0 @@
1
- export * from './entities';
2
- export * from './payloads';
3
- export * from './queries';
4
- export * from './responses';
@@ -1,11 +0,0 @@
1
- import { z } from 'zod';
2
- import { Connector } from '../connector';
3
-
4
- const MARKET_BASKET_POSITION_COUNTS_MAX_BASKETS = 500;
5
- const BasketKey = z.string().regex(/^[0-9a-f]{64}$/, "A basket key is 64 lowercase hex characters \u2014 see deriveBasketKey in @pear-protocol/utils");
6
- const MarketBasketPositionCountsPayload = z.object({
7
- connector: z.array(Connector).min(1, "Name at least one connector, or omit the field for every venue").optional().describe("Absent means every connector, summed"),
8
- basketKeys: z.array(BasketKey).min(1, "At least one basket key is required").max(MARKET_BASKET_POSITION_COUNTS_MAX_BASKETS, "Too many basket keys in one request").describe("Canonical basket keys, as /markets/baskets reports them")
9
- });
10
-
11
- export { MARKET_BASKET_POSITION_COUNTS_MAX_BASKETS, MarketBasketPositionCountsPayload };
@@ -1,19 +0,0 @@
1
- import { z } from 'zod';
2
- import { Connector } from '../connector';
3
- import { InstrumentScope } from '../instrument';
4
-
5
- const MarketsQueryParams = z.object({
6
- connector: Connector,
7
- // Markets are connector-scoped so the API can return one exchange's live view
8
- // without mixing instruments that have different ids, liquidity, or stats feeds.
9
- scope: InstrumentScope.default("tradable")
10
- });
11
- const MarketBasketsQueryParams = z.object({
12
- connector: Connector,
13
- scope: InstrumentScope.default("tradable"),
14
- search: z.string().trim().max(128).optional(),
15
- limit: z.coerce.number().int().min(1).max(1e3).default(500),
16
- offset: z.coerce.number().int().min(0).default(0)
17
- });
18
-
19
- export { MarketBasketsQueryParams, MarketsQueryParams };
@@ -1,18 +0,0 @@
1
- import { z } from 'zod';
2
- import { MarketTotals, Market, BasketMarket, MarketBasketPositionCounts } from './entities';
3
-
4
- const MarketsResponse = z.object({
5
- markets: z.array(Market),
6
- totals: MarketTotals
7
- });
8
- const MarketBasketsResponse = z.object({
9
- limit: z.number(),
10
- offset: z.number(),
11
- count: z.number(),
12
- markets: z.array(BasketMarket)
13
- });
14
- const MarketBasketPositionCountsResponse = z.object({
15
- counts: z.array(MarketBasketPositionCounts)
16
- });
17
-
18
- export { MarketBasketPositionCountsResponse, MarketBasketsResponse, MarketsResponse };
@@ -1,2 +0,0 @@
1
- export * from './payloads';
2
- export * from './responses';
@@ -1,99 +0,0 @@
1
- import { z } from 'zod';
2
- import { EthereumAddress } from '../common/address';
3
-
4
- const CreateLighterApiKeyParams = z.object({
5
- accountIndex: z.number(),
6
- apiKeyIndex: z.number()
7
- });
8
- const SubmitChangePubKeyParams = z.object({
9
- l1Signature: z.string(),
10
- txInfo: z.string(),
11
- accountIndex: z.number(),
12
- apiKeyIndex: z.number()
13
- });
14
- const PrepareApproveIntegratorParams = z.object({
15
- accountIndex: z.number(),
16
- apiKeyIndex: z.number(),
17
- apiPrivateKey: z.string()
18
- });
19
- const SubmitApproveIntegratorParams = z.object({
20
- l1Signature: z.string(),
21
- txInfo: z.string(),
22
- accountIndex: z.number(),
23
- apiKeyIndex: z.number()
24
- });
25
- const CreateAuthTokenParams = z.object({
26
- accountIndex: z.number(),
27
- apiKeyIndex: z.number(),
28
- apiPrivateKey: z.string(),
29
- ttlSeconds: z.number().optional()
30
- });
31
- const PrepareLighterFastWithdrawParams = z.object({
32
- accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
33
- toAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/),
34
- amount: z.number().int().min(4e6).max(Number.MAX_SAFE_INTEGER),
35
- apiKeyIndex: z.number().int().nonnegative().max(254),
36
- apiPrivateKey: z.string()
37
- });
38
- const SubmitLighterFastWithdrawParams = z.object({
39
- accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
40
- toAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/),
41
- apiKeyIndex: z.number().int().nonnegative().max(254),
42
- apiPrivateKey: z.string(),
43
- txInfo: z.string(),
44
- l1Signature: z.string()
45
- });
46
- const CreateLighterSubAccountParams = z.object({
47
- accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
48
- apiKeyIndex: z.number().int().nonnegative().max(254),
49
- apiPrivateKey: z.string()
50
- });
51
- const TransferLighterSubAccountParams = z.object({
52
- /**
53
- * L1 address that owns both accounts; the transfer is refused unless Lighter agrees.
54
- * Validate the Ethereum address and normalize its representation at the request boundary.
55
- */
56
- l1Address: EthereumAddress,
57
- fromAccountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
58
- toAccountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
59
- amount: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
60
- apiKeyIndex: z.number().int().nonnegative().max(254),
61
- apiPrivateKey: z.string()
62
- });
63
- const SetLighterSubAccountMetadataParams = z.object({
64
- mainAccountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
65
- subAccountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
66
- apiKeyIndex: z.number().int().nonnegative().max(254),
67
- apiPrivateKey: z.string(),
68
- name: z.string().min(1),
69
- description: z.string().optional()
70
- });
71
- const LighterAccountTier = z.enum([
72
- "standard",
73
- "plus",
74
- "premium"
75
- ]);
76
- const ChangeLighterAccountTierParams = z.object({
77
- accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
78
- apiKeyIndex: z.number().int().nonnegative().max(254),
79
- apiPrivateKey: z.string(),
80
- tier: LighterAccountTier
81
- });
82
- const CreateLighterUdaParams = z.object({
83
- walletAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/),
84
- market: z.enum([
85
- "perps",
86
- "spot"
87
- ]),
88
- asset: z.enum([
89
- "USDC",
90
- "ETH"
91
- ]),
92
- // Targets a sub-account; absent credits the wallet's master account index.
93
- accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()
94
- });
95
- const ListLighterUdaDepositsParams = z.object({
96
- walletAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/)
97
- });
98
-
99
- export { ChangeLighterAccountTierParams, CreateAuthTokenParams, CreateLighterApiKeyParams, CreateLighterSubAccountParams, CreateLighterUdaParams, LighterAccountTier, ListLighterUdaDepositsParams, PrepareApproveIntegratorParams, PrepareLighterFastWithdrawParams, SetLighterSubAccountMetadataParams, SubmitApproveIntegratorParams, SubmitChangePubKeyParams, SubmitLighterFastWithdrawParams, TransferLighterSubAccountParams };
@@ -1,85 +0,0 @@
1
- import { z } from 'zod';
2
- import { LighterAccountTier } from './payloads';
3
-
4
- const CreateApiKeyWithMessageResult = z.object({
5
- privateKey: z.string(),
6
- publicKey: z.string(),
7
- apiKeyIndex: z.number(),
8
- messageToSign: z.string(),
9
- txInfo: z.string()
10
- });
11
- const SubmitChangePubKeyResult = z.object({
12
- txHash: z.string()
13
- });
14
- const PrepareApproveIntegratorResult = z.object({
15
- messageToSign: z.string(),
16
- txInfo: z.string()
17
- });
18
- const SubmitApproveIntegratorResult = z.object({
19
- txHash: z.string()
20
- });
21
- const CreateAuthTokenResult = z.object({
22
- token: z.string()
23
- });
24
- const PrepareLighterFastWithdrawResult = z.object({
25
- messageToSign: z.string(),
26
- txInfo: z.string(),
27
- // Integer USDC units Lighter charges on top of the amount, quoted for this exact transfer.
28
- fee: z.number().int().nonnegative(),
29
- // Integer USDC units the account could still move when the transfer was signed.
30
- availableBalance: z.number().int().nonnegative()
31
- });
32
- const SubmitLighterFastWithdrawResult = z.object({
33
- txHash: z.string()
34
- });
35
- const CreateLighterSubAccountResult = z.object({
36
- txHash: z.string()
37
- });
38
- const TransferLighterSubAccountResult = z.object({
39
- txHash: z.string()
40
- });
41
- const ChangeLighterAccountTierResult = z.object({
42
- // The tier Lighter accepted. Its own acknowledgement names no tier, so this echoes the request.
43
- tier: LighterAccountTier
44
- });
45
- const LighterUdaResolution = z.object({
46
- toChainId: z.string(),
47
- toTokenAddress: z.string(),
48
- actionType: z.string(),
49
- recipientAddr: z.string(),
50
- userId: z.string()
51
- });
52
- const CreateLighterUdaResult = z.object({
53
- uda: z.discriminatedUnion("status", [
54
- z.object({
55
- status: z.literal("blocked")
56
- }),
57
- z.object({
58
- status: z.literal("served"),
59
- depositAddr: z.string(),
60
- resolved: LighterUdaResolution,
61
- // Absent rather than blank on a chain family the bridge does not currently serve.
62
- solanaAddr: z.string().min(1).optional(),
63
- tronAddr: z.string().min(1).optional(),
64
- btcAddrSegwit: z.string().min(1).optional()
65
- })
66
- ])
67
- });
68
- const LighterUdaTransaction = z.object({
69
- fromChainId: z.string(),
70
- fromTokenAddress: z.string(),
71
- fromAmountBaseUnit: z.string(),
72
- toChainId: z.string(),
73
- toTokenAddress: z.string(),
74
- // Failed bridge transactions can stop before Fun.xyz assigns a transaction hash.
75
- txHash: z.string().optional(),
76
- // A transaction the bridge has only just detected can arrive before it stamps a creation time.
77
- createdTimeMs: z.number().optional(),
78
- status: z.string(),
79
- depositAddr: z.string()
80
- });
81
- const ListLighterUdaDepositsResult = z.object({
82
- transactions: z.array(LighterUdaTransaction)
83
- });
84
-
85
- export { ChangeLighterAccountTierResult, CreateApiKeyWithMessageResult, CreateAuthTokenResult, CreateLighterSubAccountResult, CreateLighterUdaResult, LighterUdaResolution, LighterUdaTransaction, ListLighterUdaDepositsResult, PrepareApproveIntegratorResult, PrepareLighterFastWithdrawResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult, SubmitLighterFastWithdrawResult, TransferLighterSubAccountResult };