canhelp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGiven a canister ID or name in , fetch and summarize its Candid interface.
$ARGUMENTS获取 中给定的 canister ID 或名称,并汇总其 Candid 接口。
$ARGUMENTSSteps
步骤
-
Resolve the canister ID by running the resolve script from the skill's base directory:bash
./scripts/resolve-canister-id.sh "$ARGUMENTS"Ifis already a valid principal, the script echoes it back. Otherwise, it queries the IC Dashboard API and outputs matches as$ARGUMENTS(one per line).<canister-id> <name>- If there is a single result, clearly display the resolved canister ID and use it directly.
- If there are multiple results, present the list to the user and ask them to pick one before continuing.
-
Fetch the Candid interface using the resolved canister ID:bash
./scripts/fetch-candid.sh <resolved-canister-id>The script outputs the path to the downloadedfile..did -
Read the file using thetool.
Read -
Present the output as a readable summary with the following structure:Canister
<canister-id>Query methods:- — one-line description if inferable from the name
method_name(arg1: type1, arg2: type2) → return_type
Update methods:method_name(arg1: type1) → return_type
Types:- List any custom record/variant types defined in the interface, with their fields
-
运行 skill 基础目录中的 resolve 脚本,解析 canister ID:bash
./scripts/resolve-canister-id.sh "$ARGUMENTS"如果已经是有效的 principal,脚本会直接回显该值。 否则,脚本将查询 IC Dashboard API,并以$ARGUMENTS的格式输出匹配结果(每行一个)。<canister-id> <name>- 如果只有一个结果,应清晰展示解析出的 canister ID,并直接使用该 ID。
- 如果有多个结果,则向用户展示列表,并要求用户选择一个后再继续。
-
使用解析出的 canister ID 获取 Candid 接口:bash
./scripts/fetch-candid.sh <resolved-canister-id>该脚本会输出已下载的文件路径。.did -
使用工具读取该文件。
Read -
按以下结构以易读形式呈现结果:Canister
<canister-id>Query methods:- — 如果可以根据名称推断,则提供一句话说明
method_name(arg1: type1, arg2: type2) → return_type
Update methods:method_name(arg1: type1) → return_type
Types:- 列出接口中定义的所有自定义 record/variant 类型及其字段
Guidelines
指南
- Group methods by query vs update
- Sort methods alphabetically within each group
- For complex nested types, show the top-level structure and note nesting
- If the candid is very large (>100 methods), show a summary count and list only the most important-looking methods, offering to show the full list on request
- If the fetch succeeds, but the Candid interface is empty,explain that the canister is not exposing its Candid interface in the wasm metadata
- If the fetch fails, suggest the user verify the canister ID and that is installed
icp
- 按 query 和 update 对方法进行分组
- 在每组内部按字母顺序排列方法
- 对于复杂的嵌套类型,展示顶层结构并注明嵌套关系
- 如果 Candid 接口非常大(超过 100 个方法),则显示汇总数量,仅列出看起来最重要的方法,并主动询问是否需要展示完整列表
- 如果获取成功,但 Candid 接口为空,应说明该 canister 未在 wasm metadata 中公开其 Candid 接口
- 如果获取失败,应建议用户检查 canister ID,并确认已安装
icp