Skip to main content
The HIP-4 SDK exposes four share-conversion methods on the trading adapter. They settle directly against your spot balances at the protocol mint price - no orderbook, no slippage, no spread paid. See the Converting tokens concept page for the underlying bundle equivalences. All four methods use L1 agent signing, the same authority as placeOrder. Authenticate once with auth.initAuth, then call any conversion method.
Conversions affect your spot balances directly. There is no “are you sure?” step - a successful call mints or burns shares immediately. Validate inputs before submitting, especially amount strings.

Setup

The four methods live at hip4.trading.splitOutcome, hip4.trading.mergeOutcome, hip4.trading.mergeQuestion, and hip4.trading.negateOutcome. Each returns a WalletActionResult:
None of the conversion methods throw - branch on result.success.

Split: USDC → Yes + No

splitOutcome burns X USDC and mints X Yes + X No of one outcome. Use it when you want exposure to both sides of an outcome, or to seed paired shares before a negate.
The outcome field is the numeric outcome ID (matches market.outcomeId on a fetched market). The amount is a decimal string - the SDK strips trailing zeros to match Hyperliquid’s wire format.

Merge outcome: Yes + No → USDC

mergeOutcome is the inverse of split - burn X Yes + X No of one outcome and mint X USDC. Use it to recover collateral from a paired position.
Pass amount: null to merge the maximum available - the protocol will burn min(yes_balance, no_balance) shares automatically:

Merge question: full Yes-bundle → USDC

mergeQuestion burns X Yes shares from every outcome of a question (named outcomes plus the fallback) and mints X USDC. Useful when you hold the full bundle and want to redeem before settlement - the bundle is already worth exactly 1 USDC by the bundle equivalence.
Like mergeOutcome, amount: null redeems the maximum - min(yes_balance) across every outcome of the question:
The question field is the question ID. For multi-outcome and price-bucket markets, this is market.questionId. For default-binary markets (which have no parent question), mergeQuestion doesn’t apply - use mergeOutcome instead.

Negate: No → Yes of every other outcome

negateOutcome burns X No shares of one outcome and mints X Yes shares of every other outcome in the same question (including the fallback). “I don’t think this wins” becomes “I think one of the others wins” without touching the book.
After this call, your No-5160 balance drops by 5, and you hold 5 additional Yes shares of every other outcome (5161, 5162, …, including the fallback) in question 42.
The on-wire sub-key is negateOutcome (matching Hyperliquid’s testnet “Convert Outcomes” UI). Hyperliquid’s docs body shows negateQuestion in places - that’s a typo. The SDK uses the correct key.

Error handling

All four methods return a WalletActionResult and never throw. Common error cases:
If success: true, the conversion settled and your spot balances now reflect the new shares. There’s no fill price to inspect - conversions don’t fill against the book.

Putting it together: lock in profit on a Yes bundle

You hold 100 Yes shares across every outcome of question 42 - a full bundle worth exactly 1 USDC each by equivalence. Instead of waiting for settlement, redeem now:
If one leg has 80 Yes and the rest have 100, null redeems 80 - the protocol enforces the bundle constraint automatically.

See also