@pear-protocol/hyperliquid-sdk 0.0.78 → 0.0.79

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 (2) hide show
  1. package/dist/index.js +4 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -781,6 +781,7 @@ const useHyperliquidNativeWebSocket = ({ address, enabled = true, onUserFills, }
781
781
  const { setAllMids, setActiveAssetData, upsertActiveAssetData, setCandleData, deleteCandleSymbol, deleteActiveAssetData, addCandleData, setFinalAssetContexts, setFinalAtOICaps, setAggregatedClearingHouseState, setRawClearinghouseStates, } = useHyperliquidData();
782
782
  const { setSpotState } = useUserData();
783
783
  const { candleInterval } = useUserSelection$1();
784
+ const userSummary = useUserData((state) => state.accountSummary);
784
785
  const longTokens = useUserSelection$1((s) => s.longTokens);
785
786
  const shortTokens = useUserSelection$1((s) => s.shortTokens);
786
787
  const selectedTokenSymbols = useMemo(() => [...longTokens, ...shortTokens].map((t) => t.symbol), [longTokens, shortTokens]);
@@ -1155,9 +1156,8 @@ const useHyperliquidNativeWebSocket = ({ address, enabled = true, onUserFills, }
1155
1156
  setRawClearinghouseStates,
1156
1157
  setSpotState,
1157
1158
  ]);
1158
- // Subscribe to userFills only after allDexsClearinghouseState data is received
1159
1159
  useEffect(() => {
1160
- if (!isConnected || !subscribedAddress || !clearinghouseStateReceived)
1160
+ if (!isConnected || !subscribedAddress || !clearinghouseStateReceived || !userSummary)
1161
1161
  return;
1162
1162
  const subscribeUserFills = {
1163
1163
  method: 'subscribe',
@@ -1167,7 +1167,7 @@ const useHyperliquidNativeWebSocket = ({ address, enabled = true, onUserFills, }
1167
1167
  },
1168
1168
  };
1169
1169
  sendJsonMessage(subscribeUserFills);
1170
- }, [isConnected, subscribedAddress, clearinghouseStateReceived, sendJsonMessage]);
1170
+ }, [isConnected, subscribedAddress, clearinghouseStateReceived, userSummary, sendJsonMessage]);
1171
1171
  // Handle token subscriptions for activeAssetData
1172
1172
  useEffect(() => {
1173
1173
  if (!isConnected || !address)
@@ -8347,7 +8347,7 @@ function useHyperliquidUserFills(options) {
8347
8347
  if (!userState.accountSummary)
8348
8348
  return;
8349
8349
  const clearinghouseState = useHyperliquidData.getState().aggregatedClearingHouseState;
8350
- if (!(clearinghouseState === null || clearinghouseState === void 0 ? void 0 : clearinghouseState.assetPositions))
8350
+ if (!clearinghouseState)
8351
8351
  return;
8352
8352
  setIsSyncing(true);
8353
8353
  setError(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pear-protocol/hyperliquid-sdk",
3
- "version": "0.0.78",
3
+ "version": "0.0.79",
4
4
  "description": "React SDK for Pear Protocol Hyperliquid API integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",