Skip to content

LedgerService.GetObject ​

Get object through sui.rpc.v2.LedgerService/GetObject on Inodra's Sui gRPC endpoint.

Endpoint ​

NetworkHostAuthentication
Mainnetmainnet-grpc.inodra.com:443x-api-key metadata
Testnettestnet-grpc.inodra.com:443x-api-key metadata

Full method name: sui.rpc.v2.LedgerService/GetObject. Unary: one request, one response. Get a key from the dashboard; the same key works on every protocol.

Request: GetObjectRequest ​

FieldTypeDescription
object_idstringRequired. The ObjectId of the requested object.
versionuint64Request a specific version of the object. If no version is specified, and the object is live, then the latest version of the object is returned.
read_maskgoogle.protobuf.FieldMaskMask specifying which fields to read. If no mask is specified, defaults to object_id,version,digest.

Response: GetObjectResponse ​

FieldTypeDescription
objectObject

Object ​

An object on the Sui blockchain.

FieldTypeDescription
bcsBcsThis Object serialized as BCS.
object_idstringObjectId for this object.
versionuint64Version of the object.
digeststringThe digest of this Object.
ownerOwnerOwner of the object.
object_typestringThe type of this object. This will be 'package' for packages and a StructTag for move structs.
has_public_transferboolDEPRECATED this field is no longer used to determine whether a tx can transfer this object. Instead, it is always calculated from the objects type when loaded in execution. Only set for Move structs
contentsBcsBCS bytes of a Move struct value. Only set for Move structs
packagePackagePackage information for Move Packages
previous_transactionstringThe digest of the transaction that created or last mutated this object
storage_rebateuint64The amount of SUI to rebate if this object gets deleted. This number is re-calculated each time the object is mutated based on the present storage gas price.
jsongoogle.protobuf.ValueJSON rendering of the object.
balanceuint64Current balance if this object is a 0x2::coin::Coin<T>
displayDisplayJSON rendering of the object based on an on-chain template. This will not be set if the value's type does not have an associated Display template.

grpcurl ​

bash
grpcurl -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "object_id": "0x2",
  "read_mask": {
    "paths": [
      "object_id",
      "version",
      "digest"
    ]
  }
}' \
  mainnet-grpc.inodra.com:443 \
  sui.rpc.v2.LedgerService/GetObject

Server reflection is enabled, so no proto files are needed for grpcurl. Field masks are written as {"paths": [...]}.

TypeScript ​

typescript
import { GrpcWebFetchTransport, SuiGrpcClient } from '@mysten/sui/grpc'

const transport = new GrpcWebFetchTransport({
  baseUrl: 'https://mainnet-grpc.inodra.com',
  meta: { 'x-api-key': process.env.INODRA_API_KEY! }
})
const client = new SuiGrpcClient({ network: 'mainnet', transport })

const { response } = await client.ledgerService.getObject({
  objectId: '0x2',
  readMask: { paths: ['object_id', 'version', 'digest'] }
})
console.log(response.object)

@mysten/sui v2 has no typed method for this RPC, so the sample calls the generated client.ledgerService service client. Install with npm install @mysten/sui and set INODRA_API_KEY. The gRPC gateway guide covers native gRPC transport for backends.

Credits ​

1 credit per call. Reads served from the archival tier cost 2x; the response metadata carries x-inodra-backend naming the tier that answered. See credits and billing for the full table.

JSON-RPC equivalent ​

Replaces sui_getObject and sui_tryGetPastObject. The JSON-RPC to gRPC migration guide has before and after code for the common calls.

The full-stack Sui data layer.