read

suspend fun <T : Any> read(ref: AnchorRef, serializer: KSerializer<T>): T

Reads anchored data from a blockchain.

Example:

val anchorRef = AnchorRef(
chainId = "algorand:testnet",
txHash = "abc123..."
)
val data = blockchainService.read<MyData>(
ref = anchorRef,
serializer = MyData.serializer()
)

Return

The anchored data

Parameters

ref

Anchor reference containing chain ID and transaction hash

serializer

Kotlinx Serialization serializer for the data type

Throws

if chain is not registered