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

# SDK 快速入门

> 使用 TypeScript SDK 查询 BNB 测试网上的在售卡包。

## 读取在售卡包

此示例使用 Node.js 24 或更高版本及 `@renaiss-protocol/client@0.1.0-beta.3`，最多查询五个在售卡包，无需钱包或开发者密钥。

使用 SDK `0.1.0-beta.3` 或 `0.1.0-beta.4` 查询当前测试网卡包目录时，可能会收到 `INVALID_SCHEMA`。要查看卡包数据，请打开[卡包列表调试面板](https://docs.renaiss.xyz/cn/api-reference/gacha/list-packs.md?playground=open)，选择测试网后发送请求。

```ts theme={null}
import {
  BNB_TESTNET,
  GachaMachineStage,
  createGachaClient,
  getError,
  getValue,
  isFailed,
} from '@renaiss-protocol/client';

const gacha = createGachaClient({
  baseUrl: 'https://dev-api.renaiss.xyz',
  network: BNB_TESTNET,
});

const result = await gacha.listGachaMachines({
  stage: GachaMachineStage.Active,
  pageSize: 5,
}).firstPage();

if (isFailed(result)) {
  throw new Error(getError(result).detail);
}

for (const pack of getValue(result).items) {
  console.log(pack.slug, pack.name, pack.priceInUsdt);
}
```

## 接入钱包操作

1. 为目标环境[申请开发者访问权限](https://docs.renaiss.xyz/cn/builder-program.md)。
2. 在后端验证用户身份。只对接受开发者密钥的接口添加 `x-builder-api-key`。
3. 在请求签名前，让用户核对钱包、链、卡牌或卡包及金额。使用与环境匹配的[网络及合约](https://docs.renaiss.xyz/cn/contracts.md)。
4. 接入配送前，注册前端来源并[验证配送钱包](https://docs.renaiss.xyz/cn/authentication.md#验证配送钱包)。

接下来可阅读[抽卡](https://docs.renaiss.xyz/cn/gacha.md)、[市场](https://docs.renaiss.xyz/cn/marketplace.md)或[实物兑换](https://docs.renaiss.xyz/cn/redeem.md)接入指南。已有 TypeScript 项目请先核对 [SDK 兼容性](https://docs.renaiss.xyz/cn/typescript-sdk.md#版本兼容性)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.