@syldel/hl-shared-types 0.0.1 → 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.
Files changed (71) hide show
  1. package/README.md +27 -22
  2. package/dist/index.d.ts +1 -6
  3. package/dist/index.js +1 -6
  4. package/dist/interfaces/actions/cancel.interfaces.d.ts +14 -0
  5. package/dist/interfaces/actions/index.d.ts +4 -0
  6. package/dist/interfaces/actions/index.js +20 -0
  7. package/dist/interfaces/actions/modify.interfaces.d.ts +26 -0
  8. package/dist/interfaces/actions/order.interfaces.d.ts +12 -0
  9. package/dist/interfaces/actions/transfer.interfaces.d.ts +94 -0
  10. package/dist/interfaces/actions/transfer.interfaces.js +10 -0
  11. package/dist/interfaces/common/common.interfaces.d.ts +4 -0
  12. package/dist/interfaces/common/index.d.ts +1 -0
  13. package/dist/interfaces/common/index.js +17 -0
  14. package/dist/interfaces/index.d.ts +8 -0
  15. package/dist/interfaces/index.js +24 -0
  16. package/dist/interfaces/orders/index.d.ts +4 -0
  17. package/dist/interfaces/orders/index.js +20 -0
  18. package/dist/interfaces/orders/open-order.interfaces.d.ts +20 -0
  19. package/dist/interfaces/orders/order-details.interfaces.d.ts +69 -0
  20. package/dist/interfaces/orders/order-status.interfaces.d.ts +34 -0
  21. package/dist/interfaces/orders/order-status.interfaces.js +2 -0
  22. package/dist/interfaces/orders/user-fills.interfaces.d.ts +19 -0
  23. package/dist/interfaces/orders/user-fills.interfaces.js +2 -0
  24. package/dist/interfaces/params/index.d.ts +1 -0
  25. package/dist/interfaces/params/index.js +17 -0
  26. package/dist/interfaces/params/params.d.ts +64 -0
  27. package/dist/interfaces/params/params.js +2 -0
  28. package/dist/interfaces/params/signature.interfaces.d.ts +13 -0
  29. package/dist/interfaces/params/signature.interfaces.js +2 -0
  30. package/dist/interfaces/perp/balance.interfaces.d.ts +42 -0
  31. package/dist/interfaces/perp/balance.interfaces.js +2 -0
  32. package/dist/interfaces/perp/index.d.ts +2 -0
  33. package/dist/interfaces/perp/index.js +18 -0
  34. package/dist/interfaces/perp/meta.interfaces.d.ts +50 -0
  35. package/dist/interfaces/perp/meta.interfaces.js +2 -0
  36. package/dist/interfaces/responses/cancel.interfaces.d.ts +9 -0
  37. package/dist/interfaces/responses/cancel.interfaces.js +2 -0
  38. package/dist/interfaces/responses/error.interfaces.d.ts +10 -0
  39. package/dist/interfaces/responses/error.interfaces.js +18 -0
  40. package/dist/interfaces/responses/index.d.ts +4 -0
  41. package/dist/interfaces/responses/index.js +20 -0
  42. package/dist/interfaces/responses/order.interfaces.d.ts +18 -0
  43. package/dist/interfaces/responses/order.interfaces.js +2 -0
  44. package/dist/interfaces/responses/success.interfaces.d.ts +4 -0
  45. package/dist/interfaces/responses/success.interfaces.js +2 -0
  46. package/dist/interfaces/smart/batch-protective-order.interfaces.d.ts +31 -0
  47. package/dist/interfaces/smart/batch-protective-order.interfaces.js +2 -0
  48. package/dist/interfaces/smart/index.d.ts +3 -0
  49. package/dist/interfaces/smart/index.js +19 -0
  50. package/dist/interfaces/smart/protective-order.interfaces.d.ts +11 -0
  51. package/dist/interfaces/smart/protective-order.interfaces.js +2 -0
  52. package/dist/interfaces/smart/smart-order.interfaces.d.ts +26 -0
  53. package/dist/interfaces/smart/smart-order.interfaces.js +2 -0
  54. package/dist/interfaces/spot/balance.interfaces.d.ts +11 -0
  55. package/dist/interfaces/spot/balance.interfaces.js +2 -0
  56. package/dist/interfaces/spot/index.d.ts +2 -0
  57. package/dist/interfaces/spot/index.js +18 -0
  58. package/dist/interfaces/{market.d.ts → spot/meta.interfaces.d.ts} +4 -5
  59. package/dist/interfaces/spot/meta.interfaces.js +2 -0
  60. package/package.json +30 -5
  61. package/dist/interfaces/account.d.ts +0 -23
  62. package/dist/interfaces/common.d.ts +0 -7
  63. package/dist/interfaces/dto.d.ts +0 -32
  64. package/dist/interfaces/orders.d.ts +0 -15
  65. package/dist/interfaces/responses.d.ts +0 -37
  66. /package/dist/interfaces/{account.js → actions/cancel.interfaces.js} +0 -0
  67. /package/dist/interfaces/{common.js → actions/modify.interfaces.js} +0 -0
  68. /package/dist/interfaces/{dto.js → actions/order.interfaces.js} +0 -0
  69. /package/dist/interfaces/{market.js → common/common.interfaces.js} +0 -0
  70. /package/dist/interfaces/{orders.js → orders/open-order.interfaces.js} +0 -0
  71. /package/dist/interfaces/{responses.js → orders/order-details.interfaces.js} +0 -0
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
- Inspiré par les standards de `nktkas/hyperliquid` et `nomeida/hyperliquid`.
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,35 +44,25 @@ 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
75
63
  1. Générer un token sur NPM avec les permissions `Read and Write`.
76
64
  2. Restreindre l'accès au package `@syldel/hl-shared-types` uniquement.
65
+ 3. Utiliser l'option `Bypass 2FA` pour permettre l'automatisation.
77
66
 
78
67
  ### Commande de publication rapide
79
68
  Si tu n'utilises pas de fichier `.npmrc`, tu peux publier en passant le token directement :
@@ -81,6 +70,25 @@ Si tu n'utilises pas de fichier `.npmrc`, tu peux publier en passant le token di
81
70
  npm publish --access public --//registry.npmjs.org/:_authToken=TON_TOKEN_ICI
82
71
  ```
83
72
 
73
+ ### Configuration de la publication
74
+ Créez un fichier .npmrc à la racine (ignoré par Git) pour l'authentification :
75
+
76
+ ```
77
+ //registry.npmjs.org/:_authToken=npm_votre_token_ici
78
+ ```
79
+
80
+ ### Publier une nouvelle version
81
+ La commande suivante automatise le build, l'incrémentation de version et l'envoi vers NPM :
82
+
83
+ ```bash
84
+ npm run release
85
+ ```
86
+
87
+ ### Pousse le commit ET le tag sur GitHub
88
+ ```bash
89
+ git push origin main --follow-tags
90
+ ```
91
+
84
92
  ---
85
93
 
86
94
  ## 📝 Conventions de code
@@ -90,6 +98,3 @@ npm publish --access public --//registry.npmjs.org/:_authToken=TON_TOKEN_ICI
90
98
  * **Types stricts** : Usage de `DecimalString` pour la précision financière.
91
99
 
92
100
  ---
93
-
94
- ## ⚖️ Licence
95
- ISC
package/dist/index.d.ts CHANGED
@@ -1,6 +1 @@
1
- export * from './interfaces/common';
2
- export * from './interfaces/account';
3
- export * from './interfaces/market';
4
- export * from './interfaces/orders';
5
- export * from './interfaces/responses';
6
- export * from './interfaces/dto';
1
+ export * from './interfaces';
package/dist/index.js CHANGED
@@ -14,9 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./interfaces/common"), exports);
18
- __exportStar(require("./interfaces/account"), exports);
19
- __exportStar(require("./interfaces/market"), exports);
20
- __exportStar(require("./interfaces/orders"), exports);
21
- __exportStar(require("./interfaces/responses"), exports);
22
- __exportStar(require("./interfaces/dto"), exports);
17
+ __exportStar(require("./interfaces"), exports);
@@ -0,0 +1,14 @@
1
+ export interface HLCancelAction {
2
+ type: 'cancel';
3
+ cancels: Array<{
4
+ a: number;
5
+ o: number;
6
+ }>;
7
+ }
8
+ export interface HLCancelByCloidAction {
9
+ type: 'cancelByCloid';
10
+ cancels: Array<{
11
+ asset: number;
12
+ cloid: string;
13
+ }>;
14
+ }
@@ -0,0 +1,4 @@
1
+ export * from './order.interfaces';
2
+ export * from './cancel.interfaces';
3
+ export * from './modify.interfaces';
4
+ export * from './transfer.interfaces';
@@ -0,0 +1,20 @@
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("./order.interfaces"), exports);
18
+ __exportStar(require("./cancel.interfaces"), exports);
19
+ __exportStar(require("./modify.interfaces"), exports);
20
+ __exportStar(require("./transfer.interfaces"), exports);
@@ -0,0 +1,26 @@
1
+ import { HLOid } from '../common';
2
+ import { HLApiOrder } from '../orders';
3
+ export interface HLModifyAction {
4
+ type: 'modify';
5
+ oid: HLOid;
6
+ order: HLApiOrder;
7
+ }
8
+ export interface HLBatchModifyAction {
9
+ type: 'batchModify';
10
+ modifies: Array<{
11
+ oid: HLOid;
12
+ order: HLApiOrder;
13
+ }>;
14
+ }
15
+ export interface HLUpdateLeverageAction {
16
+ type: 'updateLeverage';
17
+ asset: number;
18
+ isCross: boolean;
19
+ leverage: number;
20
+ }
21
+ export interface HLUpdateIsolatedMarginAction {
22
+ type: 'updateIsolatedMargin';
23
+ asset: number;
24
+ isBuy: boolean;
25
+ ntli: number;
26
+ }
@@ -0,0 +1,12 @@
1
+ import { HLApiOrder } from '../orders/order-details.interfaces';
2
+ export type HLOrderGrouping = 'na' | 'normalTpsl' | 'positionTpsl';
3
+ export type HLOrderBuilder = {
4
+ b: string;
5
+ f: number;
6
+ };
7
+ export interface HLOrderAction {
8
+ type: 'order';
9
+ orders: HLApiOrder[];
10
+ grouping: HLOrderGrouping;
11
+ builder?: HLOrderBuilder;
12
+ }
@@ -0,0 +1,94 @@
1
+ export interface HLUsdClassTransferAction {
2
+ type: 'usdClassTransfer';
3
+ hyperliquidChain: 'Mainnet' | 'Testnet';
4
+ signatureChainId: string;
5
+ amount: string;
6
+ toPerp: boolean;
7
+ nonce: number;
8
+ }
9
+ export interface HLSpotSendAction {
10
+ type: 'spotSend';
11
+ hyperliquidChain: 'Mainnet' | 'Testnet';
12
+ signatureChainId: string;
13
+ destination: string;
14
+ token: string;
15
+ amount: string;
16
+ time: number;
17
+ }
18
+ export interface HLSendAssetAction {
19
+ type: 'sendAsset';
20
+ hyperliquidChain: 'Mainnet' | 'Testnet';
21
+ signatureChainId: string;
22
+ destination: string;
23
+ sourceDex: string;
24
+ destinationDex: string;
25
+ token: string;
26
+ amount: string;
27
+ fromSubAccount: string;
28
+ nonce: number;
29
+ }
30
+ export interface HLCDepositAction {
31
+ type: 'cDeposit';
32
+ hyperliquidChain: 'Mainnet' | 'Testnet';
33
+ signatureChainId: string;
34
+ wei: number;
35
+ nonce: number;
36
+ }
37
+ export interface HLCWithdrawAction {
38
+ type: 'cWithdraw';
39
+ hyperliquidChain: 'Mainnet' | 'Testnet';
40
+ signatureChainId: string;
41
+ wei: number;
42
+ nonce: number;
43
+ }
44
+ export interface HLTokenDelegateAction {
45
+ type: 'tokenDelegate';
46
+ hyperliquidChain: 'Mainnet' | 'Testnet';
47
+ signatureChainId: string;
48
+ validator: string;
49
+ isUndelegate: boolean;
50
+ wei: number;
51
+ nonce: number;
52
+ }
53
+ export interface HLVaultTransferAction {
54
+ type: 'vaultTransfer';
55
+ vaultAddress: string;
56
+ isDeposit: boolean;
57
+ usd: number;
58
+ }
59
+ export interface HLApproveAgentAction {
60
+ type: 'approveAgent';
61
+ hyperliquidChain: 'Mainnet' | 'Testnet';
62
+ signatureChainId: string;
63
+ agentAddress: string;
64
+ agentName?: string;
65
+ nonce: number;
66
+ }
67
+ export interface HLApproveBuilderFeeAction {
68
+ type: 'approveBuilderFee';
69
+ hyperliquidChain: 'Mainnet' | 'Testnet';
70
+ signatureChainId: string;
71
+ maxFeeRate: string;
72
+ builder: string;
73
+ nonce: number;
74
+ }
75
+ export interface HLTwapOrderAction {
76
+ type: 'twapOrder';
77
+ twap: {
78
+ a: number;
79
+ b: boolean;
80
+ s: string;
81
+ r: boolean;
82
+ m: number;
83
+ t: boolean;
84
+ };
85
+ }
86
+ export interface HLTwapCancelAction {
87
+ type: 'twapCancel';
88
+ a: number;
89
+ t: number;
90
+ }
91
+ export interface HLReserveRequestWeightAction {
92
+ type: 'reserveRequestWeight';
93
+ weight: number;
94
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // export interface HLUsdSendAction {
3
+ // type: 'usdSend';
4
+ // hyperliquidChain: 'Mainnet' | 'Testnet';
5
+ // signatureChainId: string;
6
+ // destination: string;
7
+ // amount: string;
8
+ // time: number;
9
+ // }
10
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type DecimalString = string;
2
+ export type Timestamp = number;
3
+ export type HexString = `0x${string}`;
4
+ export type HLOid = number | HexString;
@@ -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);
@@ -0,0 +1,8 @@
1
+ export * from './actions/index';
2
+ export * from './common/index';
3
+ export * from './orders/index';
4
+ export * from './params/index';
5
+ export * from './responses/index';
6
+ export * from './spot/index';
7
+ export * from './perp/index';
8
+ export * from './smart/index';
@@ -0,0 +1,24 @@
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("./actions/index"), exports);
18
+ __exportStar(require("./common/index"), exports);
19
+ __exportStar(require("./orders/index"), exports);
20
+ __exportStar(require("./params/index"), exports);
21
+ __exportStar(require("./responses/index"), exports);
22
+ __exportStar(require("./spot/index"), exports);
23
+ __exportStar(require("./perp/index"), exports);
24
+ __exportStar(require("./smart/index"), exports);
@@ -0,0 +1,4 @@
1
+ export * from './order-details.interfaces';
2
+ export * from './order-status.interfaces';
3
+ export * from './open-order.interfaces';
4
+ export * from './user-fills.interfaces';
@@ -0,0 +1,20 @@
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("./order-details.interfaces"), exports);
18
+ __exportStar(require("./order-status.interfaces"), exports);
19
+ __exportStar(require("./open-order.interfaces"), exports);
20
+ __exportStar(require("./user-fills.interfaces"), exports);
@@ -0,0 +1,20 @@
1
+ import { DecimalString, HLOid, Timestamp } from '../common';
2
+ export interface HLOpenOrder {
3
+ coin: string;
4
+ limitPx: DecimalString;
5
+ oid: HLOid;
6
+ side: 'A' | 'B';
7
+ sz: DecimalString;
8
+ timestamp: Timestamp;
9
+ }
10
+ export type HLOpenOrdersResponse = HLOpenOrder[];
11
+ export interface HLFrontendOpenOrder extends HLOpenOrder {
12
+ isPositionTpsl: boolean;
13
+ isTrigger: boolean;
14
+ orderType: 'Limit' | 'Market';
15
+ origSz: DecimalString;
16
+ reduceOnly: boolean;
17
+ triggerCondition: string;
18
+ triggerPx: DecimalString;
19
+ }
20
+ export type HLFrontendOpenOrdersResponse = HLFrontendOpenOrder[];
@@ -0,0 +1,69 @@
1
+ import { DecimalString } from '../common';
2
+ /**
3
+ * Détails d'un ordre à placer sur Hyperliquid.
4
+ *
5
+ * @interface HLOrderDetails
6
+ *
7
+ * @property {number} asset - Identifiant numérique de l'actif à trader.
8
+ * @property {boolean} isBuy - True pour un ordre d'achat, false pour un ordre de vente.
9
+ * @property {DecimalString} limitPx - Prix limite pour l'ordre (pour limit orders).
10
+ * @property {DecimalString} sz - Taille (quantité) de l'ordre.
11
+ * @property {boolean} reduceOnly - True si l'ordre est uniquement pour réduire une position existante.
12
+ * @property { { limit: { tif: 'Alo' | 'Ioc' | 'Gtc' } } | { trigger: { isMarket: boolean, triggerPx: DecimalString, tpsl: 'tp' | 'sl' } } } orderType
13
+ * - Type d'ordre :
14
+ * - **Limit Order** : { limit: { tif } } où `tif` définit le comportement du temps de vie de l'ordre :
15
+ *
16
+ * | TIF | Comportement |
17
+ * |-----|--------------|
18
+ * | **Alo** | Post-only, annule si risque d’exécution immédiate |
19
+ * | **Ioc** | Immediate or Cancel, exécute ce qui peut être pris, annule le reste |
20
+ * | **Gtc** | Good Till Cancelled, reste sur le carnet jusqu’à annulation manuelle ou exécution |
21
+ *
22
+ * - **Trigger Order** : { trigger: { isMarket, triggerPx, tpsl } } pour TP/SL
23
+ * - `isMarket` : True si l'ordre se déclenche au prix du marché
24
+ * - `triggerPx` : Prix de déclenchement
25
+ * - `tpsl` : "tp" pour Take Profit, "sl" pour Stop Loss
26
+ * @property {string} [cloid] - Client Order ID optionnel (128-bit hex string, ex. "0x1234...").
27
+ */
28
+ export interface HLOrderDetails {
29
+ assetName: string;
30
+ isBuy: boolean;
31
+ limitPx: DecimalString;
32
+ sz: DecimalString;
33
+ reduceOnly: boolean;
34
+ orderType: {
35
+ limit: {
36
+ tif: 'Alo' | 'Ioc' | 'Gtc';
37
+ };
38
+ } | {
39
+ trigger: {
40
+ isMarket: boolean;
41
+ triggerPx: DecimalString;
42
+ tpsl: 'tp' | 'sl';
43
+ };
44
+ };
45
+ cloid?: string;
46
+ }
47
+ /**
48
+ * Représente un ordre formaté pour l'API Hyperliquid.
49
+ * Les clés correspondent exactement à ce que l'API attend.
50
+ */
51
+ export interface HLApiOrder {
52
+ a: number;
53
+ b: boolean;
54
+ p: DecimalString;
55
+ s: DecimalString;
56
+ r: boolean;
57
+ t: {
58
+ limit: {
59
+ tif: 'Alo' | 'Ioc' | 'Gtc';
60
+ };
61
+ } | {
62
+ trigger: {
63
+ isMarket: boolean;
64
+ triggerPx: DecimalString;
65
+ tpsl: 'tp' | 'sl';
66
+ };
67
+ };
68
+ c?: string;
69
+ }
@@ -0,0 +1,34 @@
1
+ import { DecimalString, HLOid, Timestamp } from '../common';
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';
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;
13
+ children: unknown[];
14
+ isPositionTpsl: boolean;
15
+ reduceOnly: boolean;
16
+ orderType: string;
17
+ origSz: DecimalString;
18
+ tif: string;
19
+ cloid: string | null;
20
+ }
21
+ export interface HLOrderStatusData {
22
+ order: HLOrderStatusDetails;
23
+ status: HLOrderStatus;
24
+ statusTimestamp: Timestamp;
25
+ }
26
+ export interface HLOrderStatusResponse {
27
+ status: 'order' | 'unknownOid';
28
+ order: HLOrderStatusData;
29
+ }
30
+ export interface HLOrderStatusRequest {
31
+ type: 'orderStatus';
32
+ user: `0x${string}`;
33
+ oid: HLOid;
34
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { Timestamp } from '../common';
2
+ export interface HLUserFill {
3
+ coin: string;
4
+ px: string;
5
+ sz: string;
6
+ side: 'A' | 'B';
7
+ time: Timestamp;
8
+ oid: number;
9
+ tid: number;
10
+ dir: string;
11
+ startPosition: string;
12
+ closedPnl: string;
13
+ crossed: boolean;
14
+ hash: `0x${string}`;
15
+ fee: string;
16
+ feeToken: string;
17
+ builderFee?: string;
18
+ }
19
+ export type HLUserFillsResponse = HLUserFill[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './signature.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("./signature.interfaces"), exports);
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ export interface HLSignature {
2
+ v: number;
3
+ r: string;
4
+ s: string;
5
+ }
6
+ /** ECDSA signature components. */
7
+ export interface HLParams<T> {
8
+ action: T;
9
+ nonce: number;
10
+ signature: HLSignature;
11
+ vaultAddress?: string | null;
12
+ expiresAfter?: number;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });