suix_getStakesByIds{deprecated} - Sui

This method returns stake details for specific StakedSui object IDs on the SUI network. Unlike suix_getStakes which returns all stakes for an address, this method retrieves data for specific stake objects when you already know their IDs.

This method is deprecated

Parameters

ParameterTypeRequiredDescription
staked_sui_idsarrayYesArray of StakedSui object IDs

Request Example

curl.sh

bashcurl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "suix_getStakesByIds",
  "params": [
    [
      "0x378423de90ed03b694cecf443c72b5387b29a731d26d98108d7abc4902107d7d",
      "0x6a8e0f8fea6fda5488462e58724c034462b6064a08845e2ae2942fe7c4ee816d"
    ]
  ]
}'

example.js

javascriptconst axios = require('axios');

const payload = {
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'suix_getStakesByIds',
  params: [[
    '0x378423de90ed03b694cecf443c72b5387b29a731d26d98108d7abc4902107d7d',
    '0x6a8e0f8fea6fda5488462e58724c034462b6064a08845e2ae2942fe7c4ee816d'
  ]]
};

axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', payload)
.then(response => console.log(response.data));

example.py

pythonimport requests

payload = {
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "suix_getStakesByIds",
    "params": [[
        "0x378423de90ed03b694cecf443c72b5387b29a731d26d98108d7abc4902107d7d",
        "0x6a8e0f8fea6fda5488462e58724c034462b6064a08845e2ae2942fe7c4ee816d"
    ]]
}

response = requests.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/", json=payload)
print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let payload = json!({
        "jsonrpc": "2.0",
        "id": "getblock.io",
        "method": "suix_getStakesByIds",
        "params": [[
            "0x378423de90ed03b694cecf443c72b5387b29a731d26d98108d7abc4902107d7d"
        ]]
    });
    let response = client.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .json(&payload).send().await?;
    println!("{}", response.text().await?);
    Ok(())
}

Response Example

response.json

json{
  "jsonrpc": "2.0",
  "result": [
    {
      "validatorAddress": "0x3befb84f03a24386492bd3b05b1fd386172eb450e5059ce7df0ea6d9d6cefcaa",
      "stakingPool": "0x9a95cf69368e31b4dbe8ee9bdb3c0587bbc79d8fc6edf4007e185a962fd906df",
      "stakes": [
        {
          "stakedSuiId": "0x378423de90ed03b694cecf443c72b5387b29a731d26d98108d7abc4902107d7d",
          "stakeRequestEpoch": "62",
          "stakeActiveEpoch": "63",
          "principal": "200000000000",
          "status": "Active",
          "estimatedReward": "520000000"
        }
      ]
    }
  ],
  "id": "getblock.io"
}

Response Parameters

ParameterTypeDescription
validatorAddressstringValidator address
stakingPoolstringStaking pool ID
stakedSuiIdstringStake object ID
principalstringStaked amount
statusstringActive, Pending, or Unstaked
estimatedRewardstringEstimated rewards

Use Cases

  • Query specific stake objects efficiently
  • Track individual stake positions
  • Verify stake object ownership
  • Build stake management tools

Error Handling

Error CodeDescription
-32602Invalid params - malformed IDs
-32603Internal error - node issues

SDK Integration

ts-example.ts

typescriptimport { SuiClient } from '@mysten/sui/client';

const client = new SuiClient({ url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' });
const stakes = await client.getStakesByIds({
  stakedSuiIds: ['0x378423de90ed03b694cecf443c72b5387b29a731d26d98108d7abc4902107d7d']
});
console.log(stakes);

rs-sdk-example.rs

rustuse sui_sdk::SuiClientBuilder;

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let sui = SuiClientBuilder::default().build("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/").await?;
    let ids = vec!["0x378423de90ed03b694cecf443c72b5387b29a731d26d98108d7abc4902107d7d".parse()?];
    let stakes = sui.governance_api().get_stakes_by_ids(ids).await?;
    println!("{:?}", stakes);
    Ok(())
}