@lifi/perps-types 17.0.0 → 18.1.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/cjs/account.d.ts +63 -60
- package/dist/cjs/account.d.ts.map +1 -1
- package/dist/cjs/action.d.ts +21 -20
- package/dist/cjs/action.d.ts.map +1 -1
- package/dist/cjs/asset.d.ts +2 -1
- package/dist/cjs/asset.d.ts.map +1 -1
- package/dist/cjs/decimal.d.ts +4 -0
- package/dist/cjs/decimal.d.ts.map +1 -0
- package/dist/cjs/decimal.js +9 -0
- package/dist/cjs/decimal.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/market.d.ts +25 -23
- package/dist/cjs/market.d.ts.map +1 -1
- package/dist/cjs/portfolioHistory.d.ts +5 -4
- package/dist/cjs/portfolioHistory.d.ts.map +1 -1
- package/dist/cjs/quote.d.ts +7 -6
- package/dist/cjs/quote.d.ts.map +1 -1
- package/dist/cjs/referral.d.ts +5 -4
- package/dist/cjs/referral.d.ts.map +1 -1
- package/dist/cjs/referral.js.map +1 -1
- package/dist/cjs/subscriptions.d.ts +2 -1
- package/dist/cjs/subscriptions.d.ts.map +1 -1
- package/dist/esm/account.d.ts +81 -68
- package/dist/esm/account.d.ts.map +1 -1
- package/dist/esm/action.d.ts +40 -28
- package/dist/esm/action.d.ts.map +1 -1
- package/dist/esm/asset.d.ts +2 -1
- package/dist/esm/asset.d.ts.map +1 -1
- package/dist/esm/decimal.d.ts +23 -0
- package/dist/esm/decimal.d.ts.map +1 -0
- package/dist/esm/decimal.js +17 -0
- package/dist/esm/decimal.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/market.d.ts +29 -23
- package/dist/esm/market.d.ts.map +1 -1
- package/dist/esm/portfolioHistory.d.ts +5 -4
- package/dist/esm/portfolioHistory.d.ts.map +1 -1
- package/dist/esm/quote.d.ts +7 -6
- package/dist/esm/quote.d.ts.map +1 -1
- package/dist/esm/referral.d.ts +5 -5
- package/dist/esm/referral.d.ts.map +1 -1
- package/dist/esm/referral.js.map +1 -1
- package/dist/esm/subscriptions.d.ts +2 -1
- package/dist/esm/subscriptions.d.ts.map +1 -1
- package/dist/types/account.d.ts +81 -68
- package/dist/types/account.d.ts.map +1 -1
- package/dist/types/action.d.ts +40 -28
- package/dist/types/action.d.ts.map +1 -1
- package/dist/types/asset.d.ts +2 -1
- package/dist/types/asset.d.ts.map +1 -1
- package/dist/types/decimal.d.ts +23 -0
- package/dist/types/decimal.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/market.d.ts +29 -23
- package/dist/types/market.d.ts.map +1 -1
- package/dist/types/portfolioHistory.d.ts +5 -4
- package/dist/types/portfolioHistory.d.ts.map +1 -1
- package/dist/types/quote.d.ts +7 -6
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/referral.d.ts +5 -5
- package/dist/types/referral.d.ts.map +1 -1
- package/dist/types/subscriptions.d.ts +2 -1
- package/dist/types/subscriptions.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account.ts +81 -68
- package/src/action.ts +41 -28
- package/src/asset.ts +3 -1
- package/src/decimal.ts +26 -0
- package/src/index.ts +1 -0
- package/src/market.ts +29 -23
- package/src/portfolioHistory.ts +6 -4
- package/src/quote.ts +7 -6
- package/src/referral.ts +5 -5
- package/src/subscriptions.ts +2 -1
package/src/market.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Asset } from './asset.js'
|
|
2
|
+
import type { DecimalString } from './decimal.js'
|
|
2
3
|
import type { PositionMarginAdjustment } from './enums.js'
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -9,7 +10,7 @@ import type { PositionMarginAdjustment } from './enums.js'
|
|
|
9
10
|
*/
|
|
10
11
|
export interface FundingInfo {
|
|
11
12
|
/** Funding rate as a decimal fraction. */
|
|
12
|
-
rate:
|
|
13
|
+
rate: DecimalString
|
|
13
14
|
/** Next funding timestamp in Unix milliseconds. */
|
|
14
15
|
nextFundingTime: number
|
|
15
16
|
}
|
|
@@ -43,14 +44,14 @@ export interface BaseMarket {
|
|
|
43
44
|
* describe the tick. Format prices through the provider's `formatOrderPrice`
|
|
44
45
|
* rather than applying this field directly.
|
|
45
46
|
*/
|
|
46
|
-
priceIncrement?:
|
|
47
|
+
priceIncrement?: DecimalString
|
|
47
48
|
/**
|
|
48
49
|
* Exact size lot as a plain decimal string (e.g. `'0.05'`). Present when the
|
|
49
50
|
* venue's grid is not a power of ten, where `szDecimals` alone cannot
|
|
50
51
|
* describe the lot. Format sizes through the provider's `formatOrderSize`
|
|
51
52
|
* rather than applying this field directly.
|
|
52
53
|
*/
|
|
53
|
-
sizeIncrement?:
|
|
54
|
+
sizeIncrement?: DecimalString
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -60,17 +61,22 @@ export interface BaseMarket {
|
|
|
60
61
|
*/
|
|
61
62
|
export interface PerpsMarket extends BaseMarket {
|
|
62
63
|
maxLeverage: number
|
|
64
|
+
/**
|
|
65
|
+
* The display leverage the venue applies to a market with no stored user
|
|
66
|
+
* setting. Absent when the venue publishes no default.
|
|
67
|
+
*/
|
|
68
|
+
defaultLeverage?: number
|
|
63
69
|
/**
|
|
64
70
|
* Minimum order notional in USD for this market, as a plain decimal string.
|
|
65
71
|
* Lighter applies it to resting (post-only) orders only. Separate from the
|
|
66
72
|
* venue-wide `Provider.minOrderValueUsd`, which is a `number`; parse this
|
|
67
73
|
* string before comparing the two.
|
|
68
74
|
*/
|
|
69
|
-
minOrderValueUsd?:
|
|
75
|
+
minOrderValueUsd?: DecimalString
|
|
70
76
|
/** Maximum market-order notional in USD, as a plain decimal string. */
|
|
71
|
-
maxMarketOrderUsd?:
|
|
77
|
+
maxMarketOrderUsd?: DecimalString
|
|
72
78
|
/** Maximum limit-order notional in USD, as a plain decimal string. */
|
|
73
|
-
maxLimitOrderUsd?:
|
|
79
|
+
maxLimitOrderUsd?: DecimalString
|
|
74
80
|
onlyIsolated: boolean
|
|
75
81
|
/** Whether individual position margin can be added and/or removed. */
|
|
76
82
|
positionMarginAdjustment: PositionMarginAdjustment
|
|
@@ -145,16 +151,16 @@ export interface MarketContext {
|
|
|
145
151
|
/** Opaque provider market identifier for this context frame. */
|
|
146
152
|
marketId: string
|
|
147
153
|
/** Current order-book midpoint, as a decimal quote string. */
|
|
148
|
-
midPrice:
|
|
154
|
+
midPrice: DecimalString
|
|
149
155
|
/** Provider mark price, as a decimal quote string. */
|
|
150
|
-
markPrice:
|
|
151
|
-
oraclePrice?:
|
|
152
|
-
prevDayPrice?:
|
|
153
|
-
priceChange24h?:
|
|
154
|
-
volume24h?:
|
|
155
|
-
marketCap?:
|
|
156
|
+
markPrice: DecimalString
|
|
157
|
+
oraclePrice?: DecimalString
|
|
158
|
+
prevDayPrice?: DecimalString
|
|
159
|
+
priceChange24h?: DecimalString
|
|
160
|
+
volume24h?: DecimalString
|
|
161
|
+
marketCap?: DecimalString
|
|
156
162
|
/** Quote-asset open-interest notional as a decimal string. */
|
|
157
|
-
openInterest?:
|
|
163
|
+
openInterest?: DecimalString
|
|
158
164
|
funding?: FundingInfo
|
|
159
165
|
}
|
|
160
166
|
|
|
@@ -171,11 +177,11 @@ export interface PricesResponse {
|
|
|
171
177
|
*/
|
|
172
178
|
export interface Candle {
|
|
173
179
|
t: number
|
|
174
|
-
o:
|
|
175
|
-
h:
|
|
176
|
-
l:
|
|
177
|
-
c:
|
|
178
|
-
v:
|
|
180
|
+
o: DecimalString
|
|
181
|
+
h: DecimalString
|
|
182
|
+
l: DecimalString
|
|
183
|
+
c: DecimalString
|
|
184
|
+
v: DecimalString
|
|
179
185
|
}
|
|
180
186
|
|
|
181
187
|
/** Response containing candles for one provider market and interval. @public */
|
|
@@ -210,8 +216,8 @@ export type OhlcvInterval =
|
|
|
210
216
|
|
|
211
217
|
/** One price/size level in an order book; both values are decimal strings. @public */
|
|
212
218
|
export interface OrderbookLevel {
|
|
213
|
-
price:
|
|
214
|
-
size:
|
|
219
|
+
price: DecimalString
|
|
220
|
+
size: DecimalString
|
|
215
221
|
}
|
|
216
222
|
|
|
217
223
|
/** Snapshot of bids and asks for one market. `timestamp` is Unix milliseconds. @public */
|
|
@@ -227,8 +233,8 @@ export interface OrderbookResponse {
|
|
|
227
233
|
export interface Trade {
|
|
228
234
|
provider: string
|
|
229
235
|
marketId: string
|
|
230
|
-
price:
|
|
231
|
-
size:
|
|
236
|
+
price: DecimalString
|
|
237
|
+
size: DecimalString
|
|
232
238
|
timestamp: number
|
|
233
239
|
side: 'buy' | 'sell'
|
|
234
240
|
id?: string
|
package/src/portfolioHistory.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { DecimalString } from './decimal.js'
|
|
2
|
+
|
|
1
3
|
/** Lookback window of a portfolio history read. @public */
|
|
2
4
|
export type PortfolioHistoryRange = '24h' | '7d' | '30d' | 'all'
|
|
3
5
|
|
|
@@ -9,9 +11,9 @@ export type PortfolioHistoryRange = '24h' | '7d' | '30d' | 'all'
|
|
|
9
11
|
export interface PortfolioHistoryPoint {
|
|
10
12
|
/** Unix milliseconds. */
|
|
11
13
|
timestamp: number
|
|
12
|
-
accountValue:
|
|
14
|
+
accountValue: DecimalString
|
|
13
15
|
/** Cumulative PnL from the start of the requested window. */
|
|
14
|
-
pnl:
|
|
16
|
+
pnl: DecimalString
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -22,6 +24,6 @@ export interface PortfolioHistoryPoint {
|
|
|
22
24
|
export interface PortfolioHistoryResponse {
|
|
23
25
|
range: PortfolioHistoryRange
|
|
24
26
|
points: PortfolioHistoryPoint[]
|
|
25
|
-
volume?:
|
|
26
|
-
totalPnl?:
|
|
27
|
+
volume?: DecimalString
|
|
28
|
+
totalPnl?: DecimalString
|
|
27
29
|
}
|
package/src/quote.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FeeTier } from './account.js'
|
|
2
|
+
import type { DecimalString } from './decimal.js'
|
|
2
3
|
import type { FundingInfo } from './market.js'
|
|
3
4
|
|
|
4
5
|
/** Side of the quoted market order, using lowercase wire values. @public */
|
|
@@ -26,20 +27,20 @@ export interface Quote {
|
|
|
26
27
|
type: TradeType
|
|
27
28
|
side: QuoteSide
|
|
28
29
|
/** Input notional in USD. */
|
|
29
|
-
sizeUsd:
|
|
30
|
+
sizeUsd: DecimalString
|
|
30
31
|
/** Base amount the book filled for `sizeUsd` (or the most obtainable when the book is too thin). */
|
|
31
|
-
baseSize:
|
|
32
|
-
markPrice:
|
|
32
|
+
baseSize: DecimalString
|
|
33
|
+
markPrice: DecimalString
|
|
33
34
|
/** Volume-weighted average fill price from the book walk. */
|
|
34
|
-
expectedFillPrice:
|
|
35
|
+
expectedFillPrice: DecimalString
|
|
35
36
|
/** VWAP deviation from `markPrice` in basis points; non-negative. */
|
|
36
|
-
priceImpactBps:
|
|
37
|
+
priceImpactBps: DecimalString
|
|
37
38
|
/** Base maker/taker fee fractions (not bps) for the public tier. */
|
|
38
39
|
feeTier: FeeTier
|
|
39
40
|
/** Always `true` in v1 — quotes use the public base tier, never a per-account tier. */
|
|
40
41
|
isDefaultFeeTier: boolean
|
|
41
42
|
/** Taker fee on the filled notional in USD: `filledNotional * feeTier.taker`. */
|
|
42
|
-
feeUsd:
|
|
43
|
+
feeUsd: DecimalString
|
|
43
44
|
/** Current funding for perps; `null` for spot. */
|
|
44
45
|
funding: FundingInfo | null
|
|
45
46
|
/** `true` when the book could not fill the full `sizeUsd` — `baseSize`/fill reflect the best obtainable. */
|
package/src/referral.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Pagination } from './account.js'
|
|
2
|
+
import type { DecimalString } from './decimal.js'
|
|
2
3
|
import type { Address } from './primitives.js'
|
|
3
4
|
import type { PerpsTypedData, TypedDataParameter } from './typedData.js'
|
|
4
5
|
|
|
@@ -71,9 +72,9 @@ export interface OwnedReferralCodeEligibility {
|
|
|
71
72
|
* Executed notional the address must reach, as a decimal string in the
|
|
72
73
|
* backend's reporting currency. Absent when the backend does not disclose it.
|
|
73
74
|
*/
|
|
74
|
-
requiredNotional?:
|
|
75
|
+
requiredNotional?: DecimalString
|
|
75
76
|
/** The address's executed notional so far, in the same units as `requiredNotional`. */
|
|
76
|
-
currentNotional?:
|
|
77
|
+
currentNotional?: DecimalString
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
/**
|
|
@@ -125,7 +126,7 @@ export interface ReferralActivityItem {
|
|
|
125
126
|
* Executed notional recorded against this attachment, as a decimal string in
|
|
126
127
|
* the backend's reporting currency.
|
|
127
128
|
*/
|
|
128
|
-
notional:
|
|
129
|
+
notional: DecimalString
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
/**
|
|
@@ -217,8 +218,7 @@ export interface OnboardTypedData extends PerpsTypedData {
|
|
|
217
218
|
* @public
|
|
218
219
|
*/
|
|
219
220
|
export interface CreateReferralCodeParams {
|
|
220
|
-
|
|
221
|
-
code?: string
|
|
221
|
+
code: string
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
/**
|
package/src/subscriptions.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
Order,
|
|
7
7
|
Position,
|
|
8
8
|
} from './account.js'
|
|
9
|
+
import type { DecimalString } from './decimal.js'
|
|
9
10
|
import type {
|
|
10
11
|
Candle,
|
|
11
12
|
MarketContext,
|
|
@@ -152,7 +153,7 @@ export type PositionsEvent = { channel: 'positions'; data: Position[] }
|
|
|
152
153
|
*/
|
|
153
154
|
export type SpotBalancesEvent = {
|
|
154
155
|
channel: 'spotBalances'
|
|
155
|
-
data: (Balance & { locked:
|
|
156
|
+
data: (Balance & { locked: DecimalString })[]
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
/**
|