ETHAddress.fromPublicKey constructor

ETHAddress.fromPublicKey(
  1. List<int> keyBytes
)

Creates an ETHAddress instance from a public key represented as a bytes.

Implementation

factory ETHAddress.fromPublicKey(List<int> keyBytes) {
  try {
    final toAddress = EthAddrEncoder().encodeKey(keyBytes);
    return ETHAddress._(toAddress);
  } catch (e) {
    throw MessageException("invalid ethreum public key",
        details: {"input": BytesUtils.toHexString(keyBytes)});
  }
}