Sui JSON-RPC (deprecated) (4/4)
API reference for Sui. All methods ->
Methods supported
suix_getOwnedObjects
Retrieves the list of objects owned by an address.
Note that if the address owns more than QUERY_MAX_RESULT_LIMIT objects, the pagination is not accurate, because previous page may have been updated when the next page is fetched. Please use suix_queryObjects if this is a concern.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<address>(BigInt_for_uint64): the owner's Sui address.<query>(object): the objects query criteria.<cursor>(objectID): the page cursor. If provided, the query will start from the next item after the specified cursor. Defaults to start from the first item if not specified.<limit>(uint): the max number of items returned per page; defaults to[QUERY_MAX_RESULT_LIMIT]if not specified.
Returns
ObjectsPage: all the objects the address provided in the request owns and that match the filter.
Request example
curl -X POST https://rpc.ankr.com/sui/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "suix_getOwnedObjects",
"params": [
"0x30430471882ea79bd2153df98b455c6b62a6acf76642a17649665266eddb9a26",
{
"filter": {
"StructType": "0x2::coin::Coin<0x2::sui::SUI>"
},
"options": {
"showType": true,
"showOwner": true,
"showPreviousTransaction": true,
"showDisplay": false,
"showContent": false,
"showBcs": false,
"showStorageRebate": false
}
},
null,
3
]
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"data": {
"objectId": "0x4da1e109117bd649ca431d91f11632ea84e577ed53c23ab2f8ab1e80aeb37887",
"version": "1062199345",
"digest": "4fg9Zph1VcoDDup9MuNUKMVYK4iWYSpckB4NqvXh6veB",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"owner": {
"AddressOwner": "0x30430471882ea79bd2153df98b455c6b62a6acf76642a17649665266eddb9a26"
},
"previousTransaction": "jaBYC1XVXR7TVhA2YvapQ34fjNw2Jyuba8C8VVA533s"
}
}
],
"nextCursor": "zAEAMEMEcYgup5vSFT35i0Vca2KmrPdmQqF2SWZSZu3bmiYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAEY29pbgAAAAAAAAAEQ29pbgAAAAAAAAABAAAABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAANzdWkAAAAAAAAAA1NVSQAAAAAAAAAAAf////0s5UM3TaHhCRF71knKQx2R8RYy6oTld+1Twjqy+KsegK6zeIc=",
"hasNextPage": false
}
}
suix_getReferenceGasPrice
Retrieves the reference gas price for the network.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON RPC spec used (example: 2.0).method(string; required): a method used for the request.params(array; required): none.
Returns
BigInt<u64>: reference gas price information for the network.
Request example
curl -X POST https://rpc.ankr.com/sui/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "suix_getReferenceGasPrice",
"params": []
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "100"
}
suix_getStakes
Retrieves all
DelegatedStake.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<owner>: Sui address.
Returns
Vec<DelegatedStake>
suix_getStakesByIds
Retrieves one or more
DelegatedStakes.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<staked_sui_ids>: object ID.
Returns
Vec<DelegatedStake>
suix_getValidatorsApy
Retrieves the validator APY.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON RPC spec used (example: 2.0).method(string; required): a method used for the request.params(array; required): none
Returns
apys: validator APYs.epoch: the epoch.
Request example
curl -X POST https://rpc.ankr.com/sui/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "suix_getValidatorsApy",
"params": []
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"apys": [
{
"address": "0xb7d1cb695b9491893f88a5ae1b9d4f235b3c7e00acf5386662fa062483ba507b",
"apy": 0.06
},
{
"address": "0x1e9e3039750f0a270f2e12441ad7f611a5f7fd0b2c4326c56b1fec231d73038d",
"apy": 0.02
},
{
"address": "0xba0f0885b97982f5fcac3ec6f5c8cae16743671832358f25bfacde706e528df4",
"apy": 0.05
}
],
"epoch": "420"
}
}
suix_queryTransactionBlocks
Retrieves list of transactions for a specified query criteria.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<query>(TransactionBlockResponseQuery): the transaction query criteria.<cursor>(TransactionDigest; optional): the page cursor. If provided, the query will start from the next item after the specified cursor. Defaults to start from the first item if not specified.<limit>(uint): the max items returned per page, default toQUERY_MAX_RESULT_LIMITif not specified.<descending_order>(boolean): the query results order; defaults to false (ascending order), oldest record first.
Returns
TransactionBlocksPage: the transaction digest for specified query criteria.
Request example
curl -X POST https://rpc.ankr.com/sui/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "suix_queryTransactionBlocks",
"params": [
{
"filter": {
"FromAddress": "0x30430471882ea79bd2153df98b455c6b62a6acf76642a17649665266eddb9a26"
}
},
null,
3,
true
]
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"digest": "jaBYC1XVXR7TVhA2YvapQ34fjNw2Jyuba8C8VVA533s",
"timestampMs": "1793024222131",
"checkpoint": "338351849"
},
{
"digest": "6ed5G9fiVgvDWhYEdpjFzkTBEXDvaPJcqrmzZC4itDMA",
"timestampMs": "1792981560694",
"checkpoint": "338169670"
},
{
"digest": "7d7TQUGrX8FXs4egVVufo79AFutF1QaLVtmPexmFjACG",
"timestampMs": "1792974120976",
"checkpoint": "338137654"
}
],
"nextCursor": "NjM0NjI4NDU1Nw==",
"hasNextPage": true
}
}
suix_resolveNameServiceAddress
Retrieves the resolved address given the resolver and name.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<name>(string): the name to resolve.
Returns
SuiAddress
suix_resolveNameServiceNames
Retrieves the resolved names given an address.
If multiple names are resolved, the first one is the primary name.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):<address>(SuiAddress): the address to resolve.<cursor>(ObjectID): starting position.<limit>(uint): max number per page.
Returns
Page<String,ObjectID>