@pear-protocol/hyperliquid-sdk 0.1.0 → 0.1.3
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 -1
- package/dist/clients/positions.d.ts +1 -44
- package/dist/hooks/useAgentWallet.d.ts +1 -1
- package/dist/hooks/useAllUserBalances.d.ts +20 -6
- package/dist/hooks/useMarketData.d.ts +14 -8
- package/dist/hooks/usePosition.d.ts +2 -2
- package/dist/hooks/useTokenSelectionMetadata.d.ts +1 -1
- package/dist/hooks/useUserSelection.d.ts +16 -1
- package/dist/index.d.ts +204 -142
- package/dist/index.js +454 -384
- package/dist/store/hyperliquidDataStore.d.ts +8 -2
- package/dist/store/tokenSelectionMetadataStore.d.ts +2 -3
- package/dist/types.d.ts +65 -2
- package/dist/utils/position-validator.d.ts +1 -1
- package/dist/utils/token-metadata-extractor.d.ts +35 -20
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ interface ExternalFillDto {
|
|
|
60
60
|
feeToken?: string | null;
|
|
61
61
|
liquidation?: ExternalLiquidationDto | null;
|
|
62
62
|
}
|
|
63
|
+
interface SyncFillsRequestDto {
|
|
64
|
+
user: string;
|
|
65
|
+
fills: ExternalFillDto[];
|
|
66
|
+
assetPositions?: AssetPosition[];
|
|
67
|
+
}
|
|
63
68
|
interface SyncFillsResponseDto {
|
|
64
69
|
insertedFills: number;
|
|
65
70
|
skippedDuplicates: number;
|
|
@@ -76,6 +81,12 @@ interface TwapSliceFillResponseItem {
|
|
|
76
81
|
* WebSocket connection states
|
|
77
82
|
*/
|
|
78
83
|
type WebSocketConnectionState = 'connecting' | 'connected' | 'disconnected' | 'error';
|
|
84
|
+
declare enum ReadyState {
|
|
85
|
+
CONNECTING = 0,
|
|
86
|
+
OPEN = 1,
|
|
87
|
+
CLOSING = 2,
|
|
88
|
+
CLOSED = 3
|
|
89
|
+
}
|
|
79
90
|
/**
|
|
80
91
|
* WebSocket channels
|
|
81
92
|
*/
|
|
@@ -327,7 +338,7 @@ type TpSlTriggerType = 'PERCENTAGE' | 'DOLLAR' | 'POSITION_VALUE' | 'PRICE' | 'P
|
|
|
327
338
|
/**
|
|
328
339
|
* Trigger type for trigger orders
|
|
329
340
|
*/
|
|
330
|
-
type TriggerType
|
|
341
|
+
type TriggerType = 'PRICE' | 'PRICE_RATIO' | 'WEIGHTED_RATIO' | 'BTC_DOM' | 'CROSS_ASSET_PRICE' | 'PREDICTION_MARKET_OUTCOME';
|
|
331
342
|
type OrderDirection = 'MORE_THAN' | 'LESS_THAN';
|
|
332
343
|
/**
|
|
333
344
|
* Market order parameters
|
|
@@ -343,7 +354,7 @@ interface MarketOrderParameters {
|
|
|
343
354
|
interface TriggerOrderParameters {
|
|
344
355
|
leverage: number;
|
|
345
356
|
usdValue: number;
|
|
346
|
-
triggerType: TriggerType
|
|
357
|
+
triggerType: TriggerType;
|
|
347
358
|
triggerValue: number;
|
|
348
359
|
direction: OrderDirection;
|
|
349
360
|
reduceOnly?: boolean;
|
|
@@ -455,6 +466,15 @@ interface AccountSummaryResponseDto {
|
|
|
455
466
|
platformAccountSummary: PlatformAccountSummaryResponseDto | null;
|
|
456
467
|
agentWallet?: AgentWalletDto;
|
|
457
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Address management state
|
|
471
|
+
*/
|
|
472
|
+
interface AddressState {
|
|
473
|
+
currentAddress: string | null;
|
|
474
|
+
isLoggedIn: boolean;
|
|
475
|
+
autoConnect: boolean;
|
|
476
|
+
previousAddresses: string[];
|
|
477
|
+
}
|
|
458
478
|
interface UseAuthOptions {
|
|
459
479
|
baseUrl: string;
|
|
460
480
|
clientId: string;
|
|
@@ -481,13 +501,50 @@ interface EIP712AuthDetails {
|
|
|
481
501
|
}
|
|
482
502
|
interface GetEIP712MessageResponse extends EIP712AuthDetails {
|
|
483
503
|
}
|
|
504
|
+
interface PrivyAuthDetails {
|
|
505
|
+
appId: string;
|
|
506
|
+
accessToken: string;
|
|
507
|
+
}
|
|
508
|
+
interface AuthenticateRequest {
|
|
509
|
+
method: 'eip712' | 'api_key' | 'privy_access_token';
|
|
510
|
+
address: string;
|
|
511
|
+
clientId: string;
|
|
512
|
+
details: {
|
|
513
|
+
signature: string;
|
|
514
|
+
timestamp: number;
|
|
515
|
+
} | {
|
|
516
|
+
apiKey: string;
|
|
517
|
+
} | PrivyAuthDetails;
|
|
518
|
+
}
|
|
519
|
+
interface AuthenticateResponse {
|
|
520
|
+
accessToken: string;
|
|
521
|
+
refreshToken: string;
|
|
522
|
+
tokenType: string;
|
|
523
|
+
expiresIn: number;
|
|
524
|
+
address: string;
|
|
525
|
+
clientId: string;
|
|
526
|
+
}
|
|
527
|
+
interface RefreshTokenRequest {
|
|
528
|
+
refreshToken: string;
|
|
529
|
+
}
|
|
484
530
|
interface RefreshTokenResponse {
|
|
485
531
|
accessToken: string;
|
|
486
532
|
refreshToken: string;
|
|
487
533
|
tokenType: string;
|
|
488
534
|
expiresIn: number;
|
|
489
535
|
}
|
|
536
|
+
interface LogoutRequest {
|
|
537
|
+
refreshToken: string;
|
|
538
|
+
}
|
|
539
|
+
interface LogoutResponse {
|
|
540
|
+
message: string;
|
|
541
|
+
}
|
|
490
542
|
type AgentWalletStatus = 'ACTIVE' | 'EXPIRED' | 'NOT_FOUND';
|
|
543
|
+
interface GetAgentWalletResponseDto {
|
|
544
|
+
agentWalletAddress?: string;
|
|
545
|
+
agentName: string;
|
|
546
|
+
status: AgentWalletStatus;
|
|
547
|
+
}
|
|
491
548
|
interface CreateAgentWalletResponseDto {
|
|
492
549
|
agentWalletAddress: string;
|
|
493
550
|
message: string;
|
|
@@ -599,8 +656,10 @@ interface AssetCtx {
|
|
|
599
656
|
* Collateral token type
|
|
600
657
|
* 0 = USDC
|
|
601
658
|
* 360 = USDH
|
|
659
|
+
* 235 = USDE
|
|
660
|
+
* 268 = USDT0
|
|
602
661
|
*/
|
|
603
|
-
type CollateralToken = 'USDC' | 'USDH';
|
|
662
|
+
type CollateralToken = 'USDC' | 'USDH' | 'USDE' | 'USDT0';
|
|
604
663
|
/**
|
|
605
664
|
* Universe asset metadata
|
|
606
665
|
*/
|
|
@@ -612,6 +671,24 @@ interface UniverseAsset {
|
|
|
612
671
|
isDelisted?: boolean;
|
|
613
672
|
collateralToken: CollateralToken;
|
|
614
673
|
}
|
|
674
|
+
interface PerpMetaAsset extends UniverseAsset {
|
|
675
|
+
marginTableId: number;
|
|
676
|
+
}
|
|
677
|
+
interface MarginTier {
|
|
678
|
+
lowerBound: string;
|
|
679
|
+
maxLeverage: number;
|
|
680
|
+
}
|
|
681
|
+
interface MarginTableDef {
|
|
682
|
+
description: string;
|
|
683
|
+
marginTiers: MarginTier[];
|
|
684
|
+
}
|
|
685
|
+
type MarginTablesEntry = [number, MarginTableDef];
|
|
686
|
+
interface AllPerpMetasItem {
|
|
687
|
+
universe: PerpMetaAsset[];
|
|
688
|
+
marginTables: MarginTablesEntry[];
|
|
689
|
+
collateralToken: number;
|
|
690
|
+
}
|
|
691
|
+
type AllPerpMetasResponse = AllPerpMetasItem[];
|
|
615
692
|
interface ClearinghouseState {
|
|
616
693
|
assetPositions: AssetPosition[];
|
|
617
694
|
crossMaintenanceMarginUsed: string;
|
|
@@ -757,6 +834,7 @@ interface AssetMarketData {
|
|
|
757
834
|
interface PairAssetDto {
|
|
758
835
|
asset: string;
|
|
759
836
|
weight: number;
|
|
837
|
+
metadata?: TokenMetadata | null;
|
|
760
838
|
}
|
|
761
839
|
interface ActiveAssetGroupItem {
|
|
762
840
|
longAssets: PairAssetDto[];
|
|
@@ -770,7 +848,6 @@ interface ActiveAssetGroupItem {
|
|
|
770
848
|
weightedRatio?: string;
|
|
771
849
|
weightedPrevRatio?: string;
|
|
772
850
|
weightedChange24h?: string;
|
|
773
|
-
collateralType: 'USDC' | 'USDH' | 'MIXED';
|
|
774
851
|
}
|
|
775
852
|
interface ActiveAssetsResponse {
|
|
776
853
|
active: ActiveAssetGroupItem[];
|
|
@@ -779,6 +856,12 @@ interface ActiveAssetsResponse {
|
|
|
779
856
|
highlighted: ActiveAssetGroupItem[];
|
|
780
857
|
watchlist: ActiveAssetGroupItem[];
|
|
781
858
|
}
|
|
859
|
+
interface ActiveAssetsAllResponse {
|
|
860
|
+
active: ActiveAssetGroupItem[];
|
|
861
|
+
all: ActiveAssetGroupItem[];
|
|
862
|
+
highlighted: ActiveAssetGroupItem[];
|
|
863
|
+
watchlist: ActiveAssetGroupItem[];
|
|
864
|
+
}
|
|
782
865
|
/**
|
|
783
866
|
* Candle interval options
|
|
784
867
|
*/
|
|
@@ -827,6 +910,71 @@ interface SpotState {
|
|
|
827
910
|
user: string;
|
|
828
911
|
balances: SpotBalance[];
|
|
829
912
|
}
|
|
913
|
+
interface TokenEntry {
|
|
914
|
+
symbol: string;
|
|
915
|
+
data: AssetMarketData;
|
|
916
|
+
}
|
|
917
|
+
interface PerpDex {
|
|
918
|
+
name: string;
|
|
919
|
+
fullName: string;
|
|
920
|
+
deployer: string;
|
|
921
|
+
oracleUpdater: string | null;
|
|
922
|
+
feeRecipient: string | null;
|
|
923
|
+
deployerFeeScale: string;
|
|
924
|
+
assetToStreamingOiCap: [string, string][];
|
|
925
|
+
assetToFundingMultiplier: [string, string][];
|
|
926
|
+
subDeployers: [string, string[]][];
|
|
927
|
+
lastDeployerFeeScaleChangeTime: string;
|
|
928
|
+
}
|
|
929
|
+
type PerpDexsResponse = (PerpDex | null)[];
|
|
930
|
+
interface SpotBalances {
|
|
931
|
+
[coin: string]: number;
|
|
932
|
+
}
|
|
933
|
+
interface AvailableToTrades {
|
|
934
|
+
[collateralCoin: string]: number;
|
|
935
|
+
}
|
|
936
|
+
type ExecutionType = "MARKET" | "TRIGGER" | "TWAP" | "LADDER" | "TP" | "SL" | "SPOT_MARKET" | "SPOT_LIMIT" | "SPOT_TWAP";
|
|
937
|
+
type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE" | "PRICE" | "PRICE_RATIO" | "WEIGHTED_RATIO";
|
|
938
|
+
interface PairAssetInput {
|
|
939
|
+
asset: string;
|
|
940
|
+
weight?: number;
|
|
941
|
+
}
|
|
942
|
+
interface TpSlThresholdInput {
|
|
943
|
+
type: TpSlThresholdType;
|
|
944
|
+
value?: number;
|
|
945
|
+
isTrailing?: boolean;
|
|
946
|
+
trailingDeltaValue?: number;
|
|
947
|
+
trailingActivationValue?: number;
|
|
948
|
+
}
|
|
949
|
+
interface LadderConfigInput {
|
|
950
|
+
ratioStart: number;
|
|
951
|
+
ratioEnd: number;
|
|
952
|
+
numberOfLevels: number;
|
|
953
|
+
}
|
|
954
|
+
interface CreatePositionRequestInput {
|
|
955
|
+
slippage: number;
|
|
956
|
+
executionType: ExecutionType;
|
|
957
|
+
leverage: number;
|
|
958
|
+
usdValue: number;
|
|
959
|
+
longAssets?: PairAssetInput[];
|
|
960
|
+
shortAssets?: PairAssetInput[];
|
|
961
|
+
triggerValue?: string | number;
|
|
962
|
+
triggerType?: TriggerType;
|
|
963
|
+
direction?: "MORE_THAN" | "LESS_THAN";
|
|
964
|
+
assetName?: string;
|
|
965
|
+
marketCode?: string;
|
|
966
|
+
twapDuration?: number;
|
|
967
|
+
twapIntervalSeconds?: number;
|
|
968
|
+
randomizeExecution?: boolean;
|
|
969
|
+
referralCode?: string;
|
|
970
|
+
ladderConfig?: LadderConfigInput;
|
|
971
|
+
takeProfit?: TpSlThresholdInput | null;
|
|
972
|
+
stopLoss?: TpSlThresholdInput | null;
|
|
973
|
+
}
|
|
974
|
+
interface CreatePositionResponseDto {
|
|
975
|
+
orderId: string;
|
|
976
|
+
fills?: ExternalFillDto[];
|
|
977
|
+
}
|
|
830
978
|
|
|
831
979
|
declare const useAccountSummary: () => {
|
|
832
980
|
data: AccountSummaryResponseDto | null;
|
|
@@ -867,7 +1015,22 @@ interface UserSelectionState {
|
|
|
867
1015
|
resetToDefaults: () => void;
|
|
868
1016
|
}
|
|
869
1017
|
|
|
870
|
-
declare const useUserSelection: () =>
|
|
1018
|
+
declare const useUserSelection: () => {
|
|
1019
|
+
longTokens: TokenSelection[];
|
|
1020
|
+
shortTokens: TokenSelection[];
|
|
1021
|
+
candleInterval: CandleInterval;
|
|
1022
|
+
openTokenSelector: boolean;
|
|
1023
|
+
selectorConfig: TokenSelectorConfig | null;
|
|
1024
|
+
openConflictModal: boolean;
|
|
1025
|
+
setLongTokens: (tokens: TokenSelection[]) => void;
|
|
1026
|
+
setShortTokens: (tokens: TokenSelection[]) => void;
|
|
1027
|
+
setCandleInterval: (interval: CandleInterval) => void;
|
|
1028
|
+
setTokenSelections: (longTokens: TokenSelection[], shortTokens: TokenSelection[]) => void;
|
|
1029
|
+
setOpenTokenSelector: (open: boolean) => void;
|
|
1030
|
+
setSelectorConfig: (config: TokenSelectorConfig | null) => void;
|
|
1031
|
+
setOpenConflictModal: (open: boolean) => void;
|
|
1032
|
+
addToken: (isLong: boolean) => boolean;
|
|
1033
|
+
};
|
|
871
1034
|
|
|
872
1035
|
/**
|
|
873
1036
|
* Hook to access webData
|
|
@@ -890,8 +1053,8 @@ interface UseTokenSelectionMetadataReturn {
|
|
|
890
1053
|
volume: string;
|
|
891
1054
|
sumNetFunding: number;
|
|
892
1055
|
maxLeverage: number;
|
|
893
|
-
minMargin: number;
|
|
894
1056
|
leverageMatched: boolean;
|
|
1057
|
+
minSize: Record<string, number>;
|
|
895
1058
|
}
|
|
896
1059
|
declare const useTokenSelectionMetadata: () => UseTokenSelectionMetadataReturn;
|
|
897
1060
|
|
|
@@ -1040,49 +1203,6 @@ interface SpotOrderResponseDto {
|
|
|
1040
1203
|
*/
|
|
1041
1204
|
declare function executeSpotOrder(baseUrl: string, payload: SpotOrderRequestInput): Promise<ApiResponse<SpotOrderResponseDto>>;
|
|
1042
1205
|
|
|
1043
|
-
type ExecutionType = "MARKET" | "TRIGGER" | "TWAP" | "LADDER" | "TP" | "SL" | "SPOT_MARKET" | "SPOT_LIMIT" | "SPOT_TWAP";
|
|
1044
|
-
type TriggerType = "PRICE" | "PRICE_RATIO" | "WEIGHTED_RATIO" | "BTC_DOM" | "CROSS_ASSET_PRICE" | "PREDICTION_MARKET_OUTCOME";
|
|
1045
|
-
type TpSlThresholdType = "PERCENTAGE" | "DOLLAR" | "POSITION_VALUE" | "PRICE" | "PRICE_RATIO" | "WEIGHTED_RATIO";
|
|
1046
|
-
interface PairAssetInput {
|
|
1047
|
-
asset: string;
|
|
1048
|
-
weight?: number;
|
|
1049
|
-
}
|
|
1050
|
-
interface TpSlThresholdInput {
|
|
1051
|
-
type: TpSlThresholdType;
|
|
1052
|
-
value?: number;
|
|
1053
|
-
isTrailing?: boolean;
|
|
1054
|
-
trailingDeltaValue?: number;
|
|
1055
|
-
trailingActivationValue?: number;
|
|
1056
|
-
}
|
|
1057
|
-
interface LadderConfigInput {
|
|
1058
|
-
ratioStart: number;
|
|
1059
|
-
ratioEnd: number;
|
|
1060
|
-
numberOfLevels: number;
|
|
1061
|
-
}
|
|
1062
|
-
interface CreatePositionRequestInput {
|
|
1063
|
-
slippage: number;
|
|
1064
|
-
executionType: ExecutionType;
|
|
1065
|
-
leverage: number;
|
|
1066
|
-
usdValue: number;
|
|
1067
|
-
longAssets?: PairAssetInput[];
|
|
1068
|
-
shortAssets?: PairAssetInput[];
|
|
1069
|
-
triggerValue?: string | number;
|
|
1070
|
-
triggerType?: TriggerType;
|
|
1071
|
-
direction?: "MORE_THAN" | "LESS_THAN";
|
|
1072
|
-
assetName?: string;
|
|
1073
|
-
marketCode?: string;
|
|
1074
|
-
twapDuration?: number;
|
|
1075
|
-
twapIntervalSeconds?: number;
|
|
1076
|
-
randomizeExecution?: boolean;
|
|
1077
|
-
referralCode?: string;
|
|
1078
|
-
ladderConfig?: LadderConfigInput;
|
|
1079
|
-
takeProfit?: TpSlThresholdInput | null;
|
|
1080
|
-
stopLoss?: TpSlThresholdInput | null;
|
|
1081
|
-
}
|
|
1082
|
-
interface CreatePositionResponseDto {
|
|
1083
|
-
orderId: string;
|
|
1084
|
-
fills?: ExternalFillDto[];
|
|
1085
|
-
}
|
|
1086
1206
|
/**
|
|
1087
1207
|
* Create a position (MARKET/LIMIT/TWAP) using Pear Hyperliquid service
|
|
1088
1208
|
* Authorization is derived from headers (Axios defaults or browser localStorage fallback)
|
|
@@ -1219,14 +1339,19 @@ interface UseNotificationsResult {
|
|
|
1219
1339
|
*/
|
|
1220
1340
|
declare function useNotifications(): UseNotificationsResult;
|
|
1221
1341
|
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1342
|
+
interface UseMarketDataHookOptions {
|
|
1343
|
+
topGainersLimit?: number;
|
|
1344
|
+
topLosersLimit?: number;
|
|
1345
|
+
}
|
|
1346
|
+
interface UseMarketDataHookResult {
|
|
1347
|
+
marketData: ActiveAssetsResponse | null;
|
|
1348
|
+
activeBaskets: ActiveAssetGroupItem[];
|
|
1349
|
+
topGainers: ActiveAssetGroupItem[];
|
|
1350
|
+
topLosers: ActiveAssetGroupItem[];
|
|
1351
|
+
highlightedBaskets: ActiveAssetGroupItem[];
|
|
1352
|
+
watchlistBaskets: ActiveAssetGroupItem[];
|
|
1353
|
+
}
|
|
1354
|
+
declare const useMarketDataHook: (options?: UseMarketDataHookOptions) => UseMarketDataHookResult;
|
|
1230
1355
|
|
|
1231
1356
|
declare function useWatchlist(): {
|
|
1232
1357
|
readonly watchlists: ActiveAssetGroupItem[] | null;
|
|
@@ -1298,14 +1423,27 @@ declare function useAuth(): {
|
|
|
1298
1423
|
readonly logout: () => Promise<void>;
|
|
1299
1424
|
};
|
|
1300
1425
|
|
|
1301
|
-
interface
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1426
|
+
interface MarginRequiredPerCollateral {
|
|
1427
|
+
collateral: CollateralToken;
|
|
1428
|
+
marginRequired: number;
|
|
1429
|
+
availableBalance: number;
|
|
1430
|
+
hasEnough: boolean;
|
|
1431
|
+
shortfall: number;
|
|
1432
|
+
}
|
|
1433
|
+
interface MarginRequiredResult {
|
|
1434
|
+
totalMarginRequired: number;
|
|
1435
|
+
orderValue: number;
|
|
1436
|
+
perCollateral: MarginRequiredPerCollateral[];
|
|
1437
|
+
hasEnoughTotal: boolean;
|
|
1438
|
+
}
|
|
1439
|
+
interface AllUserBalancesResult {
|
|
1440
|
+
spotBalances: SpotBalances;
|
|
1441
|
+
availableToTrades: AvailableToTrades;
|
|
1306
1442
|
isLoading: boolean;
|
|
1443
|
+
getMarginRequired: (assetsLeverage: Record<string, number>, size: number) => MarginRequiredResult;
|
|
1444
|
+
getMaxSize: (assetsLeverage: Record<string, number>) => number;
|
|
1307
1445
|
}
|
|
1308
|
-
declare const useAllUserBalances: () =>
|
|
1446
|
+
declare const useAllUserBalances: () => AllUserBalancesResult;
|
|
1309
1447
|
|
|
1310
1448
|
interface UseHyperliquidUserFillsOptions {
|
|
1311
1449
|
baseUrl: string;
|
|
@@ -1324,28 +1462,6 @@ interface UseHyperliquidUserFillsState {
|
|
|
1324
1462
|
*/
|
|
1325
1463
|
declare function useHyperliquidUserFills(options: UseHyperliquidUserFillsOptions): UseHyperliquidUserFillsState;
|
|
1326
1464
|
|
|
1327
|
-
interface UseHyperliquidWebSocketProps {
|
|
1328
|
-
wsUrl: string;
|
|
1329
|
-
address: string | null;
|
|
1330
|
-
enabled?: boolean;
|
|
1331
|
-
}
|
|
1332
|
-
declare const useHyperliquidWebSocket: ({ wsUrl, address, enabled, }: UseHyperliquidWebSocketProps) => {
|
|
1333
|
-
isConnected: boolean;
|
|
1334
|
-
lastError: string | null;
|
|
1335
|
-
};
|
|
1336
|
-
|
|
1337
|
-
interface UseHyperliquidNativeWebSocketProps {
|
|
1338
|
-
address: string | null;
|
|
1339
|
-
tokens?: string[];
|
|
1340
|
-
enabled?: boolean;
|
|
1341
|
-
onUserFills?: () => void | Promise<void>;
|
|
1342
|
-
}
|
|
1343
|
-
interface UseHyperliquidNativeWebSocketReturn {
|
|
1344
|
-
isConnected: boolean;
|
|
1345
|
-
lastError: string | null;
|
|
1346
|
-
}
|
|
1347
|
-
declare const useHyperliquidNativeWebSocket: ({ address, enabled, onUserFills, }: UseHyperliquidNativeWebSocketProps) => UseHyperliquidNativeWebSocketReturn;
|
|
1348
|
-
|
|
1349
1465
|
/**
|
|
1350
1466
|
* Mark notifications as read up to a given timestamp (ms)
|
|
1351
1467
|
*/
|
|
@@ -1448,23 +1564,6 @@ interface GetKalshiMarketsParams {
|
|
|
1448
1564
|
}
|
|
1449
1565
|
declare function getKalshiMarkets(params?: GetKalshiMarketsParams): Promise<ApiResponse<KalshiMarketsResponse>>;
|
|
1450
1566
|
|
|
1451
|
-
/**
|
|
1452
|
-
* Account summary calculation utility class
|
|
1453
|
-
*/
|
|
1454
|
-
declare class AccountSummaryCalculator {
|
|
1455
|
-
private clearinghouseState;
|
|
1456
|
-
constructor(clearinghouseState: ClearinghouseState | null);
|
|
1457
|
-
/**
|
|
1458
|
-
* Calculate account summary from real-time clearinghouse state and platform orders
|
|
1459
|
-
*/
|
|
1460
|
-
calculateAccountSummary(platformAccountSummary: PlatformAccountSummaryResponseDto | null, registeredAgentWallets: ExtraAgent[]): AccountSummaryResponseDto | null;
|
|
1461
|
-
getClearinghouseState(): ClearinghouseState | null;
|
|
1462
|
-
/**
|
|
1463
|
-
* Check if real-time data is available
|
|
1464
|
-
*/
|
|
1465
|
-
hasRealTimeData(): boolean;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
1567
|
/**
|
|
1469
1568
|
* Detects conflicts between selected tokens and existing positions
|
|
1470
1569
|
*/
|
|
@@ -1479,43 +1578,6 @@ declare class ConflictDetector {
|
|
|
1479
1578
|
static detectConflicts(longTokens: TokenSelection[], shortTokens: TokenSelection[], openPositions: RawPositionDto[] | null): TokenConflict[];
|
|
1480
1579
|
}
|
|
1481
1580
|
|
|
1482
|
-
/**
|
|
1483
|
-
* Extracts token metadata from aggregated WebData3 contexts and AllMids data
|
|
1484
|
-
*/
|
|
1485
|
-
declare class TokenMetadataExtractor {
|
|
1486
|
-
/**
|
|
1487
|
-
* Extracts comprehensive token metadata
|
|
1488
|
-
* @param symbol - Token symbol (e.g., "BTC", "TSLA")
|
|
1489
|
-
* @param perpMetaAssets - Aggregated universe assets (flattened across dexes)
|
|
1490
|
-
* @param finalAssetContexts - Aggregated asset contexts (flattened across dexes)
|
|
1491
|
-
* @param allMids - AllMids data containing current prices
|
|
1492
|
-
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1493
|
-
* @returns TokenMetadata or null if token not found
|
|
1494
|
-
*/
|
|
1495
|
-
static extractTokenMetadata(symbol: string, perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null, finalAtOICaps?: string[] | null): TokenMetadata | null;
|
|
1496
|
-
/**
|
|
1497
|
-
* Extracts metadata for multiple tokens
|
|
1498
|
-
* @param tokens - Array of token strings (e.g., "BTC", "TSLA")
|
|
1499
|
-
* @param perpMetaAssets - Aggregated universe assets
|
|
1500
|
-
* @param finalAssetContexts - Aggregated asset contexts
|
|
1501
|
-
* @param allMids - AllMids data
|
|
1502
|
-
* @param activeAssetData - Optional active asset data containing leverage information
|
|
1503
|
-
* @returns Record of token string to TokenMetadata (keys match input tokens exactly)
|
|
1504
|
-
*/
|
|
1505
|
-
static extractMultipleTokensMetadata(tokens: string[], perpMetaAssets: UniverseAsset[] | null, finalAssetContexts: WebData3AssetCtx[] | null, allMids: WsAllMidsData | null, activeAssetData?: Record<string, ActiveAssetData> | null, finalAtOICaps?: string[] | null): Record<string, TokenMetadata | null>;
|
|
1506
|
-
/**
|
|
1507
|
-
* Checks if token data is available in aggregated universe assets
|
|
1508
|
-
* @param symbol - Token symbol
|
|
1509
|
-
* @param perpMetaAssets - Aggregated universe assets
|
|
1510
|
-
* @returns boolean indicating if token exists in universe
|
|
1511
|
-
*/
|
|
1512
|
-
static isTokenAvailable(symbol: string, perpMetaAssets: UniverseAsset[] | null): boolean;
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
type TokenMetadataBySymbol = Record<string, TokenMetadata | null>;
|
|
1516
|
-
declare const selectTokenMetadataBySymbols: (tokenMetadata: TokenMetadataBySymbol, symbols: string[]) => TokenMetadataBySymbol;
|
|
1517
|
-
declare const getAssetByName: (tokenMetadata: TokenMetadataBySymbol, symbol: string) => TokenMetadata | null;
|
|
1518
|
-
|
|
1519
1581
|
/**
|
|
1520
1582
|
* Create efficient timestamp-based lookup maps for candle data
|
|
1521
1583
|
*/
|
|
@@ -1633,7 +1695,7 @@ declare function getOrderTpSlTriggerType(order: OpenLimitOrderDto): TpSlTriggerT
|
|
|
1633
1695
|
/**
|
|
1634
1696
|
* Get trigger type from order parameters (for Trigger orders)
|
|
1635
1697
|
*/
|
|
1636
|
-
declare function getOrderTriggerType(order: OpenLimitOrderDto): TriggerType
|
|
1698
|
+
declare function getOrderTriggerType(order: OpenLimitOrderDto): TriggerType | undefined;
|
|
1637
1699
|
/**
|
|
1638
1700
|
* Get order direction from order parameters (for Trigger orders)
|
|
1639
1701
|
*/
|
|
@@ -1674,5 +1736,5 @@ interface MarketDataState {
|
|
|
1674
1736
|
}
|
|
1675
1737
|
declare const useMarketData: zustand.UseBoundStore<zustand.StoreApi<MarketDataState>>;
|
|
1676
1738
|
|
|
1677
|
-
export {
|
|
1678
|
-
export type { AccountSummaryResponseDto, ActiveAssetGroupItem, ActiveAssetsResponse, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, BalanceSummaryDto, BaseTriggerOrderNotificationParams, BtcDomTriggerParams, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto,
|
|
1739
|
+
export { ConflictDetector, MAX_ASSETS_PER_LEG, MINIMUM_ASSET_USD_VALUE, MaxAssetsPerLegError, MinimumPositionSizeError, PearHyperliquidProvider, ReadyState, adjustAdvancePosition, adjustOrder, adjustPosition, calculateMinimumPositionValue, calculateWeightedRatio, cancelOrder, cancelTwap, cancelTwapOrder, closeAllPositions, closePosition, computeBasketCandles, createCandleLookups, createPosition, executeSpotOrder, getCompleteTimestamps, getKalshiMarkets, getOrderDirection, getOrderLadderConfig, getOrderLeverage, getOrderReduceOnly, getOrderTpSlTriggerType, getOrderTrailingInfo, getOrderTriggerType, getOrderTriggerValue, getOrderTwapDuration, getOrderUsdValue, getPortfolio, isBtcDomOrder, mapCandleIntervalToTradingViewInterval, mapTradingViewIntervalToCandleInterval, markNotificationReadById, markNotificationsRead, toggleWatchlist, updateLeverage, updateRiskParameters, useAccountSummary, useAgentWallet, useAllUserBalances, useAuth, useBasketCandles, useHistoricalPriceData, useHistoricalPriceDataStore, useHyperliquidUserFills, useMarket, useMarketData, useMarketDataHook, useNotifications, useOpenOrders, useOrders, usePearHyperliquid, usePerformanceOverlays, usePortfolio, usePosition, useSpotOrder, useTokenSelectionMetadata, useTradeHistories, useTwap, useUserSelection, useWatchlist, validateMaxAssetsPerLeg, validateMinimumAssetSize, validatePositionSize };
|
|
1740
|
+
export type { AccountSummaryResponseDto, ActiveAssetData, ActiveAssetGroupItem, ActiveAssetsAllResponse, ActiveAssetsResponse, AddressState, AdjustAdvanceAssetInput, AdjustAdvanceItemInput, AdjustAdvanceResponseDto, AdjustExecutionType, AdjustOrderRequestInput, AdjustOrderResponseDto, AdjustPositionRequestInput, AdjustPositionResponseDto, AgentWalletDto, AgentWalletState, AgentWalletStatus, AllDexsAssetCtxsData, AllDexsClearinghouseStateData, AllPerpMetasItem, AllPerpMetasResponse, ApiErrorResponse, ApiResponse, AssetCtx, AssetInformationDetail, AssetMarketData, AssetPosition, AuthenticateRequest, AuthenticateResponse, AvailableToTrades, BalanceSummaryDto, BaseTriggerOrderNotificationParams, BtcDomTriggerParams, CancelOrderResponseDto, CancelTwapResponseDto, CandleChartData, CandleData, CandleInterval, CandleSnapshotRequest, ChunkFillDto, ClearinghouseState, CloseAllPositionsResponseDto, CloseAllPositionsResultDto, CloseExecutionType, ClosePositionRequestInput, ClosePositionResponseDto, CollateralToken, CreateAgentWalletResponseDto, CreatePositionRequestInput, CreatePositionResponseDto, CrossAssetPriceTriggerParams, CrossMarginSummaryDto, CumFundingDto, EIP712AuthDetails, ExecutionType, ExternalFillDto, ExternalLiquidationDto, ExtraAgent, GetAgentWalletResponseDto, GetEIP712MessageResponse, GetKalshiMarketsParams, HLChannel, HLChannelDataMap, HLWebSocketResponse, HistoricalRange, KalshiMarket, KalshiMarketsResponse, KalshiMveLeg, KalshiPriceRange, LadderConfigInput, LadderOrderParameters, LeverageInfo, LogoutRequest, LogoutResponse, MarginRequiredPerCollateral, MarginRequiredResult, MarginSummaryDto, MarginTableDef, MarginTablesEntry, MarginTier, MarketOrderParameters, NotificationCategory, NotificationDto, OpenLimitOrderDto, OpenPositionDto, OrderAssetDto, OrderDirection, OrderParameters, OrderStatus, OrderType, PairAssetDto, PairAssetInput, PerformanceOverlay, PerpDex, PerpDexsResponse, PerpMetaAsset, PlatformAccountSummaryResponseDto, PortfolioBucketDto, PortfolioInterval, PortfolioIntervalsDto, PortfolioOverallDto, PortfolioResponseDto, PositionAdjustmentType, PositionAssetDetailDto, PredictionMarketOutcomeTriggerParams, PriceRatioTriggerParams, PriceTriggerParams, PrivyAuthDetails, RawAssetDto, RawPositionDto, RealtimeBar, RealtimeBarsCallback, RefreshTokenRequest, RefreshTokenResponse, SpotBalance, SpotBalances, SpotOrderFilledStatus, SpotOrderHyperliquidData, SpotOrderHyperliquidResult, SpotOrderRequestInput, SpotOrderResponseDto, SpotState, SyncFillsRequestDto, SyncFillsResponseDto, ToggleWatchlistResponseDto, TokenConflict, TokenEntry, TokenHistoricalPriceData, TokenMetadata, TokenSelection, TokenSelectorConfig, TpSlOrderParameters, TpSlThreshold, TpSlThresholdInput, TpSlThresholdType, TpSlTriggerType, TradeHistoryAssetDataDto, TradeHistoryDataDto, TriggerOrderNotificationAsset, TriggerOrderNotificationParams, TriggerOrderNotificationType, TriggerOrderParameters, TriggerType, TwapChunkStatus, TwapChunkStatusDto, TwapMonitoringDto, TwapOrderOverallStatus, TwapOrderParameters, TwapSliceFillResponseItem, UniverseAsset, UpdateLeverageRequestInput, UpdateLeverageResponseDto, UpdateRiskParametersRequestInput, UpdateRiskParametersResponseDto, UseAuthOptions, UseBasketCandlesReturn, UseHistoricalPriceDataReturn, UseHyperliquidUserFillsOptions, UseHyperliquidUserFillsState, UseNotificationsResult, UsePerformanceOverlaysReturn, UsePortfolioResult, UseSpotOrderResult, UseTokenSelectionMetadataReturn, UserProfile, UserSelectionState, WatchlistAssetDto, WatchlistItemDto, WebData3AssetCtx, WebData3PerpDexState, WebData3Response, WebData3UserState, WebSocketAckResponse, WebSocketChannel, WebSocketConnectionState, WebSocketDataMessage, WebSocketMessage, WebSocketSubscribeMessage, WsAllMidsData };
|