PrivateKeySigner.fromHex constructor
PrivateKeySigner.fromHex(
- String privateKeyHex, {
- required Web3Client getClient(),
- required int getChainId(),
Factory from hex private key string.
Implementation
factory PrivateKeySigner.fromHex(
String privateKeyHex, {
required Web3Client Function() getClient,
required int Function() getChainId,
}) {
final normalized = privateKeyHex.trim().startsWith('0x')
? privateKeyHex.trim()
: '0x${privateKeyHex.trim()}';
final creds = EthPrivateKey.fromHex(normalized);
return PrivateKeySigner(
credentials: creds,
getClient: getClient,
getChainId: getChainId,
);
}