TronPrivateKey.fromBytes constructor

TronPrivateKey.fromBytes(
  1. List<int> keyBytes
)

Factory method to create a TronPrivateKey from a list of key bytes

Implementation

factory TronPrivateKey.fromBytes(List<int> keyBytes) {
  try {
    final Secp256k1PrivateKeyEcdsa key =
        Secp256k1PrivateKeyEcdsa.fromBytes(keyBytes);
    return TronPrivateKey._(key);
  } catch (e) {
    // Throw a MessageException with details if an error occurs during the creation
    throw TronPluginException("invalid tron private key",
        details: {"input": BytesUtils.toHexString(keyBytes)});
  }
}