@syldel/hl-shared-types 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -22
- package/dist/interfaces/actions/modify.interfaces.d.ts +2 -1
- package/dist/interfaces/common/common.interfaces.d.ts +4 -0
- package/dist/interfaces/common/common.interfaces.js +2 -0
- package/dist/interfaces/common/index.d.ts +1 -0
- package/dist/interfaces/common/index.js +17 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/orders/open-order.interfaces.d.ts +2 -3
- package/dist/interfaces/orders/order-details.interfaces.d.ts +1 -1
- package/dist/interfaces/orders/order-status.interfaces.d.ts +3 -4
- package/dist/interfaces/orders/user-fills.interfaces.d.ts +2 -1
- package/dist/interfaces/params/params.d.ts +64 -0
- package/dist/interfaces/params/params.js +2 -0
- package/dist/interfaces/perp/balance.interfaces.d.ts +1 -2
- package/dist/interfaces/perp/meta.interfaces.d.ts +1 -1
- package/dist/interfaces/responses/order.interfaces.d.ts +3 -3
- package/dist/interfaces/smart/batch-protective-order.interfaces.d.ts +2 -1
- package/dist/interfaces/smart/protective-order.interfaces.d.ts +1 -1
- package/dist/interfaces/smart/smart-order.interfaces.d.ts +1 -1
- package/dist/interfaces/spot/balance.interfaces.d.ts +1 -1
- package/package.json +23 -7
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
# @syldel/hl-types
|
|
1
|
+
# @syldel/hl-shared-types
|
|
2
2
|
|
|
3
3
|
Ce package centralise les définitions TypeScript pour l'écosystème **Hyperliquid**. Il sert de source de vérité unique pour les interfaces d'API, les types de la blockchain (L1) et les DTOs de communication entre le Gateway, le Bot de trading et l'application mobile.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p style="display: flex; justify-content: center; gap: 24px;">
|
|
6
|
+
<a href="https://www.typescriptlang.org/" target="_blank"><img src="https://i.postimg.cc/28V1jRWW/typescript.png" alt="Typescript" height="120" /></a>
|
|
7
|
+
<a href="https://app.hyperliquid.xyz/" target="_blank"><img src="https://i.postimg.cc/prPKc0cg/HL-symbol-mint-green.png" alt="Hyperliquid" height="120" /></a>
|
|
8
|
+
</p>
|
|
6
9
|
|
|
7
10
|
---
|
|
8
11
|
|
|
@@ -12,7 +15,6 @@ Inspiré par les standards de `nktkas/hyperliquid` et `nomeida/hyperliquid`.
|
|
|
12
15
|
* **Account** : États du compte, positions Perp et soldes Spot.
|
|
13
16
|
* **Market** : Métadonnées des actifs et résumés de marché.
|
|
14
17
|
* **Orders** : Définitions des ordres ouverts et historiques.
|
|
15
|
-
* **DTO** : Objets de transfert de données pour les requêtes API (NestJS).
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
@@ -34,9 +36,6 @@ Le projet utilise **ESLint** pour la logique et **Prettier** pour le formatage.
|
|
|
34
36
|
```bash
|
|
35
37
|
# Vérifier les erreurs
|
|
36
38
|
npx eslint .
|
|
37
|
-
|
|
38
|
-
# Formater automatiquement
|
|
39
|
-
npx prettier --write .
|
|
40
39
|
```
|
|
41
40
|
|
|
42
41
|
---
|
|
@@ -45,30 +44,19 @@ npx prettier --write .
|
|
|
45
44
|
|
|
46
45
|
Pour utiliser ce package dans tes autres projets (`bot`, `gateway` ou `mobile`) sans le publier sur NPM :
|
|
47
46
|
|
|
48
|
-
1. Dans le dossier `hl-types` :
|
|
47
|
+
1. Dans le dossier `hl-shared-types` :
|
|
49
48
|
```bash
|
|
50
49
|
npm link
|
|
51
50
|
```
|
|
52
51
|
2. Dans ton projet (ex: `my-trading-bot`) :
|
|
53
52
|
```bash
|
|
54
|
-
npm link @syldel/hl-types
|
|
53
|
+
npm link @syldel/hl-shared-types
|
|
55
54
|
```
|
|
56
55
|
|
|
57
56
|
---
|
|
58
57
|
|
|
59
58
|
## 📦 Publication
|
|
60
59
|
|
|
61
|
-
### 1. Préparer la version
|
|
62
|
-
Mets à jour la version dans le `package.json` (ex: `1.0.0`), puis :
|
|
63
|
-
```bash
|
|
64
|
-
npm run build
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### 2. Publier sur NPM (Public)
|
|
68
|
-
```bash
|
|
69
|
-
npm publish --access public
|
|
70
|
-
```
|
|
71
|
-
|
|
72
60
|
Le projet utilise des **Granular Access Tokens** pour la publication afin de contourner la double authentification (2FA) manuelle tout en maintenant une sécurité maximale.
|
|
73
61
|
|
|
74
62
|
### Configuration du Token
|
|
@@ -96,6 +84,11 @@ La commande suivante automatise le build, l'incrémentation de version et l'envo
|
|
|
96
84
|
npm run release
|
|
97
85
|
```
|
|
98
86
|
|
|
87
|
+
### Pousse le commit ET le tag sur GitHub
|
|
88
|
+
```bash
|
|
89
|
+
git push origin main --follow-tags
|
|
90
|
+
```
|
|
91
|
+
|
|
99
92
|
---
|
|
100
93
|
|
|
101
94
|
## 📝 Conventions de code
|
|
@@ -105,6 +98,3 @@ npm run release
|
|
|
105
98
|
* **Types stricts** : Usage de `DecimalString` pour la précision financière.
|
|
106
99
|
|
|
107
100
|
---
|
|
108
|
-
|
|
109
|
-
## ⚖️ Licence
|
|
110
|
-
ISC
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './common.interfaces';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./common.interfaces"), exports);
|
package/dist/interfaces/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./actions/index"), exports);
|
|
18
|
+
__exportStar(require("./common/index"), exports);
|
|
18
19
|
__exportStar(require("./orders/index"), exports);
|
|
19
20
|
__exportStar(require("./params/index"), exports);
|
|
20
21
|
__exportStar(require("./responses/index"), exports);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { DecimalString } from '
|
|
2
|
-
export type HLOid = number | `0x${string}`;
|
|
1
|
+
import { DecimalString, HLOid, Timestamp } from '../common';
|
|
3
2
|
export interface HLOpenOrder {
|
|
4
3
|
coin: string;
|
|
5
4
|
limitPx: DecimalString;
|
|
6
5
|
oid: HLOid;
|
|
7
6
|
side: 'A' | 'B';
|
|
8
7
|
sz: DecimalString;
|
|
9
|
-
timestamp:
|
|
8
|
+
timestamp: Timestamp;
|
|
10
9
|
}
|
|
11
10
|
export type HLOpenOrdersResponse = HLOpenOrder[];
|
|
12
11
|
export interface HLFrontendOpenOrder extends HLOpenOrder {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { HLOid } from '
|
|
2
|
-
import { DecimalString } from './order-details.interfaces';
|
|
1
|
+
import { DecimalString, HLOid, Timestamp } from '../common';
|
|
3
2
|
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';
|
|
4
3
|
export interface HLOrderStatusDetails {
|
|
5
4
|
coin: string;
|
|
@@ -7,7 +6,7 @@ export interface HLOrderStatusDetails {
|
|
|
7
6
|
limitPx: DecimalString;
|
|
8
7
|
sz: DecimalString;
|
|
9
8
|
oid: HLOid;
|
|
10
|
-
timestamp:
|
|
9
|
+
timestamp: Timestamp;
|
|
11
10
|
triggerCondition: string;
|
|
12
11
|
isTrigger: boolean;
|
|
13
12
|
triggerPx: DecimalString;
|
|
@@ -22,7 +21,7 @@ export interface HLOrderStatusDetails {
|
|
|
22
21
|
export interface HLOrderStatusData {
|
|
23
22
|
order: HLOrderStatusDetails;
|
|
24
23
|
status: HLOrderStatus;
|
|
25
|
-
statusTimestamp:
|
|
24
|
+
statusTimestamp: Timestamp;
|
|
26
25
|
}
|
|
27
26
|
export interface HLOrderStatusResponse {
|
|
28
27
|
status: 'order' | 'unknownOid';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { HLOrderGrouping } from '../actions';
|
|
2
|
+
import { HLOid } from '../common';
|
|
3
|
+
import { HLOrderDetails } from '../orders';
|
|
4
|
+
export interface PlaceOrderParams {
|
|
5
|
+
order: HLOrderDetails;
|
|
6
|
+
grouping?: HLOrderGrouping;
|
|
7
|
+
builder?: {
|
|
8
|
+
b: string;
|
|
9
|
+
f: number;
|
|
10
|
+
};
|
|
11
|
+
isTestnet?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ModifyOrderItem {
|
|
14
|
+
oid: HLOid;
|
|
15
|
+
order: HLOrderDetails;
|
|
16
|
+
}
|
|
17
|
+
export interface ModifyOrderParams extends ModifyOrderItem {
|
|
18
|
+
isTestnet?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface BatchModifyOrdersParams {
|
|
21
|
+
modifies: ModifyOrderItem[];
|
|
22
|
+
isTestnet?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface CancelOrderParams {
|
|
25
|
+
cancels: {
|
|
26
|
+
asset: number;
|
|
27
|
+
oid: HLOid;
|
|
28
|
+
}[];
|
|
29
|
+
isTestnet?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface CancelOrderByCloidParams {
|
|
32
|
+
cancels: {
|
|
33
|
+
asset: number;
|
|
34
|
+
cloid: string;
|
|
35
|
+
}[];
|
|
36
|
+
isTestnet?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface UpdateLeverageParams {
|
|
39
|
+
asset: number;
|
|
40
|
+
isCross: boolean;
|
|
41
|
+
leverage: number;
|
|
42
|
+
isTestnet?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface GetOpenOrdersQueryParams {
|
|
45
|
+
dex?: string;
|
|
46
|
+
isTestnet?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface OrderStatusQueryParams {
|
|
49
|
+
isTestnet?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface TransferSpotPerpParams {
|
|
52
|
+
amount: string;
|
|
53
|
+
toPerp: boolean;
|
|
54
|
+
isTestnet?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ProtectiveActionResult {
|
|
57
|
+
cancelled: HLOid[];
|
|
58
|
+
created: HLOid[];
|
|
59
|
+
updated: HLOid[];
|
|
60
|
+
}
|
|
61
|
+
export interface SmartOrderResponse {
|
|
62
|
+
tp: ProtectiveActionResult;
|
|
63
|
+
sl: ProtectiveActionResult;
|
|
64
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { HLOid } from '../
|
|
1
|
+
import { DecimalString, HLOid } from '../common';
|
|
2
2
|
export interface HLPlaceOrderStatus {
|
|
3
3
|
resting?: {
|
|
4
4
|
oid: HLOid;
|
|
5
5
|
};
|
|
6
6
|
filled?: {
|
|
7
7
|
oid: HLOid;
|
|
8
|
-
totalSz:
|
|
9
|
-
avgPx:
|
|
8
|
+
totalSz: DecimalString;
|
|
9
|
+
avgPx: DecimalString;
|
|
10
10
|
};
|
|
11
11
|
error?: string;
|
|
12
12
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DecimalString, HLOid
|
|
1
|
+
import { DecimalString, HLOid } from '../common';
|
|
2
|
+
import { HLOrderDetails } from '../orders';
|
|
2
3
|
import { HLProtectiveKind } from './protective-order.interfaces';
|
|
3
4
|
export interface BatchProtectiveOrderItem {
|
|
4
5
|
sz: string;
|
package/package.json
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syldel/hl-shared-types",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Shared Hyperliquid
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Shared TypeScript interfaces and types for Hyperliquid integration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Syldel/hl-shared-types.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Syldel/hl-shared-types/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/Syldel/hl-shared-types#readme",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
8
18
|
"scripts": {
|
|
9
19
|
"lint": "eslint .",
|
|
10
20
|
"lint:fix": "eslint . --fix",
|
|
11
|
-
"format:pkg": "eslint package.json --fix",
|
|
12
21
|
"clean": "rm -rf dist",
|
|
13
22
|
"build": "npm run lint && npm run clean && tsc",
|
|
14
|
-
"postversion": "npm run format:pkg",
|
|
15
23
|
"prepublishOnly": "npm run build",
|
|
16
|
-
"release": "npm
|
|
24
|
+
"release": "npm run build && npm version patch && npm publish"
|
|
17
25
|
},
|
|
18
26
|
"publishConfig": {
|
|
19
27
|
"access": "public"
|
|
20
28
|
},
|
|
21
|
-
"keywords": [
|
|
29
|
+
"keywords": [
|
|
30
|
+
"hyperliquid",
|
|
31
|
+
"trading",
|
|
32
|
+
"types",
|
|
33
|
+
"interfaces",
|
|
34
|
+
"crypto",
|
|
35
|
+
"exchange",
|
|
36
|
+
"defi"
|
|
37
|
+
],
|
|
22
38
|
"author": "Syl. D.",
|
|
23
39
|
"license": "ISC",
|
|
24
40
|
"devDependencies": {
|