# Overview

TypeScript SDK and React widget for USDH on Hyperliquid.

`usdh-kit` helps apps convert USDC into USDH without reimplementing Hyperliquid spot routing, EIP-712 order signing, HyperEVM bridge transactions, or bridge-credit polling.

## Packages

| Package            | Purpose                                        |
| ------------------ | ---------------------------------------------- |
| `@usdh-kit/sdk`    | Quote, route, bridge, and swap `USDC -> USDH`. |
| `@usdh-kit/widget` | Embeddable React swap widget built on the SDK. |

## What works today

* Quote and swap `USDC -> USDH` on the canonical Hyperliquid spot pair.
* Route from existing HyperCore USDC when available.
* Bridge USDC from HyperEVM to HyperCore, wait for credit, then swap.
* Use approved Hyperliquid agent wallets so browser apps do not ask Rabby or other injected wallets to sign L1 order payloads directly.
* Display HyperEVM and HyperCore balances for USDC and USDH in the widget.

## Quick install

```sh
pnpm add @usdh-kit/sdk
```

For the widget:

```sh
pnpm add @usdh-kit/widget @usdh-kit/sdk wagmi viem @tanstack/react-query react react-dom
```

## Minimal widget

```tsx
import { USDHSwap } from '@usdh-kit/widget'
import '@usdh-kit/widget/styles.css'

export default function Page() {
  return <USDHSwap network="mainnet" />
}
```

## Minimal SDK flow

```ts
import { approveAgent, createUsdhKit } from '@usdh-kit/sdk'

await approveAgent({
  network: 'mainnet',
  signer: masterSigner,
  agentAddress: agentSigner.address,
  agentName: 'my-app-usdh',
  signatureChainId: 999,
})

const kit = createUsdhKit({
  network: 'mainnet',
  signer: agentSigner,
  accountAddress: masterSigner.address,
  evmWallet: masterEvmWallet,
  slippageBps: 30,
})

const result = await kit.bridgeAndSwap({
  from: 'USDC',
  amount: 11_000_000n,
  onProgress: (event) => console.log(event.phase),
})

console.log(result.swap.orderId)
```

## Read next

* [Bridge and swap flow](/usdh-kit/get-started/bridge-and-swap.md) explains the full user journey and Rabby prompts.
* [Agent wallets](/usdh-kit/get-started/agent-wallets.md) explains secure signing patterns for builders.
* [Architecture](/usdh-kit/reference/architecture.md) documents the SDK internals.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://usdh-kit.gitbook.io/usdh-kit/get-started/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
