@lifi/perps-sdk-provider-hyperliquid 6.0.0 → 6.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/HyperliquidProvider.d.ts.map +1 -1
- package/dist/cjs/HyperliquidProvider.js.map +1 -1
- package/dist/cjs/services/getActivity.d.ts.map +1 -1
- package/dist/cjs/services/getActivity.js.map +1 -1
- package/dist/cjs/services/getFills.d.ts.map +1 -1
- package/dist/cjs/services/getFills.js.map +1 -1
- package/dist/cjs/services/getOrders.d.ts.map +1 -1
- package/dist/cjs/services/getOrders.js.map +1 -1
- package/dist/cjs/signers/HyperliquidAgentStore.d.ts.map +1 -1
- package/dist/cjs/signers/HyperliquidAgentStore.js.map +1 -1
- package/dist/cjs/signers/signActions.d.ts.map +1 -1
- package/dist/cjs/signers/signActions.js.map +1 -1
- package/dist/cjs/types/account.d.ts.map +1 -1
- package/dist/cjs/types/account.js.map +1 -1
- package/dist/cjs/types/action.d.ts.map +1 -1
- package/dist/cjs/types/action.js.map +1 -1
- package/dist/cjs/types/asset.d.ts.map +1 -1
- package/dist/cjs/types/fill.d.ts.map +1 -1
- package/dist/cjs/types/ledger.d.ts.map +1 -1
- package/dist/cjs/types/ledger.js.map +1 -1
- package/dist/cjs/types/order.d.ts.map +1 -1
- package/dist/cjs/types/ws.d.ts.map +1 -1
- package/dist/cjs/utils/assetId.d.ts.map +1 -1
- package/dist/cjs/utils/assetId.js.map +1 -1
- package/dist/cjs/utils/assetLogo.d.ts.map +1 -1
- package/dist/cjs/utils/assetLogo.js.map +1 -1
- package/dist/cjs/utils/decodeFastAssetCtxs.d.ts.map +1 -1
- package/dist/cjs/utils/decodeFastAssetCtxs.js.map +1 -1
- package/dist/cjs/utils/infoClient.d.ts.map +1 -1
- package/dist/cjs/utils/infoClient.js.map +1 -1
- package/dist/cjs/utils/mapActivity.d.ts.map +1 -1
- package/dist/cjs/utils/mapActivity.js +13 -10
- package/dist/cjs/utils/mapActivity.js.map +1 -1
- package/dist/cjs/utils/mapFill.d.ts.map +1 -1
- package/dist/cjs/utils/mapFill.js.map +1 -1
- package/dist/cjs/utils/mapOrder.d.ts.map +1 -1
- package/dist/cjs/utils/mapOrder.js.map +1 -1
- package/dist/cjs/utils/mapPosition.d.ts.map +1 -1
- package/dist/cjs/utils/mapPosition.js.map +1 -1
- package/dist/cjs/utils/spotBalance.d.ts.map +1 -1
- package/dist/cjs/utils/spotBalance.js.map +1 -1
- package/dist/cjs/utils/spotCollateral.d.ts.map +1 -1
- package/dist/cjs/utils/spotCollateral.js.map +1 -1
- package/dist/cjs/utils/transferMargin.d.ts.map +1 -1
- package/dist/cjs/utils/transferMargin.js +1 -2
- package/dist/cjs/utils/transferMargin.js.map +1 -1
- package/dist/esm/HyperliquidProvider.d.ts +14 -4
- package/dist/esm/HyperliquidProvider.d.ts.map +1 -1
- package/dist/esm/HyperliquidProvider.js.map +1 -1
- package/dist/esm/services/getActivity.d.ts +5 -1
- package/dist/esm/services/getActivity.d.ts.map +1 -1
- package/dist/esm/services/getActivity.js.map +1 -1
- package/dist/esm/services/getFills.d.ts +4 -3
- package/dist/esm/services/getFills.d.ts.map +1 -1
- package/dist/esm/services/getFills.js.map +1 -1
- package/dist/esm/services/getOrders.d.ts +2 -1
- package/dist/esm/services/getOrders.d.ts.map +1 -1
- package/dist/esm/services/getOrders.js.map +1 -1
- package/dist/esm/services/getPositions.d.ts +2 -2
- package/dist/esm/services/getPositions.d.ts.map +1 -1
- package/dist/esm/signers/HyperliquidAgentStore.d.ts +3 -3
- package/dist/esm/signers/HyperliquidAgentStore.d.ts.map +1 -1
- package/dist/esm/signers/HyperliquidAgentStore.js +1 -0
- package/dist/esm/signers/HyperliquidAgentStore.js.map +1 -1
- package/dist/esm/signers/signActions.d.ts +8 -6
- package/dist/esm/signers/signActions.d.ts.map +1 -1
- package/dist/esm/signers/signActions.js +8 -6
- package/dist/esm/signers/signActions.js.map +1 -1
- package/dist/esm/types/account.d.ts +51 -8
- package/dist/esm/types/account.d.ts.map +1 -1
- package/dist/esm/types/account.js.map +1 -1
- package/dist/esm/types/action.d.ts +28 -10
- package/dist/esm/types/action.d.ts.map +1 -1
- package/dist/esm/types/action.js +7 -7
- package/dist/esm/types/action.js.map +1 -1
- package/dist/esm/types/asset.d.ts +60 -15
- package/dist/esm/types/asset.d.ts.map +1 -1
- package/dist/esm/types/fill.d.ts +9 -3
- package/dist/esm/types/fill.d.ts.map +1 -1
- package/dist/esm/types/ledger.d.ts +24 -6
- package/dist/esm/types/ledger.d.ts.map +1 -1
- package/dist/esm/types/ledger.js.map +1 -1
- package/dist/esm/types/order.d.ts +19 -5
- package/dist/esm/types/order.d.ts.map +1 -1
- package/dist/esm/types/ws.d.ts +43 -14
- package/dist/esm/types/ws.d.ts.map +1 -1
- package/dist/esm/utils/assetId.d.ts +7 -7
- package/dist/esm/utils/assetId.d.ts.map +1 -1
- package/dist/esm/utils/assetId.js +7 -7
- package/dist/esm/utils/assetId.js.map +1 -1
- package/dist/esm/utils/assetLogo.d.ts +15 -13
- package/dist/esm/utils/assetLogo.d.ts.map +1 -1
- package/dist/esm/utils/assetLogo.js +15 -13
- package/dist/esm/utils/assetLogo.js.map +1 -1
- package/dist/esm/utils/decodeFastAssetCtxs.d.ts +7 -1
- package/dist/esm/utils/decodeFastAssetCtxs.d.ts.map +1 -1
- package/dist/esm/utils/decodeFastAssetCtxs.js +7 -1
- package/dist/esm/utils/decodeFastAssetCtxs.js.map +1 -1
- package/dist/esm/utils/infoClient.d.ts +6 -1
- package/dist/esm/utils/infoClient.d.ts.map +1 -1
- package/dist/esm/utils/infoClient.js.map +1 -1
- package/dist/esm/utils/mapActivity.d.ts +10 -1
- package/dist/esm/utils/mapActivity.d.ts.map +1 -1
- package/dist/esm/utils/mapActivity.js +23 -11
- package/dist/esm/utils/mapActivity.js.map +1 -1
- package/dist/esm/utils/mapFill.d.ts +1 -0
- package/dist/esm/utils/mapFill.d.ts.map +1 -1
- package/dist/esm/utils/mapFill.js +1 -0
- package/dist/esm/utils/mapFill.js.map +1 -1
- package/dist/esm/utils/mapOrder.d.ts +15 -4
- package/dist/esm/utils/mapOrder.d.ts.map +1 -1
- package/dist/esm/utils/mapOrder.js +15 -4
- package/dist/esm/utils/mapOrder.js.map +1 -1
- package/dist/esm/utils/mapPosition.d.ts +6 -1
- package/dist/esm/utils/mapPosition.d.ts.map +1 -1
- package/dist/esm/utils/mapPosition.js +6 -1
- package/dist/esm/utils/mapPosition.js.map +1 -1
- package/dist/esm/utils/spotBalance.d.ts +9 -10
- package/dist/esm/utils/spotBalance.d.ts.map +1 -1
- package/dist/esm/utils/spotBalance.js +9 -10
- package/dist/esm/utils/spotBalance.js.map +1 -1
- package/dist/esm/utils/spotCollateral.d.ts +9 -5
- package/dist/esm/utils/spotCollateral.d.ts.map +1 -1
- package/dist/esm/utils/spotCollateral.js +4 -4
- package/dist/esm/utils/spotCollateral.js.map +1 -1
- package/dist/esm/utils/transferMargin.d.ts.map +1 -1
- package/dist/esm/utils/transferMargin.js +2 -3
- package/dist/esm/utils/transferMargin.js.map +1 -1
- package/dist/types/HyperliquidProvider.d.ts +14 -4
- package/dist/types/HyperliquidProvider.d.ts.map +1 -1
- package/dist/types/services/getActivity.d.ts +5 -1
- package/dist/types/services/getActivity.d.ts.map +1 -1
- package/dist/types/services/getFills.d.ts +4 -3
- package/dist/types/services/getFills.d.ts.map +1 -1
- package/dist/types/services/getOrders.d.ts +2 -1
- package/dist/types/services/getOrders.d.ts.map +1 -1
- package/dist/types/services/getPositions.d.ts +2 -2
- package/dist/types/services/getPositions.d.ts.map +1 -1
- package/dist/types/signers/HyperliquidAgentStore.d.ts +3 -3
- package/dist/types/signers/HyperliquidAgentStore.d.ts.map +1 -1
- package/dist/types/signers/signActions.d.ts +8 -6
- package/dist/types/signers/signActions.d.ts.map +1 -1
- package/dist/types/types/account.d.ts +51 -8
- package/dist/types/types/account.d.ts.map +1 -1
- package/dist/types/types/action.d.ts +28 -10
- package/dist/types/types/action.d.ts.map +1 -1
- package/dist/types/types/asset.d.ts +60 -15
- package/dist/types/types/asset.d.ts.map +1 -1
- package/dist/types/types/fill.d.ts +9 -3
- package/dist/types/types/fill.d.ts.map +1 -1
- package/dist/types/types/ledger.d.ts +24 -6
- package/dist/types/types/ledger.d.ts.map +1 -1
- package/dist/types/types/order.d.ts +19 -5
- package/dist/types/types/order.d.ts.map +1 -1
- package/dist/types/types/ws.d.ts +43 -14
- package/dist/types/types/ws.d.ts.map +1 -1
- package/dist/types/utils/assetId.d.ts +7 -7
- package/dist/types/utils/assetId.d.ts.map +1 -1
- package/dist/types/utils/assetLogo.d.ts +15 -13
- package/dist/types/utils/assetLogo.d.ts.map +1 -1
- package/dist/types/utils/decodeFastAssetCtxs.d.ts +7 -1
- package/dist/types/utils/decodeFastAssetCtxs.d.ts.map +1 -1
- package/dist/types/utils/infoClient.d.ts +6 -1
- package/dist/types/utils/infoClient.d.ts.map +1 -1
- package/dist/types/utils/mapActivity.d.ts +10 -1
- package/dist/types/utils/mapActivity.d.ts.map +1 -1
- package/dist/types/utils/mapFill.d.ts +1 -0
- package/dist/types/utils/mapFill.d.ts.map +1 -1
- package/dist/types/utils/mapOrder.d.ts +15 -4
- package/dist/types/utils/mapOrder.d.ts.map +1 -1
- package/dist/types/utils/mapPosition.d.ts +6 -1
- package/dist/types/utils/mapPosition.d.ts.map +1 -1
- package/dist/types/utils/spotBalance.d.ts +9 -10
- package/dist/types/utils/spotBalance.d.ts.map +1 -1
- package/dist/types/utils/spotCollateral.d.ts +9 -5
- package/dist/types/utils/spotCollateral.d.ts.map +1 -1
- package/dist/types/utils/transferMargin.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/HyperliquidProvider.ts +14 -4
- package/src/services/getActivity.ts +5 -1
- package/src/services/getFills.ts +4 -3
- package/src/services/getOrders.ts +2 -1
- package/src/services/getPositions.ts +2 -2
- package/src/signers/HyperliquidAgentStore.ts +3 -3
- package/src/signers/signActions.ts +8 -6
- package/src/types/account.ts +51 -8
- package/src/types/action.ts +28 -10
- package/src/types/asset.ts +60 -15
- package/src/types/fill.ts +9 -3
- package/src/types/ledger.ts +24 -6
- package/src/types/order.ts +19 -5
- package/src/types/ws.ts +43 -14
- package/src/utils/assetId.ts +7 -7
- package/src/utils/assetLogo.ts +15 -13
- package/src/utils/decodeFastAssetCtxs.ts +7 -1
- package/src/utils/infoClient.ts +6 -1
- package/src/utils/mapActivity.ts +23 -11
- package/src/utils/mapFill.ts +1 -0
- package/src/utils/mapOrder.ts +15 -4
- package/src/utils/mapPosition.ts +6 -1
- package/src/utils/spotBalance.ts +9 -10
- package/src/utils/spotCollateral.ts +9 -5
- package/src/utils/transferMargin.ts +2 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/types/order.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/types/order.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,OAAO,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAChC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,qEAAqE;AACrE,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,EAAE,CAAA;AAExD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,EAAE,EAAE,MAAM,CAAA;QACV,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,UAAU,EAAE,OAAO,CAAA;QACnB,SAAS,EAAE,MAAM,CAAA;QACjB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;QAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;QACpB,gBAAgB,EAAE,MAAM,CAAA;QACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KACzB,CAAA;IACD,MAAM,EAAE,MAAM,CAAA;IACd,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,aAAa,CAAA;CACrB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC7B,kBAAkB,GAClB;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAAA"}
|
package/dist/types/types/ws.d.ts
CHANGED
|
@@ -18,7 +18,11 @@ export type HlWsPerpAssetCtx = {
|
|
|
18
18
|
midPx: string | null;
|
|
19
19
|
oraclePx: string;
|
|
20
20
|
};
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Partial perp context carried by compressed (`pac`) updates. Omitted fields
|
|
23
|
+
* are unchanged from the prior context and must be merged by the consumer.
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
22
26
|
export type HlWsPerpAssetCtxPayload = Partial<HlWsPerpAssetCtx>;
|
|
23
27
|
/**
|
|
24
28
|
* `allDexsAssetCtxs` carries one `[dex, ctxs]` pair per perp sub-DEX, mirroring
|
|
@@ -36,7 +40,7 @@ export type HlWsAllDexsAssetCtxsData = {
|
|
|
36
40
|
* @public
|
|
37
41
|
*/
|
|
38
42
|
export type HlWsPacData = [string, HlWsPerpAssetCtxPayload[]][];
|
|
39
|
-
/** @public */
|
|
43
|
+
/** Generic Hyperliquid WS envelope; `channel` identifies the subscription and `data` is channel-specific. @public */
|
|
40
44
|
export type HlWsMessage = {
|
|
41
45
|
channel: string;
|
|
42
46
|
data: unknown;
|
|
@@ -51,7 +55,12 @@ export type HlWsFastAssetCtx = {
|
|
|
51
55
|
markPx?: string;
|
|
52
56
|
midPx?: string | null;
|
|
53
57
|
};
|
|
54
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Incremental spot asset context. Hyperliquid may encode numeric fields as
|
|
60
|
+
* strings or numbers and omits unchanged fields; `midPx: null` means no book
|
|
61
|
+
* midpoint is available.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
55
64
|
export type HlWsSpotAssetCtx = {
|
|
56
65
|
dayNtlVlm?: HlWsNumberString;
|
|
57
66
|
prevDayPx?: HlWsNumberString;
|
|
@@ -60,12 +69,12 @@ export type HlWsSpotAssetCtx = {
|
|
|
60
69
|
dayBaseVlm?: HlWsNumberString;
|
|
61
70
|
circulatingSupply?: HlWsNumberString;
|
|
62
71
|
};
|
|
63
|
-
/** @public */
|
|
72
|
+
/** Active perp context event keyed by its Hyperliquid wire coin. @public */
|
|
64
73
|
export type HlWsActiveAssetCtxData = {
|
|
65
74
|
coin: string;
|
|
66
75
|
ctx: Partial<Record<keyof HlWsPerpAssetCtx, HlWsNumberString | null>>;
|
|
67
76
|
};
|
|
68
|
-
/** @public */
|
|
77
|
+
/** Active spot context event keyed by its Hyperliquid wire coin. @public */
|
|
69
78
|
export type HlWsActiveSpotAssetCtxData = {
|
|
70
79
|
coin: string;
|
|
71
80
|
ctx: HlWsSpotAssetCtx;
|
|
@@ -76,11 +85,15 @@ export type HlWsActiveSpotAssetCtxData = {
|
|
|
76
85
|
* @public
|
|
77
86
|
*/
|
|
78
87
|
export type HlWsSacData = Record<string, HlWsSpotAssetCtx>;
|
|
79
|
-
/** @public */
|
|
88
|
+
/** L2 snapshot envelope with the wire coin attached to {@link HlL2Book}. @public */
|
|
80
89
|
export type HlWsL2BookData = HlL2Book & {
|
|
81
90
|
coin: string;
|
|
82
91
|
};
|
|
83
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* L2 channel payload. `s` is a full snapshot, while `u` is a compressed delta;
|
|
94
|
+
* `c` carries the checksum/control value when present.
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
84
97
|
export type HlWsL2Data = {
|
|
85
98
|
s?: HlL2Book & {
|
|
86
99
|
coin: string;
|
|
@@ -88,12 +101,16 @@ export type HlWsL2Data = {
|
|
|
88
101
|
c?: string;
|
|
89
102
|
u?: HlWsCompressedL2Data;
|
|
90
103
|
};
|
|
91
|
-
/** @public */
|
|
104
|
+
/** One level in a compressed L2 update: `p` is price and `s` is size. @public */
|
|
92
105
|
export type HlWsCompressedL2Level = {
|
|
93
106
|
p: string;
|
|
94
107
|
s: string;
|
|
95
108
|
};
|
|
96
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Compressed L2 delta. `t` is the update timestamp in milliseconds, `l` holds
|
|
111
|
+
* bid/ask levels, and optional `r` describes removals.
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
97
114
|
export type HlWsCompressedL2Data = {
|
|
98
115
|
c: string;
|
|
99
116
|
t: number;
|
|
@@ -107,14 +124,22 @@ export type HlWsCompressedL2Data = {
|
|
|
107
124
|
}>
|
|
108
125
|
];
|
|
109
126
|
};
|
|
110
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Candle event payload. Inherited `t` is candle-open time; `T` is close time,
|
|
129
|
+
* `s` is the symbol, `i` is interval, and `n` is the trade count.
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
111
132
|
export type HlWsCandleData = HlCandle & {
|
|
112
133
|
T: number;
|
|
113
134
|
s: string;
|
|
114
135
|
i: string;
|
|
115
136
|
n: number;
|
|
116
137
|
};
|
|
117
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Public trade event. Prices and size are decimal strings; `time` is
|
|
140
|
+
* milliseconds since epoch, with optional trade ID and transaction hash.
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
118
143
|
export type HlWsTrade = {
|
|
119
144
|
coin: string;
|
|
120
145
|
side: string;
|
|
@@ -124,13 +149,17 @@ export type HlWsTrade = {
|
|
|
124
149
|
tid?: number;
|
|
125
150
|
hash?: string;
|
|
126
151
|
};
|
|
127
|
-
/** @public */
|
|
152
|
+
/** User fills event; `isSnapshot` distinguishes the initial snapshot from updates. @public */
|
|
128
153
|
export type HlWsUserFillsData = {
|
|
129
154
|
isSnapshot: boolean;
|
|
130
155
|
user: string;
|
|
131
156
|
fills: HlUserFill[];
|
|
132
157
|
};
|
|
133
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* Per-dex clearinghouse event for one user. Each tuple contains a wire DEX name
|
|
160
|
+
* and the perp positions/equity fields supplied by that DEX.
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
134
163
|
export type HlWsAllDexsClearinghouseStateData = {
|
|
135
164
|
user: string;
|
|
136
165
|
clearinghouseStates: [
|
|
@@ -138,7 +167,7 @@ export type HlWsAllDexsClearinghouseStateData = {
|
|
|
138
167
|
Pick<HlClearinghouseState, 'assetPositions' | 'marginSummary'>
|
|
139
168
|
][];
|
|
140
169
|
};
|
|
141
|
-
/** @public */
|
|
170
|
+
/** User spot clearinghouse event containing the current spot balances. @public */
|
|
142
171
|
export type HlWsSpotStateData = {
|
|
143
172
|
user: string;
|
|
144
173
|
spotState: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../../src/types/ws.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAA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AAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,EAAE;QACnB,MAAM;QACN,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,GAAG,eAAe,CAAC;KAC/D,EAAE,CAAA;CACJ,CAAA;AAED,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE;QAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;KAAE,CAAA;CACzC,CAAA"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Return whether a Hyperliquid asset ID identifies spot (`@<pairIndex>`).
|
|
3
|
+
* @param assetId - Raw Hyperliquid asset ID.
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
6
|
export declare const assetIsSpot: (assetId: string) => boolean;
|
|
7
7
|
/**
|
|
8
|
-
* Calculate
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* HIP-3 providers (provider = 'xyz'): assetId = 100_000 + perpDexIndex * 10_000 + indexInProvider
|
|
8
|
+
* Calculate Hyperliquid's numeric asset ID from a perp DEX index and the
|
|
9
|
+
* asset's zero-based index within that DEX. The main DEX uses the index
|
|
10
|
+
* directly; HIP-3 DEXes use `100000 + dexIndex * 10000 + assetIndex`.
|
|
12
11
|
* @public
|
|
13
12
|
*/
|
|
14
13
|
export declare const calculateAssetId: (providerIndex: number, indexInProvider: number) => number;
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
15
|
+
* Find a sub-DEX's zero-based index in the names returned by Hyperliquid.
|
|
16
|
+
* @throws If `provider` is absent from `providerNames`.
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export declare const getProviderIndex: (provider: string, providerNames: string[]) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetId.d.ts","sourceRoot":"","sources":["../../../src/utils/assetId.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,OAAkC,CAAA;AAEhF
|
|
1
|
+
{"version":3,"file":"assetId.d.ts","sourceRoot":"","sources":["../../../src/utils/assetId.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,OAAkC,CAAA;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,eAAe,MAAM,EACrB,iBAAiB,MAAM,KACtB,MAKF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,eAAe,MAAM,EAAE,KACtB,MAMF,CAAA"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import type { Asset } from '@lifi/perps-types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Names of Unit-bridged Hyperliquid spot tokens recognized by the logo
|
|
4
|
+
* resolver. The set is read-only and is intended for callers that need to
|
|
5
|
+
* distinguish Unit balances before resolving their icons.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
3
8
|
export declare const UNIT_TOKEN_NAMES: ReadonlySet<string>;
|
|
4
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Apply the provider's known symbol-specific logo corrections to an asset.
|
|
11
|
+
* Returns the original object when no override exists.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
5
14
|
export declare const applyLogoOverride: (asset: Asset) => Asset;
|
|
6
15
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* When `fullName` is absent — spot *balances* (`HlSpotBalance`) carry no
|
|
13
|
-
* `fullName` and this issue deliberately does not fetch `spotMeta` on the
|
|
14
|
-
* account path — the derivation degrades to the symbol-keyed override + base
|
|
15
|
-
* `_spot` rule, so a Unit-bridged balance uses the base rule rather than its
|
|
16
|
-
* underlying's icon. The registry path (which has `fullName`) keeps full Unit
|
|
17
|
-
* resolution.
|
|
16
|
+
* Resolve the logo URI for a Hyperliquid spot token. Unit-bridged tokens use
|
|
17
|
+
* the underlying symbol's icon when `fullName` starts with `'Unit'`; otherwise
|
|
18
|
+
* the base URI is `coins/${name}_spot.svg`. Known symbol overrides win.
|
|
19
|
+
* @public
|
|
18
20
|
*/
|
|
19
21
|
export declare const spotLogoURI: (name: string, fullName?: string | null) => string;
|
|
20
22
|
//# sourceMappingURL=assetLogo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetLogo.d.ts","sourceRoot":"","sources":["../../../src/utils/assetLogo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAiD9C
|
|
1
|
+
{"version":3,"file":"assetLogo.d.ts","sourceRoot":"","sources":["../../../src/utils/assetLogo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAiD9C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAEhD,CAAA;AAQD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,KAAG,KAGhD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,GAAG,IAAI,KAAG,MAKpE,CAAA"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { HlWsFastAssetCtx } from '../types/index.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Decode a base64-encoded raw-DEFLATE payload and parse its UTF-8 JSON body.
|
|
4
|
+
* @typeParam T - Expected shape of the decoded JSON value.
|
|
5
|
+
* @throws If decompression or JSON parsing fails.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
3
8
|
export declare function decodeCompressedJson<T>(base64: string): Promise<T>;
|
|
4
9
|
/**
|
|
5
10
|
* Decode a Hyperliquid `fastAssetCtxs` frame. HL sends the payload as a
|
|
@@ -8,6 +13,7 @@ export declare function decodeCompressedJson<T>(base64: string): Promise<T>;
|
|
|
8
13
|
* (Node 18+, modern browsers), so no dependency is needed.
|
|
9
14
|
*
|
|
10
15
|
* @throws If the input is not valid base64 / raw-DEFLATE / JSON.
|
|
16
|
+
* @public
|
|
11
17
|
*/
|
|
12
18
|
export declare function decodeFastAssetCtxs(base64: string): Promise<Record<string, HlWsFastAssetCtx>>;
|
|
13
19
|
//# sourceMappingURL=decodeFastAssetCtxs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeFastAssetCtxs.d.ts","sourceRoot":"","sources":["../../../src/utils/decodeFastAssetCtxs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD
|
|
1
|
+
{"version":3,"file":"decodeFastAssetCtxs.d.ts","sourceRoot":"","sources":["../../../src/utils/decodeFastAssetCtxs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAcxE;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAE3C"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { type PerpsSDKClient, type ResolvedRetryPolicy, type SDKRequestOptions } from '@lifi/perps-sdk';
|
|
2
2
|
/** @internal */
|
|
3
3
|
export declare const HYPERLIQUID_RETRY_DEFAULTS: ResolvedRetryPolicy;
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Transport options for a direct Hyperliquid `/info` request. `policy`
|
|
6
|
+
* controls retries, `signal` cancels the request, and `fetchImpl` overrides
|
|
7
|
+
* the runtime's global `fetch` implementation.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
5
10
|
export interface InfoRequestOptions {
|
|
6
11
|
signal?: AbortSignal;
|
|
7
12
|
policy?: ResolvedRetryPolicy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infoClient.d.ts","sourceRoot":"","sources":["../../../src/utils/infoClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAA;AAuBxB,gBAAgB;AAChB,eAAO,MAAM,0BAA0B,EAAE,mBAmBxC,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"infoClient.d.ts","sourceRoot":"","sources":["../../../src/utils/infoClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAExB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAA;AAuBxB,gBAAgB;AAChB,eAAO,MAAM,0BAA0B,EAAE,mBAmBxC,CAAA;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,cAAc,EACtB,UAAU,iBAAiB,KAC1B,kBAQD,CAAA;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAqCZ"}
|
|
@@ -10,6 +10,15 @@ import type { HlFundingUpdate, HlLedgerUpdate } from '../types/index.js';
|
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export declare const mapLedgerEntry: (entry: HlLedgerUpdate, providerKey: string, queriedAddress: string, resolveMarket: (coin: string) => MarketDisplay) => ActivityItem | null;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Map a Hyperliquid funding ledger update to a normalized funding activity.
|
|
15
|
+
* `amount`, `positionSize`, and `fundingRate` retain the upstream decimal
|
|
16
|
+
* strings; `resolveMarket` supplies the provider-agnostic market metadata.
|
|
17
|
+
*
|
|
18
|
+
* `userFunding` entries all carry the zero hash, so a deterministic
|
|
19
|
+
* `funding:<coin>:<ISO time>` id is synthesized — funding accrues at most
|
|
20
|
+
* once per coin per hourly settlement, so the pair is unique per account.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
14
23
|
export declare const mapFundingActivity: (entry: HlFundingUpdate, providerKey: string, resolveMarket: (coin: string) => MarketDisplay) => FundingActivity;
|
|
15
24
|
//# sourceMappingURL=mapActivity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapActivity.d.ts","sourceRoot":"","sources":["../../../src/utils/mapActivity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,eAAe,EAEf,aAAa,EAGd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGxE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,cAAc,EACrB,aAAa,MAAM,EACnB,gBAAgB,MAAM,EACtB,eAAe,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,KAC7C,YAAY,GAAG,IA0IjB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"mapActivity.d.ts","sourceRoot":"","sources":["../../../src/utils/mapActivity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,eAAe,EAEf,aAAa,EAGd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAGxE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,cAAc,EACrB,aAAa,MAAM,EACnB,gBAAgB,MAAM,EACtB,eAAe,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,KAC7C,YAAY,GAAG,IA0IjB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,eAAe,EACtB,aAAa,MAAM,EACnB,eAAe,CAAC,IAAI,EAAE,MAAM,KAAK,aAAa,KAC7C,eAYF,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { classifyFillFromPosition } from '@lifi/perps-sdk';
|
|
2
2
|
import type { Fill, MarketDisplay } from '@lifi/perps-types';
|
|
3
3
|
import type { HlUserFill } from '../types/index.js';
|
|
4
|
+
/** Re-export the shared fill-position classifier used by Hyperliquid mappings. @public */
|
|
4
5
|
export { classifyFillFromPosition };
|
|
5
6
|
/**
|
|
6
7
|
* Spot-ness comes from the resolved market's category, not the coin string —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapFill.d.ts","sourceRoot":"","sources":["../../../src/utils/mapFill.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAGzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAS5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,wBAAwB,EAAE,CAAA;AAEnC;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,UAAU,EAAE,QAAQ,aAAa,KAAG,IA4BhE,CAAA"}
|
|
1
|
+
{"version":3,"file":"mapFill.d.ts","sourceRoot":"","sources":["../../../src/utils/mapFill.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAGzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAS5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,0FAA0F;AAC1F,OAAO,EAAE,wBAAwB,EAAE,CAAA;AAEnC;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,MAAM,UAAU,EAAE,QAAQ,aAAa,KAAG,IA4BhE,CAAA"}
|
|
@@ -7,7 +7,7 @@ import type { HlFrontendOpenOrder, HlOrderDetail } from '../types/index.js';
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export declare const mapOrderType: (orderType: string) => OrderType;
|
|
10
|
-
/** @public */
|
|
10
|
+
/** Return whether an SDK order type represents a take-profit or stop trigger. @public */
|
|
11
11
|
export declare const isTriggerType: (type: OrderType) => boolean;
|
|
12
12
|
/**
|
|
13
13
|
* Decide whether a raw Hyperliquid order belongs in the cross-provider
|
|
@@ -30,9 +30,16 @@ export declare const isTriggerType: (type: OrderType) => boolean;
|
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
32
|
export declare const isTriggerOrder: (o: HlFrontendOpenOrder | HlOrderDetail["order"]) => boolean;
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Map an open Hyperliquid order to the SDK's normalized open-order shape.
|
|
35
|
+
* Numeric IDs become strings and wire millisecond timestamps become ISO dates.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
34
38
|
export declare const mapOpenOrder: (o: HlFrontendOpenOrder, market: MarketDisplay) => OpenOrder;
|
|
35
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Map a Hyperliquid trigger/TP-SL order to the SDK's trigger-order shape.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
36
43
|
export declare const mapTriggerOrder: (o: HlFrontendOpenOrder, market: MarketDisplay) => TriggerOrder;
|
|
37
44
|
/**
|
|
38
45
|
* Map a raw Hyperliquid order status string to the SDK's OrderStatus enum.
|
|
@@ -54,6 +61,10 @@ export declare const mapOrderStatus: (status: string) => OrderStatus;
|
|
|
54
61
|
* @public
|
|
55
62
|
*/
|
|
56
63
|
export declare const mapStatusReason: (status: string) => string | undefined;
|
|
57
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Map an `orderStatus` detail to the SDK's normalized order shape, preserving
|
|
66
|
+
* decimal size/price strings and translating status, side, and time-in-force.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
58
69
|
export declare const mapOrder: (detail: HlOrderDetail, market: MarketDisplay) => Order;
|
|
59
70
|
//# sourceMappingURL=mapOrder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapOrder.d.ts","sourceRoot":"","sources":["../../../src/utils/mapOrder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,KAAK,EACL,YAAY,EACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,WAAW,EACX,SAAS,EAEV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,WAAW,MAAM,KAAG,SAehD,CAAA;AAED,
|
|
1
|
+
{"version":3,"file":"mapOrder.d.ts","sourceRoot":"","sources":["../../../src/utils/mapOrder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,KAAK,EACL,YAAY,EACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,WAAW,EACX,SAAS,EAEV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,WAAW,MAAM,KAAG,SAehD,CAAA;AAED,yFAAyF;AACzF,eAAO,MAAM,aAAa,GAAI,MAAM,SAAS,KAAG,OAIjB,CAAA;AAE/B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,GACzB,GAAG,mBAAmB,GAAG,aAAa,CAAC,OAAO,CAAC,KAC9C,OAkBF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,GACvB,GAAG,mBAAmB,EACtB,QAAQ,aAAa,KACpB,SAaD,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,GAAG,mBAAmB,EACtB,QAAQ,aAAa,KACpB,YAcF,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,WAwB/C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAmDzD,CAAA;AAeD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GACnB,QAAQ,aAAa,EACrB,QAAQ,aAAa,KACpB,KAsBF,CAAA"}
|
|
@@ -7,6 +7,11 @@ import type { HlAssetPosition } from '../types/index.js';
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export declare const isOpenAssetPosition: (ap: HlAssetPosition) => boolean;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Map a non-zero Hyperliquid position payload to the SDK's normalized
|
|
12
|
+
* position. Signed wire size determines side; decimal strings remain strings
|
|
13
|
+
* in the normalized response.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
11
16
|
export declare const mapPosition: (ap: HlAssetPosition, market: PerpsMarketDisplay) => Position;
|
|
12
17
|
//# sourceMappingURL=mapPosition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapPosition.d.ts","sourceRoot":"","sources":["../../../src/utils/mapPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,eAAe,KAAG,OAChB,CAAA;AAE1C
|
|
1
|
+
{"version":3,"file":"mapPosition.d.ts","sourceRoot":"","sources":["../../../src/utils/mapPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAGrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,eAAe,KAAG,OAChB,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,IAAI,eAAe,EACnB,QAAQ,kBAAkB,KACzB,QAyBF,CAAA"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import type { Asset, Balance, Market } from '@lifi/perps-types';
|
|
2
2
|
import type { HlSpotBalance } from '../types/index.js';
|
|
3
3
|
/**
|
|
4
|
-
* USD
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Build USD prices keyed by spot token asset ID. Base tokens use the supplied
|
|
5
|
+
* market mark price; quote tokens default to exactly `$1`; missing base prices
|
|
6
|
+
* default to `0`.
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
export declare const spotPriceById: (markets: readonly Market[], priceByMarketId: ReadonlyMap<string, number>) => Map<string, number>;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `_spot` rule (see {@link spotLogoURI}).
|
|
11
|
+
* Convert a Hyperliquid spot balance's numeric token index into an SDK asset.
|
|
12
|
+
* The balance payload has no `fullName`, so logo resolution uses the base
|
|
13
|
+
* `_spot` URI rule rather than Unit-underlying lookup.
|
|
14
|
+
* @public
|
|
16
15
|
*/
|
|
17
16
|
export declare const spotAssetFromToken: (b: HlSpotBalance) => Asset;
|
|
18
|
-
/** Assemble a typed spot {@link Balance}
|
|
17
|
+
/** Assemble a typed spot {@link Balance}; `total` is native token units and its USD value uses `priceById`. @public */
|
|
19
18
|
export declare const spotBalance: (asset: Asset, total: string, priceById: Map<string, number>) => Balance;
|
|
20
19
|
//# sourceMappingURL=spotBalance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotBalance.d.ts","sourceRoot":"","sources":["../../../src/utils/spotBalance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAItD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,SAAS,MAAM,EAAE,EAC1B,iBAAiB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAC3C,GAAG,CAAC,MAAM,EAAE,MAAM,CAapB,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"spotBalance.d.ts","sourceRoot":"","sources":["../../../src/utils/spotBalance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAItD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,SAAS,MAAM,EAAE,EAC1B,iBAAiB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAC3C,GAAG,CAAC,MAAM,EAAE,MAAM,CAapB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,GAAG,aAAa,KAAG,KAIpD,CAAA;AAEF,uHAAuH;AACvH,eAAO,MAAM,WAAW,GACtB,OAAO,KAAK,EACZ,OAAO,MAAM,EACb,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAC7B,OAKD,CAAA"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { Balance } from '@lifi/perps-types';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Result of {@link partitionSpotBalances}: balances that count toward
|
|
4
|
+
* collateral and balances treated as ordinary holdings.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
3
7
|
export interface SpotPartition {
|
|
4
8
|
collateralBalances: Balance[];
|
|
5
9
|
balances: Balance[];
|
|
6
10
|
}
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* Partition spot balances into collateral and ordinary holdings. Quote assets
|
|
13
|
+
* are full-value collateral; portfolio-margin-supported assets retain their
|
|
14
|
+
* LTV as `collateralWeight`.
|
|
15
|
+
* @public
|
|
12
16
|
*/
|
|
13
17
|
export declare const partitionSpotBalances: (spotBalances: readonly Balance[], quoteAssetIds: ReadonlySet<string>, portfolioMargin: boolean) => SpotPartition;
|
|
14
18
|
//# sourceMappingURL=spotCollateral.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotCollateral.d.ts","sourceRoot":"","sources":["../../../src/utils/spotCollateral.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAehD
|
|
1
|
+
{"version":3,"file":"spotCollateral.d.ts","sourceRoot":"","sources":["../../../src/utils/spotCollateral.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAehD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB,EAAE,OAAO,EAAE,CAAA;IAC7B,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,cAAc,SAAS,OAAO,EAAE,EAChC,eAAe,WAAW,CAAC,MAAM,CAAC,EAClC,iBAAiB,OAAO,KACvB,aAkBF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transferMargin.d.ts","sourceRoot":"","sources":["../../../src/utils/transferMargin.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"transferMargin.d.ts","sourceRoot":"","sources":["../../../src/utils/transferMargin.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,yBAAyB,EAE/B,MAAM,mBAAmB,CAAA;AAyB1B;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,GACjB,yBAAyB,GAAG,SAAS,CAoBvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/perps-sdk-provider-hyperliquid",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Hyperliquid provider plugin for @lifi/perps-sdk",
|
|
5
5
|
"homepage": "https://github.com/lifinance/perps-sdk",
|
|
6
6
|
"bugs": {
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"big.js": "^7.0.1",
|
|
50
50
|
"viem": "^2.48.8",
|
|
51
|
-
"@lifi/perps-types": "^4.
|
|
51
|
+
"@lifi/perps-types": "^4.1.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@lifi/perps-sdk": "^6.
|
|
54
|
+
"@lifi/perps-sdk": "^6.1.0"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
@@ -101,15 +101,25 @@ export interface HyperliquidProviderOptions {
|
|
|
101
101
|
* persistence, and revocation. The base {@link PerpsProviderPlugin} contract
|
|
102
102
|
* stays provider-agnostic — this extension is opt-in for callers that
|
|
103
103
|
* explicitly type against it (e.g. to surface a "revoke agent" affordance).
|
|
104
|
+
* @public
|
|
104
105
|
*/
|
|
105
106
|
export interface HyperliquidPerpsProvider extends PerpsProviderPlugin {
|
|
106
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Resolve the stored agent wallet address for a user.
|
|
109
|
+
* @throws {PerpsError} With `AgentNotFound` when no agent has been created.
|
|
110
|
+
*/
|
|
107
111
|
getAgentAddress(address: Address): Promise<Address>
|
|
108
|
-
/**
|
|
112
|
+
/** Return whether a persisted agent keypair exists for the user address. */
|
|
109
113
|
hasAgent(address: Address): Promise<boolean>
|
|
110
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Remove the user's persisted agent keypair and local authorization.
|
|
116
|
+
* This does not submit an on-chain `APPROVE_AGENT` revocation.
|
|
117
|
+
*/
|
|
111
118
|
removeAgent(address: Address): Promise<void>
|
|
112
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Validate, persist, and return an existing agent private key for a user.
|
|
121
|
+
* The returned private key is stored by the configured {@link StorageAdapter}.
|
|
122
|
+
*/
|
|
113
123
|
importAgent(address: Address, privateKey: Hex): Promise<HyperliquidAgent>
|
|
114
124
|
}
|
|
115
125
|
|
|
@@ -31,11 +31,15 @@ import {
|
|
|
31
31
|
*/
|
|
32
32
|
export interface GetActivityParams {
|
|
33
33
|
address: Address
|
|
34
|
+
/** Maximum items returned; defaults to 50 and is capped at 200. */
|
|
34
35
|
limit?: number
|
|
35
|
-
/**
|
|
36
|
+
/** Millisecond timestamp cursor; rows strictly older than it are returned. */
|
|
36
37
|
cursor?: string
|
|
38
|
+
/** Inclusive lower bound in milliseconds since epoch; defaults to 90 days ago. */
|
|
37
39
|
startTime?: number
|
|
40
|
+
/** Inclusive upper bound in milliseconds since epoch. */
|
|
38
41
|
endTime?: number
|
|
42
|
+
/** Optional normalized activity-type filter applied after mapping. */
|
|
39
43
|
type?: ActivityType[]
|
|
40
44
|
}
|
|
41
45
|
|
package/src/services/getFills.ts
CHANGED
|
@@ -22,12 +22,13 @@ import { hlInfoOptions, infoRequest } from '../utils/infoClient.js'
|
|
|
22
22
|
*/
|
|
23
23
|
export interface GetFillsParams {
|
|
24
24
|
address: Address
|
|
25
|
+
/** Maximum items returned; defaults to 50 and is capped at 200. */
|
|
25
26
|
limit?: number
|
|
26
|
-
/** Opaque
|
|
27
|
+
/** Opaque cursor returned in the previous page's `pagination.cursor`. */
|
|
27
28
|
cursor?: string
|
|
28
|
-
/** Inclusive lower bound in
|
|
29
|
+
/** Inclusive lower bound in milliseconds; selects `userFillsByTime`. */
|
|
29
30
|
startTime?: number
|
|
30
|
-
/** Inclusive upper bound in
|
|
31
|
+
/** Inclusive upper bound in milliseconds; selects `userFillsByTime`. */
|
|
31
32
|
endTime?: number
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -22,8 +22,9 @@ import { hlInfoOptions, infoRequest } from '../utils/infoClient.js'
|
|
|
22
22
|
*/
|
|
23
23
|
export interface GetOrdersParams {
|
|
24
24
|
address: Address
|
|
25
|
-
/** Optional filter
|
|
25
|
+
/** Optional filter using the normalized opaque `Market.id`. */
|
|
26
26
|
marketId?: string
|
|
27
|
+
/** Page-size hint; Hyperliquid returns all open orders in one response. */
|
|
27
28
|
limit?: number
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -22,9 +22,9 @@ import { hlInfoOptions, infoRequest } from '../utils/infoClient.js'
|
|
|
22
22
|
*/
|
|
23
23
|
export interface GetPositionsParams {
|
|
24
24
|
address: Address
|
|
25
|
-
/**
|
|
25
|
+
/** Optional filter using the normalized opaque `Market.id`. */
|
|
26
26
|
marketId?: string
|
|
27
|
-
/** Page
|
|
27
|
+
/** Page-size hint; Hyperliquid returns all open positions in one response. */
|
|
28
28
|
limit?: number
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -15,12 +15,11 @@ const STORAGE_PREFIX = 'lifi-perps-agent'
|
|
|
15
15
|
/**
|
|
16
16
|
* Hyperliquid agent keypair — an EVM keypair the user approves (via
|
|
17
17
|
* `APPROVE_AGENT`) to sign trading actions on their behalf, so each order
|
|
18
|
-
* does not require a wallet prompt.
|
|
18
|
+
* does not require a wallet prompt. `privateKey` is a 32-byte EVM hex key.
|
|
19
|
+
* @public
|
|
19
20
|
*/
|
|
20
21
|
export interface HyperliquidAgent {
|
|
21
|
-
/** Agent wallet address. */
|
|
22
22
|
address: Address
|
|
23
|
-
/** Agent private key. */
|
|
24
23
|
privateKey: Hex
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -60,6 +59,7 @@ const isHyperliquidAgent = (value: unknown): value is HyperliquidAgent => {
|
|
|
60
59
|
* fully compromised page — a same-origin script can still drive this store to
|
|
61
60
|
* decrypt. Blast radius is limited to agent trading: fund withdrawal still
|
|
62
61
|
* requires L1 `APPROVE_AGENT` consent that the agent key alone cannot grant.
|
|
62
|
+
* @public
|
|
63
63
|
*/
|
|
64
64
|
export class HyperliquidAgentStore {
|
|
65
65
|
private storage: StorageAdapter
|