@liberfi.io/ui-perpetuals 1.1.70 → 1.1.72
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 +229 -137
- package/dist/index.d.ts +229 -137
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -10
package/dist/index.d.mts
CHANGED
|
@@ -283,7 +283,7 @@ interface AccountState {
|
|
|
283
283
|
*/
|
|
284
284
|
universe?: UniverseSnapshot;
|
|
285
285
|
/** Raw payload from the venue (untransformed) for debugging. */
|
|
286
|
-
raw?:
|
|
286
|
+
raw?: unknown;
|
|
287
287
|
}
|
|
288
288
|
/**
|
|
289
289
|
* Position information
|
|
@@ -716,7 +716,7 @@ interface PlaceOrderResult {
|
|
|
716
716
|
*/
|
|
717
717
|
avgPrice?: number;
|
|
718
718
|
/** Raw response data (for debugging, optional) */
|
|
719
|
-
raw?:
|
|
719
|
+
raw?: unknown;
|
|
720
720
|
}
|
|
721
721
|
/**
|
|
722
722
|
* Cancel order result
|
|
@@ -733,7 +733,7 @@ interface CancelOrderResult {
|
|
|
733
733
|
/** Cancel timestamp (milliseconds) */
|
|
734
734
|
timestamp: number;
|
|
735
735
|
/** Raw response data (for debugging, optional) */
|
|
736
|
-
raw?:
|
|
736
|
+
raw?: unknown;
|
|
737
737
|
}
|
|
738
738
|
/**
|
|
739
739
|
* Get positions result
|
|
@@ -748,7 +748,7 @@ interface GetPositionsResult {
|
|
|
748
748
|
/** Total unrealized PnL (optional) */
|
|
749
749
|
totalUnrealizedPnl?: number;
|
|
750
750
|
/** Raw response data (for debugging, optional) */
|
|
751
|
-
raw?:
|
|
751
|
+
raw?: unknown;
|
|
752
752
|
}
|
|
753
753
|
/**
|
|
754
754
|
* Get open orders result
|
|
@@ -759,7 +759,7 @@ interface GetOpenOrdersResult {
|
|
|
759
759
|
/** Total order count (optional) */
|
|
760
760
|
totalCount?: number;
|
|
761
761
|
/** Raw response data (for debugging, optional) */
|
|
762
|
-
raw?:
|
|
762
|
+
raw?: unknown;
|
|
763
763
|
}
|
|
764
764
|
/**
|
|
765
765
|
* Get trades result
|
|
@@ -770,7 +770,7 @@ interface GetTradesResult {
|
|
|
770
770
|
/** Total trade count (optional) */
|
|
771
771
|
totalCount?: number;
|
|
772
772
|
/** Raw response data (for debugging, optional) */
|
|
773
|
-
raw?:
|
|
773
|
+
raw?: unknown;
|
|
774
774
|
}
|
|
775
775
|
/**
|
|
776
776
|
* Perpetuals client interface
|
|
@@ -943,7 +943,7 @@ interface IPerpetualsClient {
|
|
|
943
943
|
* price buckets. Implementations may ignore unknown options.
|
|
944
944
|
* @returns Subscription ID (for unsubscribing)
|
|
945
945
|
*/
|
|
946
|
-
subscribeMarketData(type: "ticker" | "trades" | "orderBook", symbol: string, callback: (data:
|
|
946
|
+
subscribeMarketData(type: "ticker" | "trades" | "orderBook", symbol: string, callback: (data: unknown) => void, options?: {
|
|
947
947
|
aggregation?: OrderBookAggregationOptions;
|
|
948
948
|
}): string;
|
|
949
949
|
/**
|
|
@@ -961,7 +961,7 @@ interface IPerpetualsClient {
|
|
|
961
961
|
* @param callback Data callback function
|
|
962
962
|
* @returns Subscription ID (for unsubscribing)
|
|
963
963
|
*/
|
|
964
|
-
subscribeUserData(type: "orders" | "positions" | "fills", userAddress: string, callback: (data:
|
|
964
|
+
subscribeUserData(type: "orders" | "positions" | "fills", userAddress: string, callback: (data: unknown) => void): string;
|
|
965
965
|
/**
|
|
966
966
|
* Subscribe to the user's full account state via a single push
|
|
967
967
|
* channel (Hyperliquid `webData2`, Drift `userAccount`, etc.).
|
|
@@ -1337,7 +1337,7 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
1337
1337
|
*
|
|
1338
1338
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint
|
|
1339
1339
|
*/
|
|
1340
|
-
placeOrder(
|
|
1340
|
+
placeOrder(params: PlaceOrderParams): Promise<PlaceOrderResult>;
|
|
1341
1341
|
/**
|
|
1342
1342
|
* 取消订单
|
|
1343
1343
|
*
|
|
@@ -1350,7 +1350,7 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
1350
1350
|
*
|
|
1351
1351
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint
|
|
1352
1352
|
*/
|
|
1353
|
-
cancelOrder(
|
|
1353
|
+
cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;
|
|
1354
1354
|
/**
|
|
1355
1355
|
* 获取用户持仓信息
|
|
1356
1356
|
*
|
|
@@ -1443,7 +1443,7 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
1443
1443
|
* wide-range books at coarse aggregation steps (e.g. $1000 buckets).
|
|
1444
1444
|
* @returns Subscription ID (for unsubscribing)
|
|
1445
1445
|
*/
|
|
1446
|
-
subscribeMarketData(type: "ticker" | "trades" | "orderBook", symbol: string, callback: (data:
|
|
1446
|
+
subscribeMarketData(type: "ticker" | "trades" | "orderBook", symbol: string, callback: (data: unknown) => void, options?: {
|
|
1447
1447
|
aggregation?: OrderBookAggregation;
|
|
1448
1448
|
}): string;
|
|
1449
1449
|
/**
|
|
@@ -1463,7 +1463,7 @@ declare class HyperliquidPerpetualsClient implements IPerpetualsClient {
|
|
|
1463
1463
|
* @param callback Data callback function
|
|
1464
1464
|
* @returns Subscription ID (for unsubscribing)
|
|
1465
1465
|
*/
|
|
1466
|
-
subscribeUserData(type: "orders" | "positions" | "fills", userAddress: string, callback: (data:
|
|
1466
|
+
subscribeUserData(type: "orders" | "positions" | "fills", userAddress: string, callback: (data: unknown) => void): string;
|
|
1467
1467
|
/**
|
|
1468
1468
|
* Subscribe to the user's full account state via Hyperliquid's
|
|
1469
1469
|
* `webData2` channel. Each push carries a complete snapshot of:
|
|
@@ -1860,7 +1860,7 @@ declare class LiberFiPerpetualsClient implements IPerpetualsClient {
|
|
|
1860
1860
|
* default leverage without raising — the perpetuals-server can grow
|
|
1861
1861
|
* this endpoint later and we'll plug it in here.
|
|
1862
1862
|
*/
|
|
1863
|
-
getActiveAssetLeverage(
|
|
1863
|
+
getActiveAssetLeverage(params: GetActiveAssetLeverageParams): Promise<ActiveAssetLeverage | null>;
|
|
1864
1864
|
/**
|
|
1865
1865
|
* The LiberFi backend doesn't currently surface per-asset
|
|
1866
1866
|
* `szDecimals` / `maxLeverage` over a dedicated endpoint. We could
|
|
@@ -1874,7 +1874,7 @@ declare class LiberFiPerpetualsClient implements IPerpetualsClient {
|
|
|
1874
1874
|
* `maxLeverage`) so this can resolve without a side trip to the
|
|
1875
1875
|
* upstream venue.
|
|
1876
1876
|
*/
|
|
1877
|
-
getAssetMeta(
|
|
1877
|
+
getAssetMeta(params: GetAssetMetaParams): Promise<AssetMeta | null>;
|
|
1878
1878
|
placeOrder(params: PlaceOrderParams): Promise<PlaceOrderResult>;
|
|
1879
1879
|
cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;
|
|
1880
1880
|
connectWebSocket(): Promise<void>;
|
|
@@ -2170,128 +2170,97 @@ interface EvmDepositAdapter {
|
|
|
2170
2170
|
sendTransaction(tx: EvmTxRequest): Promise<string>;
|
|
2171
2171
|
}
|
|
2172
2172
|
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2173
|
+
interface PerpetualMarketCapability {
|
|
2174
|
+
getSupportedCoins(): Promise<string[]>;
|
|
2175
|
+
getMarket(symbol: string): Promise<MarketData | null>;
|
|
2176
|
+
getMarkets(symbols?: string[]): Promise<MarketData[]>;
|
|
2177
|
+
getKlines(symbol: string, interval: KlineInterval, limitOrOptions?: number | KlineQueryOptions): Promise<Kline[]>;
|
|
2178
|
+
getOrderBook(symbol: string, maxLevel?: number, options?: OrderBookAggregationOptions): Promise<OrderBook>;
|
|
2179
|
+
getRecentTrades(symbol: string, limit?: number): Promise<Trade[]>;
|
|
2180
|
+
getUniverseSnapshot(): Promise<UniverseSnapshot>;
|
|
2181
|
+
getAssetMeta(params: GetAssetMetaParams): Promise<AssetMeta | null>;
|
|
2182
|
+
}
|
|
2183
|
+
interface PerpetualAccountCapability {
|
|
2184
|
+
getPositions(params?: GetPositionsParams): Promise<GetPositionsResult>;
|
|
2185
|
+
getOpenOrders(params?: GetOpenOrdersParams): Promise<GetOpenOrdersResult>;
|
|
2186
|
+
getTrades(params?: GetTradesParams): Promise<GetTradesResult>;
|
|
2187
|
+
getActiveAssetLeverage(params: GetActiveAssetLeverageParams): Promise<ActiveAssetLeverage | null>;
|
|
2188
|
+
}
|
|
2189
|
+
interface PerpetualExecutionCapability {
|
|
2190
|
+
placeOrder(params: PlaceOrderParams): Promise<PlaceOrderResult>;
|
|
2191
|
+
cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;
|
|
2192
|
+
}
|
|
2193
|
+
interface PerpetualRealtimeCapability {
|
|
2194
|
+
connectWebSocket(): Promise<void>;
|
|
2195
|
+
disconnectWebSocket(): void;
|
|
2196
|
+
subscribeMarketData(type: "ticker" | "trades" | "orderBook", symbol: string, callback: (data: unknown) => void, options?: {
|
|
2197
|
+
aggregation?: OrderBookAggregationOptions;
|
|
2198
|
+
}): string;
|
|
2199
|
+
subscribeCandles(symbol: string, interval: KlineInterval, callback: (candle: Kline) => void): string;
|
|
2200
|
+
subscribeUserData(type: "orders" | "positions" | "fills", userAddress: string, callback: (data: unknown) => void): string;
|
|
2201
|
+
subscribeAccountState?(userAddress: string, callback: (state: AccountState) => void): string;
|
|
2202
|
+
unsubscribe(subscriptionId: string): void;
|
|
2203
|
+
}
|
|
2204
|
+
interface PerpetualCapabilityBundle {
|
|
2205
|
+
market: PerpetualMarketCapability;
|
|
2206
|
+
account: PerpetualAccountCapability;
|
|
2207
|
+
execution: PerpetualExecutionCapability;
|
|
2208
|
+
realtime: PerpetualRealtimeCapability;
|
|
2209
|
+
}
|
|
2191
2210
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
quote: DepositQuoteResponse;
|
|
2246
|
-
} | {
|
|
2247
|
-
type: "QUOTE_FAILED";
|
|
2248
|
-
error: DepositErrorInfo;
|
|
2249
|
-
} | {
|
|
2250
|
-
type: "QUOTE_EXPIRED";
|
|
2251
|
-
} | {
|
|
2252
|
-
type: "SIGN_START";
|
|
2253
|
-
} | {
|
|
2254
|
-
type: "SIGN_FAILED";
|
|
2255
|
-
error: DepositErrorInfo;
|
|
2256
|
-
} | {
|
|
2257
|
-
type: "BROADCAST_START";
|
|
2258
|
-
} | {
|
|
2259
|
-
type: "BROADCAST_FAILED";
|
|
2260
|
-
error: DepositErrorInfo;
|
|
2261
|
-
} | {
|
|
2262
|
-
type: "SUBMIT_OK";
|
|
2263
|
-
intentId: string;
|
|
2264
|
-
/** Origin-chain tx hash (Solana signature or EVM 0x-hash). */
|
|
2265
|
-
originTxHash: string;
|
|
2266
|
-
} | {
|
|
2267
|
-
type: "SUBMIT_FAILED";
|
|
2268
|
-
error: DepositErrorInfo;
|
|
2269
|
-
} | {
|
|
2270
|
-
type: "STATUS_UPDATE";
|
|
2271
|
-
status: DepositStatusResponse;
|
|
2272
|
-
};
|
|
2273
|
-
declare const initialDepositState: DepositState;
|
|
2274
|
-
/**
|
|
2275
|
-
* Transition function. Pure, total — every (state, event) pair is
|
|
2276
|
-
* handled. Unknown transitions are no-ops (return current state); we
|
|
2277
|
-
* don't throw because hooks may fan out events optimistically (e.g. a
|
|
2278
|
-
* stale STATUS_UPDATE arriving after RESET).
|
|
2279
|
-
*/
|
|
2280
|
-
declare function reduceDepositState(state: DepositState, event: DepositEvent): DepositState;
|
|
2281
|
-
/** True when the FSM has reached a terminal phase. */
|
|
2282
|
-
declare function isTerminal(state: DepositState): boolean;
|
|
2283
|
-
/** True when the UI should keep polling /status. */
|
|
2284
|
-
declare function isPolling(state: DepositState): boolean;
|
|
2285
|
-
/** Returns the current backend lifecycle status, if any. */
|
|
2286
|
-
declare function currentStatus(state: DepositState): DepositStatus | undefined;
|
|
2287
|
-
/** Returns the breakdown the UI should display, if any. */
|
|
2288
|
-
declare function currentBreakdown(state: DepositState): DepositBreakdown | undefined;
|
|
2289
|
-
/**
|
|
2290
|
-
* Returns true when the phase is terminal *and* corresponds to one of
|
|
2291
|
-
* the known DepositStatus terminal values. Useful for analytics fan-out
|
|
2292
|
-
* (only emit the funnel-end event once per intent).
|
|
2293
|
-
*/
|
|
2294
|
-
declare function isTerminalLifecycle(status: DepositStatus | undefined): boolean;
|
|
2211
|
+
declare class PerpetualDisconnectedError extends Error {
|
|
2212
|
+
constructor();
|
|
2213
|
+
}
|
|
2214
|
+
declare class PerpetualRejectedError extends Error {
|
|
2215
|
+
constructor();
|
|
2216
|
+
}
|
|
2217
|
+
declare function createInMemoryPerpetualCapabilities(options?: {
|
|
2218
|
+
coins?: string[];
|
|
2219
|
+
disconnected?: boolean;
|
|
2220
|
+
rejectOrders?: boolean;
|
|
2221
|
+
}): PerpetualCapabilityBundle;
|
|
2222
|
+
|
|
2223
|
+
interface PerpetualDataRuntime {
|
|
2224
|
+
readonly generation: number;
|
|
2225
|
+
connect(): Promise<void>;
|
|
2226
|
+
disconnect(): void;
|
|
2227
|
+
getUniverseSnapshot(): Promise<UniverseSnapshot>;
|
|
2228
|
+
getMarket: PerpetualMarketCapability["getMarket"];
|
|
2229
|
+
getPositions: PerpetualAccountCapability["getPositions"];
|
|
2230
|
+
subscribeMarketData(type: "ticker" | "trades" | "orderBook", symbol: string, callback: (data: unknown) => void, options?: {
|
|
2231
|
+
aggregation?: OrderBookAggregationOptions;
|
|
2232
|
+
}): {
|
|
2233
|
+
unsubscribe(): void;
|
|
2234
|
+
};
|
|
2235
|
+
subscribeCandles(symbol: string, interval: KlineInterval, callback: (candle: Kline) => void): {
|
|
2236
|
+
unsubscribe(): void;
|
|
2237
|
+
};
|
|
2238
|
+
subscriptionCount(): number;
|
|
2239
|
+
}
|
|
2240
|
+
declare function createPerpetualDataRuntime(ports: {
|
|
2241
|
+
market: PerpetualMarketCapability;
|
|
2242
|
+
account: PerpetualAccountCapability;
|
|
2243
|
+
realtime: PerpetualRealtimeCapability;
|
|
2244
|
+
}): PerpetualDataRuntime;
|
|
2245
|
+
|
|
2246
|
+
type PerpetualExecutionStatus = "idle" | "signing" | "submitting" | "pending" | "succeeded" | "failed" | "rejected" | "disconnected";
|
|
2247
|
+
interface PerpetualExecutionSnapshot {
|
|
2248
|
+
status: PerpetualExecutionStatus;
|
|
2249
|
+
result?: PlaceOrderResult;
|
|
2250
|
+
error?: Error;
|
|
2251
|
+
}
|
|
2252
|
+
interface PerpetualSignerPort {
|
|
2253
|
+
sign(params: PlaceOrderParams): Promise<void>;
|
|
2254
|
+
}
|
|
2255
|
+
interface PerpetualExecutionRuntime {
|
|
2256
|
+
snapshot(): PerpetualExecutionSnapshot;
|
|
2257
|
+
submit(params: PlaceOrderParams): Promise<PerpetualExecutionSnapshot>;
|
|
2258
|
+
}
|
|
2259
|
+
declare function createPerpetualExecutionRuntime(options: {
|
|
2260
|
+
execution: PerpetualExecutionCapability;
|
|
2261
|
+
signer?: PerpetualSignerPort;
|
|
2262
|
+
onChange?: (snapshot: PerpetualExecutionSnapshot) => void;
|
|
2263
|
+
}): PerpetualExecutionRuntime;
|
|
2295
2264
|
|
|
2296
2265
|
/**
|
|
2297
2266
|
* Perpetuals context value type
|
|
@@ -2828,6 +2797,129 @@ interface UsePerpDepositQuoteOptions extends Omit<UseQueryOptions<DepositQuoteRe
|
|
|
2828
2797
|
*/
|
|
2829
2798
|
declare function usePerpDepositQuote(req: DepositQuoteRequest | null | undefined, options?: UsePerpDepositQuoteOptions): _tanstack_react_query.UseQueryResult<DepositQuoteResponse, Error>;
|
|
2830
2799
|
|
|
2800
|
+
/**
|
|
2801
|
+
* Pure state machine for the deposit UI.
|
|
2802
|
+
*
|
|
2803
|
+
* The backend owns the *authoritative* lifecycle (broadcasted → relay_*
|
|
2804
|
+
* → settled / refunded / failed / stuck). The frontend has a few extra
|
|
2805
|
+
* states *before* we can call /submit (idle, quoting, ready_to_sign,
|
|
2806
|
+
* signing, broadcasting). We model both halves here as a single FSM so
|
|
2807
|
+
* presentational components can switch on a single tag.
|
|
2808
|
+
*
|
|
2809
|
+
* Engineering principles applied:
|
|
2810
|
+
* - First principles: a state is a *type*, transitions are pure
|
|
2811
|
+
* functions over (state, event) → state. No timers, no fetch, no
|
|
2812
|
+
* setState — those live in hooks.
|
|
2813
|
+
* - Single responsibility: this file knows nothing about HTTP, React,
|
|
2814
|
+
* or wallets. It is unit-testable in isolation.
|
|
2815
|
+
* - Extensibility: add a new event by extending DepositEvent + a case
|
|
2816
|
+
* in `reduceDepositState`. The compiler enforces exhaustiveness.
|
|
2817
|
+
*/
|
|
2818
|
+
|
|
2819
|
+
/** UI-only state tags. Server-driven tags are a subset of DepositStatus. */
|
|
2820
|
+
type DepositPhase = "idle" | "quoting" | "ready_to_sign" | "signing" | "broadcasting" | "submitted" | "tracking" | "succeeded" | "refunded" | "failed" | "expired";
|
|
2821
|
+
/** Discriminated union representing the entire deposit flow at any moment. */
|
|
2822
|
+
type DepositState = {
|
|
2823
|
+
phase: "idle";
|
|
2824
|
+
} | {
|
|
2825
|
+
phase: "quoting";
|
|
2826
|
+
} | {
|
|
2827
|
+
phase: "ready_to_sign";
|
|
2828
|
+
quote: DepositQuoteResponse;
|
|
2829
|
+
/** Epoch ms — caller pre-computes for stable comparisons. */
|
|
2830
|
+
expiresAtMs: number;
|
|
2831
|
+
} | {
|
|
2832
|
+
phase: "signing";
|
|
2833
|
+
quote: DepositQuoteResponse;
|
|
2834
|
+
} | {
|
|
2835
|
+
phase: "broadcasting";
|
|
2836
|
+
quote: DepositQuoteResponse;
|
|
2837
|
+
} | {
|
|
2838
|
+
phase: "submitted";
|
|
2839
|
+
quote: DepositQuoteResponse;
|
|
2840
|
+
intentId: string;
|
|
2841
|
+
/** Origin-chain tx hash (Solana signature or EVM 0x-hash). */
|
|
2842
|
+
originTxHash: string;
|
|
2843
|
+
} | {
|
|
2844
|
+
phase: "tracking";
|
|
2845
|
+
intentId: string;
|
|
2846
|
+
status: DepositStatusResponse;
|
|
2847
|
+
} | {
|
|
2848
|
+
phase: "succeeded";
|
|
2849
|
+
intentId: string;
|
|
2850
|
+
status: DepositStatusResponse;
|
|
2851
|
+
} | {
|
|
2852
|
+
phase: "refunded";
|
|
2853
|
+
intentId: string;
|
|
2854
|
+
status: DepositStatusResponse;
|
|
2855
|
+
} | {
|
|
2856
|
+
phase: "failed";
|
|
2857
|
+
error: DepositErrorInfo;
|
|
2858
|
+
/** Populated when the failure happened post-submit. */
|
|
2859
|
+
intentId?: string;
|
|
2860
|
+
status?: DepositStatusResponse;
|
|
2861
|
+
} | {
|
|
2862
|
+
phase: "expired";
|
|
2863
|
+
quote: DepositQuoteResponse;
|
|
2864
|
+
};
|
|
2865
|
+
/** Events the FSM can react to. Driven by hooks/components. */
|
|
2866
|
+
type DepositEvent = {
|
|
2867
|
+
type: "RESET";
|
|
2868
|
+
} | {
|
|
2869
|
+
type: "QUOTE_REQUEST";
|
|
2870
|
+
} | {
|
|
2871
|
+
type: "QUOTE_RECEIVED";
|
|
2872
|
+
quote: DepositQuoteResponse;
|
|
2873
|
+
} | {
|
|
2874
|
+
type: "QUOTE_FAILED";
|
|
2875
|
+
error: DepositErrorInfo;
|
|
2876
|
+
} | {
|
|
2877
|
+
type: "QUOTE_EXPIRED";
|
|
2878
|
+
} | {
|
|
2879
|
+
type: "SIGN_START";
|
|
2880
|
+
} | {
|
|
2881
|
+
type: "SIGN_FAILED";
|
|
2882
|
+
error: DepositErrorInfo;
|
|
2883
|
+
} | {
|
|
2884
|
+
type: "BROADCAST_START";
|
|
2885
|
+
} | {
|
|
2886
|
+
type: "BROADCAST_FAILED";
|
|
2887
|
+
error: DepositErrorInfo;
|
|
2888
|
+
} | {
|
|
2889
|
+
type: "SUBMIT_OK";
|
|
2890
|
+
intentId: string;
|
|
2891
|
+
/** Origin-chain tx hash (Solana signature or EVM 0x-hash). */
|
|
2892
|
+
originTxHash: string;
|
|
2893
|
+
} | {
|
|
2894
|
+
type: "SUBMIT_FAILED";
|
|
2895
|
+
error: DepositErrorInfo;
|
|
2896
|
+
} | {
|
|
2897
|
+
type: "STATUS_UPDATE";
|
|
2898
|
+
status: DepositStatusResponse;
|
|
2899
|
+
};
|
|
2900
|
+
declare const initialDepositState: DepositState;
|
|
2901
|
+
/**
|
|
2902
|
+
* Transition function. Pure, total — every (state, event) pair is
|
|
2903
|
+
* handled. Unknown transitions are no-ops (return current state); we
|
|
2904
|
+
* don't throw because hooks may fan out events optimistically (e.g. a
|
|
2905
|
+
* stale STATUS_UPDATE arriving after RESET).
|
|
2906
|
+
*/
|
|
2907
|
+
declare function reduceDepositState(state: DepositState, event: DepositEvent): DepositState;
|
|
2908
|
+
/** True when the FSM has reached a terminal phase. */
|
|
2909
|
+
declare function isTerminal(state: DepositState): boolean;
|
|
2910
|
+
/** True when the UI should keep polling /status. */
|
|
2911
|
+
declare function isPolling(state: DepositState): boolean;
|
|
2912
|
+
/** Returns the current backend lifecycle status, if any. */
|
|
2913
|
+
declare function currentStatus(state: DepositState): DepositStatus | undefined;
|
|
2914
|
+
/** Returns the breakdown the UI should display, if any. */
|
|
2915
|
+
declare function currentBreakdown(state: DepositState): DepositBreakdown | undefined;
|
|
2916
|
+
/**
|
|
2917
|
+
* Returns true when the phase is terminal *and* corresponds to one of
|
|
2918
|
+
* the known DepositStatus terminal values. Useful for analytics fan-out
|
|
2919
|
+
* (only emit the funnel-end event once per intent).
|
|
2920
|
+
*/
|
|
2921
|
+
declare function isTerminalLifecycle(status: DepositStatus | undefined): boolean;
|
|
2922
|
+
|
|
2831
2923
|
/**
|
|
2832
2924
|
* Adapter the host app must provide for Solana-origin deposits.
|
|
2833
2925
|
*
|
|
@@ -3538,7 +3630,7 @@ type PlaceOrderFormUIProps = {
|
|
|
3538
3630
|
*/
|
|
3539
3631
|
onUpdateLeverage?: (leverage: number) => Promise<void>;
|
|
3540
3632
|
};
|
|
3541
|
-
declare function PlaceOrderFormUI({ methods, side, orderType, onSideChange, onOrderTypeChange, onSubmit, isSubmitting, symbol, currentPrice, marketPrice,
|
|
3633
|
+
declare function PlaceOrderFormUI({ methods, side, orderType, onSideChange, onOrderTypeChange, onSubmit, isSubmitting, symbol, currentPrice, marketPrice, liquidationPrice, availableMargin, accountValue, currentPosition, maxLeverage, isLeverageReady, hasOpenOrdersForSymbol, szDecimals, onAddFunds, onUpdateLeverage, }: PlaceOrderFormUIProps): react_jsx_runtime.JSX.Element;
|
|
3542
3634
|
|
|
3543
3635
|
type CloseType = "market" | "limit";
|
|
3544
3636
|
type UseClosePositionParams = {
|
|
@@ -4239,4 +4331,4 @@ interface HyperliquidInitWidgetProps extends Pick<UseHyperliquidSetupOptions, "a
|
|
|
4239
4331
|
}
|
|
4240
4332
|
declare function HyperliquidInitWidget({ adapter, userAddress, steps, autoLoad, onComplete, onError, onDismiss, className, }: HyperliquidInitWidgetProps): react_jsx_runtime.JSX.Element;
|
|
4241
4333
|
|
|
4242
|
-
export { type Account, type AccountState, type ActiveAssetLeverage, type ApproveBuilderFeeParams, type AssetMeta, type CancelOrderImpl, type CancelOrderParams, type CancelOrderResult, type CancelOrdersImpl, ClosePositionModal, type ClosePositionModalProps, type CloseType, type Coin, CoinInfoNotFoundUI, CoinInfoSkeletonsUI, CoinInfoUI, type CoinInfoUIProps, CoinInfoWidget, type CoinInfoWidgetProps, DEFAULT_ORDER_BOOK_PRECISION_OPTIONS, type DepositBreakdown, type ChainNamespace as DepositChainNamespace, DepositConfirmUI, type DepositConfirmUIProps, type DepositErrorInfo, type DepositEvent, type DepositEvmQuotePayload, DepositFlowWidget, type DepositFlowWidgetProps, DepositFormUI, type DepositFormUIProps, type DepositPhase, type DepositQuoteRequest, type DepositQuoteResponse, type DepositSigners, type DepositSolanaQuotePayload, type DepositSource, type DepositState, type DepositStatus, type DepositStatusResponse, type DepositStatusTransition, DepositStatusUI, type DepositStatusUIProps, type DepositSubmitRequest, type DepositSubmitResponse, type EvmDepositAdapter, type EvmTxRequest, type ExecuteDepositInput, type GetActiveAssetLeverageParams, type GetAssetMetaParams, type GetOpenOrdersParams, type GetOpenOrdersResult, type GetPositionsParams, type GetPositionsResult, type GetTradesParams, type GetTradesResult, HL_USDC_DECIMALS, type HyperliquidAccountState, HyperliquidApiError, type HyperliquidClientConfig, type HyperliquidEnvironment, HyperliquidInitUI, type HyperliquidInitUIProps, HyperliquidInitWidget, type HyperliquidInitWidgetProps, HyperliquidPerpetualsClient, type HyperliquidSetupActionResult, type IHyperliquidSetupAdapter, type IPerpDepositClient, type IPerpetualsClient, type Kline, type KlineInterval, type KlineQueryOptions, LiberFiApiError, type LiberFiHttpMethod, type RequestOptions as LiberFiHttpRequestOptions, LiberFiHttpTransport, type LiberFiHttpTransportConfig, LiberFiPerpDepositClient, type LiberFiPerpDepositClientConfig, LiberFiPerpetualsClient, type LiberFiPerpetualsClientConfig, type MarketData, type MarketDataType, type OpenOrderSortKey, OpenOrdersEmpty, OpenOrdersSkeleton, OpenOrdersUI, type OpenOrdersUIProps, OpenOrdersWidget, type OpenOrdersWidgetProps, type Order, type OrderBook, type OrderBookAggregationOptions, type OrderBookLevel, OrderBookUI, type OrderBookUIProps, OrderBookWidget, type OrderBookWidgetProps, type OrderSide, type OrderStatus, type OrderType, PerpetualsContext, type PerpetualsContextValue, PerpetualsProvider, type PerpetualsProviderProps, type PlaceOrderFormData, PlaceOrderFormUI, type PlaceOrderFormUIProps, PlaceOrderFormWidget, type PlaceOrderFormWidgetProps, type PlaceOrderParams, type PlaceOrderRequest, type PlaceOrderResult, type Position, type PositionSortKey, PositionsEmpty, PositionsSkeleton, PositionsUI, type PositionsUIProps, PositionsWidget, type PositionsWidgetProps, type PriceLevel, SearchCoinsUI, type SearchCoinsUIProps, SearchCoinsWidget, type SearchCoinsWidgetProps, type SetReferrerParams, type SetupAction, type SetupPhase, type SetupState, type SetupStep, type SetupStepId, type SignAndBroadcastSolanaTx, type SignTypedDataFn, type SortDirection, type SpotBalance, type StepRecord, type StepStatus, type Symbol, TERMINAL_DEPOSIT_STATUSES, type Trade, type TradeHistory, TradeHistoryEmpty, TradeHistorySkeleton, type TradeHistorySortKey, TradeHistoryUI, type TradeHistoryUIProps, TradeHistoryWidget, type TradeHistoryWidgetProps, type TradeSide, TradesUI, type TradesUIProps, TradesWidget, type TradesWidgetProps, type TradingProvider, type UniverseAssetEntry, type UniverseSnapshot, type UpdateLeverageParams, type UseAccountStateQueryParams, type UseAccountStateSubscriptionParams, type UseAccountStateSubscriptionResult, type UseActiveAssetLeverageQueryParams, type UseAssetMetaQueryParams, type UseCancelOrderMutationParams, type UseCandlesSubscriptionParams, type UseCandlesSubscriptionResult, type UseClosePositionParams, type UseClosePositionResult, type UseCoinInfoReturnType, type UseCreateOrderMutationParams, type UseHyperliquidSetupOptions, type UseHyperliquidSetupResult, type UseHyperliquidUserBootstrapParams, type UseKlinesQueryParams, type UseMarketDataSubscriptionParams, type UseMarketDataSubscriptionResult, type UseMarketQueryParams, type UseMarketsQueryParams, type UseOpenOrdersScriptParams, type UseOpenOrdersScriptResult, type UseOrderBookQueryParams, type UseOrderBookScriptParams, type UseOrderBookScriptResult, type UseOrdersQueryParams, type UsePerpDepositExecuteResult, type UsePerpDepositQuoteOptions, type UsePerpDepositStatusOptions, type UsePlaceOrderFormScriptParams, type UsePlaceOrderFormScriptResult, type UsePositionsQueryParams, type UsePositionsScriptParams, type UsePositionsScriptResult, type UseRecentTradesQueryParams, type UseSearchCoinsScriptParams, type UseSearchCoinsScriptResult, type UseTradeHistoryScriptParams, type UseTradeHistoryScriptResult, type UseTradesQueryParams, type UseTradesScriptParams, type UseTradesScriptResult, type UseUserDataSubscriptionParams, type UseUserDataSubscriptionResult, type UserDataType, accountStateQueryKey, activeAssetLeverageQueryKey, aggregationFromStep, assetMetaQueryKey, cancelOrder, classifyStep, coinsQueryKey, createOrder, currentBreakdown as currentDepositBreakdown, currentStatus as currentDepositStatus, fetchActiveAssetLeverage, fetchAssetMeta, fetchCoins, fetchKlines, fetchMarket, fetchMarkets, fetchOrderBook, fetchOrders, fetchPerpDepositQuote, fetchPerpDepositStatus, fetchPositions, fetchRecentTrades, fetchTrades, fetchUniverse, hlUsdcRawToUsdc, initialDepositState, initialSetupState, isPolling as isDepositPolling, isTerminal as isDepositTerminal, isTerminalLifecycle as isTerminalDepositLifecycle, klinesQueryKey, lamportsToSol, marketQueryKey, marketsQueryKey, microUsdcToUsdc, nextRunnableStep, orderBookQueryKey, ordersQueryKey, perpDepositQuoteQueryKey, perpDepositStatusQueryKey, positionsQueryKey, recentTradesQueryKey, reduceDepositState, reduceSetupState, secondsUntil, shortAddress, solToLamports, supportsUniverseSnapshot, tradesQueryKey, universeQueryKey, useAccountStateQuery, useAccountStateSubscription, useActiveAssetLeverageQuery, useAssetMetaQuery, useCancelOrderMutation, useCandlesSubscription, useClosePosition, useCoinInfo, useCoinsQuery, useCreateOrderMutation, useHyperliquidSetup, useHyperliquidUserBootstrap, useKlinesQuery, useMarketDataSubscription, useMarketQuery, useMarketsQuery, useOpenOrdersScript, useOrderBookQuery, useOrderBookScript, useOrdersQuery, usePerpDepositClient, usePerpDepositClientMaybe, usePerpDepositExecute, usePerpDepositQuote, usePerpDepositStatus, usePerpetualsClient, usePlaceOrderFormScript, usePositionsQuery, usePositionsScript, useRecentTradesQuery, useSearchCoinsScript, useTradeHistoryScript, useTradesQuery, useTradesScript, useUniverseQuery, useUserDataSubscription };
|
|
4334
|
+
export { type Account, type AccountState, type ActiveAssetLeverage, type ApproveBuilderFeeParams, type AssetMeta, type CancelOrderImpl, type CancelOrderParams, type CancelOrderResult, type CancelOrdersImpl, ClosePositionModal, type ClosePositionModalProps, type CloseType, type Coin, CoinInfoNotFoundUI, CoinInfoSkeletonsUI, CoinInfoUI, type CoinInfoUIProps, CoinInfoWidget, type CoinInfoWidgetProps, DEFAULT_ORDER_BOOK_PRECISION_OPTIONS, type DepositBreakdown, type ChainNamespace as DepositChainNamespace, DepositConfirmUI, type DepositConfirmUIProps, type DepositErrorInfo, type DepositEvent, type DepositEvmQuotePayload, DepositFlowWidget, type DepositFlowWidgetProps, DepositFormUI, type DepositFormUIProps, type DepositPhase, type DepositQuoteRequest, type DepositQuoteResponse, type DepositSigners, type DepositSolanaQuotePayload, type DepositSource, type DepositState, type DepositStatus, type DepositStatusResponse, type DepositStatusTransition, DepositStatusUI, type DepositStatusUIProps, type DepositSubmitRequest, type DepositSubmitResponse, type EvmDepositAdapter, type EvmTxRequest, type ExecuteDepositInput, type GetActiveAssetLeverageParams, type GetAssetMetaParams, type GetOpenOrdersParams, type GetOpenOrdersResult, type GetPositionsParams, type GetPositionsResult, type GetTradesParams, type GetTradesResult, HL_USDC_DECIMALS, type HyperliquidAccountState, HyperliquidApiError, type HyperliquidClientConfig, type HyperliquidEnvironment, HyperliquidInitUI, type HyperliquidInitUIProps, HyperliquidInitWidget, type HyperliquidInitWidgetProps, HyperliquidPerpetualsClient, type HyperliquidSetupActionResult, type IHyperliquidSetupAdapter, type IPerpDepositClient, type IPerpetualsClient, type Kline, type KlineInterval, type KlineQueryOptions, LiberFiApiError, type LiberFiHttpMethod, type RequestOptions as LiberFiHttpRequestOptions, LiberFiHttpTransport, type LiberFiHttpTransportConfig, LiberFiPerpDepositClient, type LiberFiPerpDepositClientConfig, LiberFiPerpetualsClient, type LiberFiPerpetualsClientConfig, type MarketData, type MarketDataType, type OpenOrderSortKey, OpenOrdersEmpty, OpenOrdersSkeleton, OpenOrdersUI, type OpenOrdersUIProps, OpenOrdersWidget, type OpenOrdersWidgetProps, type Order, type OrderBook, type OrderBookAggregationOptions, type OrderBookLevel, OrderBookUI, type OrderBookUIProps, OrderBookWidget, type OrderBookWidgetProps, type OrderSide, type OrderStatus, type OrderType, type PerpetualAccountCapability, type PerpetualCapabilityBundle, type PerpetualDataRuntime, PerpetualDisconnectedError, type PerpetualExecutionCapability, type PerpetualExecutionRuntime, type PerpetualExecutionSnapshot, type PerpetualExecutionStatus, type PerpetualMarketCapability, type PerpetualRealtimeCapability, PerpetualRejectedError, type PerpetualSignerPort, PerpetualsContext, type PerpetualsContextValue, PerpetualsProvider, type PerpetualsProviderProps, type PlaceOrderFormData, PlaceOrderFormUI, type PlaceOrderFormUIProps, PlaceOrderFormWidget, type PlaceOrderFormWidgetProps, type PlaceOrderParams, type PlaceOrderRequest, type PlaceOrderResult, type Position, type PositionSortKey, PositionsEmpty, PositionsSkeleton, PositionsUI, type PositionsUIProps, PositionsWidget, type PositionsWidgetProps, type PriceLevel, SearchCoinsUI, type SearchCoinsUIProps, SearchCoinsWidget, type SearchCoinsWidgetProps, type SetReferrerParams, type SetupAction, type SetupPhase, type SetupState, type SetupStep, type SetupStepId, type SignAndBroadcastSolanaTx, type SignTypedDataFn, type SortDirection, type SpotBalance, type StepRecord, type StepStatus, type Symbol, TERMINAL_DEPOSIT_STATUSES, type Trade, type TradeHistory, TradeHistoryEmpty, TradeHistorySkeleton, type TradeHistorySortKey, TradeHistoryUI, type TradeHistoryUIProps, TradeHistoryWidget, type TradeHistoryWidgetProps, type TradeSide, TradesUI, type TradesUIProps, TradesWidget, type TradesWidgetProps, type TradingProvider, type UniverseAssetEntry, type UniverseSnapshot, type UpdateLeverageParams, type UseAccountStateQueryParams, type UseAccountStateSubscriptionParams, type UseAccountStateSubscriptionResult, type UseActiveAssetLeverageQueryParams, type UseAssetMetaQueryParams, type UseCancelOrderMutationParams, type UseCandlesSubscriptionParams, type UseCandlesSubscriptionResult, type UseClosePositionParams, type UseClosePositionResult, type UseCoinInfoReturnType, type UseCreateOrderMutationParams, type UseHyperliquidSetupOptions, type UseHyperliquidSetupResult, type UseHyperliquidUserBootstrapParams, type UseKlinesQueryParams, type UseMarketDataSubscriptionParams, type UseMarketDataSubscriptionResult, type UseMarketQueryParams, type UseMarketsQueryParams, type UseOpenOrdersScriptParams, type UseOpenOrdersScriptResult, type UseOrderBookQueryParams, type UseOrderBookScriptParams, type UseOrderBookScriptResult, type UseOrdersQueryParams, type UsePerpDepositExecuteResult, type UsePerpDepositQuoteOptions, type UsePerpDepositStatusOptions, type UsePlaceOrderFormScriptParams, type UsePlaceOrderFormScriptResult, type UsePositionsQueryParams, type UsePositionsScriptParams, type UsePositionsScriptResult, type UseRecentTradesQueryParams, type UseSearchCoinsScriptParams, type UseSearchCoinsScriptResult, type UseTradeHistoryScriptParams, type UseTradeHistoryScriptResult, type UseTradesQueryParams, type UseTradesScriptParams, type UseTradesScriptResult, type UseUserDataSubscriptionParams, type UseUserDataSubscriptionResult, type UserDataType, accountStateQueryKey, activeAssetLeverageQueryKey, aggregationFromStep, assetMetaQueryKey, cancelOrder, classifyStep, coinsQueryKey, createInMemoryPerpetualCapabilities, createOrder, createPerpetualDataRuntime, createPerpetualExecutionRuntime, currentBreakdown as currentDepositBreakdown, currentStatus as currentDepositStatus, fetchActiveAssetLeverage, fetchAssetMeta, fetchCoins, fetchKlines, fetchMarket, fetchMarkets, fetchOrderBook, fetchOrders, fetchPerpDepositQuote, fetchPerpDepositStatus, fetchPositions, fetchRecentTrades, fetchTrades, fetchUniverse, hlUsdcRawToUsdc, initialDepositState, initialSetupState, isPolling as isDepositPolling, isTerminal as isDepositTerminal, isTerminalLifecycle as isTerminalDepositLifecycle, klinesQueryKey, lamportsToSol, marketQueryKey, marketsQueryKey, microUsdcToUsdc, nextRunnableStep, orderBookQueryKey, ordersQueryKey, perpDepositQuoteQueryKey, perpDepositStatusQueryKey, positionsQueryKey, recentTradesQueryKey, reduceDepositState, reduceSetupState, secondsUntil, shortAddress, solToLamports, supportsUniverseSnapshot, tradesQueryKey, universeQueryKey, useAccountStateQuery, useAccountStateSubscription, useActiveAssetLeverageQuery, useAssetMetaQuery, useCancelOrderMutation, useCandlesSubscription, useClosePosition, useCoinInfo, useCoinsQuery, useCreateOrderMutation, useHyperliquidSetup, useHyperliquidUserBootstrap, useKlinesQuery, useMarketDataSubscription, useMarketQuery, useMarketsQuery, useOpenOrdersScript, useOrderBookQuery, useOrderBookScript, useOrdersQuery, usePerpDepositClient, usePerpDepositClientMaybe, usePerpDepositExecute, usePerpDepositQuote, usePerpDepositStatus, usePerpetualsClient, usePlaceOrderFormScript, usePositionsQuery, usePositionsScript, useRecentTradesQuery, useSearchCoinsScript, useTradeHistoryScript, useTradesQuery, useTradesScript, useUniverseQuery, useUserDataSubscription };
|