@rabby-wallet/hyperliquid-sdk 1.0.0-beta.13 → 1.0.0-beta.15
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AllMids, L2Book, Candle,
|
|
1
|
+
import type { AllMids, L2Book, Candle, WsOrder, WebData2, WsActiveAssetCtx, WsUserFills } from '../types';
|
|
2
2
|
export interface WebSocketClientConfig {
|
|
3
3
|
masterAddress: string;
|
|
4
4
|
isTestnet?: boolean;
|
|
@@ -57,7 +57,7 @@ export declare class WebSocketClient {
|
|
|
57
57
|
/**
|
|
58
58
|
* Subscribe to user fills
|
|
59
59
|
*/
|
|
60
|
-
subscribeToUserFills(callback: SubscriptionCallback<
|
|
60
|
+
subscribeToUserFills(callback: SubscriptionCallback<WsUserFills>): Subscription;
|
|
61
61
|
/**
|
|
62
62
|
* Subscribe to user order updates
|
|
63
63
|
*/
|
|
@@ -82,9 +82,10 @@ class WebSocketClient {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
this.ws.onclose = () => {
|
|
85
|
+
var _a;
|
|
85
86
|
this.isConnecting = false;
|
|
86
87
|
console.log('WebSocket disconnected');
|
|
87
|
-
if (this.config.autoReconnect && this.reconnectAttempts < this.config.maxReconnectAttempts) {
|
|
88
|
+
if (this.config.autoReconnect && this.reconnectAttempts < this.config.maxReconnectAttempts && ((_a = this.ws) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.OPEN) {
|
|
88
89
|
this.reconnectAttempts++;
|
|
89
90
|
console.log(`Reconnecting... (${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`);
|
|
90
91
|
setTimeout(() => this.connect(), this.config.reconnectDelay);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -210,6 +210,11 @@ export interface WsOrder {
|
|
|
210
210
|
children?: WsOrder[];
|
|
211
211
|
user: string;
|
|
212
212
|
}
|
|
213
|
+
export interface WsUserFills {
|
|
214
|
+
isSnapshot?: boolean;
|
|
215
|
+
user: string;
|
|
216
|
+
fills: WsFill[];
|
|
217
|
+
}
|
|
213
218
|
export interface WsFill {
|
|
214
219
|
coin: string;
|
|
215
220
|
px: string;
|
package/package.json
CHANGED