@pear-protocol/hyperliquid-sdk 0.0.52 → 0.0.54
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/index.js +5 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -188,6 +188,7 @@ const useHyperliquidWebSocket = ({ wsUrl, address, enabled = true, }) => {
|
|
|
188
188
|
const ws = new WebSocket(wsUrl);
|
|
189
189
|
wsRef.current = ws;
|
|
190
190
|
ws.onopen = () => {
|
|
191
|
+
// Reset attempts on successful connection
|
|
191
192
|
reconnectAttemptsRef.current = 0;
|
|
192
193
|
setReadyState(ReadyState.OPEN);
|
|
193
194
|
setLastError(null);
|
|
@@ -198,7 +199,8 @@ const useHyperliquidWebSocket = ({ wsUrl, address, enabled = true, }) => {
|
|
|
198
199
|
};
|
|
199
200
|
ws.onclose = () => {
|
|
200
201
|
setReadyState(ReadyState.CLOSED);
|
|
201
|
-
if (!manualCloseRef.current
|
|
202
|
+
if (!manualCloseRef.current) {
|
|
203
|
+
setLastSubscribedAddress(null);
|
|
202
204
|
reconnectAttemptsRef.current += 1;
|
|
203
205
|
setTimeout(() => connect(), 3000);
|
|
204
206
|
}
|
|
@@ -6349,6 +6351,8 @@ const buildPositionValue = (rawPositions, clearinghouseState, allMids) => {
|
|
|
6349
6351
|
let mappedPosition = {
|
|
6350
6352
|
positionId: position.positionId,
|
|
6351
6353
|
address: position.address,
|
|
6354
|
+
createdAt: position.createdAt,
|
|
6355
|
+
updatedAt: position.updatedAt,
|
|
6352
6356
|
entryRatio: 1,
|
|
6353
6357
|
marginUsed: 0,
|
|
6354
6358
|
markRatio: 1,
|