Sui JSON-RPC (deprecated) (3/5)
API reference for Sui. All methods ->
Methods supported
sui_multiGetTransactionBlocks
Retrieves an ordered list of transaction responses.
The method will throw an error if the input contains any duplicate or the input size exceeds QUERY_MAX_RESULT_LIMIT.
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):<digests>: a list of transaction digests.<options>: config options to control which fields to fetch.
Returns
Vec<SuiTransactionBlockResponse>: the transaction data for specified digest.
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": "sui_multiGetTransactionBlocks",
"params": [
[
"Gd2vRA1pRwWu8j7KQe6fzHS4mMChq1JHJpi9KGnVJMtV",
"73FjSYzymaz1UWPu4bMW191cyxSxziKXJm2MyTQMjeur",
"7TxdfBqwTPYgG4hztwiQdeQcdWgeqpZKF7EJpyjDojFd"
],
{
"showInput": true,
"showRawInput": false,
"showEffects": true,
"showEvents": true,
"showObjectChanges": false,
"showBalanceChanges": false
}
]
}'
sui_tryGetPastObject
Retrieves the object information for a specified version.
There is no software-level guarantee/SLA that objects with past versions can be retrieved by this API, even if the object and version exists/existed. The result may vary across nodes depending on their pruning policies.
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):<object_id>: a list of transaction digests.<version>(sequence number): the version of the queried object. If None, default to the latest known version.<options>: options for specifying the content to be returned.
Returns
SuiPastObjectResponse: past object data.
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": "sui_tryGetPastObject",
"params": [
"0x11af4b844ff94b3fbef6e36b518da3ad4c5856fa686464524a876b463d129760",
4,
{
"showType": true,
"showOwner": true,
"showPreviousTransaction": true,
"showDisplay": false,
"showContent": true,
"showBcs": false,
"showStorageRebate": true
}
]
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"status": "VersionFound",
"details": {
"objectId": "0x11af4b844ff94b3fbef6e36b518da3ad4c5856fa686464524a876b463d129760",
"version": "4",
"digest": "5VPAwDXy3BL72ehFc7gSJoz27ahMd6spUg5YwYc4ibcv",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"owner": {
"AddressOwner": "0x3568c40e814d9d5396d23087a0fd641e91e0e00df6c012cded9ef9ba5e5bf042"
},
"previousTransaction": "5jQByoouHBwaico5pQB73GdbzerC2StjTiHh5garBjiV",
"storageRebate": "100",
"content": {
"dataType": "moveObject",
"type": "0x2::coin::Coin<0x2::sui::SUI>",
"hasPublicTransfer": true,
"fields": {
"balance": "10000",
"id": {
"id": "0x11af4b844ff94b3fbef6e36b518da3ad4c5856fa686464524a876b463d129760"
}
}
}
}
}
}
sui_tryMultiGetPastObjects
Retrieves the object information for a specified version.
There is no software-level guarantee/SLA that objects with past versions can be retrieved by this API, even if the object and version exists/existed. The result may vary across nodes depending on their pruning policies.
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):<past_objects>: a vector of object and versions to be queried.<options>: options for specifying the content to be returned.
Returns
SuiPastObjectResponse: past object data.
suix_getAllBalances
Retrieves the total coin balance for all coin types owned by the address owner.
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>: the owner's Sui address.
Returns
Vec<Balance>: all balances for the address in the request.
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_getAllBalances",
"params": [
"0x94f1a597b4e8f709a396f7f6b1482bdcd65a673d111e49286c527fab7c2d0961"
]
}'
Response example
{
"jsonrpc": "2.0",
"result": [
{
"coinType": "0x2::sui::SUI",
"coinObjectCount": 15,
"totalBalance": "3000000000",
"lockedBalance": {}
}
]
}
suix_getAllCoins
Retrieves all Coin objects owned by an address.
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>: the owner's Sui address.cursor(optional): a page cursor.limit(uint): max number of items per page.
Returns
CoinPage: all coins for the address in the request body.
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_getAllCoins",
"params": [
"0x41f5975e3c6bd5c95f041a8493ad7e9934be26e69152d2c2e86d8a9bdbd242b3",
"0x2564cd31a71cf9833609b111436d8f0f47b7f8b9927ec3f8975a1dcbf9b25564",
3
]
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"data": [
{
"coinType": "0x2::sui::SUI",
"coinObjectId": "0x91825debff541cf4e08b5c5f7296ff9840e6f0b185af93984cde8cf3870302c0",
"version": "103626",
"digest": "7dp5WtTmtGp83EXYYFMzjBJRFeSgR67AzqMETLrfgeFx",
"balance": "200000000",
"previousTransaction": "9WfFUVhjbbh4tWkyUse1QxzbKX952cyXScH7xJNPB2vQ"
},
{
"coinType": "0x2::sui::SUI",
"coinObjectId": "0x48a53f22e2e901ea2a5bf44fdd5bb94a1d83b6efc4dd779f0890ca3b1f6ba997",
"version": "103626",
"digest": "9xLdMXezY8d1yRA2TtN6pYjapyy2EVKHWNriGPFGCFvd",
"balance": "200000000",
"previousTransaction": "Byq9SyV7x6fvzaf88YRA9JM8vLbVLJAqUX8pESDmKcgw"
},
{
"coinType": "0x2::sui::SUI",
"coinObjectId": "0x6867fcc63161269c5c0c73b02229486bbaff319209dfb8299ced3b8609037997",
"version": "103626",
"digest": "5xexWFq6QpGHBQyC9P2cbAJXq9qm2EjzfuRM9NwS1uyG",
"balance": "200000000",
"previousTransaction": "CEjwHmo98nAiYhSMfKoSDvUMtfKJ6ge6Uj4wKotK4MPZ"
}
],
"nextCursor": "0x861c5e055605b2bb1199faf653a8771e448930bc95a0369fad43a9870a2e5878",
"hasNextPage": true
}
}
suix_getBalance
Retrieves the total coin balance for one coin type owned by the address owner.
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>: the owner's Sui address.<coin_type>(string, optional): type names for the coin (example0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC), defaults to0x2::sui::SUIif not specified.
Returns
coinObjectCountcoinTypelockedBalancetotalBalance
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_getBalance",
"params": [
"0x51ceab2edc89f74730e683ebee65578cb3bc9237ba6fca019438a9737cf156ae",
"0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC"
]
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"coinType": "0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC",
"coinObjectCount": 15,
"totalBalance": "15",
"lockedBalance": {}
}
}
suix_getCoinMetadata
Retrieves metadata (as symbol or decimals) 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): type names for the coin (example0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC).
Returns
decimals: the number of decimal places the coin uses.description: token description.iconUrl: URL for the token logo.id: an object ID for the CoinMetadata object.name: a token name.symbol: a token symbol.
Request example
curl -X POST https://rpc.ankr.com/sui/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"result": {
"id": {
"id": "0x6d907beaa3a49db57bdfdb3557e6d405cbf01c293a53e01457d65e92b5d8dd68"
},
"decimals": 9,
"name": "Usdc",
"symbol": "USDC",
"description": "Stable coin.",
"icon_url": null
}
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"id": {
"id": "0x6d907beaa3a49db57bdfdb3557e6d405cbf01c293a53e01457d65e92b5d8dd68"
},
"decimals": 9,
"name": "Usdc",
"symbol": "USDC",
"description": "Stable coin.",
"icon_url": null
}
}
suix_getCoins
Retrieves all coin type objects owned by an address.
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>: the owner's Sui address.<coin_type>(string): type names for the coin (example0x168da5bf1f48dafc111b0a488fa454aca95e0b5e::usdc::USDC), defaults to0x2::sui::SUIif not specified.<cursor>(optional): a page cursor.<limit>(uint): max number of items per page.
Returns
CoinPage: all SUI coins owned by the address 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_getCoins",
"params": [
"0xd62ca040aba24f862a763851c54908cd2a0ee7d709c11b93d4a2083747b76856",
"0x2::sui::SUI",
"0xe5c651321915b06c81838c2e370109b554a448a78d3a56220f798398dde66eab",
3
]
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"data": [
{
"coinType": "0x2::sui::SUI",
"coinObjectId": "0xa5a8e30db5a798a7354340b6ea78a66f50921841ab5359ec7a3dc01f282420ae",
"version": "103626",
"digest": "tw5DzJTfdxTn4f3rekFrhN7dQTUezBgsEhycDobTBLb",
"balance": "200000000",
"previousTransaction": "HSein75AFXgdsnbABWLQ5mvjFmPFWrBFi9CMVsNn7gJr"
},
{
"coinType": "0x2::sui::SUI",
"coinObjectId": "0x47dfa99496428c65b2054ad7db1872b87ff05b1047bb5e3adf5257cceb08ecb4",
"version": "103626",
"digest": "AfgFe7ZfjJ5dWV6VAy2LbtvBFhcABkvdvwEjLrRcFqtr",
"balance": "200000000",
"previousTransaction": "5WHnm9jUZEtDvSvsj7HBrP5BoxA3UY6R57qqumXJXboV"
},
{
"coinType": "0x2::sui::SUI",
"coinObjectId": "0xd4f062dbcfc3bf73f5861945592222ff7b090ac21c8a3cf840abdc5b743da778",
"version": "103626",
"digest": "9er6jxigfuQEKsn9gtPV2oW1zGQRcFtKNijHVe88GUJD",
"balance": "200000000",
"previousTransaction": "H3gwoKE2FSLx3BwvNTTKqCsNHmg6ARzm345icHhXUAEW"
}
],
"nextCursor": "0xd4f062dbcfc3bf73f5861945592222ff7b090ac21c8a3cf840abdc5b743da778",
"hasNextPage": true
}
}
suix_getCommitteeInfo
Retrieves the committee information for the epoch specified.
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):<epoch>(BigInt_for_uint64): the epoch of interest. If None, default to the latest epoch.
Returns
SuiCommittee: committee information.
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_getCommitteeInfo",
"params": [
"5000"
]
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"epoch": "5000",
"validators": [
[
"jc/20VUECmVvSBmxMRG1LFdGqGunLzlfuv4uw4R9HoFA5iSnUf32tfIFC8cgXPnTAATJCwx0Cv/TJs5nPMKyOi0k1T4q/rKG38Zo/UBgCJ1tKxe3md02+Q0zLlSnozjU",
"2500"
],
[
"mfJe9h+AMrkUY2RgmCxcxvE07x3a52ZX8sv+wev8jQlzdAgN9vzw3Li8Sw2OCvXYDrv/K0xZn1T0LWMS38MUJ2B4wcw0fru+xRmL4lhRPzhrkw0CwnSagD4jMJVevRoQ",
"2500"
],
[
"rd7vlNiYyI5A297/kcXxBfnPLHR/tvK8N+wD1ske2y4aV4z1RL6LCTHiXyQ9WbDDDZihbOO6HWzx1/UEJpkusK2zE0sFW+gUDS218l+wDYP45CIr8B/WrJOh/0152ljy",
"2500"
],
[
"s/1e+1yHJAOkrRPxGZUTYG0jNUqEUkmuoVdWTCP/PBXGyeZSty10DoysuTy8wGhrDsDMDBx2C/tCtDZRn8WoBUt2UzqXqfI5h9CX75ax8lJrsgc/oQp3GZQXcjR+8nT0",
"2500"
]
]
}
}
suix_getDynamicFieldObject
Retrieves the dynamic field object information for a specified object.
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):<parent_object_id>: the ID of the queried parent object.<name>: the name of the dynamic field.
Returns
data: object data.error: object response error.
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_getDynamicFieldObject",
"params": [
"0xc8359b6b5e3bfeab524e5edaad3a204b4053745b2d45d1f00cd8d24e5b697607",
{
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"value": "some_value"
}
]
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"data": {
"objectId": "0xc8359b6b5e3bfeab524e5edaad3a204b4053745b2d45d1f00cd8d24e5b697607",
"version": "1",
"digest": "2VivvkBoFVwEg8oXq3tK9r3d3ybvMACtk9QwpFnkM6v2",
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"owner": {
"AddressOwner": "0xc055d5c23e2f6c69e6aacf5b4664b570cb20d4feace07fc863a2eef286c3e95e"
},
"previousTransaction": "FJjAr8fdpuQvVZgd9VswXxz9jZcFGEAgKgdi8d6zXE3S",
"storageRebate": "100",
"content": {
"dataType": "moveObject",
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"hasPublicTransfer": true,
"fields": {}
}
}
}
}
suix_getDynamicFields
Retrieves the list of dynamic field objects owned by an object.
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):<parent_object_id>(string, hex): the ID of the parent object.<cursor>(optional): a 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): max items returned per page; defaults to[QUERY_MAX_RESULT_LIMIT]if not specified.
Returns
DynamicFieldPage: dynamic fields for the object the request provides.
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_getDynamicFields",
"params": [
"0xe15bb8de6dadd21835dfe44f4973139c15f93ddea0f8c3da994d9ead562ce76e",
"0xa9334aeacc435c70ab9635e47a277d8f8dd9d87765d1aadec2db8cc24c312542",
3
]
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"data": [
{
"name": {
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"value": "some_value"
},
"bcsName": "2F1KQ3miNpBx1RzoRr1MVYMraK7RV",
"type": "DynamicField",
"objectType": "test",
"objectId": "0x36fdef6a382da344930c73d1298b0e9644b85ea6f7a348f4a7bd1a9ab069eb7f",
"version": 1,
"digest": "7hWCQjKfZf7oNLpSrhFJZEmYnpmSPzVLwJfFuHmMD9ct"
},
{
"name": {
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"value": "some_value"
},
"bcsName": "2F1KQ3miNpBx1RzoRr1MVYMraK7RV",
"type": "DynamicField",
"objectType": "test",
"objectId": "0xfe41671856fd3450dc5574abd53c793c9f22d8a72d5550df8d2d64a9155d126c",
"version": 1,
"digest": "CxuC9uMcWLk8oMg7QGaJSqUE4hwP6cMUQ94ipiN53jr3"
},
{
"name": {
"type": "0x0000000000000000000000000000000000000000000000000000000000000009::test::TestField",
"value": "some_value"
},
"bcsName": "2F1KQ3miNpBx1RzoRr1MVYMraK7RV",
"type": "DynamicField",
"objectType": "test",
"objectId": "0x1edb2df5ea5d55c96a611371d22799d268270cd4bb4d4f520fe9bbf0cf1cebe3",
"version": 1,
"digest": "HJxTwLy4oE1Aoy3PocGfL9oHystQiyssHfmyE8YaPrw4"
}
],
"nextCursor": "0x8a25d8876ea3c60e345ac3861444136b4a1b0b37a91692359a98496738a58c17",
"hasNextPage": true
}
}
suix_getLatestSuiSystemState
Retrieves the latest SUI system state object on-chain.
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
activeValidators: the list of active validators in the current epoch.atRiskValidators: the map storing the number of epochs for which each validator has been below the low stake threshold.epoch: the current epoch ID, starting from 0.epochDurationMs: the duration of an epoch, in milliseconds.epochStartTimestampMs: the Unix timestamp of the current epoch start.inactivePoolsId: the ID of the object that maps from a staking pool ID to the inactive validator that has that pool as its staking pool.inactivePoolsSize: the of inactive staking pools.maxValidatorCount: the max number of active validators at any moment. We do not allow the number of validators in any epoch to go above this.minValidatorJoiningStake: the lower bound on the amount of stake required to become a validator.pendingActiveValidatorsId: the ID of the object that contains the list of new validators that will join at the end of the epoch.pendingActiveValidatorsSize: the number of new validators that will join at the end of the epoch.pendingRemovals: the removal of requests from the validators. Each element is an index pointing toactive_validators.protocolVersion: the current protocol version, starting from 1.referenceGasPrice: the reference gas price for the current epoch.safeMode: whether the system is running in a downgraded safe mode due to a non-recoverable bug. This is set whenever we failed to executeadvance_epoch, and ended up executing advance_epoch_safe_mode. It can be reset once we are able to successfully executeadvance_epoch.safeModeComputationRewards: the amount of computation rewards accumulated (and not yet distributed) during safe mode.safeModeNonRefundableStorageFee: the amount of non-refundable storage fee accumulated during safe mode.safeModeStorageRebates: the amount of storage rebates accumulated (and not yet burned) during safe mode.safeModeStorageRewards: the amount of storage rewards accumulated (and not yet distributed) during safe mode.stakeSubsidyBalance: the balance of SUI set aside for stake subsidies that will be drawn down over time.stakeSubsidyCurrentDistributionAmount: the amount of stake subsidy to be drawn down per epoch. This amount decays and decreases over time.stakeSubsidyDecreaseRate: the rate at which the distribution amount decays at the end of each period. Expressed in basis points.stakeSubsidyDistributionCounter: this counter may be different from the current epoch number if in some epochs it is decided to skip the subsidy.stakeSubsidyPeriodLength: the number of distributions to occur before the distribution amount decays.stakeSubsidyStartEpoch: the starting epoch in which stake subsidies start being paid out.stakingPoolMappingsId: the ID of the object that maps from staking pool's ID to the sui address of a validator.stakingPoolMappingsSize: the number of staking pool mappings.storageFundNonRefundableBalance: the non-refundable portion of the storage fund coming from storage reinvestment, non-refundable storage rebates and any leftover staking rewards.storageFundTotalObjectStorageRebates: the storage rebates of all the objects on-chain stored in the storage fund.systemStateVersion: the current version of the system state data structure type.totalStake: the total amount of stake from all active validators at the beginning of the epoch.validatorCandidatesId: the ID of the object that stores proactive validators, mapping their addresses to theirValidatorstructs.validatorCandidatesSize: the number of proactive validators.validatorLowStakeGracePeriod: the validator can have stake belowvalidator_low_stake_thresholdfor this many epochs before being kicked out.validatorLowStakeThreshold: validators with stake amount belowvalidator_low_stake_thresholdare considered to have low stake and will be escorted out of the validator set after being below this threshold for more thanvalidator_low_stake_grace_periodnumber of epochs.validatorReportRecords: a map storing the records of validator reporting each other.validatorVeryLowStakeThreshold: validators with stake belowvalidator_very_low_stake_thresholdwill be removed immediately at epoch change, no grace period.
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_getLatestSuiSystemState",
"params": []
}'
Response example
{
"jsonrpc": "2.0",
"result": "some_system_state"
}