light-token-client

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Light Token Client SDKs

Light Token客户端SDK

Client-side cookbook for
@lightprotocol/compressed-token
(TypeScript) and
light_token_client
(Rust). Covers all token operations: create mints, associated token accounts, transfer, approve, revoke, burn, wrap, unwrap, freeze, thaw, close, and load.
这是
@lightprotocol/compressed-token
(TypeScript版)和
light_token_client
(Rust版)的客户端使用手册,涵盖所有代币操作:创建铸币、关联代币账户、转账、授权、撤销授权、销毁、封装、解封装、冻结、解冻、关闭账户以及加载账户。

Workflow

工作流程

  1. Clarify intent
    • Recommend plan mode, if it's not activated
    • Use
      AskUserQuestion
      to resolve blind spots
    • All questions must be resolved before execution
  2. Identify references and skills
  3. Write plan file (YAML task format)
    • Use
      AskUserQuestion
      for anything unclear — never guess or assume
    • Identify blockers: permissions, dependencies, unknowns
    • Plan must be complete before execution begins
  4. Execute
    • Use
      Task
      tool with subagents for parallel research
    • Subagents load skills via
      Skill
      tool
    • Track progress with
      TodoWrite
  5. When stuck: spawn subagent with
    Read
    ,
    Glob
    ,
    Grep
    , DeepWiki MCP access and load
    skills/ask-mcp
  1. 明确需求
    • 若未激活计划模式,建议启用该模式
    • 使用
      AskUserQuestion
      来解决疑问点
    • 所有问题必须在执行前解决
  2. 确定参考资料与技能
    • 将任务与下方的【领域参考资料】匹配
    • 查找相关文档和示例
  3. 编写计划文件(YAML任务格式)
    • 任何不明确的地方都使用
      AskUserQuestion
      ,切勿猜测或假设
    • 识别阻碍因素:权限、依赖项、未知内容
    • 计划必须完整才能开始执行
  4. 执行任务
    • 使用
      Task
      工具并结合子代理进行并行研究
    • 子代理通过
      Skill
      工具加载技能
    • 使用
      TodoWrite
      跟踪进度
  5. 遇到困境时:生成具备
    Read
    Glob
    Grep
    、DeepWiki MCP访问权限的子代理,并加载
    skills/ask-mcp
    技能

Domain references

领域参考资料

TaskReference
Create a mintcreate-mint.md
Create SPL interface PDAcreate-interface-pda.md
Create associated token accountcreate-associated-token-account.md
Create token accountcreate-token-account.md
Mint tokensmint-to.md
Transfer tokenstransfer-interface.md
Transfer checkedtransfer-checked.md
Approve delegateapprove.md
Revoke delegaterevoke.md
Wrap SPL to Lightwrap.md
Unwrap Light to SPLunwrap.md
Load associated token accountload-associated-token-account.md
Burn tokensburn.md
Burn checkedburn-checked.md
Freeze token accountfreeze.md
Thaw token accountthaw.md
Close token accountclose-token-account.md
Mint SPL, wrap, and transferspl-mint-wrap-transfer.md
任务参考资料
创建铸币create-mint.md
创建SPL接口PDAcreate-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

操作概览

OperationTypeScriptRustDocs
Create Light mint
createMintInterface
CreateMint
create-mint
Create SPL mint w/ interface PDA
createMintInterface
+
TOKEN_PROGRAM_ID
create-mint
Create T22 mint w/ interface PDA
createMintInterface
+
TOKEN_2022_PROGRAM_ID
create-mint
Add interface PDA to existing mint
createSplInterface
create-mint
Create associated token account
createAtaInterface
CreateAta
create-ata
Create token account
CreateTokenAccount
create-token-account
Mint to
mintToInterface
MintTo
mint-to
Transfer
transferInterface
TransferInterface
transfer-interface
Transfer checked
TransferChecked
transfer-checked
Approve
approve
Approve
approve-revoke
Revoke
revoke
Revoke
approve-revoke
Burn
Burn
burn
Burn checked
BurnChecked
burn
Wrap SPL to Light
wrap
Wrap
wrap-unwrap
Unwrap Light to SPL
unwrap
Unwrap
wrap-unwrap
Load associated token account (cold to hot)
loadAta
load-ata
Freeze
Freeze
freeze-thaw
Thaw
Thaw
freeze-thaw
Close
Close
close-token-account
操作TypeScriptRust文档
创建Light铸币
createMintInterface
CreateMint
create-mint
创建带接口PDA的SPL铸币
createMintInterface
+
TOKEN_PROGRAM_ID
create-mint
创建带接口PDA的T22铸币
createMintInterface
+
TOKEN_2022_PROGRAM_ID
create-mint
为现有铸币添加接口PDA
createSplInterface
create-mint
创建关联代币账户
createAtaInterface
CreateAta
create-ata
创建代币账户
CreateTokenAccount
create-token-account
铸币到账户
mintToInterface
MintTo
mint-to
转账
transferInterface
TransferInterface
transfer-interface
校验转账
TransferChecked
transfer-checked
授权
approve
Approve
approve-revoke
撤销授权
revoke
Revoke
approve-revoke
销毁代币
Burn
burn
校验销毁代币
BurnChecked
burn
将SPL代币封装为Light代币
wrap
Wrap
wrap-unwrap
将Light代币解封装为SPL代币
unwrap
Unwrap
wrap-unwrap
加载关联代币账户(冷转热)
loadAta
load-ata
冻结账户
Freeze
freeze-thaw
解冻账户
Thaw
freeze-thaw
关闭账户
Close
close-token-account

When to use TypeScript vs Rust

TypeScript与Rust版本的适用场景

CriteriaTypeScriptRust
EnvironmentBrowser, Node.js, DenoServer-side, CLI tools, on-chain tests
Package
@lightprotocol/compressed-token
+
@lightprotocol/stateless.js
light_token_client
Pattern
await action(rpc, payer, ...)
Action::new(...).execute(&mut rpc, &payer).await
Freeze/Thaw/Close/BurnNot yet in TS SDKAvailable
评估标准TypeScriptRust
运行环境浏览器、Node.js、Deno服务端、CLI工具、链上测试
依赖包
@lightprotocol/compressed-token
+
@lightprotocol/stateless.js
light_token_client
代码模式
await action(rpc, payer, ...)
Action::new(...).execute(&mut rpc, &payer).await
冻结/解冻/关闭账户/销毁代币TS SDK暂不支持已支持

External references

外部参考资料

ResourceLink
Docs cookbookzkcompression.com/light-token/cookbook
TypeScript examplesexamples-light-token/typescript-client
Rust examplesexamples-light-token/rust-client
@lightprotocol/stateless.js
API docs
@lightprotocol/compressed-token
API docs
light-client
docs.rs
light-token-client
docs.rs
light-token
docs.rs
资源链接
官方使用手册zkcompression.com/light-token/cookbook
TypeScript示例examples-light-token/typescript-client
Rust示例examples-light-token/rust-client
@lightprotocol/stateless.js
API文档
@lightprotocol/compressed-token
API文档
light-client
docs.rs
light-token-client
docs.rs
light-token
docs.rs