@syldel/hl-shared-types 0.0.8 → 0.0.10
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/interfaces/common/common.interfaces.d.ts +7 -0
- package/dist/interfaces/orders/open-order.interfaces.d.ts +26 -2
- package/dist/interfaces/orders/order-details.interfaces.d.ts +3 -3
- package/dist/interfaces/orders/order-status.interfaces.d.ts +3 -17
- package/dist/interfaces/perp/dexs.interfaces.d.ts +35 -0
- package/dist/interfaces/perp/dexs.interfaces.js +2 -0
- package/dist/interfaces/perp/index.d.ts +1 -0
- package/dist/interfaces/perp/index.js +1 -0
- package/dist/interfaces/spot/balance.interfaces.d.ts +12 -0
- package/dist/interfaces/spot/meta.interfaces.d.ts +27 -0
- package/package.json +1 -1
|
@@ -2,3 +2,10 @@ export type DecimalString = string;
|
|
|
2
2
|
export type Timestamp = number;
|
|
3
3
|
export type HexString = `0x${string}`;
|
|
4
4
|
export type HLOid = number | HexString;
|
|
5
|
+
/**
|
|
6
|
+
* Time In Force options for Hyperliquid orders.
|
|
7
|
+
* Gtc: Good Til Cancelled
|
|
8
|
+
* Ioc: Immediate Or Cancel
|
|
9
|
+
* Alo: Add Liquidity Only (Post-Only)
|
|
10
|
+
*/
|
|
11
|
+
export type HLTif = 'Gtc' | 'Ioc' | 'Alo';
|
|
@@ -1,20 +1,44 @@
|
|
|
1
|
-
import { DecimalString, HLOid, Timestamp } from '../common';
|
|
1
|
+
import { DecimalString, HLOid, HLTif, Timestamp } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Base response for any order info returned by the API.
|
|
4
|
+
* These fields are common to all order-related info endpoints.
|
|
5
|
+
*/
|
|
2
6
|
export interface HLOpenOrder {
|
|
7
|
+
/** Asset symbol (e.g., "BTC", "@107") */
|
|
3
8
|
coin: string;
|
|
9
|
+
/** Limit price as a string */
|
|
4
10
|
limitPx: DecimalString;
|
|
11
|
+
/** Internal Hyperliquid Order ID */
|
|
5
12
|
oid: HLOid;
|
|
13
|
+
/** 'A' for Ask (Sell), 'B' for Bid (Buy) */
|
|
6
14
|
side: 'A' | 'B';
|
|
15
|
+
/** Current size of the order */
|
|
7
16
|
sz: DecimalString;
|
|
17
|
+
/** Transaction timestamp in milliseconds */
|
|
8
18
|
timestamp: Timestamp;
|
|
9
19
|
}
|
|
10
20
|
export type HLOpenOrdersResponse = HLOpenOrder[];
|
|
21
|
+
/**
|
|
22
|
+
* Enhanced order details for frontend-specific views.
|
|
23
|
+
*/
|
|
11
24
|
export interface HLFrontendOpenOrder extends HLOpenOrder {
|
|
25
|
+
/** True if this is a Take Profit or Stop Loss for an open position */
|
|
12
26
|
isPositionTpsl: boolean;
|
|
27
|
+
/** True if this is a trigger order (Stop/TP) */
|
|
13
28
|
isTrigger: boolean;
|
|
14
|
-
|
|
29
|
+
/** Descriptive order type (e.g., "Limit", "Stop Market") */
|
|
30
|
+
orderType: string;
|
|
31
|
+
/** Original size of the order when placed */
|
|
15
32
|
origSz: DecimalString;
|
|
33
|
+
/** True if the order can only reduce position size */
|
|
16
34
|
reduceOnly: boolean;
|
|
35
|
+
/** Human-readable trigger condition (e.g., "Price >= 30000" or "N/A") */
|
|
17
36
|
triggerCondition: string;
|
|
37
|
+
/** Price that triggers the order, if applicable */
|
|
18
38
|
triggerPx: DecimalString;
|
|
39
|
+
/** Time In Force: API can return specific labels like "FrontendMarket" */
|
|
40
|
+
tif?: HLTif | string | null;
|
|
41
|
+
/** Client Order ID: always present in response, but can be null */
|
|
42
|
+
cloid?: string | null;
|
|
19
43
|
}
|
|
20
44
|
export type HLFrontendOpenOrdersResponse = HLFrontendOpenOrder[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DecimalString } from '../common';
|
|
1
|
+
import { DecimalString, HLTif } from '../common';
|
|
2
2
|
/**
|
|
3
3
|
* Détails d'un ordre à placer sur Hyperliquid.
|
|
4
4
|
*
|
|
@@ -33,7 +33,7 @@ export interface HLOrderDetails {
|
|
|
33
33
|
reduceOnly: boolean;
|
|
34
34
|
orderType: {
|
|
35
35
|
limit: {
|
|
36
|
-
tif:
|
|
36
|
+
tif: HLTif;
|
|
37
37
|
};
|
|
38
38
|
} | {
|
|
39
39
|
trigger: {
|
|
@@ -56,7 +56,7 @@ export interface HLApiOrder {
|
|
|
56
56
|
r: boolean;
|
|
57
57
|
t: {
|
|
58
58
|
limit: {
|
|
59
|
-
tif:
|
|
59
|
+
tif: HLTif;
|
|
60
60
|
};
|
|
61
61
|
} | {
|
|
62
62
|
trigger: {
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HLOid, Timestamp } from '../common';
|
|
2
|
+
import { HLFrontendOpenOrder } from './open-order.interfaces';
|
|
2
3
|
export type HLOrderStatus = 'open' | 'filled' | 'canceled' | 'triggered' | 'rejected' | 'marginCanceled' | 'vaultWithdrawalCanceled' | 'openInterestCapCanceled' | 'selfTradeCanceled' | 'reduceOnlyCanceled' | 'siblingFilledCanceled' | 'delistedCanceled' | 'liquidatedCanceled' | 'scheduledCancel' | 'tickRejected' | 'minTradeNtlRejected' | 'perpMarginRejected' | 'reduceOnlyRejected' | 'badAloPxRejected' | 'iocCancelRejected' | 'badTriggerPxRejected' | 'marketOrderNoLiquidityRejected' | 'positionIncreaseAtOpenInterestCapRejected' | 'positionFlipAtOpenInterestCapRejected' | 'tooAggressiveAtOpenInterestCapRejected' | 'openInterestIncreaseRejected' | 'insufficientSpotBalanceRejected' | 'oracleRejected' | 'perpMaxPositionRejected';
|
|
3
|
-
export interface HLOrderStatusDetails {
|
|
4
|
-
coin: string;
|
|
5
|
-
side: 'A' | 'B';
|
|
6
|
-
limitPx: DecimalString;
|
|
7
|
-
sz: DecimalString;
|
|
8
|
-
oid: HLOid;
|
|
9
|
-
timestamp: Timestamp;
|
|
10
|
-
triggerCondition: string;
|
|
11
|
-
isTrigger: boolean;
|
|
12
|
-
triggerPx: DecimalString;
|
|
4
|
+
export interface HLOrderStatusDetails extends HLFrontendOpenOrder {
|
|
13
5
|
children: unknown[];
|
|
14
|
-
isPositionTpsl: boolean;
|
|
15
|
-
reduceOnly: boolean;
|
|
16
|
-
orderType: string;
|
|
17
|
-
origSz: DecimalString;
|
|
18
|
-
tif: string;
|
|
19
|
-
cloid: string | null;
|
|
20
6
|
}
|
|
21
7
|
export interface HLOrderStatusData {
|
|
22
8
|
order: HLOrderStatusDetails;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the request body for the Hyperliquid info endpoint.
|
|
3
|
+
*/
|
|
4
|
+
export interface HLInfoRequest {
|
|
5
|
+
/** The type of information to retrieve. For perpetual DEXs, use 'perpDexs'. */
|
|
6
|
+
type: 'perpDexs';
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Represents a Perpetual DEX entry on the Hyperliquid exchange.
|
|
10
|
+
*/
|
|
11
|
+
export interface HLPerpDex {
|
|
12
|
+
/** The unique short name/identifier of the DEX. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** The full descriptive name of the DEX. */
|
|
15
|
+
fullName: string;
|
|
16
|
+
/** The Ethereum address of the account that deployed the DEX. */
|
|
17
|
+
deployer: string;
|
|
18
|
+
/** The address authorized to update oracles, or null if not set. */
|
|
19
|
+
oracleUpdater: string | null;
|
|
20
|
+
/** The address designated to receive trading fees, or null if not set. */
|
|
21
|
+
feeRecipient: string | null;
|
|
22
|
+
/** * A collection of streaming Open Interest caps per asset.
|
|
23
|
+
* Represented as an array of tuples: [Asset Name, Cap Value].
|
|
24
|
+
*/
|
|
25
|
+
assetToStreamingOiCap: [string, string][];
|
|
26
|
+
/** * A collection of funding rate multipliers per asset.
|
|
27
|
+
* Represented as an array of tuples: [Asset Name, Multiplier].
|
|
28
|
+
*/
|
|
29
|
+
assetToFundingMultiplier: [string, string][];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The raw response format from the Hyperliquid API for the 'perpDexs' type.
|
|
33
|
+
* The API typically returns an array where the first element can be null.
|
|
34
|
+
*/
|
|
35
|
+
export type HLPerpDexsResponse = (HLPerpDex | null)[];
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./balance.interfaces"), exports);
|
|
18
18
|
__exportStar(require("./meta.interfaces"), exports);
|
|
19
|
+
__exportStar(require("./dexs.interfaces"), exports);
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { DecimalString } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* User's balance for a spot asset.
|
|
4
|
+
*/
|
|
2
5
|
export interface HLSpotBalance {
|
|
6
|
+
/** Asset symbol, e.g. "USDC" or "ETH". */
|
|
3
7
|
coin: string;
|
|
8
|
+
/** Token index in Hyperliquid's system. */
|
|
4
9
|
token: number;
|
|
10
|
+
/** Amount currently on hold / reserved. */
|
|
5
11
|
hold: DecimalString;
|
|
12
|
+
/** Total amount owned (available + hold). */
|
|
6
13
|
total: DecimalString;
|
|
14
|
+
/** Entry notional for the position. */
|
|
7
15
|
entryNtl: DecimalString;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Spot clearinghouse state containing all balances.
|
|
19
|
+
*/
|
|
9
20
|
export interface HLSpotClearinghouseState {
|
|
21
|
+
/** Array of spot balances for this user. */
|
|
10
22
|
balances: HLSpotBalance[];
|
|
11
23
|
}
|
|
@@ -1,23 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata for a spot token.
|
|
3
|
+
*/
|
|
1
4
|
export interface HLSpotTokenMeta {
|
|
5
|
+
/** Token symbol, e.g. "USDC". */
|
|
2
6
|
name: string;
|
|
7
|
+
/** Number of decimals for display purposes. */
|
|
3
8
|
szDecimals: number;
|
|
9
|
+
/** Number of decimals used on-chain (wei). */
|
|
4
10
|
weiDecimals: number;
|
|
11
|
+
/** Token index in Hyperliquid system. */
|
|
5
12
|
index: number;
|
|
13
|
+
/** Unique token identifier. */
|
|
6
14
|
tokenId: string;
|
|
15
|
+
/** Whether this is the canonical token in the system. */
|
|
7
16
|
isCanonical: boolean;
|
|
17
|
+
/** EVM contract address (if applicable). */
|
|
8
18
|
evmContract: string | null;
|
|
19
|
+
/** Full token name, optional. */
|
|
9
20
|
fullName: string | null;
|
|
10
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Metadata for a spot market.
|
|
24
|
+
*/
|
|
11
25
|
export interface HLSpotMarketMeta {
|
|
26
|
+
/** Market symbol, e.g. "ETH/USDC". */
|
|
12
27
|
name: string;
|
|
28
|
+
/** Indexes of the base and quote tokens. */
|
|
13
29
|
tokens: [number, number];
|
|
30
|
+
/** Market index in Hyperliquid system. */
|
|
14
31
|
index: number;
|
|
32
|
+
/** Whether the market uses canonical tokens. */
|
|
15
33
|
isCanonical: boolean;
|
|
16
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Complete spot metadata including tokens and markets.
|
|
37
|
+
*/
|
|
17
38
|
export interface HLSpotMeta {
|
|
39
|
+
/** All spot tokens. */
|
|
18
40
|
tokens: HLSpotTokenMeta[];
|
|
41
|
+
/** All spot markets (universe). */
|
|
19
42
|
universe: HLSpotMarketMeta[];
|
|
20
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Summary of a spot asset, extending market metadata.
|
|
46
|
+
*/
|
|
21
47
|
export interface HLSpotAssetSummary extends HLSpotMarketMeta {
|
|
48
|
+
/** Optional: number of decimals for size/amount display. */
|
|
22
49
|
szDecimals?: number;
|
|
23
50
|
}
|