@pear-protocol/types 2.21.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/users/entities.d.ts +4 -0
- package/dist/users/response.d.ts +2 -0
- package/package.json +3 -2
- 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 -111
- package/dist/statistics/responses.js +0 -67
- package/dist/sync/index.js +0 -2
- package/dist/sync/payloads.js +0 -136
- package/dist/sync/responses.js +0 -28
- 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 -28
- 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/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 };
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Side, UnsignedDecimalString } from '../common/schema';
|
|
3
|
-
import { Connector } from '../connector';
|
|
4
|
-
import { TpSlBracketType } from '../trigger/common';
|
|
5
|
-
|
|
6
|
-
const NotificationCategory = z.enum([
|
|
7
|
-
"TAKE_PROFIT_HIT",
|
|
8
|
-
"STOP_LOSS_HIT",
|
|
9
|
-
"TRIGGER_ORDER_HIT",
|
|
10
|
-
"TAKE_PROFIT_FAILED",
|
|
11
|
-
"STOP_LOSS_FAILED",
|
|
12
|
-
"TRIGGER_ORDER_FAILED",
|
|
13
|
-
"ATTACHED_TRIGGER_DISCARDED",
|
|
14
|
-
"AUTO_REBALANCE_EXECUTED",
|
|
15
|
-
"AUTO_REBALANCE_FAILED",
|
|
16
|
-
"AUTO_REBALANCE_PAUSED",
|
|
17
|
-
"TRIGGER_TWAP_STARTED",
|
|
18
|
-
"TRIGGER_TWAP_SKIPPED",
|
|
19
|
-
"TRIGGER_TWAP_FAILED",
|
|
20
|
-
"TRIGGER_TWAP_POSITION_CHANGED",
|
|
21
|
-
"TRIGGER_CANCELLED_MIS_SCALED",
|
|
22
|
-
"COPY_PLACED",
|
|
23
|
-
"COPY_FAILED",
|
|
24
|
-
"COPY_SUBSCRIPTION_STOPPED",
|
|
25
|
-
"COPY_LEVERAGE_NOT_APPLIED",
|
|
26
|
-
"POSITION_LIQUIDATION"
|
|
27
|
-
]);
|
|
28
|
-
const NotificationMetric = z.enum([
|
|
29
|
-
"ratio",
|
|
30
|
-
"price",
|
|
31
|
-
"weighted_ratio",
|
|
32
|
-
"notional",
|
|
33
|
-
"upnl",
|
|
34
|
-
"upnl_bps",
|
|
35
|
-
"ratio_trailing",
|
|
36
|
-
"price_trailing",
|
|
37
|
-
"weighted_ratio_trailing",
|
|
38
|
-
"notional_trailing",
|
|
39
|
-
"upnl_trailing",
|
|
40
|
-
"upnl_bps_trailing",
|
|
41
|
-
"funding_rate",
|
|
42
|
-
"prediction_market",
|
|
43
|
-
"btc_dominance"
|
|
44
|
-
]);
|
|
45
|
-
const TriggerNotificationEnrichment = {
|
|
46
|
-
metric: NotificationMetric.optional(),
|
|
47
|
-
level: z.number().optional(),
|
|
48
|
-
reason: z.string().max(255).optional()
|
|
49
|
-
};
|
|
50
|
-
const TriggerNotificationLeg = z.object({
|
|
51
|
-
id: z.string().min(1),
|
|
52
|
-
symbol: z.string().min(1),
|
|
53
|
-
side: Side
|
|
54
|
-
});
|
|
55
|
-
const PositionLegParameters = z.object({
|
|
56
|
-
legs: z.array(TriggerNotificationLeg)
|
|
57
|
-
});
|
|
58
|
-
const TakeProfitNotificationParameters = PositionLegParameters.safeExtend({
|
|
59
|
-
type: z.literal("take_profit"),
|
|
60
|
-
triggerId: z.uuid(),
|
|
61
|
-
positionId: z.uuid(),
|
|
62
|
-
connector: Connector,
|
|
63
|
-
...TriggerNotificationEnrichment,
|
|
64
|
-
// User-facing bracket semantics; absent when a legacy trigger's intent is unknown.
|
|
65
|
-
semanticBracketType: TpSlBracketType.optional()
|
|
66
|
-
});
|
|
67
|
-
const StopLossNotificationParameters = PositionLegParameters.safeExtend({
|
|
68
|
-
type: z.literal("stop_loss"),
|
|
69
|
-
triggerId: z.uuid(),
|
|
70
|
-
positionId: z.uuid(),
|
|
71
|
-
connector: Connector,
|
|
72
|
-
...TriggerNotificationEnrichment,
|
|
73
|
-
// User-facing bracket semantics; absent when a legacy trigger's intent is unknown.
|
|
74
|
-
semanticBracketType: TpSlBracketType.optional()
|
|
75
|
-
});
|
|
76
|
-
const TriggerOrderNotificationParameters = PositionLegParameters.safeExtend({
|
|
77
|
-
type: z.literal("trigger_order"),
|
|
78
|
-
triggerId: z.uuid(),
|
|
79
|
-
positionId: z.uuid(),
|
|
80
|
-
connector: Connector,
|
|
81
|
-
...TriggerNotificationEnrichment
|
|
82
|
-
});
|
|
83
|
-
const DefaultTriggerNotificationParameters = PositionLegParameters.safeExtend({
|
|
84
|
-
type: z.literal("default_trigger"),
|
|
85
|
-
triggerId: z.uuid(),
|
|
86
|
-
connector: Connector,
|
|
87
|
-
...TriggerNotificationEnrichment
|
|
88
|
-
});
|
|
89
|
-
const AttachedTriggerDiscardedNotificationParameters = PositionLegParameters.safeExtend({
|
|
90
|
-
type: z.literal("attached_trigger_discarded"),
|
|
91
|
-
positionId: z.uuid(),
|
|
92
|
-
positionKey: z.string().min(1),
|
|
93
|
-
connector: Connector,
|
|
94
|
-
discarded: z.array(z.object({
|
|
95
|
-
bracketType: z.enum([
|
|
96
|
-
"STOP_LOSS",
|
|
97
|
-
"TAKE_PROFIT"
|
|
98
|
-
]),
|
|
99
|
-
metric: NotificationMetric,
|
|
100
|
-
level: z.number().optional(),
|
|
101
|
-
reason: z.enum([
|
|
102
|
-
"TRIGGER_LIMIT",
|
|
103
|
-
"TRAILING_ALREADY_EXISTS"
|
|
104
|
-
])
|
|
105
|
-
})).min(1),
|
|
106
|
-
activeTriggerLimit: z.number().int().positive()
|
|
107
|
-
});
|
|
108
|
-
const AutoRebalanceLeg = z.object({
|
|
109
|
-
id: z.string().min(1),
|
|
110
|
-
symbol: z.string().min(1),
|
|
111
|
-
side: Side
|
|
112
|
-
});
|
|
113
|
-
const AutoRebalanceAnchor = {
|
|
114
|
-
configId: z.uuid(),
|
|
115
|
-
positionId: z.uuid(),
|
|
116
|
-
positionKey: z.string().min(1),
|
|
117
|
-
connector: Connector,
|
|
118
|
-
weightSource: z.enum([
|
|
119
|
-
"INITIAL_WEIGHT",
|
|
120
|
-
"LIVE_BETA"
|
|
121
|
-
])
|
|
122
|
-
};
|
|
123
|
-
const AutoRebalanceRunLegs = z.array(AutoRebalanceLeg.safeExtend({
|
|
124
|
-
currentWeight: z.number(),
|
|
125
|
-
targetWeight: z.number()
|
|
126
|
-
}));
|
|
127
|
-
const AutoRebalanceExecutedNotificationParameters = z.object({
|
|
128
|
-
type: z.literal("auto_rebalance_executed"),
|
|
129
|
-
...AutoRebalanceAnchor,
|
|
130
|
-
legs: AutoRebalanceRunLegs,
|
|
131
|
-
driftPct: z.number(),
|
|
132
|
-
notionalUsd: z.number()
|
|
133
|
-
});
|
|
134
|
-
const AutoRebalanceFailedNotificationParameters = z.object({
|
|
135
|
-
type: z.literal("auto_rebalance_failed"),
|
|
136
|
-
...AutoRebalanceAnchor,
|
|
137
|
-
legs: AutoRebalanceRunLegs,
|
|
138
|
-
driftPct: z.number(),
|
|
139
|
-
reason: z.string().max(255)
|
|
140
|
-
});
|
|
141
|
-
const AutoRebalancePausedNotificationParameters = z.object({
|
|
142
|
-
type: z.literal("auto_rebalance_paused"),
|
|
143
|
-
...AutoRebalanceAnchor,
|
|
144
|
-
legs: z.array(AutoRebalanceLeg),
|
|
145
|
-
pausedReason: z.enum([
|
|
146
|
-
"POSITION_CHANGED",
|
|
147
|
-
"REPEATED_FAILURES",
|
|
148
|
-
"INVALID_LIVE_BETA_EXPOSURE"
|
|
149
|
-
])
|
|
150
|
-
});
|
|
151
|
-
const TriggerCancelledMisScaledNotificationParameters = z.object({
|
|
152
|
-
type: z.literal("trigger_cancelled_mis_scaled"),
|
|
153
|
-
triggerId: z.uuid(),
|
|
154
|
-
positionKey: z.string().min(1),
|
|
155
|
-
storedBps: z.number(),
|
|
156
|
-
readingMarginPct: z.number()
|
|
157
|
-
});
|
|
158
|
-
const TriggerTWAPNotificationAnchor = PositionLegParameters.safeExtend({
|
|
159
|
-
triggerId: z.uuid(),
|
|
160
|
-
positionId: z.uuid(),
|
|
161
|
-
connector: Connector
|
|
162
|
-
});
|
|
163
|
-
const TriggerTWAPStartedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
164
|
-
type: z.literal("trigger_twap_started"),
|
|
165
|
-
scheduleId: z.uuid()
|
|
166
|
-
});
|
|
167
|
-
const TriggerTWAPSkippedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
168
|
-
type: z.literal("trigger_twap_skipped"),
|
|
169
|
-
reason: z.string().min(1).max(255)
|
|
170
|
-
});
|
|
171
|
-
const TriggerTWAPFailedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
172
|
-
type: z.literal("trigger_twap_failed"),
|
|
173
|
-
scheduleId: z.uuid().optional(),
|
|
174
|
-
reason: z.string().min(1).max(255)
|
|
175
|
-
});
|
|
176
|
-
const TriggerTWAPPositionChangedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({
|
|
177
|
-
type: z.literal("trigger_twap_position_changed"),
|
|
178
|
-
scheduleId: z.uuid(),
|
|
179
|
-
reason: z.string().min(1).max(255)
|
|
180
|
-
});
|
|
181
|
-
const CopyPlacedNotificationParameters = z.object({
|
|
182
|
-
type: z.literal("copy_placed"),
|
|
183
|
-
subscriptionId: z.uuid(),
|
|
184
|
-
activityId: z.uuid(),
|
|
185
|
-
resource: z.object({
|
|
186
|
-
kind: z.literal("POSITION"),
|
|
187
|
-
id: z.uuid()
|
|
188
|
-
}),
|
|
189
|
-
leaderTradeAccountId: z.uuid()
|
|
190
|
-
});
|
|
191
|
-
const CopyFailedNotificationParameters = z.object({
|
|
192
|
-
type: z.literal("copy_failed"),
|
|
193
|
-
subscriptionId: z.uuid(),
|
|
194
|
-
activityId: z.uuid(),
|
|
195
|
-
reason: z.string().max(255)
|
|
196
|
-
});
|
|
197
|
-
const CopySubscriptionStoppedNotificationParameters = z.object({
|
|
198
|
-
type: z.literal("copy_subscription_stopped"),
|
|
199
|
-
subscriptionId: z.uuid(),
|
|
200
|
-
reason: z.enum([
|
|
201
|
-
"REPEATED_FAILURES",
|
|
202
|
-
"MANUAL_TRADE",
|
|
203
|
-
"EXTERNAL_POSITION_DETECTED",
|
|
204
|
-
"LEADER_EXTERNAL_ACTIVITY"
|
|
205
|
-
])
|
|
206
|
-
});
|
|
207
|
-
const CopyLeverageNotAppliedNotificationParameters = z.object({
|
|
208
|
-
type: z.literal("copy_leverage_not_applied"),
|
|
209
|
-
subscriptionId: z.uuid(),
|
|
210
|
-
activityId: z.uuid()
|
|
211
|
-
});
|
|
212
|
-
const PositionLiquidationNotificationParameters = z.object({
|
|
213
|
-
type: z.literal("position_liquidation"),
|
|
214
|
-
positionId: z.uuid(),
|
|
215
|
-
tradeAccountId: z.uuid(),
|
|
216
|
-
connector: Connector,
|
|
217
|
-
exchangeFillId: z.string().min(1),
|
|
218
|
-
occurredAt: z.number().int().nonnegative(),
|
|
219
|
-
leg: TriggerNotificationLeg,
|
|
220
|
-
quantity: UnsignedDecimalString,
|
|
221
|
-
price: UnsignedDecimalString,
|
|
222
|
-
outcome: z.enum([
|
|
223
|
-
"CLOSED",
|
|
224
|
-
"REDUCED"
|
|
225
|
-
])
|
|
226
|
-
});
|
|
227
|
-
const NotificationParameters = z.discriminatedUnion("type", [
|
|
228
|
-
PositionLiquidationNotificationParameters,
|
|
229
|
-
TakeProfitNotificationParameters,
|
|
230
|
-
StopLossNotificationParameters,
|
|
231
|
-
TriggerOrderNotificationParameters,
|
|
232
|
-
DefaultTriggerNotificationParameters,
|
|
233
|
-
AttachedTriggerDiscardedNotificationParameters,
|
|
234
|
-
AutoRebalanceExecutedNotificationParameters,
|
|
235
|
-
AutoRebalanceFailedNotificationParameters,
|
|
236
|
-
AutoRebalancePausedNotificationParameters,
|
|
237
|
-
TriggerTWAPStartedNotificationParameters,
|
|
238
|
-
TriggerTWAPSkippedNotificationParameters,
|
|
239
|
-
TriggerTWAPFailedNotificationParameters,
|
|
240
|
-
TriggerTWAPPositionChangedNotificationParameters,
|
|
241
|
-
TriggerCancelledMisScaledNotificationParameters,
|
|
242
|
-
CopyPlacedNotificationParameters,
|
|
243
|
-
CopyFailedNotificationParameters,
|
|
244
|
-
CopySubscriptionStoppedNotificationParameters,
|
|
245
|
-
CopyLeverageNotAppliedNotificationParameters
|
|
246
|
-
]);
|
|
247
|
-
const Notification = z.object({
|
|
248
|
-
/**
|
|
249
|
-
* Notification UUID
|
|
250
|
-
*/
|
|
251
|
-
id: z.uuid(),
|
|
252
|
-
/**
|
|
253
|
-
* What kind of notification this is
|
|
254
|
-
*/
|
|
255
|
-
category: NotificationCategory,
|
|
256
|
-
/**
|
|
257
|
-
* Category-specific display payload
|
|
258
|
-
*/
|
|
259
|
-
parameters: NotificationParameters,
|
|
260
|
-
/**
|
|
261
|
-
* Whether the user has read it
|
|
262
|
-
*/
|
|
263
|
-
isRead: z.boolean(),
|
|
264
|
-
/**
|
|
265
|
-
* Created at timestamp
|
|
266
|
-
*/
|
|
267
|
-
createdAt: z.string(),
|
|
268
|
-
/**
|
|
269
|
-
* Updated at timestamp
|
|
270
|
-
*/
|
|
271
|
-
updatedAt: z.string()
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
export { Notification, NotificationCategory, NotificationMetric, NotificationParameters };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const MarkNotificationsReadPayload = z.union([
|
|
4
|
-
z.strictObject({
|
|
5
|
-
id: z.uuid()
|
|
6
|
-
}),
|
|
7
|
-
z.strictObject({
|
|
8
|
-
timestamp: z.coerce.number().int().positive()
|
|
9
|
-
})
|
|
10
|
-
]);
|
|
11
|
-
const MarkNotificationUnreadPayload = z.strictObject({
|
|
12
|
-
id: z.uuid()
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export { MarkNotificationUnreadPayload, MarkNotificationsReadPayload };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const NotificationListParams = z.object({
|
|
4
|
-
/**
|
|
5
|
-
* The maximum number of notifications to retrieve (newest first).
|
|
6
|
-
* Matches the V2 engine: max and default are both 100.
|
|
7
|
-
*/
|
|
8
|
-
limit: z.coerce.number().int().positive().max(100).optional().default(100),
|
|
9
|
-
/**
|
|
10
|
-
* Only return notifications created at or after this date.
|
|
11
|
-
*/
|
|
12
|
-
startDate: z.coerce.date().optional(),
|
|
13
|
-
/**
|
|
14
|
-
* Only return notifications created at or before this date.
|
|
15
|
-
*/
|
|
16
|
-
endDate: z.coerce.date().optional(),
|
|
17
|
-
/**
|
|
18
|
-
* Filter by read state: `all` (default), only `read`, or only `unread`.
|
|
19
|
-
*/
|
|
20
|
-
scope: z.enum([
|
|
21
|
-
"all",
|
|
22
|
-
"read",
|
|
23
|
-
"unread"
|
|
24
|
-
]).optional().default("all")
|
|
25
|
-
}).refine((data) => !data.startDate || !data.endDate || data.startDate < data.endDate, {
|
|
26
|
-
message: "startDate must be before endDate"
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export { NotificationListParams };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Notification } from './entities';
|
|
3
|
-
|
|
4
|
-
const NotificationListResponse = z.object({
|
|
5
|
-
notifications: z.array(Notification)
|
|
6
|
-
});
|
|
7
|
-
const MarkNotificationsReadResponse = z.object({
|
|
8
|
-
/**
|
|
9
|
-
* How many notifications were flipped from unread to read.
|
|
10
|
-
*/
|
|
11
|
-
updated: z.number().int()
|
|
12
|
-
});
|
|
13
|
-
const MarkNotificationUnreadResponse = z.object({
|
|
14
|
-
/**
|
|
15
|
-
* How many notifications were flipped from read to unread.
|
|
16
|
-
*/
|
|
17
|
-
updated: z.number().int()
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { MarkNotificationUnreadResponse, MarkNotificationsReadResponse, NotificationListResponse };
|