@dhedge/trading-widget 6.2.1 → 6.3.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.
package/README.md CHANGED
@@ -201,6 +201,7 @@ At runtime, `getAutoSlippageSimulationCandidates({ maxSlippage })` filters this
201
201
  - **Zap deposit — batch** (`useBatchDeposit`): batch path uses a fixed quote index with no `estimate`, by design.
202
202
  - **Non-zap deposit** (`deposit`, `nativeDeposit`): slippage here is a min-vault-tokens gap, not a DEX swap tolerance — no estimation loop is possible.
203
203
  - **Init withdraw — non-Aave vaults**: no swap quotes involved; the `complexAssetData` is built with a single `slippageTolerance` value via `createDefaultComplexAssetData` — no estimation loop.
204
+ - **Init withdraw — HyperEVM vaults**: `slippageTolerance` is always sent as `0` (`getComplexAssetDataSlippageTolerance`), which makes `PoolLogic` skip its net-slippage check (`dh26` revert). `HyperliquidSpotGuard` pays the HyperCore portion of a withdrawal out in USDC directly to the recipient — value the check cannot account for — so any non-zero tolerance reverts once a vault holds spot balances on HyperCore, and no HyperEVM asset guard performs swaps on withdrawal that the tolerance would protect against.
204
205
  - **Limit order withdraw**: uses price bounds, not DEX slippage.
205
206
 
206
207
  ---
@@ -36,6 +36,12 @@ export interface BuildDytmActionsParams {
36
36
  quote: OndoPriceOracleQuote;
37
37
  }
38
38
  export declare const buildDytmActions: ({ collateral, dytmOffice, processor, gmToken, ondoGMSwap, usdc, gmAmount, amountOutMinimum, signature, quote, }: BuildDytmActionsParams) => DytmAction[];
39
+ export interface BuildDytmOutputAssetWithdrawActionParams {
40
+ collateral: DytmAssetData;
41
+ dytmOffice: Address;
42
+ processor: Address;
43
+ }
44
+ export declare const buildDytmOutputAssetWithdrawAction: ({ collateral, dytmOffice, processor, }: BuildDytmOutputAssetWithdrawActionParams) => DytmAction;
39
45
  export interface BuildDytmRepayActionsParams {
40
46
  accountId: bigint;
41
47
  debtKey: bigint;
@@ -1,3 +1,5 @@
1
1
  import type { Address } from 'viem';
2
2
  export declare const isHyperliquidPerpsAsset: (address: Address) => boolean;
3
+ export declare const isHyperliquidSpotSystemAsset: (address: Address) => boolean;
4
+ export declare const isHyperliquidCorePositionAsset: (address: Address) => boolean;
3
5
  export declare const getHyperliquidWithdrawAsset: () => import("@shared/types").TradingToken;
@@ -1,7 +1,7 @@
1
1
  import type { SwapDataResponse } from '@shared/types';
2
2
  import type { Address, Hex } from 'viem';
3
3
  import type { useCompleteWithdrawTrackedAssets } from '../hooks/trading/withdraw-v2/complete-step/use-complete-withdraw-tracked-assets';
4
- import type { CalculateSwapDataParamsResponse } from '../types';
4
+ import type { CalculateSwapDataParamsResponse, ChainId } from '../types';
5
5
  import type { SwapDataMap, SwapsQuotesMap } from '../utils/swap-data';
6
6
  /**
7
7
  * Calculates the slippage tolerance for withdrawSafe.
@@ -11,6 +11,19 @@ import type { SwapDataMap, SwapsQuotesMap } from '../utils/swap-data';
11
11
  * @returns {string} - The slippage tolerance.
12
12
  */
13
13
  export declare const getSlippageToleranceForContractTransaction: (slippage: number) => bigint;
14
+ /**
15
+ * Resolves the `ComplexAsset.slippageTolerance` withdrawal argument for a chain.
16
+ * A tolerance of 0 makes PoolLogic skip its net-slippage check ("dh26").
17
+ * On HyperEVM the tolerance must always be 0: HyperliquidSpotGuard pays the
18
+ * HyperCore portion of a withdrawal out in USDC directly to the recipient,
19
+ * which the net-slippage check cannot account for, so any non-zero tolerance
20
+ * reverts once the vault holds spot balances on HyperCore. No HyperEVM asset
21
+ * guard performs swaps on withdrawal, so the check protects nothing there.
22
+ */
23
+ export declare const getComplexAssetDataSlippageTolerance: ({ chainId, slippage, }: {
24
+ chainId: ChainId;
25
+ slippage: number;
26
+ }) => bigint;
14
27
  export declare const buildZapDepositTransactionArguments: ({ vaultAddress, swapData, sendTokenAddress, sendTokenAmount, vaultDepositTokenAddress, minVaultTokensReceivedAmount, routerKey, swapDestinationAmount, swapSlippage, }: {
15
28
  vaultAddress: Address;
16
29
  swapData: Hex;