@rabby-wallet/hyperliquid-sdk 1.1.8-beta.0 → 1.1.8-beta.2

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,5 +1,5 @@
1
1
  import { ExchangeType } from '../types/constants';
2
- import type { OrderResponse, CancelResponse, ExchangeClientConfig, PlaceOrderParams, MultiOrderParams, CancelOrderParams, ModifyOrderParams, WithdrawParams, SendAssetParams, UsdClassTransferParams, ApproveBuilderFeeParams, PrepareApproveBuilderFeeResult, SendApproveParams, MarketOrderParams, UpdateLeverageParams, BindTpslByOrderIdParams, UpdateIsolatedMarginParams, TwapOrderParams, TwapCancelParams, TwapOrderResponse, PlaceTPSlMarketOrderParams, PlaceTPSlLimitOrderParams, ClearinghouseState, UpdateTpslByOrderIdParams, LimitOrderParams, Abstraction, UserSetAbstractionParams, Tif } from '../types';
2
+ import type { OrderResponse, CancelResponse, ExchangeClientConfig, PlaceOrderParams, MultiOrderParams, CancelOrderParams, ModifyOrderParams, WithdrawParams, SendAssetParams, ApproveBuilderFeeParams, PrepareApproveBuilderFeeResult, SendApproveParams, MarketOrderParams, UpdateLeverageParams, BindTpslByOrderIdParams, UpdateIsolatedMarginParams, TwapOrderParams, TwapCancelParams, TwapOrderResponse, PlaceTPSlMarketOrderParams, PlaceTPSlLimitOrderParams, ClearinghouseState, UpdateTpslByOrderIdParams, LimitOrderParams, Abstraction, UserSetAbstractionParams, Tif } from '../types';
3
3
  /**
4
4
  * Client for executing trades on Hyperliquid (perpetuals only)
5
5
  * Only includes essential trading APIs as specified
@@ -173,15 +173,6 @@ export declare class ExchangeClient {
173
173
  */
174
174
  prepareSendAsset(params: SendAssetParams): PrepareApproveBuilderFeeResult;
175
175
  sendSendAsset(params: SendApproveParams): Promise<any>;
176
- /**
177
- * Move USDC between the spot and perp account on Hyperliquid.
178
- * Signed by the master wallet.
179
- *
180
- * @param params.amount - USDC amount as a decimal string (e.g. "100.5")
181
- * @param params.toPerp - true: Spot → Perp; false: Perp → Spot
182
- */
183
- prepareUsdClassTransfer(params: UsdClassTransferParams): PrepareApproveBuilderFeeResult;
184
- sendUsdClassTransfer(params: SendApproveParams): Promise<any>;
185
176
  /**
186
177
  * Place a TWAP order
187
178
  * TWAP orders split a large order into smaller slices over time
@@ -1051,50 +1051,6 @@ class ExchangeClient {
1051
1051
  signature: splitSignature,
1052
1052
  });
1053
1053
  }
1054
- /**
1055
- * Move USDC between the spot and perp account on Hyperliquid.
1056
- * Signed by the master wallet.
1057
- *
1058
- * @param params.amount - USDC amount as a decimal string (e.g. "100.5")
1059
- * @param params.toPerp - true: Spot → Perp; false: Perp → Spot
1060
- */
1061
- prepareUsdClassTransfer(params) {
1062
- const nonce = Date.now();
1063
- const action = {
1064
- type: constants_1.ExchangeType.USD_CLASS_TRANSFER,
1065
- hyperliquidChain: this.isTestnet ? 'Testnet' : 'Mainnet',
1066
- signatureChainId: this.isTestnet ? '0x66eee' : '0xa4b1',
1067
- amount: params.amount,
1068
- toPerp: params.toPerp,
1069
- nonce,
1070
- };
1071
- const { domain, types, primaryType, message } = (0, signer_1.prepareMasterSignData)({
1072
- action,
1073
- payloadTypes: [
1074
- { name: 'hyperliquidChain', type: 'string' },
1075
- { name: 'amount', type: 'string' },
1076
- { name: 'toPerp', type: 'bool' },
1077
- { name: 'nonce', type: 'uint64' },
1078
- ],
1079
- primaryType: 'HyperliquidTransaction:UsdClassTransfer',
1080
- isMainnet: !this.isTestnet,
1081
- });
1082
- return {
1083
- domain,
1084
- types,
1085
- primaryType,
1086
- message,
1087
- nonce,
1088
- };
1089
- }
1090
- sendUsdClassTransfer(params) {
1091
- const splitSignature = (0, signer_1.splitSig)(params.signature);
1092
- return this.httpClient.exchange({
1093
- action: params.action,
1094
- nonce: params.nonce,
1095
- signature: splitSignature,
1096
- });
1097
- }
1098
1054
  /**
1099
1055
  * Place a TWAP order
1100
1056
  * TWAP orders split a large order into smaller slices over time
@@ -1,4 +1,4 @@
1
- import type { Meta, AssetCtx, ClearinghouseState, CandleSnapshot, AllMids, ExtraAgent, OpenOrder, FeeResponse, UserNonFundingLedgerUpdates, UserHistoricalOrders, ReferralResponse, L2BookSnapshot, UserTwapSliceFill, FundingHistoryItem, UserFunding, WsFill, PerpDexsResponse, UserAbstractionResp, SpotClearinghouseState, PreTransferCheckResp } from '../types';
1
+ import type { Meta, AssetCtx, ClearinghouseState, CandleSnapshot, AllMids, ExtraAgent, OpenOrder, FeeResponse, UserNonFundingLedgerUpdates, UserHistoricalOrders, ReferralResponse, L2BookSnapshot, UserTwapSliceFill, FundingHistoryItem, UserFunding, WsFill, PerpDexsResponse, UserAbstractionResp, SpotClearinghouseState, PreTransferCheckResp, ActiveAssetData } from '../types';
2
2
  export interface InfoClientConfig {
3
3
  isTestnet?: boolean;
4
4
  timeout?: number;
@@ -35,6 +35,12 @@ export declare class InfoClient {
35
35
  * dex: undefined means hyper; and 'xyz' means xyz dex
36
36
  */
37
37
  getClearingHouseState(address?: string, dex?: string): Promise<ClearinghouseState>;
38
+ /**
39
+ * Get user's per-asset data: leverage, margin mode, mark price,
40
+ * max trade sizes, and available-to-trade for buy/sell.
41
+ * REST equivalent of `subscribeToActiveAssetData`.
42
+ */
43
+ getActiveAssetData(coin: string, address?: string): Promise<ActiveAssetData>;
38
44
  /**
39
45
  * Get Spot clearing house state
40
46
  */
@@ -130,6 +130,24 @@ class InfoClient {
130
130
  });
131
131
  });
132
132
  }
133
+ /**
134
+ * Get user's per-asset data: leverage, margin mode, mark price,
135
+ * max trade sizes, and available-to-trade for buy/sell.
136
+ * REST equivalent of `subscribeToActiveAssetData`.
137
+ */
138
+ getActiveAssetData(coin, address) {
139
+ return __awaiter(this, void 0, void 0, function* () {
140
+ const user = address || this.masterAddress;
141
+ if (!user) {
142
+ throw new Error('user address is empty');
143
+ }
144
+ return this.httpClient.info({
145
+ type: constants_1.InfoType.ACTIVE_ASSET_DATA,
146
+ user,
147
+ coin,
148
+ });
149
+ });
150
+ }
133
151
  /**
134
152
  * Get Spot clearing house state
135
153
  */
@@ -19,7 +19,6 @@ export declare enum ExchangeType {
19
19
  UPDATE_LEVERAGE = "updateLeverage",
20
20
  UPDATE_ISOLATED_MARGIN = "updateIsolatedMargin",
21
21
  USD_SEND = "usdSend",
22
- USD_CLASS_TRANSFER = "usdClassTransfer",
23
22
  WITHDRAW = "withdraw3",
24
23
  SEND_ASSET = "sendAsset",
25
24
  APPROVE_AGENT = "approveAgent",
@@ -25,7 +25,6 @@ var ExchangeType;
25
25
  ExchangeType["UPDATE_LEVERAGE"] = "updateLeverage";
26
26
  ExchangeType["UPDATE_ISOLATED_MARGIN"] = "updateIsolatedMargin";
27
27
  ExchangeType["USD_SEND"] = "usdSend";
28
- ExchangeType["USD_CLASS_TRANSFER"] = "usdClassTransfer";
29
28
  ExchangeType["WITHDRAW"] = "withdraw3";
30
29
  ExchangeType["SEND_ASSET"] = "sendAsset";
31
30
  ExchangeType["APPROVE_AGENT"] = "approveAgent";
@@ -81,9 +81,9 @@ export interface OpenOrder {
81
81
  triggerPx: string;
82
82
  isPositionTpsl: boolean;
83
83
  reduceOnly: boolean;
84
- orderType: 'Take Profit Market' | 'Stop Market';
85
- origSz: '0.0';
86
- tif: null;
84
+ orderType: 'Limit' | 'Take Profit Market' | 'Stop Market' | string;
85
+ origSz: string;
86
+ tif: string | null;
87
87
  children?: OpenOrder[];
88
88
  }
89
89
  export interface OrderRequest {
@@ -607,15 +607,6 @@ export interface SendAssetParams {
607
607
  destinationDex?: string;
608
608
  fromSubAccount?: string;
609
609
  }
610
- /**
611
- * Spot ↔ Perp USDC transfer parameters.
612
- * `toPerp = true` : Spot → Perp
613
- * `toPerp = false` : Perp → Spot
614
- */
615
- export interface UsdClassTransferParams {
616
- amount: string;
617
- toPerp: boolean;
618
- }
619
610
  export interface DepositParams {
620
611
  amount: string;
621
612
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/hyperliquid-sdk",
3
- "version": "1.1.8-beta.0",
3
+ "version": "1.1.8-beta.2",
4
4
  "description": "Simplified Hyperliquid Perpetuals Trading SDK for Frontend Applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",