@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.
- package/dist/bundle.d.ts +1 -0
- package/dist/fee/entities.d.ts +1 -0
- package/dist/fee/responses.d.ts +26 -0
- package/dist/index.js +7355 -3
- package/dist/rewards/entities.d.ts +28 -0
- package/dist/rewards/payloads.d.ts +7 -0
- package/dist/rewards/responses.d.ts +73 -0
- package/dist/statistics/queries.d.ts +25 -0
- package/dist/statistics/responses.d.ts +120 -0
- package/dist/sync/responses.d.ts +1 -0
- package/dist/users/entities.d.ts +4 -0
- package/dist/users/response.d.ts +3 -0
- package/package.json +4 -3
- package/dist/auth/api-keys.js +0 -44
- package/dist/auth/entities.js +0 -25
- package/dist/auth/index.js +0 -4
- package/dist/auth/payloads.js +0 -84
- package/dist/auth/response.js +0 -82
- package/dist/baskets/recommended/entities.js +0 -22
- package/dist/baskets/recommended/index.js +0 -2
- package/dist/baskets/recommended/responses.js +0 -8
- package/dist/baskets/saved/entities.js +0 -23
- package/dist/baskets/saved/payloads.js +0 -18
- package/dist/baskets/saved/responses.js +0 -14
- package/dist/bundle.js +0 -36
- package/dist/common/address.js +0 -5
- package/dist/common/array.js +0 -17
- package/dist/common/client-id.js +0 -5
- package/dist/common/hex-string.js +0 -5
- package/dist/common/index.js +0 -4
- package/dist/common/refinement.js +0 -64
- package/dist/common/request.js +0 -24
- package/dist/common/response.js +0 -28
- package/dist/common/schema.js +0 -18
- package/dist/common/trade-legs.js +0 -50
- package/dist/connector/index.js +0 -12
- package/dist/copy/entities.js +0 -151
- package/dist/copy/index.js +0 -5
- package/dist/copy/payloads.js +0 -8
- package/dist/copy/performance.js +0 -63
- package/dist/copy/queries.js +0 -20
- package/dist/copy/responses.js +0 -89
- package/dist/execution/entities.js +0 -196
- package/dist/execution/index.js +0 -3
- package/dist/execution/queries.js +0 -18
- package/dist/execution/responses.js +0 -12
- package/dist/fee/entities.js +0 -34
- package/dist/fee/index.js +0 -3
- package/dist/fee/queries.js +0 -12
- package/dist/fee/responses.js +0 -29
- package/dist/fill/entities.js +0 -82
- package/dist/fill/index.js +0 -3
- package/dist/fill/queries.js +0 -14
- package/dist/fill/responses.js +0 -23
- package/dist/funding/entities.js +0 -16
- package/dist/funding/index.js +0 -3
- package/dist/funding/queries.js +0 -8
- package/dist/funding/responses.js +0 -11
- package/dist/instrument/entities.js +0 -102
- package/dist/instrument/index.js +0 -3
- package/dist/instrument/queries.js +0 -15
- package/dist/instrument/responses.js +0 -20
- package/dist/instrument-precision/index.js +0 -56
- package/dist/ladder/entities.js +0 -24
- package/dist/ladder/index.js +0 -4
- package/dist/ladder/payloads.js +0 -96
- package/dist/ladder/queries.js +0 -12
- package/dist/ladder/responses.js +0 -18
- package/dist/leverage/index.js +0 -2
- package/dist/leverage/payloads.js +0 -14
- package/dist/leverage/response.js +0 -5
- package/dist/margin/index.js +0 -2
- package/dist/margin/payloads.js +0 -20
- package/dist/margin/response.js +0 -11
- package/dist/market/entities.js +0 -52
- package/dist/market/index.js +0 -4
- package/dist/market/payloads.js +0 -11
- package/dist/market/queries.js +0 -19
- package/dist/market/responses.js +0 -18
- package/dist/misc/index.js +0 -2
- package/dist/misc/payloads.js +0 -99
- package/dist/misc/responses.js +0 -85
- package/dist/notification/entities.js +0 -274
- package/dist/notification/index.js +0 -4
- package/dist/notification/payloads.js +0 -15
- package/dist/notification/queries.js +0 -29
- package/dist/notification/responses.js +0 -20
- package/dist/order/entities.js +0 -81
- package/dist/order/index.js +0 -1
- package/dist/portfolio/entities.js +0 -77
- package/dist/portfolio/index.js +0 -3
- package/dist/portfolio/queries.js +0 -34
- package/dist/portfolio/responses.js +0 -33
- package/dist/position/entities.js +0 -433
- package/dist/position/index.js +0 -3
- package/dist/position/queries.js +0 -109
- package/dist/position/responses.js +0 -41
- package/dist/price/entities.js +0 -10
- package/dist/price/index.js +0 -3
- package/dist/price/queries.js +0 -8
- package/dist/price/responses.js +0 -15
- package/dist/realtime/channels.js +0 -16
- package/dist/realtime/frames.js +0 -140
- package/dist/realtime/index.js +0 -6
- package/dist/realtime/messages.js +0 -118
- package/dist/realtime/public-events.js +0 -92
- package/dist/realtime/user-events.js +0 -32
- package/dist/realtime/vault-events.js +0 -42
- package/dist/rebalance/entities.js +0 -86
- package/dist/rebalance/index.js +0 -4
- package/dist/rebalance/payloads.js +0 -56
- package/dist/rebalance/queries.js +0 -14
- package/dist/rebalance/responses.js +0 -41
- package/dist/schedule/entities.js +0 -239
- package/dist/schedule/index.js +0 -5
- package/dist/schedule/payloads.js +0 -85
- package/dist/schedule/queries.js +0 -30
- package/dist/schedule/randomization.js +0 -15
- package/dist/schedule/responses.js +0 -22
- package/dist/schedule/twap-config.js +0 -29
- package/dist/statistics/entities.js +0 -105
- package/dist/statistics/index.js +0 -3
- package/dist/statistics/queries.js +0 -93
- package/dist/statistics/responses.js +0 -17
- package/dist/sync/index.js +0 -2
- package/dist/sync/payloads.js +0 -136
- package/dist/sync/responses.js +0 -26
- package/dist/tca/entities.js +0 -9
- package/dist/tca/index.js +0 -3
- package/dist/tca/queries.js +0 -14
- package/dist/tca/responses.js +0 -126
- package/dist/trade/entities.js +0 -101
- package/dist/trade/index.js +0 -4
- package/dist/trade/payloads.js +0 -84
- package/dist/trade/queries.js +0 -9
- package/dist/trade/responses.js +0 -25
- package/dist/trade-accounts/entities.js +0 -61
- package/dist/trade-accounts/index.js +0 -4
- package/dist/trade-accounts/payloads.js +0 -132
- package/dist/trade-accounts/queries.js +0 -7
- package/dist/trade-accounts/response.js +0 -79
- package/dist/traders/index.js +0 -2
- package/dist/traders/performance.js +0 -21
- package/dist/traders/public.js +0 -192
- package/dist/trigger/common/index.js +0 -39
- package/dist/trigger/entities/conditions.js +0 -174
- package/dist/trigger/entities/index.js +0 -257
- package/dist/trigger/index.js +0 -9
- package/dist/trigger/oracle.js +0 -22
- package/dist/trigger/payloads/conditions.js +0 -213
- package/dist/trigger/payloads/config.js +0 -3
- package/dist/trigger/payloads/index.js +0 -173
- package/dist/trigger/queries.js +0 -16
- package/dist/trigger/refinement/index.js +0 -2
- package/dist/trigger/refinement/static.refinement.js +0 -50
- package/dist/trigger/refinement/trailing.refinement.js +0 -83
- package/dist/trigger/responses.js +0 -18
- package/dist/triggers/entities.js +0 -27
- package/dist/triggers/index.js +0 -3
- package/dist/triggers/queries.js +0 -10
- package/dist/triggers/responses.js +0 -9
- package/dist/users/entities.js +0 -45
- package/dist/users/index.js +0 -4
- package/dist/users/payloads.js +0 -33
- package/dist/users/queries.js +0 -8
- package/dist/users/response.js +0 -27
- package/dist/vaults/entities.js +0 -96
- package/dist/vaults/index.js +0 -4
- package/dist/vaults/payloads.js +0 -65
- package/dist/vaults/queries.js +0 -66
- package/dist/vaults/responses.js +0 -368
- /package/dist/{baskets/saved/index.js → rewards/index.d.ts} +0 -0
package/dist/ladder/entities.js
DELETED
|
@@ -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 };
|
package/dist/ladder/index.js
DELETED
package/dist/ladder/payloads.js
DELETED
|
@@ -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 };
|
package/dist/ladder/queries.js
DELETED
|
@@ -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 };
|
package/dist/ladder/responses.js
DELETED
|
@@ -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 };
|
package/dist/leverage/index.js
DELETED
|
@@ -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 };
|
package/dist/margin/index.js
DELETED
package/dist/margin/payloads.js
DELETED
|
@@ -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 };
|
package/dist/margin/response.js
DELETED
|
@@ -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 };
|
package/dist/market/entities.js
DELETED
|
@@ -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 };
|
package/dist/market/index.js
DELETED
package/dist/market/payloads.js
DELETED
|
@@ -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 };
|
package/dist/market/queries.js
DELETED
|
@@ -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 };
|
package/dist/market/responses.js
DELETED
|
@@ -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 };
|
package/dist/misc/index.js
DELETED
package/dist/misc/payloads.js
DELETED
|
@@ -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 };
|
package/dist/misc/responses.js
DELETED
|
@@ -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 };
|