getResultValue

Extracts the return value from a successful Soroban contract invocation.

This helper function parses the transaction metadata and extracts the SCVal return value from a successful contract execution.

Return

The return value as an SCVal, or null if: - The transaction was not successful - The resultMetaXdr is null - No return value is present

Throws

if the XDR cannot be parsed

Example Usage

val response = sorobanServer.getTransaction(txHash)
val resultValue = response.getResultValue()

// For a vector return value
if (resultValue is SCValXdr.Vec) {
val vec = resultValue.value?.value
// Process vector elements
}