getChainId

open suspend override fun getChainId(): Result<Long, AptosSdkError>

Retrieves the chain ID of the network.

Usage

val resolution = aptos.getChainId()
when (resolution) {
is Result.Ok -> {
val chainId = resolution.value
println("Network Chain ID: $chainId")
}
is Result.Err -> {
println("Error retrieving chain ID: ${resolution.error.message}")
}
}

Return

A Result which is either Result.Ok containing the chain ID as a Long, or Result.Err containing an AptosSdkError.