For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

Sui JSON-RPC (deprecated) (4/5)

API reference for Sui. All methods ->

Part 4 of 5: 1 · 2 · 3 · 4 · 5

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": [
"0xa69bb635dcee0f33643b4729ae81730d55e5e26860fac6839ce2d7ed7e6f29d2",
{
"filter": {
"MatchAll": [
{
"StructType": "0x2::coin::Coin<0x2::sui::SUI>"
},
{
"AddressOwner": "0xa69bb635dcee0f33643b4729ae81730d55e5e26860fac6839ce2d7ed7e6f29d2"
},
{
"Version": "13488"
}
]
},
"options": {
"showType": true,
"showOwner": true,
"showPreviousTransaction": true,
"showDisplay": false,
"showContent": false,
"showBcs": false,
"showStorageRebate": false
}
},
"0x76a1b4c23f2d9a9b6f0d8b2c17beace292b72aea16d6fb49b7d1ae51f33b01ed",
3
]
}'

Response example

{
"jsonrpc": "2.0",
"result": {
"data": [
{
"data": {
"objectId": "0x3d6255ff8223c12b0fd985c49d5777a0d65ad3d707164b2a378eee639ebc2690",
"version": "13488",
"digest": "A6v9pFTLH3PkDSvEGgVjW1JhL7CtcUQKwGmgXK8SQNsc",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"owner": {
"AddressOwner": "0xa69bb635dcee0f33643b4729ae81730d55e5e26860fac6839ce2d7ed7e6f29d2"
},
"previousTransaction": "AZiaEnge9YnawyLosmuxd8grpoiYasfpvBEjSLFUmJ8m",
"storageRebate": "100"
}
},
{
"data": {
"objectId": "0x1a6e30f43933bbf40f5f5b6ce1f44957337dcb28f32e0355326f8c7d932bd54d",
"version": "13488",
"digest": "Fn1HG7LyUcLDps6bhYQkPWXpeUXgisznxRJ2qvn7Q1JN",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"owner": {
"AddressOwner": "0xa69bb635dcee0f33643b4729ae81730d55e5e26860fac6839ce2d7ed7e6f29d2"
},
"previousTransaction": "5EZjpdpApGGb48UZtuRgXuTRDBgkFDYaiNUtUNg7788k",
"storageRebate": "100"
}
},
{
"data": {
"objectId": "0x28628a24386298faa98850887f64da841b87279efd098d59a66a3d9adc87cce8",
"version": "13488",
"digest": "39aXGAwHaY3CiqWwLiBZ7JRaGSvnpvPbHxMSJAwAUY5i",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"owner": {
"AddressOwner": "0xa69bb635dcee0f33643b4729ae81730d55e5e26860fac6839ce2d7ed7e6f29d2"
},
"previousTransaction": "CnBDiCrxWcJCCU1LHoda6XwwRaCSRfva8HZzfmR3p8Ag",
"storageRebate": "100"
}
}
],
"nextCursor": "0x28628a24386298faa98850887f64da841b87279efd098d59a66a3d9adc87cce8",
"hasNextPage": true
}
}

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",
"result": 1000
}

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_getTotalSupply

Retrieves total supply for a coin.

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):

    • <coin_type> (string): a type name for the coin (example: 0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC).

Returns

  • value: total supply for the type of coin provided.

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_getTotalSupply",
"params": [
"0x0a52124e2d53af3bef7959609efa51761ad155441a1b73bdaeecce7c56488b13::acoin::ACOIN"
]
}'

Response example

{
"jsonrpc": "2.0",
"result": {
"value": "12023692"
}
}

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_queryEvents

Retrieves the list of events 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> (EventFilter): the event query criteria.
    • <cursor> (EventID, optional): the page cursor.
    • <limit> (uint): the max number of items per page, defaults to QUERY_MAX_RESULT_LIMIT if not specified.
    • <descending_order> (boolean): the query results order; defaults to false (ascending order), oldest record first.

Returns

  • EventPage: the events for a 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_queryEvents",
"params": [
{
"MoveModule": {
"package": "0x30651d6e8f93e0fb79b4bc65a512beb5b9f3378423de90ed03b694cecf443c72",
"module": "test"
}
},
{
"txDigest": "Nb5kW8n655ApSBA19d2K8UVFGtMnJHa1mJQRH1h5N9L",
"eventSeq": "1"
},
100,
false
]
}'

Response example

{
"jsonrpc": "2.0",
"result": {
"data": [
{
"id": {
"txDigest": "8WecQq8Qd79MmrHRXYudNG7e6vjWC9HtGAT4XZFyyWRM",
"eventSeq": "1"
},
"packageId": "0x28f9c59f430eaba84b8bee9b43a30f9cc83fa395759ca37c6e1ffc179184e98a",
"transactionModule": "test",
"sender": "0xc5db76052ab656e5f81853d0cf701cdbc8ebf27ab513fc6ef8c344406c78da3d",
"type": "0x3::test::Test<0x3::test::Test>",
"parsedJson": "some_value",
"bcs": ""
},
{
"id": {
"txDigest": "CNLhn3qWzHhfmmLQTdinbFDd2DuXFPN9z77UUqsC4Z4A",
"eventSeq": "1"
},
"packageId": "0x28f9c59f430eaba84b8bee9b43a30f9cc83fa395759ca37c6e1ffc179184e98a",
"transactionModule": "test",
"sender": "0x5ad3a5fcc295dc8803c15989a62d33ee859014cfd5e91c13a481370240e39246",
"type": "0x3::test::Test<0x3::test::Test>",
"parsedJson": "some_value",
"bcs": ""
},
{
"id": {
"txDigest": "FEhceVx5a6mkeZH8dPxthQkEEPkWfjWN3w1e6uTB5rFm",
"eventSeq": "1"
},
"packageId": "0x28f9c59f430eaba84b8bee9b43a30f9cc83fa395759ca37c6e1ffc179184e98a",
"transactionModule": "test",
"sender": "0x4c329a203fb9f0a8158aaab9b2a90044b26e14cc7fee4100fdcabda6d15c63c4",
"type": "0x3::test::Test<0x3::test::Test>",
"parsedJson": "some_value",
"bcs": ""
},
{
"id": {
"txDigest": "Nb5kW8n655ApSBA19d2K8UVFGtMnJHa1mJQRH1h5N9L",
"eventSeq": "1"
},
"packageId": "0x28f9c59f430eaba84b8bee9b43a30f9cc83fa395759ca37c6e1ffc179184e98a",
"transactionModule": "test",
"sender": "0xb49c45ae23f2b936495cd38b1a4b04010295baa75ac72e548aeecf2ce8b4e885",
"type": "0x3::test::Test<0x3::test::Test>",
"parsedJson": "some_value",
"bcs": ""
}
],
"nextCursor": {
"txDigest": "Nb5kW8n655ApSBA19d2K8UVFGtMnJHa1mJQRH1h5N9L",
"eventSeq": "1"
},
"hasNextPage": false
}
}

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 to QUERY_MAX_RESULT_LIMIT if 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",
"result": {
"data": [
{
"digest": "GUPcK4cmRmgsTFr52ab9f6fnzNVg3Lz6hF2aXFcsRzaD"
},
{
"digest": "B2iV1SVbBjgTKfbJKPQrvTT6F3kNdekFuBwY9tQcAxV2"
},
{
"digest": "8QrPa4x9iNG5r2zQfmeH8pJoVjjtq9AGzp8rp2fxi8Sk"
},
{
"digest": "3nek86HEjXZ7K3EtrAcBG4wMrCS21gqr8BqwwC6M6P7F"
}
],
"nextCursor": "3nek86HEjXZ7K3EtrAcBG4wMrCS21gqr8BqwwC6M6P7F",
"hasNextPage": false
}
}'

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>

unsafe_batchTransaction

Creates an unsigned batched transaction.

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):

    • <signer> (SuiAddress): the transaction signer's Sui address.
    • <single_transaction_params> (RPCTransactionRequestParams): the list of transaction request parameters.
    • <gas> (ObjectID): the gas object to be used in this transaction, node will pick one from the signer's possession if not provided.
    • <gas_budget> (BigInt_for_uint64): the gas budget, the transaction will fail if the gas cost exceed the budget.
    • <txn_builder_mode> (SuiTransactionBlockBuilderMode): whether this is a regular transaction or a Dev Inspect Transaction.

Returns

  • gas: the gas objects to be used.
  • inputObjects: objects to be used in this transaction.
  • txBytes: BCS serialized transaction data bytes without its type tag, as base-64 encoded string.

unsafe_mergeCoins

Creates an unsigned transaction to merge multiple coins into one coin.

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):

    • <signer> (SuiAddress): the transaction signer's Sui address.
    • <primary_coin> (ObjectID): the coin object to merge into, this coin will remain after the transaction.
    • <coin_to_merge> (ObjectID): the coin object to be merged, this coin will be destroyed, the balance will be added to primary_coin.
    • <gas> (ObjectID): the gas object to be used in this transaction, node will pick one from the signer's possession if not provided.
    • <gas_budget> (BigInt_for_uint64): the gas budget, the transaction will fail if the gas cost exceed the budget.

Returns

  • gas: the gas objects to be used.
  • inputObjects: the objects to be used in this transaction.
  • txBytes: BCS serialized transaction data bytes without its type tag, as base-64 encoded string.

unsafe_moveCall

Creates an unsigned transaction to execute a Move call on the network by calling the specified function in the module of a given package.

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):

    • <signer> (SuiAddress): the transaction signer's Sui address
    • <package_object_id> (ObjectID): the Move package ID (example: 0x2).
    • <module> (string): the Move module name (example: pay).
    • <function> (string): the Move function name (example: split).
    • <type_arguments> (TypeTag): the type arguments of the Move function.
    • <arguments> (SuiJsonValue): the arguments to be passed into the Move function, in SuiJson format.
    • <gas> (ObjectID): the gas object to be used in this transaction, node will pick one from the signer's possession if not provided.
    • gas_budget (BigInt_for_uint64): the gas budget, the transaction will fail if the gas cost exceed the budget.
    • <execution_mode> (SuiTransactionBlockBuilderMode): whether this is a Normal transaction or a Dev Inspect Transaction. Defaults to be SuiTransactionBlockBuilderMode::Commit when it's None.

Returns

  • gas: the gas objects to be used.
  • inputObjects: objects to be used in this transaction.
  • txBytes: BCS serialized transaction data bytes without its type tag, as base-64 encoded string.

unsafe_pay

Sends Coin<T> to a list of addresses.

T can be any coin type, following a list of amounts, The object specified in the gas field will be used to pay the gas fee for the transaction. The gas object can not appear in input_coins. If the gas object is not specified, the RPC server will auto-select one.

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):

    • <signer> (SuiAddress): the transaction signer's Sui address.
    • <input_coins> (ObjectID): the Sui coins to be used in this transaction.
    • <recipients> (SuiAddress): the recipients' addresses, the length of this vector must be the same as amounts.
    • amounts (BigInt_for_uint64): the amounts to be transferred to recipients, following the same order.
    • gas (ObjectID): the gas object to be used in this transaction, node will pick one from the signer's possession if not provided.
    • gas_budget (BigInt_for_uint64): the gas budget, the transaction will fail if the gas cost exceed the budget.

Returns

  • gas: the gas objects to be used.
  • inputObjects: objects to be used in this transaction.
  • txBytes: BCS serialized transaction data bytes without its type tag, as base-64 encoded string.

unsafe_payAllSui

Sends all SUI coins to one recipient.

This is for SUI coin only and does not require a separate gas coin object. Specifically, what pay_all_sui does are:

  1. accumulate all SUI from input coins and deposit all SUI to the first input coin
  2. transfer the updated first coin to the recipient and also use this first coin as gas coin object.
  3. the balance of the first input coin after tx is sum(input_coins) - actual_gas_cost.
  4. all other input coins other than the first are deleted.

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):

    • <signer> (SuiAddress): the transaction signer's Sui address.
    • <input_coins> (ObjectID): the Sui coins to be used in this transaction, including the coin for gas payment.
    • <recipient> (SuiAddress): the recipient address.
    • <gas_budget> (BigInt_for_uint64): the gas budget, the transaction will fail if the gas cost exceed the budget.

Returns

  • gas: the gas objects to be used.
  • inputObjects: objects to be used in this transaction.
  • txBytes: BCS serialized transaction data bytes without its type tag, as base-64 encoded string.