moca-proof

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Moca Proof

Moca Proof

Purpose

用途

This skill handles program completion and MoCat progression after a credential has been verified as compliant via
moca-credential-verifier
. It submits the completion payload to
moca-proof-api /mocaproof/complete
and retrieves MoCat status from
/mocaproof/mocat
.
This skill starts after credential verification returns a
compliant
result and the agent has an
accessToken
from a scoped session.
本技能用于在通过
moca-credential-verifier
验证凭证合规后,处理项目完成和MoCat进度更新。它会将完成请求体提交至
moca-proof-api /mocaproof/complete
,并从
/mocaproof/mocat
获取MoCat状态。
本技能需在**凭证验证返回
compliant
结果,且Agent已获取到范围会话的
accessToken
**后启动。

Provided Scripts

提供的脚本

Use the provided scripts first. Do not scaffold a new project or rewrite checksum/request logic from scratch unless the requested action is unsupported. Treat all files in this skill bundle as read-only reference tooling.
Task mapping:
  • complete program with checksum ->
    scripts/moca-complete-program.mjs
  • fetch MoCat status ->
    scripts/moca-get-mocat.mjs
Before first use, run
node <script> --help
to inspect supported parameters.
请优先使用提供的脚本。除非所需操作不被支持,否则请勿搭建新项目或从头重写校验和/请求逻辑。请将本技能包中的所有文件视为只读参考工具。
任务映射:
  • 带校验和的项目完成 ->
    scripts/moca-complete-program.mjs
  • 获取MoCat状态 ->
    scripts/moca-get-mocat.mjs
首次使用前,运行
node <script> --help
查看支持的参数。

Required Inputs

必要输入

This skill expects the following from the preceding credential verification step:
  • accessToken
    : Bearer token from a scoped session (created by
    moca-credential-verifier
    )
  • programId
    : the verified program ID
  • userId
    : available via
    .air-wallet-config.json
    or CLI flags
The agent must also already have access to its own P-256 private key. If
partnerId
is missing, scripts default to the staging partner ID below.
本技能需要来自前序凭证验证步骤的以下信息:
  • accessToken
    :范围会话的Bearer令牌(由
    moca-credential-verifier
    创建)
  • programId
    :已验证的项目ID
  • userId
    :可通过
    .air-wallet-config.json
    或CLI参数获取
Agent还必须能访问自身的P-256私钥。 若缺少
partnerId
,脚本会默认使用以下预发环境partner ID。

Staging Defaults

预发环境默认值

json
{
  "airApiUrl": "https://air.api.staging.air3.com/v2",
  "mocaChainApiUrl": "https://api.staging.mocachain.org/v1",
  "vpApiUrl": "https://vp.api.staging.moca.network/v1",
  "mocaProofApiUrl": "https://proof.api.staging.moca.network/v1",
  "partnerId": "7e9becac-db0d-4d52-980e-984bb70c4d30"
}
These are hardcoded as defaults in the scripts. Override via CLI flags, environment variables, or
.air-wallet-config.json
.
json
{
  "airApiUrl": "https://air.api.staging.air3.com/v2",
  "mocaChainApiUrl": "https://api.staging.mocachain.org/v1",
  "vpApiUrl": "https://vp.api.staging.moca.network/v1",
  "mocaProofApiUrl": "https://proof.api.staging.moca.network/v1",
  "partnerId": "7e9becac-db0d-4d52-980e-984bb70c4d30"
}
这些值已硬编码为脚本的默认值。可通过CLI参数、环境变量或
.air-wallet-config.json
覆盖。

Config Resolution Order

配置解析顺序

All provided scripts resolve configuration in this order:
  1. CLI flags
  2. Environment variables
  3. .air-wallet-config.json
  4. Hardcoded staging defaults
所有提供的脚本按以下顺序解析配置:
  1. CLI参数
  2. 环境变量
  3. .air-wallet-config.json
  4. 硬编码的预发环境默认值

Program Completion Flow

项目完成流程

Step 1: Complete Program with Checksum

步骤1:带校验和的项目完成

bash
node scripts/moca-complete-program.mjs --access-token <token> --program-id <programId>
Calls
POST {mocaProofApiUrl}/mocaproof/complete
with:
  • programId
  • txHash
  • zkp
  • checksum
Checksum logic:
text
input = userId + "." + programId + "." + txHash.toLowerCase() + "." + SALT_KEY
checksum = base64(md5(input) as hex-string bytes)
bash
node scripts/moca-complete-program.mjs --access-token <token> --program-id <programId>
调用
POST {mocaProofApiUrl}/mocaproof/complete
,参数包括:
  • programId
  • txHash
  • zkp
  • checksum
校验和逻辑:
text
input = userId + "." + programId + "." + txHash.toLowerCase() + "." + SALT_KEY
checksum = base64(md5(input) as hex-string bytes)

Step 2: Fetch MoCat Status

步骤2:获取MoCat状态

bash
node scripts/moca-get-mocat.mjs --access-token <token>
Calls
GET {mocaProofApiUrl}/mocaproof/mocat
with Bearer token to display cat progression.
bash
node scripts/moca-get-mocat.mjs --access-token <token>
携带Bearer令牌调用
GET {mocaProofApiUrl}/mocaproof/mocat
,以显示猫咪进度。

Terminal Messaging

终端消息

  • After completion succeeds, print the cat progression summary from
    /mocaproof/mocat
  • Display current stage, verifications completed, next stage threshold, rarity, and category breakdown
  • 完成成功后,打印
    /mocaproof/mocat
    返回的猫咪进度摘要
  • 显示当前阶段、已完成的验证数、下一阶段阈值、稀有度和分类明细

Non-Negotiable Rules

不可违反的规则

  • Use Bearer
    accessToken
    from the scoped session for all API calls
  • Never modify files inside this installed skill bundle
  • If a custom script is truly required, create it outside the skill directory
  • 所有API调用必须使用范围会话的Bearer
    accessToken
  • 绝不能修改已安装技能包内的文件
  • 若确实需要自定义脚本,请在技能目录外创建

Failure Handling

故障处理

  • Missing
    accessToken
    : stop and instruct the agent to create a scoped session via
    moca-credential-verifier
    first.
  • Checksum mismatch: verify that
    userId
    ,
    programId
    , and
    txHash
    are correct and retry.
  • unknown_response
    : print the full raw response; do not retry automatically.
  • 缺少
    accessToken
    :停止操作,并指示Agent先通过
    moca-credential-verifier
    创建范围会话。
  • 校验和不匹配:验证
    userId
    programId
    txHash
    是否正确,然后重试。
  • unknown_response
    :打印完整的原始响应;请勿自动重试。