haedal-hawal

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Haedal haWAL

Haedal haWAL

Haedal Protocol is a DeFi ecosystem on the SUI blockchain. haWAL is its liquid staking token (LST) for WAL: stake WAL to receive haWAL, earn staking rewards, and optionally choose validators. This skill calls the Haedal Skills API to perform stake, withdraw, instant withdraw, and claim operations via curl — no custom scripts required.
Call the haWAL HTTP APIs directly with curl.
All numeric parameters are human‑readable amounts: pass
amount
and similar quantity fields as human‑readable values, without multiplying by decimals. For example, to stake 20 tokens, simply send
"amount":"20"
.
Haedal ProtocolSUI区块链上的DeFi生态系统。haWAL是其针对WAL的流动性质押代币(LST):质押WAL即可获得haWAL,赚取质押奖励,还可选择验证节点。本技能通过curl调用Haedal Skills API来执行质押、提取、即时提取和领取奖励操作——无需自定义脚本。
直接使用curl调用haWAL HTTP接口。
所有数值参数均为人类可读金额:将
amount
及类似数量字段以人类可读值传入,无需乘以小数位数。例如,要质押20个代币,只需传入
"amount":"20"

Validator when staking

质押时的验证节点设置

Only the stake method requires a
validator
(validator node
node_id
):
  • Passing
    0x0
    means "use the default validator".
  • If the user does not provide a validator: show a reference list of validators and let the user choose. The user can respond with index 1–10 or the validator name. Map this to the corresponding
    node_id
    from the table and include it in the request.
  • The reference list is defined in
    references/validators.md
    (mapping between name and node_id, indexed 1–10).
Typical flow: the user says "stake hawal" without specifying a validator → present 10 reference validators (index + name) → the user replies with "1" or "Nansen", etc. → use the corresponding
node_id
to call stake.
只有stake方法需要传入
validator
(验证节点的
node_id
):
  • 传入**
    0x0
    **表示“使用默认验证节点”。
  • 如果用户未提供验证节点:展示验证节点参考列表供用户选择。用户可回复1-10的索引验证节点名称。将其与表格中对应的
    node_id
    映射后加入请求。
  • 参考列表定义在
    references/validators.md
    中(名称与node_id的映射,索引1-10)。
典型流程:用户说“stake hawal”但未指定验证节点 → 展示10个参考验证节点(索引+名称) → 用户回复“1”或“Nansen”等 → 使用对应的
node_id
调用质押接口。

Claiming rewards and NFTObj

领取奖励与NFTObj

The claim endpoint requires address and NFTObj (the NFT object ID that holds the rewards). When the user says "claim hawal rewards":
  1. Ask the user whether they want help finding the object id (if the user already knows the NFTObj, you can send it directly).
  2. If discovery is needed: call get_unstake_tickets_list with the user
    address
    . On HTTP 200 the response body is:
    json
    {
      "list": [
        {
          "objectId": "0x...",
          "type": "0x...::walstaking::UnstakeTicket",
          "version": "...",
          "fields": {
            "claim_epoch": 27,
            "claim_timestamp_ms": "1774364404744",
            "hawal_amount": "700000000000",
            "id": { "id": "0x..." },
            "unstake_timestamp_ms": "1772871784320",
            "wal_amount": "700635659164"
          }
        }
      ]
    }
  3. Present the list to the user in a readable format — show key fields such as
    objectId
    ,
    hawal_amount
    ,
    wal_amount
    ,
    claim_epoch
    ,
    claim_timestamp_ms
    for each entry.
  4. If there are multiple entries in the list: let the user choose which one to claim (or take the first entry if only one exists) and use that entry's
    objectId
    as NFTObj.
  5. Then call claim:
    POST /api/v1/hawal/claim
    with body
    {"address":"0x...","NFTObj":"<objectId from previous step>"}
    .
Flow summary: the user says "claim hawal rewards" → ask whether to discover the object id → if yes, call get_unstake_tickets_list(address) → present the list with key details → user selects one → take the chosen
objectId
as NFTObj → call claim(address, NFTObj).
claim接口需要addressNFTObj(存储奖励的NFT对象ID)。当用户说“claim hawal rewards”时:
  1. 询问用户是否需要帮助查找对象ID(如果用户已知NFTObj,可直接传入)。
  2. 若需要查找:调用get_unstake_tickets_list接口并传入用户
    address
    。HTTP 200响应体如下:
    json
    {
      "list": [
        {
          "objectId": "0x...",
          "type": "0x...::walstaking::UnstakeTicket",
          "version": "...",
          "fields": {
            "claim_epoch": 27,
            "claim_timestamp_ms": "1774364404744",
            "hawal_amount": "700000000000",
            "id": { "id": "0x..." },
            "unstake_timestamp_ms": "1772871784320",
            "wal_amount": "700635659164"
          }
        }
      ]
    }
  3. 以可读格式向用户展示列表——显示每个条目的关键字段,如
    objectId
    hawal_amount
    wal_amount
    claim_epoch
    claim_timestamp_ms
  4. 若列表中有多个条目:让用户选择要领取的条目(若只有一个条目则直接使用),并将该条目的
    objectId
    作为NFTObj。
  5. 然后调用claim接口
    POST /api/v1/hawal/claim
    ,请求体为
    {"address":"0x...","NFTObj":"<上一步获取的objectId>"}
流程总结:用户说“claim hawal rewards” → 询问是否需要查找对象ID → 若是则调用get_unstake_tickets_list(address) → 展示带关键信息的列表 → 用户选择条目 → 取选中条目的
objectId
作为NFTObj → 调用claim(address, NFTObj)。

Base URL

基础URL

https://skillsapi.haedal.xyz/api/v1/hawal
https://skillsapi.haedal.xyz/api/v1/hawal

Request body

请求体

MethodRequired fieldsNotes
stakeaddress, amount, validatorNo object field
withdrawaddress, amountNo object field
withdraw_instantaddress, amountNo object field
claimaddress, NFTObjRequires NFT object ID, see the "Claiming rewards" flow above
get_unstake_tickets_listaddressQuery the UnstakeTicket list for this address to obtain NFTObj
方法必填字段说明
stakeaddress, amount, validator无object字段
withdrawaddress, amount无object字段
withdraw_instantaddress, amount无object字段
claimaddress, NFTObj需要NFT对象ID,详见上方“领取奖励”流程
get_unstake_tickets_listaddress查询该地址的UnstakeTicket列表以获取NFTObj

curl examples

curl示例

stake
Pass
validator
as
0x0
to use the default validator, or use a node_id from
references/validators.md
(user can choose by index 1–10 or by name).
bash
undefined
质押
传入
validator
0x0
即可使用默认验证节点,也可使用
references/validators.md
中的node_id(用户可通过1-10的索引或名称选择)。
bash
undefined

Use the default validator

使用默认验证节点

curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/stake"
-H "Content-Type: application/json"
-d '{"address":"0xYOUR_ADDRESS","amount":"100","validator":"0x0"}'
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/stake"
-H "Content-Type: application/json"
-d '{"address":"0xYOUR_ADDRESS","amount":"100","validator":"0x0"}'

Or specify an explicit validator node_id (for example Nansen)

或指定明确的验证节点node_id(例如Nansen)

curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/stake"
-H "Content-Type: application/json"
-d '{"address":"0xYOUR_ADDRESS","amount":"100","validator":"0x7b3ba6de2ae58283f60d5b8dc04bb9e90e4796b3b2e0dea75569f491275242e7"}'

**withdraw**

```bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/withdraw" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS","amount":"100"}'
withdraw_instant
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/withdraw_instant" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS","amount":"100"}'
get_unstake_tickets_list (query the UnstakeTicket list that can be claimed, used to obtain NFTObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/get_unstake_tickets_list" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS"}'
When the response status is 200, the body contains
{"list":[{"objectId":"...","type":"...","version":"...","fields":{...}}, ...]}
. Present key fields (
objectId
,
hawal_amount
,
wal_amount
,
claim_epoch
,
claim_timestamp_ms
) to the user, then use the selected
list[].objectId
as the NFTObj for the claim call.
claim (requires NFTObj, which can be obtained from get_unstake_tickets_list → list[].objectId)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/claim" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS","NFTObj":"0xOBJECT_ID_FROM_LIST"}'
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/stake"
-H "Content-Type: application/json"
-d '{"address":"0xYOUR_ADDRESS","amount":"100","validator":"0x7b3ba6de2ae58283f60d5b8dc04bb9e90e4796b3b2e0dea75569f491275242e7"}'

**提取**

```bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/withdraw" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS","amount":"100"}'
即时提取
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/withdraw_instant" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS","amount":"100"}'
get_unstake_tickets_list(查询可领取的UnstakeTicket列表,用于获取NFTObj)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/get_unstake_tickets_list" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS"}'
响应状态为200时,响应体包含
{"list":[{"objectId":"...","type":"...","version":"...","fields":{...}}, ...]}
;使用
jq -r '.list'
获取列表。每个条目的
fields
包含
hawal_amount
wal_amount
claim_epoch
claim_timestamp_ms
unstake_timestamp_ms
。将选中条目的
objectId
作为claim接口的NFTObj。
claim(需要NFTObj,可从get_unstake_tickets_list的list[].objectId获取)
bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hawal/claim" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS","NFTObj":"0xOBJECT_ID_FROM_LIST"}'

Response

响应

  • stake / withdraw / withdraw_instant / claim: on HTTP 200, the body is
    {"txBytes":"<base64>"}
    ; use
    jq -r '.txBytes'
    to extract it. On non‑200, use
    jq -r '.msg'
    to return the error reason to the user.
  • get_unstake_tickets_list: on HTTP 200, the body is
    {"list":[{"objectId","type","version","fields":{...}}, ...]}
    ; use
    jq -r '.list'
    to obtain the list. Each entry's
    fields
    contains
    hawal_amount
    ,
    wal_amount
    ,
    claim_epoch
    ,
    claim_timestamp_ms
    ,
    unstake_timestamp_ms
    . Take the desired entry's
    objectId
    as the NFTObj for claim.
  • stake / withdraw / withdraw_instant / claim:HTTP 200响应体为
    {"txBytes":"<base64>"}
    ;使用
    jq -r '.txBytes'
    提取。非200响应时,使用
    jq -r '.msg'
    将错误原因返回给用户。
  • get_unstake_tickets_list:HTTP 200响应体为
    {"list":[{"objectId","type","version","fields":{...}}, ...]}
    ;使用
    jq -r '.list'
    获取列表。每个条目的
    fields
    包含
    hawal_amount
    wal_amount
    claim_epoch
    claim_timestamp_ms
    unstake_timestamp_ms
    。将目标条目的
    objectId
    作为claim接口的NFTObj。

MoveAbort error codes

MoveAbort错误码

When a dry-run or build call fails with
MoveAbort(..., <code>)
, use the following mapping:
CodeConstant NameDescription
1
EDataNotMatchProgram
Data version does not match the current program version
2
EStakeNotEnoughWal
Stake amount is below the minimum staking threshold (1 WAL)
3
EStakeNoHaWalMint
Calculated haWAL mint amount is zero
4
EUnstakeNormalTicketLocking
Unstake ticket is still locked (claim epoch/time not reached)
5
EUnstakeExceedMaxWalAmount
Unstake WAL amount exceeds total available WAL
6
EUnstakeNotZeroHawal
Unstake input haWAL amount must not be zero
7
EStakePause
Staking is currently paused
8
EUnstakePause
Unstaking is currently paused
9
EUnstakeNeedAmountIsNotZero
Unstake process failed: remaining
need_amount
is not zero
10
EClaimPause
Claim is currently paused
11
EValidatorCountNotMatch
Provided validator count does not match existing validator count
12
EValidatorNotFound
Validator not found in the validator list
13
EStakeActiveValidatorsNotFound
No active validators found for staking
14
EUnstakeOutOfRange
Unstake timestamp is out of the valid epoch time range
15
EStakeActiveValidatorsIsNull
Active validators list is empty
16
EUnstakeExceedMinWalAmount
Unstake WAL amount is below the minimum staking threshold
当预执行或构建调用返回
MoveAbort(..., <code>)
时,使用以下映射关系:
错误码常量名称描述
1
EDataNotMatchProgram
数据版本与当前程序版本不匹配
2
EStakeNotEnoughWal
质押金额低于最低质押阈值(1 WAL)
3
EStakeNoHaWalMint
计算出的haWAL铸造量为零
4
EUnstakeNormalTicketLocking
提取票据仍处于锁定状态(未到领取周期/时间)
5
EUnstakeExceedMaxWalAmount
提取WAL金额超过可用WAL总额
6
EUnstakeNotZeroHawal
提取输入的haWAL金额不能为零
7
EStakePause
当前质押功能已暂停
8
EUnstakePause
当前提取功能已暂停
9
EUnstakeNeedAmountIsNotZero
提取流程失败:剩余
need_amount
不为零
10
EClaimPause
当前领取奖励功能已暂停
11
EValidatorCountNotMatch
提供的验证节点数量与现有验证节点数量不匹配
12
EValidatorNotFound
在验证节点列表中未找到指定节点
13
EStakeActiveValidatorsNotFound
未找到可用于质押的活跃验证节点
14
EUnstakeOutOfRange
提取时间戳超出有效周期时间范围
15
EStakeActiveValidatorsIsNull
活跃验证节点列表为空
16
EUnstakeExceedMinWalAmount
提取WAL金额低于最低提取阈值