@pear-protocol/hyperliquid-sdk 0.0.49-hip3-alpha → 0.0.50
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/clients/hyperliquid.d.ts +8 -2
- package/dist/clients/positions.d.ts +1 -1
- package/dist/clients/sync.d.ts +1 -1
- package/dist/clients/watchlist.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useAccountSummary.d.ts +5 -0
- package/dist/hooks/useAgentWallet.d.ts +4 -9
- package/dist/hooks/usePortfolio.d.ts +1 -1
- package/dist/hooks/useTrading.d.ts +1 -8
- package/dist/hooks/useWebData.d.ts +3 -2
- package/dist/hyperliquid-websocket.d.ts +2 -1
- package/dist/index.d.ts +32 -64
- package/dist/index.js +267 -244
- package/dist/provider.d.ts +0 -20
- package/dist/types.d.ts +13 -4
- package/dist/utils/account-summary-calculator.d.ts +2 -6
- package/dist/utils/symbol-translator.d.ts +11 -0
- package/dist/websocket.d.ts +2 -1
- package/package.json +1 -1
- package/README.md +0 -735
- package/dist/hooks/useAddress.d.ts +0 -9
package/dist/provider.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import type { UserProfile } from './types';
|
|
3
3
|
import { AuthStatus } from './types';
|
|
4
|
-
import type { AgentWalletState } from './types';
|
|
5
4
|
export interface PearHyperliquidContextType {
|
|
6
5
|
apiBaseUrl: string;
|
|
7
6
|
wsUrl: string;
|
|
@@ -21,13 +20,6 @@ export interface PearHyperliquidContextType {
|
|
|
21
20
|
loginWithPrivyToken: (address: string, appId: string, accessToken: string) => Promise<void>;
|
|
22
21
|
refreshTokens: () => Promise<any>;
|
|
23
22
|
logout: () => Promise<void>;
|
|
24
|
-
agentWallet: AgentWalletState;
|
|
25
|
-
isAgentWalletReady: boolean;
|
|
26
|
-
agentWalletError: string | null;
|
|
27
|
-
agentWalletLoading: boolean;
|
|
28
|
-
refreshAgentWalletStatus: () => Promise<any>;
|
|
29
|
-
createAgentWallet: () => Promise<any>;
|
|
30
|
-
notifyAgentWalletApproved: () => Promise<any>;
|
|
31
23
|
}
|
|
32
24
|
export declare const PearHyperliquidContext: React.Context<PearHyperliquidContextType | undefined>;
|
|
33
25
|
interface PearHyperliquidProviderProps {
|
|
@@ -60,16 +52,4 @@ export declare function usePearAuth(): {
|
|
|
60
52
|
readonly refreshTokens: () => Promise<any>;
|
|
61
53
|
readonly logout: () => Promise<void>;
|
|
62
54
|
};
|
|
63
|
-
/**
|
|
64
|
-
* Provider-aware Agent Wallet hook. Uses agent wallet state/actions provided by PearHyperliquidProvider.
|
|
65
|
-
*/
|
|
66
|
-
export declare function usePearAgentWallet(): {
|
|
67
|
-
readonly agentWallet: AgentWalletState;
|
|
68
|
-
readonly isReady: boolean;
|
|
69
|
-
readonly loading: boolean;
|
|
70
|
-
readonly error: string | null;
|
|
71
|
-
readonly refreshAgentWalletStatus: () => Promise<any>;
|
|
72
|
-
readonly createAgentWallet: () => Promise<any>;
|
|
73
|
-
readonly notifyAgentWalletApproved: () => Promise<any>;
|
|
74
|
-
};
|
|
75
55
|
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -301,15 +301,22 @@ export interface BalanceSummaryDto {
|
|
|
301
301
|
* Agent wallet information
|
|
302
302
|
*/
|
|
303
303
|
export interface AgentWalletDto {
|
|
304
|
-
address
|
|
304
|
+
address?: string;
|
|
305
305
|
status: string;
|
|
306
306
|
}
|
|
307
|
+
export interface PlatformAccountSummaryResponseDto {
|
|
308
|
+
agentWalletAddress: string | null;
|
|
309
|
+
totalClosedTrades: number;
|
|
310
|
+
totalLimitOrderUsdValue?: number;
|
|
311
|
+
totalTwapChunkUsdValue?: number;
|
|
312
|
+
lastSyncedAt?: number;
|
|
313
|
+
}
|
|
307
314
|
/**
|
|
308
315
|
* Account balance response (renamed to AccountSummaryResponseDto for consistency)
|
|
309
316
|
*/
|
|
310
317
|
export interface AccountSummaryResponseDto {
|
|
311
318
|
balanceSummary: BalanceSummaryDto;
|
|
312
|
-
agentWallet
|
|
319
|
+
agentWallet?: AgentWalletDto;
|
|
313
320
|
}
|
|
314
321
|
/**
|
|
315
322
|
* Address management state
|
|
@@ -400,8 +407,10 @@ export interface CreateAgentWalletResponseDto {
|
|
|
400
407
|
agentWalletAddress: string;
|
|
401
408
|
message: string;
|
|
402
409
|
}
|
|
403
|
-
export interface
|
|
404
|
-
|
|
410
|
+
export interface ExtraAgent {
|
|
411
|
+
name: string;
|
|
412
|
+
address: string;
|
|
413
|
+
validUntil: number;
|
|
405
414
|
}
|
|
406
415
|
export interface AgentWalletState {
|
|
407
416
|
address: string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AccountSummaryResponseDto, ClearinghouseState,
|
|
1
|
+
import type { AccountSummaryResponseDto, ClearinghouseState, ExtraAgent, PlatformAccountSummaryResponseDto } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Account summary calculation utility class
|
|
4
4
|
*/
|
|
@@ -8,11 +8,7 @@ export declare class AccountSummaryCalculator {
|
|
|
8
8
|
/**
|
|
9
9
|
* Calculate account summary from real-time clearinghouse state and platform orders
|
|
10
10
|
*/
|
|
11
|
-
calculateAccountSummary(platformAccountSummary:
|
|
12
|
-
/**
|
|
13
|
-
* Calculate total USD value of open limit orders
|
|
14
|
-
*/
|
|
15
|
-
private calculateTotalLimitOrderValue;
|
|
11
|
+
calculateAccountSummary(platformAccountSummary: PlatformAccountSummaryResponseDto | null, registeredAgentWallets: ExtraAgent[]): AccountSummaryResponseDto | null;
|
|
16
12
|
getClearinghouseState(): ClearinghouseState | null;
|
|
17
13
|
/**
|
|
18
14
|
* Check if real-time data is available
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a full/prefixed symbol (e.g., "xyz:XYZ100") to a display symbol (e.g., "XYZ100").
|
|
3
|
+
*/
|
|
4
|
+
export declare function toDisplaySymbol(symbol: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Convert a display symbol back to backend form using a provided map.
|
|
7
|
+
* If mapping is missing, returns the original symbol.
|
|
8
|
+
* @param displaySymbol e.g., "XYZ100"
|
|
9
|
+
* @param displayToFull map of display -> full (e.g., "XYZ100" -> "xyz:XYZ100")
|
|
10
|
+
*/
|
|
11
|
+
export declare function toBackendSymbol(displaySymbol: string, displayToFull: Map<string, string>): string;
|
package/dist/websocket.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export interface UseHyperliquidWebSocketProps {
|
|
2
2
|
wsUrl: string;
|
|
3
3
|
address: string | null;
|
|
4
|
+
enabled?: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare const useHyperliquidWebSocket: ({ wsUrl, address }: UseHyperliquidWebSocketProps) => {
|
|
6
|
+
export declare const useHyperliquidWebSocket: ({ wsUrl, address, enabled, }: UseHyperliquidWebSocketProps) => {
|
|
6
7
|
isConnected: boolean;
|
|
7
8
|
lastError: string | null;
|
|
8
9
|
};
|