@rabby-wallet/hyperliquid-sdk 1.1.6-beta.1 → 1.1.7-beta.0

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, ApproveBuilderFeeParams, PrepareApproveBuilderFeeResult, SendApproveParams, MarketOrderParams, UpdateLeverageParams, BindTpslByOrderIdParams, UpdateIsolatedMarginParams, TwapOrderParams, TwapCancelParams, TwapOrderResponse, PlaceTPSlMarketOrderParams, PlaceTPSlLimitOrderParams, ClearinghouseState, UpdateTpslByOrderIdParams, LimitOrderParams, Abstraction } 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, Tif } from '../types';
3
3
  /**
4
4
  * Client for executing trades on Hyperliquid (perpetuals only)
5
5
  * Only includes essential trading APIs as specified
@@ -171,4 +171,21 @@ export declare class ExchangeClient {
171
171
  * Cancel a TWAP order
172
172
  */
173
173
  cancelTwapOrder(params: TwapCancelParams): Promise<any>;
174
+ /**
175
+ * Place a spot order for stablecoin swaps on Hyperliquid.
176
+ * Used to swap between USDC, USDT, USDH, USDE on the spot market.
177
+ *
178
+ * @param params.coin - The spot asset to trade (e.g., 'USDT', 'USDH')
179
+ * @param params.isBuy - true = buy the coin (sell USDC), false = sell the coin (buy USDC)
180
+ * @param params.size - Amount to trade
181
+ * @param params.limitPx - Limit price (use '1' for stablecoin 1:1 swaps)
182
+ * @param params.tif - Time in force: 'Ioc' for immediate or cancel
183
+ */
184
+ spotOrder(params: {
185
+ coin: string;
186
+ isBuy: boolean;
187
+ size: string;
188
+ limitPx: string;
189
+ tif?: Tif;
190
+ }): Promise<any>;
174
191
  }
@@ -1057,5 +1057,43 @@ class ExchangeClient {
1057
1057
  });
1058
1058
  });
1059
1059
  }
1060
+ /**
1061
+ * Place a spot order for stablecoin swaps on Hyperliquid.
1062
+ * Used to swap between USDC, USDT, USDH, USDE on the spot market.
1063
+ *
1064
+ * @param params.coin - The spot asset to trade (e.g., 'USDT', 'USDH')
1065
+ * @param params.isBuy - true = buy the coin (sell USDC), false = sell the coin (buy USDC)
1066
+ * @param params.size - Amount to trade
1067
+ * @param params.limitPx - Limit price (use '1' for stablecoin 1:1 swaps)
1068
+ * @param params.tif - Time in force: 'Ioc' for immediate or cancel
1069
+ */
1070
+ spotOrder(params) {
1071
+ return __awaiter(this, void 0, void 0, function* () {
1072
+ const { coin, isBuy, size, limitPx, tif = 'Ioc' } = params;
1073
+ const assetIndex = yield this.symbolConversion.getAssetIndex(coin);
1074
+ const nonce = Date.now();
1075
+ const orderRequest = {
1076
+ a: assetIndex,
1077
+ b: isBuy,
1078
+ p: limitPx,
1079
+ s: size,
1080
+ r: false,
1081
+ t: {
1082
+ limit: { tif },
1083
+ },
1084
+ };
1085
+ const action = {
1086
+ type: constants_1.ExchangeType.ORDER,
1087
+ orders: [orderRequest],
1088
+ grouping: 'na',
1089
+ };
1090
+ const signature = (0, signer_1.signL1AgentAction)(this.getAgentPrivateKey(), action, this.isTestnet, nonce);
1091
+ return this.httpClient.exchange({
1092
+ action,
1093
+ nonce,
1094
+ signature,
1095
+ });
1096
+ });
1097
+ }
1060
1098
  }
1061
1099
  exports.ExchangeClient = ExchangeClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/hyperliquid-sdk",
3
- "version": "1.1.6-beta.1",
3
+ "version": "1.1.7-beta.0",
4
4
  "description": "Simplified Hyperliquid Perpetuals Trading SDK for Frontend Applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",