createWalletFromPrivateKey static method
Creates a HermezWallet from one of the Ethereum wallets in the provider
@param {String} privateKey - Signer data used to build a Signer to create the wallet
@returns {Object} Contains the hermezWallet
as a HermezWallet instance and the hermezEthereumAddress
Implementation
static dynamic createWalletFromPrivateKey(String privateKey) async {
final prvKey = EthPrivateKey.fromHex(privateKey);
final ethereumAddress = await prvKey.extractAddress();
final hermezEthereumAddress = getHermezAddress(ethereumAddress.hex);
final signature = await prvKey.sign(
Uint8ArrayUtils.uint8ListfromString(HERMEZ_ACCOUNT_ACCESS_MESSAGE));
final hashedBufferSignature = keccak256(signature);
final hermezWallet =
new HermezWallet(hashedBufferSignature, hermezEthereumAddress);
return List.from([hermezWallet, hermezEthereumAddress]);
}