@lifi/perps-types 3.3.2 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/account.d.ts +11 -2
- package/dist/cjs/account.d.ts.map +1 -1
- package/dist/cjs/action.d.ts +1 -0
- package/dist/cjs/action.d.ts.map +1 -1
- package/dist/cjs/asset.d.ts.map +1 -1
- package/dist/cjs/enums.d.ts +5 -0
- package/dist/cjs/enums.d.ts.map +1 -1
- package/dist/cjs/enums.js +7 -1
- package/dist/cjs/enums.js.map +1 -1
- package/dist/cjs/errors.d.ts.map +1 -1
- package/dist/cjs/market.d.ts +4 -0
- package/dist/cjs/market.d.ts.map +1 -1
- package/dist/cjs/primitives.d.ts.map +1 -1
- package/dist/cjs/providers.d.ts.map +1 -1
- package/dist/cjs/subscriptions.d.ts.map +1 -1
- package/dist/cjs/typedData.d.ts.map +1 -1
- package/dist/cjs/vote.d.ts.map +1 -1
- package/dist/cjs/vote.js.map +1 -1
- package/dist/esm/account.d.ts +223 -32
- package/dist/esm/account.d.ts.map +1 -1
- package/dist/esm/action.d.ts +205 -37
- package/dist/esm/action.d.ts.map +1 -1
- package/dist/esm/asset.d.ts +1 -4
- package/dist/esm/asset.d.ts.map +1 -1
- package/dist/esm/enums.d.ts +43 -20
- package/dist/esm/enums.d.ts.map +1 -1
- package/dist/esm/enums.js +43 -19
- package/dist/esm/enums.js.map +1 -1
- package/dist/esm/errors.d.ts +6 -1
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/market.d.ts +57 -15
- package/dist/esm/market.d.ts.map +1 -1
- package/dist/esm/primitives.d.ts +12 -2
- package/dist/esm/primitives.d.ts.map +1 -1
- package/dist/esm/providers.d.ts +19 -6
- package/dist/esm/providers.d.ts.map +1 -1
- package/dist/esm/quote.d.ts +2 -2
- package/dist/esm/quote.d.ts.map +1 -1
- package/dist/esm/subscriptions.d.ts +27 -19
- package/dist/esm/subscriptions.d.ts.map +1 -1
- package/dist/esm/typedData.d.ts +15 -5
- package/dist/esm/typedData.d.ts.map +1 -1
- package/dist/esm/vote.d.ts +1 -3
- package/dist/esm/vote.d.ts.map +1 -1
- package/dist/esm/vote.js.map +1 -1
- package/dist/types/account.d.ts +223 -32
- package/dist/types/account.d.ts.map +1 -1
- package/dist/types/action.d.ts +205 -37
- package/dist/types/action.d.ts.map +1 -1
- package/dist/types/asset.d.ts +1 -4
- package/dist/types/asset.d.ts.map +1 -1
- package/dist/types/enums.d.ts +43 -20
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/errors.d.ts +6 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/market.d.ts +57 -15
- package/dist/types/market.d.ts.map +1 -1
- package/dist/types/primitives.d.ts +12 -2
- package/dist/types/primitives.d.ts.map +1 -1
- package/dist/types/providers.d.ts +19 -6
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/quote.d.ts +2 -2
- package/dist/types/quote.d.ts.map +1 -1
- package/dist/types/subscriptions.d.ts +27 -19
- package/dist/types/subscriptions.d.ts.map +1 -1
- package/dist/types/typedData.d.ts +15 -5
- package/dist/types/typedData.d.ts.map +1 -1
- package/dist/types/vote.d.ts +1 -3
- package/dist/types/vote.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account.ts +225 -37
- package/src/action.ts +205 -37
- package/src/asset.ts +1 -4
- package/src/enums.ts +44 -20
- package/src/errors.ts +6 -1
- package/src/market.ts +69 -16
- package/src/primitives.ts +12 -2
- package/src/providers.ts +19 -6
- package/src/quote.ts +2 -2
- package/src/subscriptions.ts +27 -19
- package/src/typedData.ts +15 -5
- package/src/vote.ts +1 -3
package/src/market.ts
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import type { Asset } from './asset.js'
|
|
2
|
+
import type { PositionMarginAdjustment } from './enums.js'
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Current funding rate and next funding timestamp for a perpetual market.
|
|
6
|
+
* `rate` is a decimal fraction; `nextFundingTime` is Unix milliseconds.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
4
10
|
export interface FundingInfo {
|
|
11
|
+
/** Funding rate as a decimal fraction. */
|
|
5
12
|
rate: string
|
|
13
|
+
/** Next funding timestamp in Unix milliseconds. */
|
|
6
14
|
nextFundingTime: number
|
|
7
15
|
}
|
|
8
16
|
|
|
9
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Shared market metadata for perpetual and spot instruments.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
10
22
|
export interface BaseMarket {
|
|
11
23
|
providerId: string
|
|
12
24
|
/** Opaque provider market id; referenced elsewhere as `marketId`. */
|
|
13
25
|
id: string
|
|
14
|
-
/** Whether the venue has delisted this market. */
|
|
15
26
|
isDelisted?: boolean
|
|
16
27
|
/** References a {@link ProviderCategory} by id. */
|
|
17
28
|
categoryId: string
|
|
18
29
|
baseAsset: Asset
|
|
19
30
|
quoteAsset: Asset
|
|
31
|
+
/** Maximum fractional precision accepted for order sizes. */
|
|
20
32
|
szDecimals: number
|
|
21
33
|
/**
|
|
22
34
|
* Maximum decimal places the venue accepts for order prices on this market.
|
|
@@ -41,10 +53,16 @@ export interface BaseMarket {
|
|
|
41
53
|
sizeIncrement?: string
|
|
42
54
|
}
|
|
43
55
|
|
|
44
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Perpetual market metadata, including leverage and margin constraints.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
45
61
|
export interface PerpsMarket extends BaseMarket {
|
|
46
62
|
maxLeverage: number
|
|
47
63
|
onlyIsolated: boolean
|
|
64
|
+
/** Whether individual position margin can be added and/or removed. */
|
|
65
|
+
positionMarginAdjustment: PositionMarginAdjustment
|
|
48
66
|
/**
|
|
49
67
|
* Venue maintenance margin rate for this market as a fraction (e.g. `0.012`
|
|
50
68
|
* = 1.2%). Feeds client-side liquidation-price estimates via the provider's
|
|
@@ -53,18 +71,40 @@ export interface PerpsMarket extends BaseMarket {
|
|
|
53
71
|
maintenanceMarginRate?: number
|
|
54
72
|
}
|
|
55
73
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Spot markets cannot expose perpetual-position margin capabilities.
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export interface SpotMarket extends BaseMarket {
|
|
79
|
+
positionMarginAdjustment?: never
|
|
80
|
+
}
|
|
58
81
|
|
|
59
|
-
/** @public */
|
|
82
|
+
/** Union of perpetual and spot market representations. @public */
|
|
60
83
|
export type Market = PerpsMarket | SpotMarket
|
|
61
84
|
|
|
62
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* UI-safe market projection containing identity, category, assets, and
|
|
87
|
+
* delisting state without provider-specific trading constraints.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
63
91
|
export type MarketDisplay = Pick<
|
|
64
92
|
BaseMarket,
|
|
65
93
|
'providerId' | 'id' | 'categoryId' | 'baseAsset' | 'quoteAsset' | 'isDelisted'
|
|
66
94
|
>
|
|
67
95
|
|
|
96
|
+
/** Perpetual-market identity embedded on an open {@link Position}. @public */
|
|
97
|
+
export type PerpsMarketDisplay = Pick<
|
|
98
|
+
PerpsMarket,
|
|
99
|
+
| 'providerId'
|
|
100
|
+
| 'id'
|
|
101
|
+
| 'categoryId'
|
|
102
|
+
| 'baseAsset'
|
|
103
|
+
| 'quoteAsset'
|
|
104
|
+
| 'isDelisted'
|
|
105
|
+
| 'positionMarginAdjustment'
|
|
106
|
+
>
|
|
107
|
+
|
|
68
108
|
/**
|
|
69
109
|
* Minimal market reference for write-action params: identifies a market by
|
|
70
110
|
* its opaque `marketId` within a `categoryId`. Embeds no Assets — write
|
|
@@ -76,7 +116,7 @@ export interface MarketRef {
|
|
|
76
116
|
categoryId: string
|
|
77
117
|
}
|
|
78
118
|
|
|
79
|
-
/** @public */
|
|
119
|
+
/** Response containing all markets returned for a provider. @public */
|
|
80
120
|
export interface MarketsResponse {
|
|
81
121
|
markets: Market[]
|
|
82
122
|
}
|
|
@@ -91,8 +131,11 @@ export interface MarketsResponse {
|
|
|
91
131
|
* @public
|
|
92
132
|
*/
|
|
93
133
|
export interface MarketContext {
|
|
134
|
+
/** Opaque provider market identifier for this context frame. */
|
|
94
135
|
marketId: string
|
|
136
|
+
/** Current order-book midpoint, as a decimal quote string. */
|
|
95
137
|
midPrice: string
|
|
138
|
+
/** Provider mark price, as a decimal quote string. */
|
|
96
139
|
markPrice: string
|
|
97
140
|
oraclePrice?: string
|
|
98
141
|
prevDayPrice?: string
|
|
@@ -103,12 +146,17 @@ export interface MarketContext {
|
|
|
103
146
|
funding?: FundingInfo
|
|
104
147
|
}
|
|
105
148
|
|
|
106
|
-
/** @public */
|
|
149
|
+
/** Response containing live context for requested markets. @public */
|
|
107
150
|
export interface PricesResponse {
|
|
108
151
|
prices: MarketContext[]
|
|
109
152
|
}
|
|
110
153
|
|
|
111
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* OHLCV candle with Unix-millisecond open time and decimal-string OHLCV
|
|
156
|
+
* values. Field names follow the compact provider response shape.
|
|
157
|
+
*
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
112
160
|
export interface Candle {
|
|
113
161
|
t: number
|
|
114
162
|
o: string
|
|
@@ -118,7 +166,7 @@ export interface Candle {
|
|
|
118
166
|
v: string
|
|
119
167
|
}
|
|
120
168
|
|
|
121
|
-
/** @public */
|
|
169
|
+
/** Response containing candles for one provider market and interval. @public */
|
|
122
170
|
export interface OhlcvResponse {
|
|
123
171
|
provider: string
|
|
124
172
|
marketId: string
|
|
@@ -126,7 +174,12 @@ export interface OhlcvResponse {
|
|
|
126
174
|
candles: Candle[]
|
|
127
175
|
}
|
|
128
176
|
|
|
129
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* Supported OHLCV intervals. Values are wire interval strings (`1M` is one
|
|
179
|
+
* month; lowercase `m` values are minutes).
|
|
180
|
+
*
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
130
183
|
export type OhlcvInterval =
|
|
131
184
|
| '1m'
|
|
132
185
|
| '3m'
|
|
@@ -143,13 +196,13 @@ export type OhlcvInterval =
|
|
|
143
196
|
| '1w'
|
|
144
197
|
| '1M'
|
|
145
198
|
|
|
146
|
-
/** @public */
|
|
199
|
+
/** One price/size level in an order book; both values are decimal strings. @public */
|
|
147
200
|
export interface OrderbookLevel {
|
|
148
201
|
price: string
|
|
149
202
|
size: string
|
|
150
203
|
}
|
|
151
204
|
|
|
152
|
-
/** @public */
|
|
205
|
+
/** Snapshot of bids and asks for one market. `timestamp` is Unix milliseconds. @public */
|
|
153
206
|
export interface OrderbookResponse {
|
|
154
207
|
provider: string
|
|
155
208
|
marketId: string
|
|
@@ -158,7 +211,7 @@ export interface OrderbookResponse {
|
|
|
158
211
|
timestamp: number
|
|
159
212
|
}
|
|
160
213
|
|
|
161
|
-
/** @public */
|
|
214
|
+
/** Recent trade normalized for a market; `timestamp` is Unix milliseconds. @public */
|
|
162
215
|
export interface Trade {
|
|
163
216
|
provider: string
|
|
164
217
|
marketId: string
|
package/src/primitives.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Hex-prefixed EVM address string. The type validates only the `0x` prefix;
|
|
3
|
+
* checksum and byte-length validation remain runtime/provider concerns.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
2
7
|
export type Address = `0x${string}`
|
|
3
8
|
|
|
4
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Hex-prefixed byte string used for hashes, signatures, salts, and other EVM
|
|
11
|
+
* wire values. The type does not constrain byte length.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
5
15
|
export type Hex = `0x${string}`
|
package/src/providers.ts
CHANGED
|
@@ -2,13 +2,17 @@ import type { Asset, DepositAsset } from './asset.js'
|
|
|
2
2
|
import type { ActionType, PerpsSigner, SigningMethod } from './enums.js'
|
|
3
3
|
import type { OhlcvInterval } from './market.js'
|
|
4
4
|
|
|
5
|
-
/** @public */
|
|
5
|
+
/** A fixed option value presented for a provider action parameter. @public */
|
|
6
6
|
export interface ParamOption {
|
|
7
7
|
value: string
|
|
8
8
|
label: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Metadata describing one provider action parameter and its UI constraints.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
12
16
|
export interface Param {
|
|
13
17
|
/** Wire key for the action params object: `{ [param.name]: value }`. */
|
|
14
18
|
name: string
|
|
@@ -60,7 +64,11 @@ export interface TradeNotice {
|
|
|
60
64
|
message: string
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Provider category metadata, including quote asset and optional market notice.
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
64
72
|
export interface ProviderCategory {
|
|
65
73
|
id: string
|
|
66
74
|
logoURI?: string
|
|
@@ -69,7 +77,7 @@ export interface ProviderCategory {
|
|
|
69
77
|
tradeNotice?: TradeNotice
|
|
70
78
|
}
|
|
71
79
|
|
|
72
|
-
/** @public */
|
|
80
|
+
/** Provider-wide funding cadence metadata, expressed in seconds. @public */
|
|
73
81
|
export interface ProviderFunding {
|
|
74
82
|
/** Number of seconds represented by the provider's funding rate. */
|
|
75
83
|
ratePeriodSeconds: number
|
|
@@ -77,7 +85,12 @@ export interface ProviderFunding {
|
|
|
77
85
|
payoutCadenceSeconds: number
|
|
78
86
|
}
|
|
79
87
|
|
|
80
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Provider descriptor containing capabilities, actions, categories, and
|
|
90
|
+
* optional deposit/trading limits.
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
81
94
|
export interface Provider {
|
|
82
95
|
key: string
|
|
83
96
|
name: string
|
|
@@ -142,7 +155,7 @@ export interface Provider {
|
|
|
142
155
|
supportedIntervals: OhlcvInterval[]
|
|
143
156
|
}
|
|
144
157
|
|
|
145
|
-
/** @public */
|
|
158
|
+
/** Response containing provider descriptors available to the client. @public */
|
|
146
159
|
export interface ProvidersResponse {
|
|
147
160
|
providers: Provider[]
|
|
148
161
|
}
|
package/src/quote.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { FeeTier } from './account.js'
|
|
2
2
|
import type { FundingInfo } from './market.js'
|
|
3
3
|
|
|
4
|
-
/** @public */
|
|
4
|
+
/** Side of the quoted market order, using lowercase wire values. @public */
|
|
5
5
|
export type QuoteSide = 'buy' | 'sell'
|
|
6
6
|
|
|
7
|
-
/** @public */
|
|
7
|
+
/** Trade instrument kind represented by the quote. @public */
|
|
8
8
|
export type TradeType = 'perps' | 'spot'
|
|
9
9
|
|
|
10
10
|
/**
|
package/src/subscriptions.ts
CHANGED
|
@@ -15,18 +15,18 @@ import type {
|
|
|
15
15
|
} from './market.js'
|
|
16
16
|
import type { Address } from './primitives.js'
|
|
17
17
|
|
|
18
|
-
/** @public */
|
|
18
|
+
/** Subscription for the provider's aggregate market-context stream. @public */
|
|
19
19
|
export type MarketsContextSubscription = {
|
|
20
20
|
channel: 'marketsContext'
|
|
21
21
|
dex: string
|
|
22
22
|
}
|
|
23
|
-
/** @public */
|
|
23
|
+
/** Subscription for one market's live context stream. @public */
|
|
24
24
|
export type MarketContextSubscription = {
|
|
25
25
|
channel: 'marketContext'
|
|
26
26
|
dex: string
|
|
27
27
|
marketId: string
|
|
28
28
|
}
|
|
29
|
-
/** @public */
|
|
29
|
+
/** Subscription for streamed order-book updates for one market. @public */
|
|
30
30
|
export type OrderbookSubscription = {
|
|
31
31
|
channel: 'orderbook'
|
|
32
32
|
dex: string
|
|
@@ -40,51 +40,55 @@ export type OrderbookSubscription = {
|
|
|
40
40
|
*/
|
|
41
41
|
priceStep?: number
|
|
42
42
|
}
|
|
43
|
-
/** @public */
|
|
43
|
+
/** Subscription for OHLCV candle updates for one market and interval. @public */
|
|
44
44
|
export type CandleSubscription = {
|
|
45
45
|
channel: 'candle'
|
|
46
46
|
dex: string
|
|
47
47
|
marketId: string
|
|
48
48
|
interval: OhlcvInterval
|
|
49
49
|
}
|
|
50
|
-
/** @public */
|
|
50
|
+
/** Subscription for recent trade updates for one market. @public */
|
|
51
51
|
export type TradesSubscription = {
|
|
52
52
|
channel: 'trades'
|
|
53
53
|
dex: string
|
|
54
54
|
marketId: string
|
|
55
55
|
}
|
|
56
|
-
/** @public */
|
|
56
|
+
/** Subscription for order lifecycle updates for one account. @public */
|
|
57
57
|
export type OrderUpdatesSubscription = {
|
|
58
58
|
channel: 'orderUpdates'
|
|
59
59
|
dex: string
|
|
60
60
|
address: Address
|
|
61
61
|
}
|
|
62
|
-
/** @public */
|
|
62
|
+
/** Subscription for execution/fill updates for one account. @public */
|
|
63
63
|
export type FillsSubscription = {
|
|
64
64
|
channel: 'fills'
|
|
65
65
|
dex: string
|
|
66
66
|
address: Address
|
|
67
67
|
}
|
|
68
|
-
/** @public */
|
|
68
|
+
/** Subscription for the full open-position set for one account. @public */
|
|
69
69
|
export type PositionsSubscription = {
|
|
70
70
|
channel: 'positions'
|
|
71
71
|
dex: string
|
|
72
72
|
address: Address
|
|
73
73
|
}
|
|
74
|
-
/** @public */
|
|
74
|
+
/** Subscription for spot-balance updates for one account. @public */
|
|
75
75
|
export type SpotBalancesSubscription = {
|
|
76
76
|
channel: 'spotBalances'
|
|
77
77
|
dex: string
|
|
78
78
|
address: Address
|
|
79
79
|
}
|
|
80
|
-
/** @public */
|
|
80
|
+
/** Subscription for aggregate account-summary updates for one account. @public */
|
|
81
81
|
export type AccountSummarySubscription = {
|
|
82
82
|
channel: 'accountSummary'
|
|
83
83
|
dex: string
|
|
84
84
|
address: Address
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Union of all websocket subscription request shapes.
|
|
89
|
+
*
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
88
92
|
export type Subscription =
|
|
89
93
|
| MarketsContextSubscription
|
|
90
94
|
| MarketContextSubscription
|
|
@@ -97,23 +101,23 @@ export type Subscription =
|
|
|
97
101
|
| SpotBalancesSubscription
|
|
98
102
|
| AccountSummarySubscription
|
|
99
103
|
|
|
100
|
-
/** @public */
|
|
104
|
+
/** Event containing the provider's aggregate market contexts. @public */
|
|
101
105
|
export type MarketsContextEvent = {
|
|
102
106
|
channel: 'marketsContext'
|
|
103
107
|
data: Record<string, MarketContext>
|
|
104
108
|
}
|
|
105
|
-
/** @public */
|
|
109
|
+
/** Event containing one market's live context. @public */
|
|
106
110
|
export type MarketContextEvent = {
|
|
107
111
|
channel: 'marketContext'
|
|
108
112
|
data: MarketContext
|
|
109
113
|
}
|
|
110
|
-
/** @public */
|
|
114
|
+
/** Event containing an order-book snapshot or update. @public */
|
|
111
115
|
export type OrderbookEvent = { channel: 'orderbook'; data: OrderbookResponse }
|
|
112
|
-
/** @public */
|
|
116
|
+
/** Event containing one OHLCV candle. @public */
|
|
113
117
|
export type CandleEvent = { channel: 'candle'; data: Candle }
|
|
114
|
-
/** @public */
|
|
118
|
+
/** Event containing recent trades. @public */
|
|
115
119
|
export type TradesEvent = { channel: 'trades'; data: Trade[] }
|
|
116
|
-
/** @public */
|
|
120
|
+
/** Event containing order upserts and terminal order ids. @public */
|
|
117
121
|
export type OrderUpdatesEvent = {
|
|
118
122
|
channel: 'orderUpdates'
|
|
119
123
|
data: {
|
|
@@ -128,7 +132,7 @@ export type OrderUpdatesEvent = {
|
|
|
128
132
|
terminated: string[]
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
|
-
/** @public */
|
|
135
|
+
/** Event containing newly observed executions/fills. @public */
|
|
132
136
|
export type FillsEvent = { channel: 'fills'; data: Fill[] }
|
|
133
137
|
/**
|
|
134
138
|
* Positions stream frame. `data` is always the full set of currently open
|
|
@@ -159,7 +163,11 @@ export type AccountSummaryEvent = {
|
|
|
159
163
|
data: AccountSummary
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Union of all websocket event frame shapes emitted for subscriptions.
|
|
168
|
+
*
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
163
171
|
export type SubscriptionEvent =
|
|
164
172
|
| MarketsContextEvent
|
|
165
173
|
| MarketContextEvent
|
package/src/typedData.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Address, Hex } from './primitives.js'
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* EIP-712 domain fields used to identify a signing domain. `chainId` is the
|
|
5
|
+
* numeric EVM chain id when present.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
4
9
|
export interface TypedDataDomain {
|
|
5
10
|
name?: string
|
|
6
11
|
version?: string
|
|
@@ -9,16 +14,21 @@ export interface TypedDataDomain {
|
|
|
9
14
|
salt?: Hex
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
/** @public */
|
|
17
|
+
/** One named field in an EIP-712 primary type definition. @public */
|
|
13
18
|
export interface TypedDataParameter {
|
|
14
19
|
name: string
|
|
15
20
|
type: string
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
/** @public */
|
|
23
|
+
/** Primary-type name used by a perps EIP-712 payload. @public */
|
|
19
24
|
export type PerpsPrimaryType = string
|
|
20
25
|
|
|
21
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Provider-neutral EIP-712 payload passed between backend and SDK. `message`
|
|
28
|
+
* intentionally remains open because each action defines its own fields.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
22
32
|
export type PerpsTypedData = {
|
|
23
33
|
domain: TypedDataDomain
|
|
24
34
|
types: Record<string, readonly TypedDataParameter[]>
|
|
@@ -26,7 +36,7 @@ export type PerpsTypedData = {
|
|
|
26
36
|
message: Record<string, any>
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
/** @public */
|
|
39
|
+
/** EIP-712 payload accompanied by its client-produced signature. @public */
|
|
30
40
|
export type PerpsSignedTypedData = PerpsTypedData & {
|
|
31
41
|
signature: Hex
|
|
32
42
|
}
|
package/src/vote.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { PerpsTypedData, TypedDataParameter } from './typedData.js'
|
|
|
9
9
|
*/
|
|
10
10
|
export const META_PROVIDER = 'meta'
|
|
11
11
|
|
|
12
|
-
/** @public */
|
|
12
|
+
/** Type alias for the {@link META_PROVIDER} provider-independent sentinel. @public */
|
|
13
13
|
export type MetaProvider = typeof META_PROVIDER
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -34,7 +34,6 @@ export type VoteType = 'provider'
|
|
|
34
34
|
* @public
|
|
35
35
|
*/
|
|
36
36
|
export interface VoteParams {
|
|
37
|
-
/** Key of the inactive provider being voted on (the voted-on subject). */
|
|
38
37
|
targetProvider: string
|
|
39
38
|
direction: VoteDirection
|
|
40
39
|
voteType: VoteType
|
|
@@ -45,7 +44,6 @@ export interface VoteParams {
|
|
|
45
44
|
* @public
|
|
46
45
|
*/
|
|
47
46
|
export interface VoteMessage {
|
|
48
|
-
/** Key of the inactive provider being voted on. */
|
|
49
47
|
targetProvider: string
|
|
50
48
|
direction: VoteDirection
|
|
51
49
|
voteType: VoteType
|