funcResToNative

fun funcResToNative(functionName: String, scVal: SCValXdr): Any?

Converts a contract function result from XDR to a native Kotlin value.

This method takes the XDR result value returned from a contract function call and converts it back to a native Kotlin type based on the function's output specification.

Usage

// With SCValXdr
val result = spec.funcResToNative("balance", resultScVal)

// With base64-encoded XDR
val result = spec.funcResToNative("balance", "AAAAAwAAAAQ=")

Return

The converted native Kotlin value, or null for void results

Parameters

functionName

The function name

scVal

The result value as SCValXdr

Throws

if the function is not found, has multiple outputs, or type conversion fails


fun funcResToNative(functionName: String, base64Xdr: String): Any?

Converts a contract function result from base64-encoded XDR to a native Kotlin value.

This is a convenience overload that first decodes the base64 XDR string before conversion.

Return

The converted native Kotlin value, or null for void results

Parameters

functionName

The function name

base64Xdr

The result value as base64-encoded XDR string

Throws

if the function is not found, has multiple outputs, or type conversion fails