BatchGetObjects - Sui
BatchGetObjects. Returns several objects in one call.
BatchGetObjects - sui [Value: 20CU]
Returns several objects in one call. Each entry contains either the object or an error.
gRPC: sui.rpc.v2.LedgerService/BatchGetObjects
Use cases
- Load many objects at once
- Reduce round trips for UIs
- Mix latest and historical versions
Constraints
- At most 1000 objects per request
- Only top-level read_mask applies
- Per-item errors, not call errors
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
grpcurl \
-H "x-drpc-key: {API-KEY}" \
-H "x-drpc-chain: sui" \
-d '{
"requests": [
{ "object_id": "0x5" },
{ "object_id": "0x6" }
],
"read_mask": "objectId,version,digest,objectType"
}' \
grpc.drpc.live:443 \
sui.rpc.v2.LedgerService/BatchGetObjectsResponse
200
{
"objects": [
{
"object": {
"object_id": "0x0000000000000000000000000000000000000000000000000000000000000005",
"version": "748391877",
"digest": "3hT6wQ9eR2yU5iO8pA1sD4fG7jK0lZ3xC6vB9nM2qW5e",
"object_type": "0x3::sui_system::SuiSystemState"
}
},
{
"object": {
"object_id": "0x0000000000000000000000000000000000000000000000000000000000000006",
"version": "748392015",
"digest": "9fK3mP7qR2sT5vW8xY1zA4bC6dE9gH2jL5nQ8rU3wX6y",
"object_type": "0x2::clock::Clock"
}
}
]
}Request params
object
requestsarray_of_objects
Objects to fetch, at most 1000. A `read_mask` inside an item is ignored; use the top-level one.
object
object_idstring
Required. The object id.
versionstring
Optional. A specific version of the object.
read_maskstring
Optional. google.protobuf.FieldMask with the fields to return, as comma-separated paths. Defaults to `object_id,version,digest`. Use `*` to return all fields.
Response
200
Returns several objects in one call. Each entry contains either the object or an error.Response params
object
objectsarray_of_objects
Results in request order.
object
objectobject
The object, if it was found.
object
object_idstring
The object id.
versionstring
Version of the object.
digeststring
Digest of the object.
ownerobject
Owner of the object.
object
kindstring
Ownership kind: `ADDRESS`, `OBJECT`, `SHARED`, `IMMUTABLE` or `CONSENSUS_ADDRESS`.
addressstring
Owning address or object id (for `ADDRESS`, `OBJECT` and `CONSENSUS_ADDRESS` kinds).
versionstring
Initial shared version (for `SHARED`) or start version (for `CONSENSUS_ADDRESS`).
object_typestring
Type of the object: a StructTag for Move structs, or `package` for packages.
has_public_transferboolean
Deprecated. Only set for Move structs.
contentsobject
BCS bytes of the Move struct value (`name`, `value`). Only set for Move structs.
packageobject
Package information, for Move packages.
previous_transactionstring
Digest of the transaction that created or last mutated this object.
storage_rebatestring
Amount of SUI rebated if this object is deleted. Recalculated each time the object is mutated.
jsonobject
JSON rendering of the object.
balancestring
Current balance, if the object is a `0x2::coin::Coin<T>`.
displayobject
JSON rendering based on the type's on-chain `Display` template. Not set if the type has no template.
bcsobject
The object serialized as BCS (`name`, `value`).
errorobject
google.rpc.Status (`code`, `message`) if the object could not be returned.