decodeAddr method
Overrides the base class method to decode a Harmony ONE address.
This method decodes a Harmony ONE address from the provided input string using Bech32 encoding.
It expects an optional map of keyword arguments for custom behavior, but specifically, it skips
the checksum encoding validation. The address Human-Readable Part (HRP) is retrieved from the
Harmony ONE configuration. The method first decodes the Bech32 address, and then decodes it again
as an Ethereum address with a custom prefix. The result is returned as a List<int>
containing
the decoded Ethereum address bytes.
Parameters:
- addr: The Harmony ONE address to be decoded.
- kwargs: Optional keyword arguments (with 'skip_chksum_enc' for skipping checksum encoding).
Returns:
A List<int>
containing the decoded Ethereum address bytes derived from the Harmony ONE address.
Implementation
@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
final List<int> addrDecBytes =
Bech32Decoder.decode(CoinsConf.harmonyOne.params.addrHrp!, addr);
/// Decode the address again as an Ethereum address with a custom prefix.
return EthAddrDecoder().decodeAddr(
CoinsConf.ethereum.params.addrPrefix! +
BytesUtils.toHexString(addrDecBytes),
{"skip_chksum_enc": true});
}