Skip to content

MovePackageService.GetDatatype ​

Get datatype through sui.rpc.v2.MovePackageService/GetDatatype 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.MovePackageService/GetDatatype. Unary: one request, one response. Get a key from the dashboard; the same key works on every protocol.

Request: GetDatatypeRequest ​

FieldTypeDescription
package_idstringRequired. The storage_id of the requested package.
module_namestringRequired. The name of the requested module.
namestringRequired. The name of the requested datatype.

Response: GetDatatypeResponse ​

FieldTypeDescription
datatypeDatatypeDescriptorThe datatype.

DatatypeDescriptor ​

Describes a Move Datatype.

FieldTypeDescription
type_namestringFully qualified name of this Datatype. This is <defining_id>::<module>::<name>
defining_idstringPackageId of the package where this Datatype is defined. A type's defining_id is the storage_id of the package version that first introduced or added that type.
modulestringName of the module where this Datatype is defined
namestringName of this Datatype
abilitiesrepeated AbilityThis type's abilities
type_parametersrepeated TypeParameterAbility constraints and phantom status for this type's generic type parameters
kindDatatypeDescriptor.DatatypeKindIndicates whether this datatype is a 'STRUCT' or an 'ENUM'
fieldsrepeated FieldDescriptorSet of fields if this Datatype is a struct. The order of the entries is the order of how the fields are defined.
variantsrepeated VariantDescriptorSet of variants if this Datatype is an enum. The order of the entries is the order of how the variants are defined.

grpcurl ​

bash
grpcurl -H "x-api-key: YOUR_API_KEY" \
  -d '{
  "package_id": "0x2",
  "module_name": "coin",
  "name": "Coin"
}' \
  mainnet-grpc.inodra.com:443 \
  sui.rpc.v2.MovePackageService/GetDatatype

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.movePackageService.getDatatype({
  packageId: '0x2',
  moduleName: 'coin',
  name: 'Coin'
})
console.log(response.datatype)

@mysten/sui v2 has no typed method for this RPC, so the sample calls the generated client.movePackageService 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. See credits and billing for the full table.

JSON-RPC equivalent ​

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

The full-stack Sui data layer.