decodeAddr method
Overrides the method to decode an EOS address from its string representation.
Implementation
@override
List<int> decodeAddr(String addr) {
/// Remove the address prefix from the given address
final addrNoPrefix = AddrDecUtils.validateAndRemovePrefix(
addr,
AddrKeyValidator.getConfigArg(
CoinsConf.eos.params.addrPrefix,
"addrPrefix",
),
);
/// Decode the remaining address bytes
final addrDecBytes = Base58Decoder.decode(addrNoPrefix);
/// Validate the length of the decoded address
AddrDecUtils.validateBytesLength(
addrDecBytes,
EcdsaKeysConst.pubKeyCompressedByteLen + EosAddrConst.checksumByteLen,
);
/// Split the address into its public key bytes and checksum
final parts = AddrDecUtils.splitPartsByChecksum(
addrDecBytes,
EosAddrConst.checksumByteLen,
);
final pubKeyBytes = parts.$1;
final checksumBytes = parts.$2;
/// Validate the checksum
AddrDecUtils.validateChecksum(
pubKeyBytes,
checksumBytes,
(pubKeyBytes) => _EosAddrUtils.computeChecksum(pubKeyBytes),
);
return pubKeyBytes;
}