@liberfi.io/ui-perpetuals 0.2.4 → 0.2.5
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/index.d.mts +45 -6
- package/dist/index.d.ts +45 -6
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ declare global {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
declare const _default: "0.2.
|
|
15
|
+
declare const _default: "0.2.5";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Trading pair symbol format
|
|
@@ -566,6 +566,13 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
566
566
|
private readonly timeout;
|
|
567
567
|
private readonly environment;
|
|
568
568
|
private wsManager;
|
|
569
|
+
/**
|
|
570
|
+
* Reference count of active WebSocket consumers. The connection is
|
|
571
|
+
* established on the first `connectWebSocket()` call and torn down
|
|
572
|
+
* only when the last consumer disconnects — see the matching comment
|
|
573
|
+
* on {@link LiberFiPerpetualsClient}.
|
|
574
|
+
*/
|
|
575
|
+
private wsRefCount;
|
|
569
576
|
/**
|
|
570
577
|
* 构造 Hyperliquid 客户端
|
|
571
578
|
*
|
|
@@ -709,7 +716,10 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
709
716
|
/**
|
|
710
717
|
* Disconnect from WebSocket server
|
|
711
718
|
*
|
|
712
|
-
*
|
|
719
|
+
* Decrements the consumer ref count. The underlying socket is closed
|
|
720
|
+
* only when the last consumer disconnects, so concurrent widgets
|
|
721
|
+
* (order book, trades, ticker) can mount/unmount independently
|
|
722
|
+
* without stealing each other's stream.
|
|
713
723
|
*/
|
|
714
724
|
disconnectWebSocket(): void;
|
|
715
725
|
/**
|
|
@@ -1071,6 +1081,14 @@ declare class LiberFiPerpetualsClient implements IPerpetualsClient {
|
|
|
1071
1081
|
private readonly wsEndpoint;
|
|
1072
1082
|
private readonly signTypedData?;
|
|
1073
1083
|
private wsManager;
|
|
1084
|
+
/**
|
|
1085
|
+
* Reference count of active WebSocket consumers (one per React hook
|
|
1086
|
+
* instance). The underlying connection is opened lazily on the first
|
|
1087
|
+
* connect() call and torn down only when the last consumer leaves —
|
|
1088
|
+
* this prevents one widget's unmount from killing the live stream
|
|
1089
|
+
* other widgets (order book, trades, ticker) still depend on.
|
|
1090
|
+
*/
|
|
1091
|
+
private wsRefCount;
|
|
1074
1092
|
constructor(config: LiberFiPerpetualsClientConfig);
|
|
1075
1093
|
getSupportedCoins(): Promise<string[]>;
|
|
1076
1094
|
getMarket(symbol: string): Promise<MarketData | null>;
|
|
@@ -1956,9 +1974,16 @@ type PlaceOrderFormWidgetProps = {
|
|
|
1956
1974
|
maxLeverage?: number;
|
|
1957
1975
|
onSuccess?: () => void;
|
|
1958
1976
|
onError?: (error: Error) => void;
|
|
1977
|
+
/**
|
|
1978
|
+
* Optional callback fired when the user clicks "Add More Funds".
|
|
1979
|
+
* The host app typically opens its deposit dialog here. When omitted,
|
|
1980
|
+
* the button is hidden so the form doesn't expose a non-functional
|
|
1981
|
+
* control.
|
|
1982
|
+
*/
|
|
1983
|
+
onAddFunds?: () => void;
|
|
1959
1984
|
className?: string;
|
|
1960
1985
|
};
|
|
1961
|
-
declare function PlaceOrderFormWidget({ symbol, userAddress, maxLeverage, onSuccess, onError, className, }: PlaceOrderFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
1986
|
+
declare function PlaceOrderFormWidget({ symbol, userAddress, maxLeverage, onSuccess, onError, onAddFunds, className, }: PlaceOrderFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
1962
1987
|
|
|
1963
1988
|
type PlaceOrderFormData = {
|
|
1964
1989
|
price?: number;
|
|
@@ -2012,8 +2037,15 @@ type PlaceOrderFormUIProps = {
|
|
|
2012
2037
|
accountValue: number;
|
|
2013
2038
|
currentPosition?: number;
|
|
2014
2039
|
maxLeverage: number;
|
|
2040
|
+
/**
|
|
2041
|
+
* Optional callback fired when the user clicks the "Add More Funds"
|
|
2042
|
+
* button (typically wired by the host app to open a deposit dialog).
|
|
2043
|
+
* The button is hidden when this prop is omitted, so consumers that
|
|
2044
|
+
* don't support a deposit flow don't render a dead control.
|
|
2045
|
+
*/
|
|
2046
|
+
onAddFunds?: () => void;
|
|
2015
2047
|
};
|
|
2016
|
-
declare function PlaceOrderFormUI({ methods, side, orderType, onSideChange, onOrderTypeChange, onSubmit, isSubmitting, symbol, currentPrice, estimatedFee, liquidationPrice, availableMargin, accountValue, currentPosition, maxLeverage, }: PlaceOrderFormUIProps): react_jsx_runtime.JSX.Element;
|
|
2048
|
+
declare function PlaceOrderFormUI({ methods, side, orderType, onSideChange, onOrderTypeChange, onSubmit, isSubmitting, symbol, currentPrice, estimatedFee, liquidationPrice, availableMargin, accountValue, currentPosition, maxLeverage, onAddFunds, }: PlaceOrderFormUIProps): react_jsx_runtime.JSX.Element;
|
|
2017
2049
|
|
|
2018
2050
|
type PositionsWidgetProps = {
|
|
2019
2051
|
userAddress?: string;
|
|
@@ -2229,9 +2261,16 @@ interface DepositConfirmUIProps {
|
|
|
2229
2261
|
declare function DepositConfirmUI({ isOpen, quote, isExecuting, isExpired, onConfirm, onCancel, onExpire, error, }: DepositConfirmUIProps): react_jsx_runtime.JSX.Element;
|
|
2230
2262
|
|
|
2231
2263
|
/**
|
|
2232
|
-
*
|
|
2264
|
+
* Polished progress / result panel for the SOL → Hyperliquid USDC
|
|
2265
|
+
* deposit flow.
|
|
2266
|
+
*
|
|
2267
|
+
* Visual design intentionally mirrors the swap-style deposit form
|
|
2268
|
+
* modal (dark surface, 14 px radius, accent-color spinner / icons,
|
|
2269
|
+
* pill-style transaction links) so the in-flight, success and failure
|
|
2270
|
+
* states all feel like the same product surface rather than a generic
|
|
2271
|
+
* HeroUI dialog.
|
|
2233
2272
|
*
|
|
2234
|
-
* Renders one of four visual states:
|
|
2273
|
+
* Renders one of four visual states based on the FSM phase:
|
|
2235
2274
|
* - in-progress (broadcasting / submitted / tracking)
|
|
2236
2275
|
* - succeeded
|
|
2237
2276
|
* - refunded
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare global {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
declare const _default: "0.2.
|
|
15
|
+
declare const _default: "0.2.5";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Trading pair symbol format
|
|
@@ -566,6 +566,13 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
566
566
|
private readonly timeout;
|
|
567
567
|
private readonly environment;
|
|
568
568
|
private wsManager;
|
|
569
|
+
/**
|
|
570
|
+
* Reference count of active WebSocket consumers. The connection is
|
|
571
|
+
* established on the first `connectWebSocket()` call and torn down
|
|
572
|
+
* only when the last consumer disconnects — see the matching comment
|
|
573
|
+
* on {@link LiberFiPerpetualsClient}.
|
|
574
|
+
*/
|
|
575
|
+
private wsRefCount;
|
|
569
576
|
/**
|
|
570
577
|
* 构造 Hyperliquid 客户端
|
|
571
578
|
*
|
|
@@ -709,7 +716,10 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
709
716
|
/**
|
|
710
717
|
* Disconnect from WebSocket server
|
|
711
718
|
*
|
|
712
|
-
*
|
|
719
|
+
* Decrements the consumer ref count. The underlying socket is closed
|
|
720
|
+
* only when the last consumer disconnects, so concurrent widgets
|
|
721
|
+
* (order book, trades, ticker) can mount/unmount independently
|
|
722
|
+
* without stealing each other's stream.
|
|
713
723
|
*/
|
|
714
724
|
disconnectWebSocket(): void;
|
|
715
725
|
/**
|
|
@@ -1071,6 +1081,14 @@ declare class LiberFiPerpetualsClient implements IPerpetualsClient {
|
|
|
1071
1081
|
private readonly wsEndpoint;
|
|
1072
1082
|
private readonly signTypedData?;
|
|
1073
1083
|
private wsManager;
|
|
1084
|
+
/**
|
|
1085
|
+
* Reference count of active WebSocket consumers (one per React hook
|
|
1086
|
+
* instance). The underlying connection is opened lazily on the first
|
|
1087
|
+
* connect() call and torn down only when the last consumer leaves —
|
|
1088
|
+
* this prevents one widget's unmount from killing the live stream
|
|
1089
|
+
* other widgets (order book, trades, ticker) still depend on.
|
|
1090
|
+
*/
|
|
1091
|
+
private wsRefCount;
|
|
1074
1092
|
constructor(config: LiberFiPerpetualsClientConfig);
|
|
1075
1093
|
getSupportedCoins(): Promise<string[]>;
|
|
1076
1094
|
getMarket(symbol: string): Promise<MarketData | null>;
|
|
@@ -1956,9 +1974,16 @@ type PlaceOrderFormWidgetProps = {
|
|
|
1956
1974
|
maxLeverage?: number;
|
|
1957
1975
|
onSuccess?: () => void;
|
|
1958
1976
|
onError?: (error: Error) => void;
|
|
1977
|
+
/**
|
|
1978
|
+
* Optional callback fired when the user clicks "Add More Funds".
|
|
1979
|
+
* The host app typically opens its deposit dialog here. When omitted,
|
|
1980
|
+
* the button is hidden so the form doesn't expose a non-functional
|
|
1981
|
+
* control.
|
|
1982
|
+
*/
|
|
1983
|
+
onAddFunds?: () => void;
|
|
1959
1984
|
className?: string;
|
|
1960
1985
|
};
|
|
1961
|
-
declare function PlaceOrderFormWidget({ symbol, userAddress, maxLeverage, onSuccess, onError, className, }: PlaceOrderFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
1986
|
+
declare function PlaceOrderFormWidget({ symbol, userAddress, maxLeverage, onSuccess, onError, onAddFunds, className, }: PlaceOrderFormWidgetProps): react_jsx_runtime.JSX.Element;
|
|
1962
1987
|
|
|
1963
1988
|
type PlaceOrderFormData = {
|
|
1964
1989
|
price?: number;
|
|
@@ -2012,8 +2037,15 @@ type PlaceOrderFormUIProps = {
|
|
|
2012
2037
|
accountValue: number;
|
|
2013
2038
|
currentPosition?: number;
|
|
2014
2039
|
maxLeverage: number;
|
|
2040
|
+
/**
|
|
2041
|
+
* Optional callback fired when the user clicks the "Add More Funds"
|
|
2042
|
+
* button (typically wired by the host app to open a deposit dialog).
|
|
2043
|
+
* The button is hidden when this prop is omitted, so consumers that
|
|
2044
|
+
* don't support a deposit flow don't render a dead control.
|
|
2045
|
+
*/
|
|
2046
|
+
onAddFunds?: () => void;
|
|
2015
2047
|
};
|
|
2016
|
-
declare function PlaceOrderFormUI({ methods, side, orderType, onSideChange, onOrderTypeChange, onSubmit, isSubmitting, symbol, currentPrice, estimatedFee, liquidationPrice, availableMargin, accountValue, currentPosition, maxLeverage, }: PlaceOrderFormUIProps): react_jsx_runtime.JSX.Element;
|
|
2048
|
+
declare function PlaceOrderFormUI({ methods, side, orderType, onSideChange, onOrderTypeChange, onSubmit, isSubmitting, symbol, currentPrice, estimatedFee, liquidationPrice, availableMargin, accountValue, currentPosition, maxLeverage, onAddFunds, }: PlaceOrderFormUIProps): react_jsx_runtime.JSX.Element;
|
|
2017
2049
|
|
|
2018
2050
|
type PositionsWidgetProps = {
|
|
2019
2051
|
userAddress?: string;
|
|
@@ -2229,9 +2261,16 @@ interface DepositConfirmUIProps {
|
|
|
2229
2261
|
declare function DepositConfirmUI({ isOpen, quote, isExecuting, isExpired, onConfirm, onCancel, onExpire, error, }: DepositConfirmUIProps): react_jsx_runtime.JSX.Element;
|
|
2230
2262
|
|
|
2231
2263
|
/**
|
|
2232
|
-
*
|
|
2264
|
+
* Polished progress / result panel for the SOL → Hyperliquid USDC
|
|
2265
|
+
* deposit flow.
|
|
2266
|
+
*
|
|
2267
|
+
* Visual design intentionally mirrors the swap-style deposit form
|
|
2268
|
+
* modal (dark surface, 14 px radius, accent-color spinner / icons,
|
|
2269
|
+
* pill-style transaction links) so the in-flight, success and failure
|
|
2270
|
+
* states all feel like the same product surface rather than a generic
|
|
2271
|
+
* HeroUI dialog.
|
|
2233
2272
|
*
|
|
2234
|
-
* Renders one of four visual states:
|
|
2273
|
+
* Renders one of four visual states based on the FSM phase:
|
|
2235
2274
|
* - in-progress (broadcasting / submitted / tracking)
|
|
2236
2275
|
* - succeeded
|
|
2237
2276
|
* - refunded
|