@liberfi.io/ui-perpetuals 0.2.22 → 0.3.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/README.md +9 -5
- package/dist/index.d.mts +822 -66
- package/dist/index.d.ts +822 -66
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -42,12 +42,12 @@ Required peer dependencies:
|
|
|
42
42
|
- `PositionsUI(props: PositionsUIProps)` — controlled, presentational positions table (div+flex layout, 9 columns, sortable headers, header tooltips, zebra striping, `min-w-[1000px]` + horizontal scroll). The `Mark Price`, `Margin Used (PNL)`, and `TP / SL` columns are kept live by `useAccountStateSubscription` (webData2): each push re-marks every position against the venue's `markPx`, recomputes PnL, and re-derives the closing-side TP/SL trigger prices client-side, so the table updates at the same cadence as the order book — no extra subscription needed at the widget level.
|
|
43
43
|
- `PositionsSkeleton()`
|
|
44
44
|
- `PositionsEmpty()`
|
|
45
|
-
- `OpenOrdersWidget(props: OpenOrdersWidgetProps)`
|
|
46
|
-
- `OpenOrdersUI(props: OpenOrdersUIProps)`
|
|
45
|
+
- `OpenOrdersWidget(props: OpenOrdersWidgetProps)` — wires `useOpenOrdersScript` to `OpenOrdersUI`; owns sort state, the per-row cancel mutation, and a confirmation dialog for the destructive `Cancel All` action
|
|
46
|
+
- `OpenOrdersUI(props: OpenOrdersUIProps)` — controlled, presentational open-orders table (div+flex layout, 12 columns mirroring Axiom 1:1, 9 sortable headers, `Leverage` header tooltip, zebra striping, `min-w-[1100px]` + horizontal scroll). The `Current Price` column reads each order's live mark price; `TP / SL` reads the parent limit order's `children[]` array (Hyperliquid's authoritative bundled-exit field), so the table updates at the same cadence as the order book — no extra subscription needed at the widget level.
|
|
47
47
|
- `OpenOrdersSkeleton()`
|
|
48
48
|
- `OpenOrdersEmpty()`
|
|
49
|
-
- `TradeHistoryWidget(props: TradeHistoryWidgetProps)`
|
|
50
|
-
- `TradeHistoryUI(props: TradeHistoryUIProps)`
|
|
49
|
+
- `TradeHistoryWidget(props: TradeHistoryWidgetProps)` — wires `useTradeHistoryScript` to `TradeHistoryUI`; thin pass-through (no destructive actions to gate). Defaults to all-coin display so the bottom-panel UX matches Positions / Open Orders.
|
|
50
|
+
- `TradeHistoryUI(props: TradeHistoryUIProps)` — controlled, presentational user-fills table (div+flex layout, 7 columns mirroring Axiom 1:1 minus the Share column, all 7 headers sortable, **virtualized via `react-window`** since `userFills` can return thousands of records, zebra striping, `min-w-[1100px]` + horizontal scroll). The `Description` column passes through Hyperliquid's `dir` string (`"Open Long"` / `"Close Short"` / `"Market liquidation triggered at <px>"`) and colours it by trade direction (buy=bullish, sell/liquidation=bearish). `Closed PnL` always renders the signed value (`+$0.06` / `-$0.06`) so the dollar amount stays readable in copy-paste / high-contrast modes.
|
|
51
51
|
- `TradeHistorySkeleton()`
|
|
52
52
|
- `TradeHistoryEmpty()`
|
|
53
53
|
- `PerpetualsProvider(props: PerpetualsProviderProps)`
|
|
@@ -125,6 +125,9 @@ Required peer dependencies:
|
|
|
125
125
|
- Positions table sort:
|
|
126
126
|
- `PositionSortKey` — discriminated string union of the seven sortable columns (`asset`, `position`, `value`, `entry`, `mark`, `liq`, `marginPnl`)
|
|
127
127
|
- `SortDirection` — `"asc" | "desc"`
|
|
128
|
+
- Trade History table sort:
|
|
129
|
+
- `TradeHistorySortKey` — discriminated string union of the seven sortable columns (`time`, `size`, `asset`, `description`, `price`, `tradeValue`, `closedPnl`)
|
|
130
|
+
- `SortDirection` — `"asc" | "desc"`
|
|
128
131
|
|
|
129
132
|
### Constants
|
|
130
133
|
|
|
@@ -268,7 +271,8 @@ checklist UI without reimplementing the transition rules.
|
|
|
268
271
|
## Future Improvements
|
|
269
272
|
|
|
270
273
|
- Add integration tests for order submit/cancel and subscription lifecycle.
|
|
271
|
-
- Finish i18n wiring across the remaining widgets (`
|
|
274
|
+
- Finish i18n wiring across the remaining widgets (`TradesUI`); positions / open-orders / trade-history tables are fully translated under their respective `perpetuals.*` namespaces.
|
|
275
|
+
- Wire a real-time `userFills` push subscription into `useTradeHistoryScript` so new fills appear instantly (today the script polls via React Query with a 5 s `staleTime`). The hook surface already accepts the data path; the only missing piece is a `subscribeUserData('fills')` listener that prepends new fills to the React Query cache for `tradesQueryKey`.
|
|
272
276
|
- Surface a **per-position TP/SL editor** behind the small `Edit` icon Axiom shows in the TP/SL cell. The data plumbing already lands the active trigger prices on each `Position` (`takeProfitPrice` / `stopLossPrice`); a popover that calls `useCreateOrderMutation` with `reduceOnly: true` triggers would complete the loop.
|
|
273
277
|
- Wire a **Limit close** action in the positions row's `Close` cell. Today only the `Market` close button is rendered; reusing the place-order form's limit-price input from a popover would close the gap.
|
|
274
278
|
- Replace placeholder account/margin values in place-order script with real account sources.
|