address function

String address(
  1. String hexPrivateKey
)

Computes the address corresponding to the given private key

Implementation

String address(String hexPrivateKey) {
  if (bridge.nativeDvote == null)
    throw Exception("The library is not initialized");

  final privKeyPtr = Utf8.toUtf8(hexPrivateKey.replaceAll(r"^0x", ""));

  // The actual native call
  final resultPtr = bridge.computeAddress(privKeyPtr);

  return bridge.handleResultStringPointer(resultPtr);
}