@rabby-wallet/hyperliquid-sdk 1.0.0-beta.7 → 1.0.0-beta.9
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.
|
@@ -32,7 +32,7 @@ export declare class ExchangeClient {
|
|
|
32
32
|
* need to update leverage before place order
|
|
33
33
|
*/
|
|
34
34
|
marketOrderOpen(params: MarketOrderParams): Promise<OrderResponse>;
|
|
35
|
-
marketOrderClose(params: MarketOrderParams): Promise<OrderResponse>;
|
|
35
|
+
marketOrderClose(params: Omit<MarketOrderParams, 'tpTriggerPx' | 'slTriggerPx'>): Promise<OrderResponse>;
|
|
36
36
|
/**
|
|
37
37
|
* Place multiple orders at once
|
|
38
38
|
*/
|
|
@@ -502,10 +502,11 @@ class ExchangeClient {
|
|
|
502
502
|
*/
|
|
503
503
|
sendApproveBuilderFee(params) {
|
|
504
504
|
return __awaiter(this, void 0, void 0, function* () {
|
|
505
|
+
const splitSignature = (0, signer_1.splitSig)(params.signature);
|
|
505
506
|
return this.httpClient.exchange({
|
|
506
507
|
action: params.action,
|
|
507
508
|
nonce: params.nonce,
|
|
508
|
-
signature:
|
|
509
|
+
signature: splitSignature,
|
|
509
510
|
});
|
|
510
511
|
});
|
|
511
512
|
}
|
|
@@ -544,10 +545,11 @@ class ExchangeClient {
|
|
|
544
545
|
};
|
|
545
546
|
}
|
|
546
547
|
sendWithdraw(params) {
|
|
548
|
+
const splitSignature = (0, signer_1.splitSig)(params.signature);
|
|
547
549
|
return this.httpClient.exchange({
|
|
548
550
|
action: params.action,
|
|
549
551
|
nonce: params.nonce,
|
|
550
|
-
signature:
|
|
552
|
+
signature: splitSignature,
|
|
551
553
|
});
|
|
552
554
|
}
|
|
553
555
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { HttpClientConfig } from "./http-client";
|
|
2
|
+
import { InfoClient } from "./info-client";
|
|
2
3
|
export declare class SymbolConversion {
|
|
3
4
|
private assetToIndexMap;
|
|
4
5
|
private httpClient;
|
|
5
6
|
private initialized;
|
|
6
|
-
|
|
7
|
+
private infoClient?;
|
|
8
|
+
constructor(config: HttpClientConfig, infoClient?: InfoClient);
|
|
7
9
|
initialize(): Promise<void>;
|
|
8
10
|
private ensureInitialized;
|
|
9
11
|
private refreshAssetMaps;
|
|
@@ -13,9 +13,10 @@ exports.SymbolConversion = void 0;
|
|
|
13
13
|
const constants_1 = require("../types/constants");
|
|
14
14
|
const http_client_1 = require("./http-client");
|
|
15
15
|
class SymbolConversion {
|
|
16
|
-
constructor(config) {
|
|
16
|
+
constructor(config, infoClient) {
|
|
17
17
|
this.assetToIndexMap = new Map();
|
|
18
18
|
this.initialized = false;
|
|
19
|
+
this.infoClient = infoClient;
|
|
19
20
|
this.httpClient = new http_client_1.HttpClient({
|
|
20
21
|
isTestnet: config.isTestnet,
|
|
21
22
|
timeout: config.timeout,
|
|
@@ -46,9 +47,15 @@ class SymbolConversion {
|
|
|
46
47
|
refreshAssetMaps() {
|
|
47
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
49
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
let perpMeta = null;
|
|
51
|
+
if (!this.infoClient) {
|
|
52
|
+
perpMeta = yield this.httpClient.info({
|
|
53
|
+
type: constants_1.InfoType.META_AND_ASSET_CTXS,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
perpMeta = yield this.infoClient.metaAndAssetCtxs(false);
|
|
58
|
+
}
|
|
52
59
|
// Verify responses are valid before proceeding
|
|
53
60
|
if (!perpMeta ||
|
|
54
61
|
!perpMeta[0] ||
|
package/dist/hyperliquid-sdk.js
CHANGED
|
@@ -21,16 +21,15 @@ const symbolConversion_1 = require("./client/symbolConversion");
|
|
|
21
21
|
*/
|
|
22
22
|
class HyperliquidSDK {
|
|
23
23
|
constructor(config) {
|
|
24
|
-
// Initialize info client (always available)
|
|
25
|
-
this.symbolConversion = new symbolConversion_1.SymbolConversion({
|
|
26
|
-
isTestnet: config.isTestnet,
|
|
27
|
-
timeout: config.timeout,
|
|
28
|
-
});
|
|
29
24
|
this.info = new info_client_1.InfoClient({
|
|
30
25
|
masterAddress: config.masterAddress,
|
|
31
26
|
isTestnet: config.isTestnet,
|
|
32
27
|
timeout: config.timeout,
|
|
33
28
|
});
|
|
29
|
+
this.symbolConversion = new symbolConversion_1.SymbolConversion({
|
|
30
|
+
isTestnet: config.isTestnet,
|
|
31
|
+
timeout: config.timeout,
|
|
32
|
+
}, this.info);
|
|
34
33
|
this.masterAddress = config.masterAddress;
|
|
35
34
|
this.configParams = config;
|
|
36
35
|
// Initialize exchange client only if private key is provided
|
package/dist/types/index.d.ts
CHANGED
|
@@ -248,13 +248,13 @@ export interface L2Book {
|
|
|
248
248
|
export interface WsActiveAssetCtx {
|
|
249
249
|
coin: string;
|
|
250
250
|
ctx: {
|
|
251
|
-
dayNtlVlm:
|
|
252
|
-
prevDayPx:
|
|
253
|
-
markPx:
|
|
254
|
-
midPx?:
|
|
255
|
-
funding:
|
|
256
|
-
openInterest:
|
|
257
|
-
oraclePx:
|
|
251
|
+
dayNtlVlm: string;
|
|
252
|
+
prevDayPx: string;
|
|
253
|
+
markPx: string;
|
|
254
|
+
midPx?: string;
|
|
255
|
+
funding: string;
|
|
256
|
+
openInterest: string;
|
|
257
|
+
oraclePx: string;
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
260
|
export interface Candle {
|
package/package.json
CHANGED