AptosAccount.fromPrivateKey constructor

AptosAccount.fromPrivateKey(
  1. String privateKey
)

Implementation

factory AptosAccount.fromPrivateKey(String privateKey) {
  final privateKeyHex = HexString(privateKey).noPrefix();
  if (privateKeyHex.length != 64 && privateKeyHex.length != 128) {
    throw ArgumentError("Invalid private key length ${privateKeyHex.length}");
  }
  return AptosAccount(HexString(privateKeyHex).toUint8Array());
}