> ## Documentation Index
> Fetch the complete documentation index at: https://docs.illa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Hyperliquid submission

> Relay pre-signed Hyperliquid exchange payloads with submitHyperliquidAction

`sdk.submitHyperliquidAction` is a thin relay for **pre-signed** Hyperliquid exchange payloads. It
POSTs to `/api/v1/hyperliquid/exchange`, which forwards the already-signed action to Hyperliquid and
returns the mapped result. The SDK never signs — the caller signs the EIP-712 typed data from the
preceding `hyperliquid*` tool result.

```ts theme={null}
submitHyperliquidAction(
  request: HyperliquidExchangeSubmitRequest,
  options?: { signal?: AbortSignal },
): Promise<HyperliquidExchangeSubmitResponse>
```

The request carries the unsigned `action` verbatim, the `nonce` the signature commits to, the
`{ r, s, v }` signature split, the `network` (`'mainnet' | 'testnet'`), and an optional integrity
`hmac`. The response is `{ success, status, oid?, avgPx?, totalSz?, error? }` where `status` is
`'filled' | 'resting' | 'error' | 'rebuilt'`.

```ts theme={null}
import { IllaSDK } from '@illalabs/sdk'

const sdk = new IllaSDK({ apiKey: process.env.ILLA_API_KEY! })

// `actionMetadata` and `signatureRequests` come from a preceding hyperliquid* tool result.
const sigHex = await wallet.signTypedData(signatureRequests[0].typedData)

const res = await sdk.submitHyperliquidAction({
  action: actionMetadata.unsignedAction, // unsigned action, verbatim from the tool
  nonce: actionMetadata.nonce,           // ms nonce the signature commits to
  signature: {                           // Hyperliquid expects the { r, s, v } split
    r: `0x${sigHex.slice(2, 66)}`,
    s: `0x${sigHex.slice(66, 130)}`,
    v: parseInt(sigHex.slice(130, 132), 16),
  },
  network: actionMetadata.network,       // 'mainnet' | 'testnet'
  hmac: signatureRequests[0].hmac,       // integrity HMAC, if the request carried one
})

if (!res.success) {
  console.error('Hyperliquid submission failed:', res.error)
} else {
  console.log(res.status, res.oid, res.avgPx, res.totalSz)
}
```

## Related pages

* [ILLA SDK](/sdk/api/illa-sdk)
* [Handling Tool Execution](/sdk/guides/handling-tool-execution)
* [PolymarketService](/sdk/api/polymarket-service)
* [Error handling](/sdk/concepts/error-handling)
