> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/jiao-cheng-yu-shi-li/rewards/reward-claim-dispenser.md).

# 奖励领取发放器

从 Rewards 活动中领取奖励的可穿戴物发放器和空投箱。

向玩家发放 Decentraland Rewards 活动中的可穿戴物品。场景包含点击领取发放器、按钮发放器，以及一个可空投可领取箱子的拉杆。

## 项目信息

**维护者：** Decentraland

[查看源代码](https://github.com/decentraland/sdk7-goerli-plaza/tree/main/reward-claim)

**许可证：** [Apache-2.0](https://github.com/decentraland/sdk7-goerli-plaza/blob/main/reward-claim/LICENSE)。重复使用前请查看上游条款；代码和资源可能适用不同条款。

## 探索代码

这些链接指向特定的源代码快照，因此随着上游持续开发，这些说明仍然有用。它们是学习参考资料，并非安全评估。

### 使用签名 fetch 请求奖励

`claimToken` 会限制重复点击、跳过本次会话中已成功领取的发放器，并检查玩家是否拥有钱包。 `requestToken` 随后使用 `signedFetch`.

**向 Rewards 服务器发送发放器密钥、当前 catalyst 和玩家地址。** 默认启用测试（`CONFIG_CLAIM_TESTING_ENABLED` 位于 `src/config.ts`），使用的是内置测试活动。若要使用自己的活动，请替换 `ClaimConfig` 中的占位活动 ID 和发放器密钥，并关闭测试。创建活动和发放器的方法请参阅 Rewards 入门指南。

**源代码参考：**

* [`claimToken` 和 `requestToken`](https://github.com/decentraland/sdk7-goerli-plaza/blob/54a07775ee340f0ce22eb23280ef0e9c35f5e386/reward-claim/src/dispenser/claiming/claim.ts#L26-L99)
* [`ClaimConfig`](https://github.com/decentraland/sdk7-goerli-plaza/blob/54a07775ee340f0ce22eb23280ef0e9c35f5e386/reward-claim/src/dispenser/claiming/claimConfig.ts#L21-L34)

### 将 Rewards 响应映射为玩家反馈

`processResponse` 会针对活动不可用、发放器库存耗尽、奖励已分配以及成功领取等情况，显示不同的发放器界面。对于尚未启动、已禁用和已结束的活动，都会走同一分支；只有当活动配置设置了 `startDate` 或 `endDate`时，才会显示尚未开始或已结束界面，否则会显示通用的已结束界面。

**项目背景：** 界面状态定义在 `dispenserUi.tsx`中。活动配置中的开始和结束日期为可选字段。

**源代码参考：**

* [`processResponse`](https://github.com/decentraland/sdk7-goerli-plaza/blob/54a07775ee340f0ce22eb23280ef0e9c35f5e386/reward-claim/src/dispenser/claiming/claim.ts#L101-L197)

### 使用验证码重试领取

当 Rewards 服务器要求输入验证码时， `getCaptcha` 会获取验证码图片并在发放器界面中显示。提交答案时会再次调用 `claimToken` ，并附上验证码 ID 和验证码值。

**项目背景：** 是否需要验证码，是 Rewards 控制面板中发放器的一项设置。

**源代码参考：**

* [`getCaptcha`](https://github.com/decentraland/sdk7-goerli-plaza/blob/54a07775ee340f0ce22eb23280ef0e9c35f5e386/reward-claim/src/dispenser/claiming/claim.ts#L209-L216)
* [验证码提交按钮](https://github.com/decentraland/sdk7-goerli-plaza/blob/54a07775ee340f0ce22eb23280ef0e9c35f5e386/reward-claim/src/dispenser/claiming/ui/dispenserUi.tsx#L640-L643)

### 从空投箱中领取

`randomCrateSpawn` 会在场景区域内的随机位置空投一个带降落伞的箱子。 `DropCrate` 会向下发射射线以找到地面，并通过补间动画将箱子放到地面上。点击箱子即可领取奖励，箱子随后会消失。

**项目背景：** 箱子的掉落由以下内容触发： `Activate` Creator Hub 杠杆的操作，该杠杆位于 `main`.

**源代码参考：**

* [`randomCrateSpawn` 和 `SpawnCrate`](https://github.com/decentraland/sdk7-goerli-plaza/blob/54a07775ee340f0ce22eb23280ef0e9c35f5e386/reward-claim/src/crate.ts#L40-L119)
* [`DropCrate`](https://github.com/decentraland/sdk7-goerli-plaza/blob/54a07775ee340f0ce22eb23280ef0e9c35f5e386/reward-claim/src/crate.ts#L142-L189)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-zh/jiao-cheng-yu-shi-li/rewards/reward-claim-dispenser.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
