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

# WaaS API 参考

> useHeliusWallet() hook 以及 Helius wallet-kit SDK 的包导入

[`helius-wallet-kit`](https://www.npmjs.com/package/helius-wallet-kit) SDK 提供的一切。

## 导入

```ts theme={"system"}
// Provider, hook, and types
import { HeliusWalletProvider, useHeliusWallet } from "helius-wallet-kit";

// Next.js route handler
import { createHeliusRouteHandler } from "helius-wallet-kit/next";

// Styles
import "helius-wallet-kit/ui/styles.css";
```

## `useHeliusWallet()`

| 属性                                  | 类型                                                       | 描述                                                       |
| ----------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
| `address`                           | `string \| null`                                         | 已连接钱包的 Solana 地址。                                        |
| `status`                            | `"loading" \| "unauthenticated" \| "authenticated"`      | 认证状态。                                                    |
| `user`                              | `object \| null`                                         | 认证时为 `{ userId, username, email?, subOrgId, walletId }`。 |
| `login()`                           | `() => Promise<void>`                                    | 打开钱包模式进行登录。                                              |
| `logout()`                          | `() => Promise<void>`                                    | 用户注销。                                                    |
| `signMessage(message)`              | `(string) => Promise<string>`                            | 签署 UTF-8 消息并返回签名。                                        |
| `signTransaction(tx)`               | `(Uint8Array \| Buffer) => Promise<Buffer>`              | 签署序列化交易但不发送。                                             |
| `signAndSendTransaction(tx)`        | `(Uint8Array \| Buffer) => Promise<string>`              | 签署并提交序列化交易；返回签名。                                         |
| `exportWallet()`                    | `() => Promise<void>`                                    | 为用户打开加密流程以导出钱包。                                          |
| `getTransactions(options?)`         | `({ limit?: number }) => Promise<EnhancedTransaction[]>` | 解析的交易历史。需要路由处理器。                                         |
| `getPriorityFee(keys, level?)`      | `(string[], PriorityLevel?) => Promise<number>`          | 优先费估计（微 lamports）；`level` 默认为 `Medium`。                  |
| `getPriorityFeeLevels(accountKeys)` | `(string[]) => Promise<PriorityFeeLevels>`               | 每个级别的优先费估计。                                              |
| `connection`                        | `Connection`                                             | 通过 Helius RPC 的 `@solana/web3.js` 连接。                    |
| `rpcUrl`                            | `string`                                                 | 活动的 RPC URL（安全 RPC 或路由处理器代理）。                            |
| `cluster`                           | `"mainnet-beta" \| "devnet"`                             | 活动集群。                                                    |
| `setCluster(cluster)`               | `(cluster) => void`                                      | 切换活动集群。                                                  |
| `apiKey`                            | `string \| null`                                         | 已解析的 Helius API 密钥。                                      |
| `projectId`                         | `string \| null`                                         | 引导时从您的 API 密钥中解析的项目 ID。                                  |
| `planTier`                          | `HeliusPlan \| null`                                     | 账户的计划级别（如果已解析）。                                          |

## 下一步

<CardGroup cols={2}>
  <Card title="从 Privy 迁移" icon="arrow-right-arrow-left" href="/zh/waas/migrating-from-privy">
    将现有的 Privy 钱包移动到 Helius WaaS
  </Card>

  <Card title="定价" icon="credit-card" href="/zh/waas/overview#pricing">
    每个签名 200 积分（\$0.001）
  </Card>
</CardGroup>
