light-token-client
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLight Token Client SDKs
Light Token客户端SDK
Client-side cookbook for (TypeScript) and (Rust). Covers all token operations: create mints, associated token accounts, transfer, approve, revoke, burn, wrap, unwrap, freeze, thaw, close, and load.
@lightprotocol/compressed-tokenlight_token_client这是(TypeScript版)和(Rust版)的客户端使用手册,涵盖所有代币操作:创建铸币、关联代币账户、转账、授权、撤销授权、销毁、封装、解封装、冻结、解冻、关闭账户以及加载账户。
@lightprotocol/compressed-tokenlight_token_clientWorkflow
工作流程
- Clarify intent
- Recommend plan mode, if it's not activated
- Use to resolve blind spots
AskUserQuestion - All questions must be resolved before execution
- Identify references and skills
- Match task to domain references below
- Locate relevant documentation and examples
- Write plan file (YAML task format)
- Use for anything unclear — never guess or assume
AskUserQuestion - Identify blockers: permissions, dependencies, unknowns
- Plan must be complete before execution begins
- Use
- Execute
- Use tool with subagents for parallel research
Task - Subagents load skills via tool
Skill - Track progress with
TodoWrite
- Use
- When stuck: spawn subagent with ,
Read,Glob, DeepWiki MCP access and loadGrepskills/ask-mcp
- 明确需求
- 若未激活计划模式,建议启用该模式
- 使用来解决疑问点
AskUserQuestion - 所有问题必须在执行前解决
- 确定参考资料与技能
- 将任务与下方的【领域参考资料】匹配
- 查找相关文档和示例
- 编写计划文件(YAML任务格式)
- 任何不明确的地方都使用,切勿猜测或假设
AskUserQuestion - 识别阻碍因素:权限、依赖项、未知内容
- 计划必须完整才能开始执行
- 任何不明确的地方都使用
- 执行任务
- 使用工具并结合子代理进行并行研究
Task - 子代理通过工具加载技能
Skill - 使用跟踪进度
TodoWrite
- 使用
- 遇到困境时:生成具备、
Read、Glob、DeepWiki MCP访问权限的子代理,并加载Grep技能skills/ask-mcp
Domain references
领域参考资料
| Task | Reference |
|---|---|
| Create a mint | create-mint.md |
| Create SPL interface PDA | create-interface-pda.md |
| Create associated token account | create-associated-token-account.md |
| Create token account | create-token-account.md |
| Mint tokens | mint-to.md |
| Transfer tokens | transfer-interface.md |
| Transfer checked | transfer-checked.md |
| Approve delegate | approve.md |
| Revoke delegate | revoke.md |
| Wrap SPL to Light | wrap.md |
| Unwrap Light to SPL | unwrap.md |
| Load associated token account | load-associated-token-account.md |
| Burn tokens | burn.md |
| Burn checked | burn-checked.md |
| Freeze token account | freeze.md |
| Thaw token account | thaw.md |
| Close token account | close-token-account.md |
| Mint SPL, wrap, and transfer | spl-mint-wrap-transfer.md |
| 任务 | 参考资料 |
|---|---|
| 创建铸币 | create-mint.md |
| 创建SPL接口PDA | create-interface-pda.md |
| 创建关联代币账户 | create-associated-token-account.md |
| 创建代币账户 | create-token-account.md |
| 铸币 | mint-to.md |
| 转账 | transfer-interface.md |
| 校验转账 | transfer-checked.md |
| 授权代理 | approve.md |
| 撤销代理授权 | revoke.md |
| 将SPL代币封装为Light代币 | wrap.md |
| 将Light代币解封装为SPL代币 | unwrap.md |
| 加载关联代币账户 | load-associated-token-account.md |
| 销毁代币 | burn.md |
| 校验销毁代币 | burn-checked.md |
| 冻结代币账户 | freeze.md |
| 解冻代币账户 | thaw.md |
| 关闭代币账户 | close-token-account.md |
| 铸SPL代币、封装并转账 | spl-mint-wrap-transfer.md |
Operations overview
操作概览
| Operation | TypeScript | Rust | Docs |
|---|---|---|---|
| Create Light mint | | | create-mint |
| Create SPL mint w/ interface PDA | | — | create-mint |
| Create T22 mint w/ interface PDA | | — | create-mint |
| Add interface PDA to existing mint | | — | create-mint |
| Create associated token account | | | create-ata |
| Create token account | — | | create-token-account |
| Mint to | | | mint-to |
| Transfer | | | transfer-interface |
| Transfer checked | — | | transfer-checked |
| Approve | | | approve-revoke |
| Revoke | | | approve-revoke |
| Burn | — | | burn |
| Burn checked | — | | burn |
| Wrap SPL to Light | | | wrap-unwrap |
| Unwrap Light to SPL | | | wrap-unwrap |
| Load associated token account (cold to hot) | | — | load-ata |
| Freeze | — | | freeze-thaw |
| Thaw | — | | freeze-thaw |
| Close | — | | close-token-account |
| 操作 | TypeScript | Rust | 文档 |
|---|---|---|---|
| 创建Light铸币 | | | create-mint |
| 创建带接口PDA的SPL铸币 | | — | create-mint |
| 创建带接口PDA的T22铸币 | | — | create-mint |
| 为现有铸币添加接口PDA | | — | create-mint |
| 创建关联代币账户 | | | create-ata |
| 创建代币账户 | — | | create-token-account |
| 铸币到账户 | | | mint-to |
| 转账 | | | transfer-interface |
| 校验转账 | — | | transfer-checked |
| 授权 | | | approve-revoke |
| 撤销授权 | | | approve-revoke |
| 销毁代币 | — | | burn |
| 校验销毁代币 | — | | burn |
| 将SPL代币封装为Light代币 | | | wrap-unwrap |
| 将Light代币解封装为SPL代币 | | | wrap-unwrap |
| 加载关联代币账户(冷转热) | | — | load-ata |
| 冻结账户 | — | | freeze-thaw |
| 解冻账户 | — | | freeze-thaw |
| 关闭账户 | — | | close-token-account |
When to use TypeScript vs Rust
TypeScript与Rust版本的适用场景
| Criteria | TypeScript | Rust |
|---|---|---|
| Environment | Browser, Node.js, Deno | Server-side, CLI tools, on-chain tests |
| Package | | |
| Pattern | | |
| Freeze/Thaw/Close/Burn | Not yet in TS SDK | Available |
| 评估标准 | TypeScript | Rust |
|---|---|---|
| 运行环境 | 浏览器、Node.js、Deno | 服务端、CLI工具、链上测试 |
| 依赖包 | | |
| 代码模式 | | |
| 冻结/解冻/关闭账户/销毁代币 | TS SDK暂不支持 | 已支持 |
External references
外部参考资料
| Resource | Link |
|---|---|
| Docs cookbook | zkcompression.com/light-token/cookbook |
| TypeScript examples | examples-light-token/typescript-client |
| Rust examples | examples-light-token/rust-client |
| API docs |
| API docs |
| docs.rs |
| docs.rs |
| docs.rs |
| 资源 | 链接 |
|---|---|
| 官方使用手册 | zkcompression.com/light-token/cookbook |
| TypeScript示例 | examples-light-token/typescript-client |
| Rust示例 | examples-light-token/rust-client |
| API文档 |
| API文档 |
| docs.rs |
| docs.rs |
| docs.rs |