sui_getObject{deprecated} - Sui
This method retrieves comprehensive information about a specified object on the SUI network, including its type, owner, content, version history, and storage details based on configurable options.
This method is deprecated
Parameters
| Parameter | Type | Required | Description | Default/Supported Values |
|---|---|---|---|---|
| object_id | string | Yes | The unique identifier of the object to query | Must be a valid SUI object ID (0x prefixed) |
| options | object | No | Options specifying which data to include | See ObjectDataOptions below |
ObjectDataOptions
| Field | Type | Default | Description |
|---|---|---|---|
| showType | boolean | false | Include the object's type information |
| showOwner | boolean | false | Include owner information |
| showPreviousTransaction | boolean | false | Include the digest of the last modifying transaction |
| showDisplay | boolean | false | Include display fields for NFTs |
| showContent | boolean | false | Include the object's Move content |
| showBcs | boolean | false | Include BCS-encoded content |
| showStorageRebate | boolean | false | Include storage rebate information |
Request Example
cURL
bashcurl --location --request POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "sui_getObject",
"params": [
"0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
{
"showType": true,
"showOwner": true,
"showPreviousTransaction": true,
"showContent": true,
"showStorageRebate": true
}
],
"id": "getblock.io"
}'Python
pythonimport requests
import json
url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"
headers = {"Content-Type": "application/json"}
payload = {
"jsonrpc": "2.0",
"method": "sui_getObject",
"params": [
"0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
{
"showType": True,
"showOwner": True,
"showContent": True
}
],
"id": "getblock.io"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
if response.status_code == 200:
print("Result:", response.json().get("result"))
else:
print("Error:", response.status_code, response.text)JavaScript (Axios)
javascriptconst axios = require('axios');
const url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/";
const payload = {
jsonrpc: "2.0",
method: "sui_getObject",
params: [
"0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
{
showType: true,
showOwner: true,
showContent: true
}
],
id: "getblock.io"
};
axios.post(url, payload, {
headers: { "Content-Type": "application/json" }
})
.then(response => {
console.log("Result:", response.data.result);
})
.catch(error => {
console.error("Error:", error.response?.status, error.response?.data);
});Rust
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": "sui_getObject",
"params": [
"0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
{
"showType": true,
"showOwner": true,
"showContent": true
}
]
});
let response = client
.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.header("Content-Type", "application/json")
.json(&payload)
.send()
.await?;
println!("Response: {:?}", response.text().await?);
Ok(())
}Response
json{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"data": {
"objectId": "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809",
"version": "1",
"digest": "33K5ZXJ3RyubvYaHuEnQ1QXmmbhgtrFwp199dnEbL4n7",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"owner": {
"AddressOwner": "0xc8ec1d5b84dd6289e193b9f88de4a994358c9f856135236c3e75a925e1c77ac3"
},
"previousTransaction": "5PLgmQye6rraDYqpV3npV6H1cUXoJZgJh1dPCyRa3WCv",
"storageRebate": "100",
"content": {
"dataType": "moveObject",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"hasPublicTransfer": true,
"fields": {
"balance": "100000000",
"id": {
"id": "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809"
}
}
}
}
}
}Response Parameters
| Parameter | Type | Description |
|---|---|---|
| jsonrpc | string | The JSON-RPC protocol version ("2.0") |
| id | string | Request identifier |
| result.data | object | The object data if found |
| result.data.objectId | string | Unique object identifier |
| result.data.version | string | Object version number |
| result.data.digest | string | Object digest hash |
| result.data.type | string | Fully qualified Move type |
| result.data.owner | object | Owner information (AddressOwner, ObjectOwner, Shared, or Immutable) |
| result.data.previousTransaction | string | Digest of last modifying transaction |
| result.data.storageRebate | string | Storage rebate in MIST |
| result.data.content | object | Object content including Move fields |
Use Cases
- NFT Metadata Retrieval: Fetch NFT metadata, display fields, and ownership information for marketplace applications or NFT galleries by querying the object with
showDisplayandshowContentoptions. - Object Ownership Verification: Verify object ownership before initiating transactions by checking the owner field, essential for security validations in dApps.
- Smart Contract State Inspection: Inspect the state of smart contract instances by retrieving their Move content, enabling debugging and state verification.
Error handling
| Code | Description | Solution |
|---|---|---|
| Invalid Object ID | The object ID is not properly formatted | Ensure the ID is a valid 66-character hexadecimal string |
| NotExists | Object does not exist on-chain | Verify the object ID is correct and exists |
| Deleted | Object has been deleted | The object was consumed or deleted in a transaction |
| UnknownVersion | Requested version not found | Use sui_tryGetPastObject for historical versions |
SDK Integration
SUI TypeScript SDK
typescriptimport { SuiClient } from '@mysten/sui/client';
const client = new SuiClient({ url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' });
const object = await client.getObject({
id: '0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809',
options: {
showType: true,
showOwner: true,
showContent: true,
},
});
console.log(object);SUI Rust SDK
rustuse sui_sdk::SuiClientBuilder;
use sui_sdk::types::base_types::ObjectID;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let sui = SuiClientBuilder::default()
.build("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.await?;
let object_id: ObjectID = "0x53e4567ccafa5f36ce84c80aa8bc9be64e0d5ae796884274aef3005ae6733809".parse()?;
let object = sui.read_api().get_object_with_options(object_id, None).await?;
println!("{:?}", object);
Ok(())
}