haedal-hasui

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Haedal haSUI

Haedal haSUI

Haedal Protocol is a DeFi ecosystem on the SUI blockchain. haSUI is its liquid staking token (LST): stake native SUI to receive haSUI, 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 haSUI HTTP APIs directly with curl.
All numeric parameters are human‑readable amounts: pass
amount
and other quantity fields as human‑readable values, without multiplying by decimals. For example, to stake 20 tokens, simply send
"amount":"20"
.
Haedal ProtocolSUI区块链上的DeFi生态系统。haSUI是其流动性质押代币(LST):质押原生SUI即可获得haSUI,赚取质押奖励,还可选择验证节点。本技能调用Haedal Skills API,通过curl执行质押、提取、即时提取和领取奖励操作——无需自定义脚本。
直接使用curl调用haSUI 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–5 or the validator name. Map this to the corresponding
    node_id
    in 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–5).
Typical flow: the user says "stake hasui" without specifying a validator → present 5 reference validators (index + name) → the user replies with "1" or "Ankr", etc. → use the corresponding
node_id
to call stake.
stake方法需要传入
validator
(验证节点的
node_id
):
  • 传入**
    0x0
    **表示“使用默认验证节点”。
  • 如果用户未提供验证节点:展示验证节点参考列表供用户选择。用户可回复索引1-5验证节点名称。将其映射为表格中对应的
    node_id
    并包含在请求中。
  • 参考列表定义在
    references/validators.md
    中(名称与node_id的映射,索引1-5)。
典型流程:用户说“stake hasui”但未指定验证节点 → 展示5个参考验证节点(索引+名称)→ 用户回复“1”或“Ankr”等 → 使用对应的
node_id
调用stake接口。

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 hasui 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...::staking::UnstakeTicket",
          "version": "...",
          "fields": {
            "claim_epoch": "646",
            "claim_timestamp_ms": "1737135496590",
            "id": { "id": "0x..." },
            "st_amount": "1000000000",
            "sui_amount": "1045887315",
            "unstake_timestamp_ms": "1737085604741"
          }
        }
      ]
    }
  3. Present the list to the user in a readable format — show key fields such as
    objectId
    ,
    st_amount
    ,
    sui_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/hasui/claim
    with body
    {"address":"0x...","NFTObj":"<objectId from previous step>"}
    .
Flow summary: the user says "claim hasui 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 hasui rewards”时:
  1. 询问用户是否需要帮助查找对象ID(如果用户已知道NFTObj,可直接传入)。
  2. 如果需要查找:调用get_unstake_tickets_list接口并传入用户
    address
    。HTTP 200响应体如下:
    json
    {
      "list": [
        {
          "objectId": "0x...",
          "type": "0x...::staking::UnstakeTicket",
          "version": "...",
          "fields": {
            "claim_epoch": "646",
            "claim_timestamp_ms": "1737135496590",
            "id": { "id": "0x..." },
            "st_amount": "1000000000",
            "sui_amount": "1045887315",
            "unstake_timestamp_ms": "1737085604741"
          }
        }
      ]
    }
  3. 以可读格式向用户展示列表:显示每个条目的关键字段,如
    objectId
    st_amount
    sui_amount
    claim_epoch
    claim_timestamp_ms
  4. 如果列表中有多个条目:让用户选择要领取的条目(如果只有一个条目则直接使用该条目),并将该条目的
    objectId
    作为NFTObj。
  5. 然后调用claim接口:向
    POST /api/v1/hasui/claim
    传入参数
    {"address":"0x...","NFTObj":"<上一步获取的objectId>"}
流程总结:用户说“claim hasui rewards” → 询问是否需要查找对象ID → 如果需要,调用get_unstake_tickets_list(address) → 展示带关键信息的列表 → 用户选择条目 → 取选中条目的
objectId
作为NFTObj → 调用claim(address, NFTObj)。

Base URL

基础URL

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

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–5 or by name).
bash
undefined
质押(stake)
传入
validator
0x0
即可使用默认验证节点,或使用
references/validators.md
中的node_id(用户可通过索引1-5或名称选择)。
bash
undefined

Use the default validator

使用默认验证节点

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

Or specify an explicit validator node_id (for example Haedal Protocol)

或指定具体的验证节点node_id(例如Haedal Protocol)

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

**withdraw**

```bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hasui/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/hasui/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/hasui/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
,
st_amount
,
sui_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/hasui/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/hasui/stake"
-H "Content-Type: application/json"
-d '{"address":"0xYOUR_ADDRESS","amount":"100","validator":"0xc8a57a7ae3b814afc15a907d963a288454b2c0f1a323fd556cb2d56d85a94583"}'

**提取(withdraw)**

```bash
curl -s -w "\n%{http_code}" -X POST "https://skillsapi.haedal.xyz/api/v1/hasui/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/hasui/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/hasui/get_unstake_tickets_list" \
  -H "Content-Type: application/json" \
  -d '{"address":"0xYOUR_ADDRESS"}'
当响应状态为200时,响应体包含
{"list":[{"objectId":"...","type":"...","version":"...","fields":{...}}, ...]}
。将关键字段(
objectId
st_amount
sui_amount
claim_epoch
claim_timestamp_ms
)展示给用户,然后将选中条目的
list[].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/hasui/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
    st_amount
    ,
    sui_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
    包含
    st_amount
    sui_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 does not match the program
2
EStakedSuiRewardsNotMatched
Staked SUI rewards do not match
3
EInvalidStakeParas
Invalid staking parameters
4
EStakeNotEnoughSui
Not enough SUI to stake
5
EStakeNoStsuiMint
No stSUI minted during staking
6
EUnstakeNormalTicketLocking
Normal unstake ticket is still in locking period
7
EUnstakeNotEnoughSui
Not enough SUI to fulfill unstake
8
EUnstakeExceedMaxSuiAmount
Unstake amount exceeds the max SUI amount
9
EUnstakeInstantNoServiceFee
Instant unstake requires a service fee (fee not set)
10
(EUnstakeNotEnoughStakedSui)
Commented out: not enough staked SUI for unstake
11
EUnstakeNotZeroStSui
Unstake stSUI amount must not be zero
12
EStakePause
Staking is paused
13
EUnstakePause
Unstaking is paused
14
(EReservedForClaim)
Commented out: reserved for claim
15
(ENoMinStakingThreshhold)
Commented out: no minimum staking threshold met
16
EUnstakeNeedAmountIsNotZero
Unstake
need_amount
must not be zero
17
EClaimPause
Claiming is paused
18
EValidatorCountNotMatch
Validator count does not match
19
EValidatorNotFound
Validator not found
20
EInjectRewardsTooLow
Injected rewards amount is too low
当预执行或构建调用失败并返回
MoveAbort(..., <code>)
时,使用以下映射关系:
错误码常量名称描述
1
EDataNotMatchProgram
数据与程序不匹配
2
EStakedSuiRewardsNotMatched
质押的SUI奖励不匹配
3
EInvalidStakeParas
质押参数无效
4
EStakeNotEnoughSui
质押所需SUI不足
5
EStakeNoStsuiMint
质押过程中未铸造stSUI
6
EUnstakeNormalTicketLocking
普通提取票据仍处于锁定期
7
EUnstakeNotEnoughSui
提取所需SUI不足
8
EUnstakeExceedMaxSuiAmount
提取金额超过SUI最大限额
9
EUnstakeInstantNoServiceFee
即时提取需要服务费(未设置费用)
10
(EUnstakeNotEnoughStakedSui)
已注释:质押的SUI不足以进行提取
11
EUnstakeNotZeroStSui
提取的stSUI金额不能为零
12
EStakePause
质押已暂停
13
EUnstakePause
提取已暂停
14
(EReservedForClaim)
已注释:为领取奖励预留
15
(ENoMinStakingThreshhold)
已注释:未达到最低质押阈值
16
EUnstakeNeedAmountIsNotZero
提取的
need_amount
不能为零
17
EClaimPause
领取奖励已暂停
18
EValidatorCountNotMatch
验证节点数量不匹配
19
EValidatorNotFound
未找到验证节点
20
EInjectRewardsTooLow
注入的奖励金额过低