decodeAddr method
Decode an Aptos blockchain address from its string representation.
This method decodes the provided addr
string by removing the prefix,
ensuring the address length is valid, and parsing the hexadecimal string
to obtain the address bytes.
Parameters:
addr
: The Aptos blockchain address in string format.kwargs
(optional): Additional arguments, though none are used in this method.
Returns:
- A List
Throws:
- ArgumentException if the provided string is not a valid hex encoding.
This method is used to convert an Aptos blockchain address from its string representation to its binary format for further processing.
Implementation
@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
String addrNoPrefix = AddrDecUtils.validateAndRemovePrefix(
addr,
CoinsConf.aptos.params.addrPrefix!,
);
addrNoPrefix = addrNoPrefix.padLeft(QuickCrypto.sha3256DigestSize * 2, "0");
AddrDecUtils.validateLength(
addrNoPrefix, QuickCrypto.sha3256DigestSize * 2);
return BytesUtils.fromHexString(addrNoPrefix);
}