create-grant

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create Grant

创建资助

Add a grant (funding record) to an existing project. This creates two on-chain attestations: Grant + GrantDetails.
See Agent API Reference for auth, base URL, and error handling.
为现有项目添加一笔资助(资金记录)。该操作会生成两份链上证明:Grant + GrantDetails。
身份验证、基础URL和错误处理相关内容请查看 Agent API 参考

Prerequisite

前置要求

If
KARMA_API_KEY
is not set in the environment, invoke the
/setup-agent
skill first, then continue with this skill.
如果环境中未设置
KARMA_API_KEY
,请先调用
/setup-agent
技能,再使用本技能。

Required Information

所需信息

FieldRequiredDescription
chainId
YesChain where the project lives
projectUID
YesThe project's attestation UID
communityUID
YesThe community/program UID (bytes32) that funded the project
title
YesGrant title (1-200 chars)
description
NoGrant description (max 5000 chars)
amount
NoFunding amount as string (e.g., "50000")
proposalURL
NoLink to the grant proposal
programId
NoProgram identifier (see below)
字段必填描述
chainId
项目所在的链
projectUID
项目的证明UID
communityUID
为项目提供资助的社区/项目UID(bytes32格式)
title
资助标题(1-200个字符)
description
资助描述(最多5000个字符)
amount
资助金额,字符串格式(例如:"50000")
proposalURL
资助提案的链接
programId
项目标识符(见下文)

Finding the programId

查找programId

If the user provides a program/track name but not a
programId
, look it up:
bash
undefined
如果用户提供了项目/赛道名称但未提供
programId
,请按如下方式查询:
bash
undefined

Accepts community slug (e.g., "optimism") or UID (0x...)

Accepts community slug (e.g., "optimism") or UID (0x...)

curl -s "${BASE_URL}/communities/${COMMUNITY_SLUG_OR_UID}/programs" | python3 -c " import sys, json data = json.load(sys.stdin) programs = data if isinstance(data, list) else data.get('payload', data.get('data', [])) for p in programs: print(f'Name: {p.get("metadata", {}).get("title", "N/A")} | ID: {p["programId"]}') "

Use the matching `programId` value in the request params.
curl -s "${BASE_URL}/communities/${COMMUNITY_SLUG_OR_UID}/programs" | python3 -c " import sys, json data = json.load(sys.stdin) programs = data if isinstance(data, list) else data.get('payload', data.get('data', [])) for p in programs: print(f'Name: {p.get("metadata", {}).get("title", "N/A")} | ID: {p["programId"]}') "

使用请求参数中匹配的`programId`值。

Finding UIDs

查找UIDs

Project UID — search by name:
bash
curl -s "${BASE_URL}/v2/projects?q=PROJECT_NAME&limit=5&page=1" | python3 -c "
import sys, json
data = json.load(sys.stdin)
for p in data.get('payload', []):
    d = p.get('details', {})
    print(f'Title: {d.get(\"title\", \"N/A\")} | Chain: {p[\"chainID\"]} | UID: {p[\"uid\"]}')
"
Community UID — browse communities or get by slug:
bash
curl -s "${BASE_URL}/v2/communities/?limit=10&page=1" | python3 -c "
import sys, json
data = json.load(sys.stdin)
for c in data if isinstance(data, list) else data.get('payload', data.get('data', [])):
    d = c.get('details', {})
    name = d.get('name', 'N/A') if isinstance(d, dict) else 'N/A'
    print(f'Name: {name} | Chain: {c.get(\"chainID\", \"?\")} | UID: {c[\"uid\"]}')
"
项目UID — 按名称搜索:
bash
curl -s "${BASE_URL}/v2/projects?q=PROJECT_NAME&limit=5&page=1" | python3 -c "
import sys, json
data = json.load(sys.stdin)
for p in data.get('payload', []):
    d = p.get('details', {})
    print(f'Title: {d.get(\"title\", \"N/A\")} | Chain: {p[\"chainID\"]} | UID: {p[\"uid\"]}')
"
社区UID — 浏览社区或通过slug获取:
bash
curl -s "${BASE_URL}/v2/communities/?limit=10&page=1" | python3 -c "
import sys, json
data = json.load(sys.stdin)
for c in data if isinstance(data, list) else data.get('payload', data.get('data', [])):
    d = c.get('details', {})
    name = d.get('name', 'N/A') if isinstance(d, dict) else 'N/A'
    print(f'Name: {name} | Chain: {c.get(\"chainID\", \"?\")} | UID: {c[\"uid\"]}')
"

Natural Language Mapping

自然语言映射

User saysAction
"add a grant from the Offchain Super Chain program to project X"Look up project UID, community UID, and programId from programs list
"add a grant to project X"Look up project UID, ask for community and grant details
"project X received $50K from Optimism"Look up project + community UIDs, ask if it's a specific program or generic grant
"add funding from program Y to project X"Look up community UID + programId for program Y, then create grant
"create a grant for 0xabc... from 0xdef..."Use UIDs directly
Important: When the user mentions a specific program name, always look up the
programId
via the programs API and include it. Without
programId
, the grant won't appear under that program on the website.
用户表述执行操作
"给项目X添加来自Offchain Super Chain项目的资助"从项目列表中查询项目UID、社区UID以及programId
"给项目X添加一笔资助"查询项目UID,向用户询问社区和资助详情
"项目X从Optimism获得了5万美元资助"查询项目和社区UID,询问用户该资助属于特定项目还是通用资助
"给项目X添加来自Y项目的资金"查询Y项目的社区UID和programId,然后创建资助
"为0xabc...创建一笔来自0xdef...的资助"直接使用提供的UID
重要提示:当用户提及具体的项目名称时,务必通过项目API查询
programId
并将其包含在内。缺少
programId
的资助不会在网站的对应项目下展示。

Making the Request

发起请求

bash
BASE_URL="${KARMA_API_URL:-https://gapapi.karmahq.xyz}"

curl -s -X POST "${BASE_URL}/v2/agent/execute" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ${KARMA_API_KEY}" \
  -d '{
    "action": "createGrant",
    "params": {
      "chainId": 10,
      "projectUID": "0xproject...",
      "communityUID": "0xcommunity...",
      "title": "Optimism Builder Grant",
      "description": "Funding for protocol development",
      "amount": "50000",
      "proposalURL": "https://gov.optimism.io/proposal/123"
    }
  }'
bash
BASE_URL="${KARMA_API_URL:-https://gapapi.karmahq.xyz}"

curl -s -X POST "${BASE_URL}/v2/agent/execute" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ${KARMA_API_KEY}" \
  -d '{
    "action": "createGrant",
    "params": {
      "chainId": 10,
      "projectUID": "0xproject...",
      "communityUID": "0xcommunity...",
      "title": "Optimism Builder Grant",
      "description": "Funding for protocol development",
      "amount": "50000",
      "proposalURL": "https://gov.optimism.io/proposal/123"
    }
  }'

After Success

成功后操作

Display the result using the standard output format. The grant will be automatically indexed by the system.
使用标准输出格式展示结果。系统会自动索引该资助记录。

Edge Cases

边缘情况

ScenarioResponse
Project or community name given instead of UIDLook up UIDs via the APIs
Community not found"Could not find that community/program. Provide the community UID directly."
Amount with currency symbolStrip the symbol and convert (e.g., "$50K" → "50000")
Missing community UIDThis is required — ask the user which program/community funded the project
场景响应内容
提供了项目或社区名称而非UID通过API查询对应的UID
未找到对应社区"无法找到该社区/项目。请直接提供社区UID。"
金额带有货币符号去除符号并转换格式(例如:"$50K" → "50000")
缺少社区UID该字段为必填项 — 询问用户是哪个项目/社区为该项目提供了资助