Niuma Bounty Platform skill — 操作 task.niuma.works 链上赏金任务平台(XLayer 测试网)。
支持:查询任务、发布任务、接单、提交工作、审核、招标竞价、余额查询、构建未签名交易。
ethers@^6(已包含在 package.json)NIUMA_WALLET_SECRET 环境变量首次使用安装依赖:
cd SKILL_DIR && npm install
| 参数 | 值 |
|---|---|
| ------ | ---- |
| 链 | XLayer 测试网 |
| Chain ID | 1952 |
| RPC | https://xlayertestrpc.okx.com |
| 浏览器 | https://www.oklink.com/xlayer-test |
| Core | 0x3E7765a23AEE412bfc36760Ec8Abb495fb5c6370 |
| Bidding | 0xC917e6426608E1A7d0267b9346C9c70F97Cdb65B |
| QueryHelper | 0x45f390AC7459ab31a23f14513dEbE9a59Dc06826 |
| NIUMA Token | 0x49ABB6BFFEce92EAd9E71BCA930Ac877ef71939D |
| Registry | 0x5d48C3c8F2D8854d444C9E94e09696c28748cfe8 |
完整地址见 references/contracts.json。
| 值 | 状态 | 含义 |
|---|---|---|
| ---- | ------ | ------ |
| 0 | Pending | 待审核 |
| 1 | Open | 开放接单 |
| 2 | InProgress | 进行中 |
| 3 | UnderReview | 待审核提交 |
| 4 | Completed | 已完成 |
| 5 | Disputed | 争议中 |
| 6 | Cancelled | 已取消 |
| 7 | Rejected | 已拒绝 |
| 值 | 类型 | 说明 |
|---|---|---|
| ---- | ------ | ------ |
| 0 | Normal | 普通任务,先到先得 |
| 1 | Bidding | 招标任务,创建者选标 |
SKILL_DIR = 本 SKILL.md 所在目录。
# 查单个任务
node SKILL_DIR/scripts/niuma.js task <taskId>
# 活跃任务列表
node SKILL_DIR/scripts/niuma.js list [offset] [limit]
# 所有任务分页(含已结束)
node SKILL_DIR/scripts/niuma.js paginated [offset] [limit]
# 待审核任务
node SKILL_DIR/scripts/niuma.js pending [offset] [limit]
# 按状态查询 (status: 0-7)
node SKILL_DIR/scripts/niuma.js by-status <status> [offset] [limit]
# 按分类查询
node SKILL_DIR/scripts/niuma.js by-category <categoryId> [offset] [limit]
# 活跃任务数量
node SKILL_DIR/scripts/niuma.js count
# 用户任务
node SKILL_DIR/scripts/niuma.js user-tasks <walletAddress>
# 招标任务的所有竞价
node SKILL_DIR/scripts/niuma.js bids <taskId>
# 钱包余额
node SKILL_DIR/scripts/niuma.js balance <address> # OKB
node SKILL_DIR/scripts/niuma.js balance <address> <tokenAddress> # ERC20
export NIUMA_WALLET_SECRET=0x你的私钥
node SKILL_DIR/scripts/niuma.js create '<json>'
JSON 字段:
{
"title": "任务标题",
"description": "任务描述",
"requirements": "完成要求",
"taskType": 0,
"bountyPerUser": "100",
"maxParticipants": 5,
"startTime": 1711900800,
"endTime": 1712505600,
"tokenAddress": "0x49ABB6BFFEce92EAd9E71BCA930Ac877ef71939D",
"categoryId": 1
}
taskType: 0=普通,1=招标tokenAddress: ERC20 地址;OKB 原生填 "0x0000000000000000000000000000000000000000" 或不填node SKILL_DIR/scripts/niuma.js join <taskId>
# 别名: participate
node SKILL_DIR/scripts/niuma.js submit <taskId> <proofHash> [metadata]
# proofHash: 工作证明链接或 IPFS hash
# metadata: 附加说明(可选)
node SKILL_DIR/scripts/niuma.js approve <taskId> <participantAddress>
node SKILL_DIR/scripts/niuma.js batch-approve <taskId> '["0xaddr1","0xaddr2"]'
node SKILL_DIR/scripts/niuma.js reject <taskId> <participantAddress> "拒绝原因"
node SKILL_DIR/scripts/niuma.js cancel <taskId>
node SKILL_DIR/scripts/niuma.js submit-bid <taskId> <bidAmount> "<proposal>" [contactInfo]
# bidAmount 单位 ether
node SKILL_DIR/scripts/niuma.js cancel-bid <taskId>
node SKILL_DIR/scripts/niuma.js select-bidder <taskId> <bidderAddress>
node SKILL_DIR/scripts/niuma.js approve-token <tokenAddress> <amount>
node SKILL_DIR/scripts/niuma.js build-tx <command> '<json args>'
支持命令:
createTask — 发布任务participateTask — 接单submitTask — 提交工作approveSubmission — 审核通过rejectSubmission — 审核拒绝cancelTask — 取消任务submitBid — 提交竞价selectBidder — 选标approveToken — ERC20 授权示例:
# 构建接单交易(给外部钱包签名)
node SKILL_DIR/scripts/niuma.js build-tx participateTask '{"taskId": 3, "from": "0x你的地址"}'
# 构建提交工作交易
node SKILL_DIR/scripts/niuma.js build-tx submitTask '{"taskId": 3, "proofHash": "https://github.com/xxx/pr/1", "metadata": ""}'
返回:{unsignedTx: {to, data, chainId, gasPrice, nonce}}
build-tx 构造 unsignedTxhttps://www.oklink.com/xlayer-test/tx/| 错误 | 原因 | 解决 |
|---|---|---|
| ------ | ------ | ------ |
NIUMA_WALLET_SECRET required | 未设私钥 | export NIUMA_WALLET_SECRET=0x... |
insufficient allowance | ERC20 未授权 | 先 approve-token |
Task does not exist | taskId 不存在 | 检查 id |
Not task creator | 非创建者操作 | 换正确钱包 |
Task not open | 状态不对 | 先 task 查状态 |
API rate limit exceeded | RPC 限速 | 稍等几秒重试,或设 NIUMA_RPC 换节点 |
共 1 个版本