haedal-vehaedal
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHaedal VeHaedal
Haedal VeHaedal
Haedal Protocol is a DeFi ecosystem on the SUI blockchain. VeHaedal is its vote-escrowed governance token: lock HAEDAL for veHaedal to earn rewards and voting power; lock duration and optional decay affect reward rates. This skill calls the Haedal Skills API for add stake, extend lock, claim rewards, decay control, and unstake — no custom scripts required.
Call the VeHaedal HTTP APIs directly with curl.
All numeric parameters are human‑readable amounts: pass and similar quantity fields as human‑readable values, without multiplying by decimals. For example, to stake 20 tokens, simply send .
amount"amount":"20"Haedal Protocol是SUI区块链上的一个DeFi生态系统。VeHaedal是其锁仓治理代币:锁定HAEDAL以获取VeHaedal,从而赚取奖励和投票权;锁仓时长及可选的衰减机制会影响奖励率。本技能调用Haedal Skills API来完成质押、延长锁仓、领取奖励、衰减控制和解锁操作——无需自定义脚本。
直接通过curl调用VeHaedal HTTP接口。
所有数值参数均为人类可读金额:传递及类似数量字段时使用人类可读数值,无需乘以小数位数。例如,要质押20个代币,只需传入。
amount"amount":"20"Querying veHaedal objects (get_vehaedal_list)
查询VeHaedal对象(get_vehaedal_list)
Several methods (add_to_existing_stake, extend_existing_lock, start_decay, stop_decay, unstake_and_claim) require a — the object ID of an existing veHaedal position. When the user triggers one of these methods:
vehaedalObj- Ask the user whether they already have the veHaedal object ID. If yes, use it directly.
- If discovery is needed: call get_vehaedal_list with the user's . On HTTP 200 the response body is:
addressjson{ "list": [ { "objectId": "0x...", "fields": { "current_amount": "10000000000", "initial_amount": "10000000000", "is_decaying": true, "lock_end_time": "1803708378450", "lock_start_time": "1772258778450", "locked_amount": "10000000000", "original_lock_weeks": "52", "owner": "0x...", "remaining_lock_weeks_when_stopped_decay": "52", "token_type": { "fields": { "name": "...::haedal::HAEDAL" }, "type": "0x1::type_name::TypeName" } } } ] } - Present the list to the user in a readable format — show key fields such as ,
objectId,current_amount,locked_amount,is_decaying,original_lock_weeksfor each entry.lock_end_time - Let the user choose which veHaedal object to operate on (or take the first entry if only one exists). Use the selected as the
objectIdparameter for the subsequent call.vehaedalObj
Flow summary: user triggers a method that requires → ask if they have the object ID → if not, call get_vehaedal_list(address) → present the list → user selects one → take that as → call the target method.
vehaedalObjobjectIdvehaedalObj部分方法(add_to_existing_stake、extend_existing_lock、start_decay、stop_decay、unstake_and_claim)需要****——即现有VeHaedal持仓的对象ID。当用户触发这些方法时:
vehaedalObj- 询问用户是否已拥有VeHaedal对象ID。如果是,直接使用该ID。
- 若需要查询:调用get_vehaedal_list接口并传入用户的。HTTP 200响应的内容如下:
addressjson{ "list": [ { "objectId": "0x...", "fields": { "current_amount": "10000000000", "initial_amount": "10000000000", "is_decaying": true, "lock_end_time": "1803708378450", "lock_start_time": "1772258778450", "locked_amount": "10000000000", "original_lock_weeks": "52", "owner": "0x...", "remaining_lock_weeks_when_stopped_decay": "52", "token_type": { "fields": { "name": "...::haedal::HAEDAL" }, "type": "0x1::type_name::TypeName" } } } ] } - 以可读格式向用户展示列表——为每个条目显示关键字段,如、
objectId、current_amount、locked_amount、is_decaying、original_lock_weeks。lock_end_time - 让用户选择要操作的VeHaedal对象(如果只有一个条目则直接使用该条目)。将选中的作为后续调用的
objectId参数。vehaedalObj
流程总结:用户触发需要的方法 → 询问用户是否拥有对象ID → 若没有,调用get_vehaedal_list(address) → 展示列表 → 用户选择 → 将选中的作为 → 调用目标方法。
vehaedalObjobjectIdvehaedalObjBase URL
基础URL
https://skillsapi.haedal.xyz/api/v1/vehaedalhttps://skillsapi.haedal.xyz/api/v1/vehaedalRequest body
请求体
| Method | Required fields | Notes |
|---|---|---|
| add_stake | signerAddress, amount, lockWeeks, isDecaying | Creates a new veHaedal position |
| get_vehaedal_list | address | Query veHaedal objects owned by this address; returns |
| add_to_existing_stake | signerAddress, vehaedalObj, amount | Requires an existing veHaedal object ID |
| extend_existing_lock | signerAddress, vehaedalObj, additionalWeeks | Requires an existing veHaedal object ID |
| start_decay | signerAddress, vehaedalObj | Requires an existing veHaedal object ID |
| stop_decay | signerAddress, vehaedalObj | Requires an existing veHaedal object ID |
| unstake_and_claim | signerAddress, vehaedalObj | Requires an existing veHaedal object ID |
| claim_rewards_v2 | signerAddress, periods | No object field needed |
| claim_rewards_v2_epoch_1 | signerAddress | No object field needed |
| 方法名称 | 必填字段 | 说明 |
|---|---|---|
| add_stake | signerAddress, amount, lockWeeks, isDecaying | 创建新的VeHaedal持仓 |
| get_vehaedal_list | address | 查询该地址名下的VeHaedal对象;返回对象列表 |
| add_to_existing_stake | signerAddress, vehaedalObj, amount | 需要现有VeHaedal对象ID |
| extend_existing_lock | signerAddress, vehaedalObj, additionalWeeks | 需要现有VeHaedal对象ID |
| start_decay | signerAddress, vehaedalObj | 需要现有VeHaedal对象ID |
| stop_decay | signerAddress, vehaedalObj | 需要现有VeHaedal对象ID |
| unstake_and_claim | signerAddress, vehaedalObj | 需要现有VeHaedal对象ID |
| claim_rewards_v2 | signerAddress, periods | 无需对象字段 |
| claim_rewards_v2_epoch_1 | signerAddress | 无需对象字段 |
curl examples
curl示例
add_stake
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/add_stake" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","amount":"20","lockWeeks":4,"isDecaying":false}'get_vehaedal_list (query veHaedal objects owned by an address, used to obtain vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/get_vehaedal_list" \
-H "Content-Type: application/json" \
-d '{"address":"0xYOUR_ADDRESS"}'add_to_existing_stake (requires vehaedalObj, obtainable from get_vehaedal_list → list[].objectId)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/add_to_existing_stake" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID","amount":"10"}'extend_existing_lock (requires vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/extend_existing_lock" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID","additionalWeeks":2}'start_decay (requires vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/start_decay" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID"}'stop_decay (requires vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/stop_decay" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID"}'unstake_and_claim (requires vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/unstake_and_claim" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID"}'claim_rewards_v2
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/claim_rewards_v2" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","periods":["1","2"]}'claim_rewards_v2_epoch_1
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/claim_rewards_v2_epoch_1" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS"}'add_stake
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/add_stake" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","amount":"20","lockWeeks":4,"isDecaying":false}'get_vehaedal_list(查询地址名下的VeHaedal对象,用于获取vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/get_vehaedal_list" \
-H "Content-Type: application/json" \
-d '{"address":"0xYOUR_ADDRESS"}'add_to_existing_stake(需要vehaedalObj,可从get_vehaedal_list → list[].objectId获取)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/add_to_existing_stake" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID","amount":"10"}'extend_existing_lock(需要vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/extend_existing_lock" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID","additionalWeeks":2}'start_decay(需要vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/start_decay" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID"}'stop_decay(需要vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/stop_decay" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID"}'unstake_and_claim(需要vehaedalObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/unstake_and_claim" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","vehaedalObj":"0xOBJECT_ID"}'claim_rewards_v2
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/claim_rewards_v2" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS","periods":["1","2"]}'claim_rewards_v2_epoch_1
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/vehaedal/claim_rewards_v2_epoch_1" \
-H "Content-Type: application/json" \
-d '{"signerAddress":"0xYOUR_ADDRESS"}'Response
响应
- add_stake / add_to_existing_stake / extend_existing_lock / start_decay / stop_decay / unstake_and_claim / claim_rewards_v2 / claim_rewards_v2_epoch_1: on HTTP 200, the body is ; use
{"txBytes":"<base64>"}to extract it. On non‑200, usejq -r '.txBytes'to extract the error reason and return it to the user.jq -r '.msg' - get_vehaedal_list: on HTTP 200, the body is . Use
{"list":[{"objectId":"...","fields":{...}}, ...]}to obtain the list, then take the desired entry'sjq -r '.list'as theobjectIdfor subsequent calls.vehaedalObj
- add_stake / add_to_existing_stake / extend_existing_lock / start_decay / stop_decay / unstake_and_claim / claim_rewards_v2 / claim_rewards_v2_epoch_1:HTTP 200响应的内容为;可使用
{"txBytes":"<base64>"}提取该值。非200响应时,使用jq -r '.txBytes'提取错误原因并返回给用户。jq -r '.msg' - get_vehaedal_list:HTTP 200响应的内容为。可使用
{"list":[{"objectId":"...","fields":{...}}, ...]}获取列表,然后选取所需条目的jq -r '.list'作为后续调用的objectId。vehaedalObj
MoveAbort error codes
MoveAbort错误码
When a dry-run or build call fails with , use the following mapping:
MoveAbort(..., <code>)| Code | Constant Name | Description |
|---|---|---|
| 0 | | |
| 1 | | Invalid lock duration, must be between 1 and 52 weeks |
| 2 | | Caller is not the owner of the veHAEDAL token |
| 3 | | No tokens available to unstake ( |
| 4 | | Invalid amount, must be greater than 0 |
| 5 | | Lock period has not expired yet |
| 6 | | Lock period should be expired |
| 7 | | Stake amount is below the minimum required |
| 8 | | Pool version does not match the current program version |
| 9 | | Lock period has already expired |
当预执行或构建调用失败并返回时,可使用以下映射关系:
MoveAbort(..., <code>)| 错误码 | 常量名称 | 说明 |
|---|---|---|
| 0 | | |
| 1 | | 锁仓时长无效,必须在1至52周之间 |
| 2 | | 调用者不是VeHAEDAL代币的持有者 |
| 3 | | 无可用代币可解锁(已解锁金额为0) |
| 4 | | 金额无效,必须大于0 |
| 5 | | 锁仓期尚未结束 |
| 6 | | 锁仓期应已结束 |
| 7 | | 质押金额低于最低要求 |
| 8 | | 资金池版本与当前程序版本不匹配 |
| 9 | | 锁仓期已结束 |