loadContractInfoForContractId

Loads contract information (Environment Meta, Contract Spec, Contract Meta) for a given contract ID.

This method:

  1. Fetches the contract instance and code using loadContractCodeForContractId

  2. Parses the WASM bytecode to extract contract metadata

The returned information includes:

  • Environment interface version (protocol version)

  • Contract specification entries (functions, structs, events, etc.)

  • Contract metadata (key-value pairs for application/tooling use)

Example

val contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5"
val contractInfo = server.loadContractInfoForContractId(contractId)
contractInfo?.let {
println("Protocol version: ${it.envInterfaceVersion}")
println("Spec entries: ${it.specEntries.size}")
println("Metadata: ${it.metaEntries}")
}

Return

The parsed contract information, or null when the instance or its code entry is not found, or when the contract is a Stellar Asset Contract

Parameters

contractId

The contract address (C... format)

See also

Throws

If the RPC request fails

If the WASM bytecode cannot be parsed

If contractId is not a valid contract address, or if the instance carries an external reference whose owner is not a contract address

If an external reference cannot be resolved: the tag entry is missing, is not a contract data entry, or does not hold a 32-byte hash