Skip to content

Conversation

perplover
Copy link
Contributor

Summary

Add staking APIs for

  • transferring from spot to staking
  • staking delegation

Transferring from Spot to Staking

Message payload looks like:

{
    "types": {
        ...
        "HyperLiquidTransaction:CDeposit": [
            {"name": "hyperliquidChain", "type": "string"},
            {"name": "wei", "type": "uint64"},
            {"name": "nonce", "type": "uint64"},
        ],
        ...
     },
    "primaryType": "HyperliquidTransaction:CDeposit",
    "domain": {
        ...
        "chainId": 1,
        ...
    },
    "message": {
        "type": "cDeposit",
        "wei": 100000000,
        "nonce": <timestamp>,
        "signatureChainId": "0x1",
        "hyperliquidChain": "Mainnet"
    }
}

The key differences are the message, the signatureChainId and chainId

img1 img2
IMG_2316 IMG_2317

Staking Delegation

Message payload looks like:

{
    "types": {
        ...
        "HyperLiquidTransaction:TokenDelegate": [
            {"name": "hyperliquidChain", "type": "string"},
            {"name": "validator", "type": "address"},
            {"name": "wei", "type": "uint64"},
            {"name": "isUndelegate", "type": "bool"},
            {"name": "nonce", "type": "uint64"},
        ],
        ...
     },
    "primaryType": "HyperliquidTransaction:TokenDelegate",
    "domain": {
        ...
        "chainId": 1,
        ...
    },
    "message": {
        "type": "tokenDelegate",
        "validator": "0x..x",
        "wei": 100000000,
        "isUndelegate": false,
        "nonce": <timestamp>,
        "signatureChainId": "0x1",
        "hyperliquidChain": "Mainnet"
    }
}

The key differences are the message, the signatureChainId and chainId

img1 img2 img3
IMG_2318 IMG_2319 IMG_2321

@cr0fx
Copy link

cr0fx commented Feb 5, 2025

Thank you, very helpful. :) Would the opposite be easy to add as well in another PR (I imagine it involves the same but with reversal)?

  1. Undelegate stake from a validator
  2. Transfer from Staking to spot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants