decodeAddr method

  1. @override
List<int> decodeAddr(
  1. String addr, [
  2. Map<String, dynamic> kwargs = const {}
])
override

Decodes a Tron address from its encoded representation.

The addr parameter is the encoded Tron address to be decoded. The optional kwargs parameter allows for additional configuration. Returns the decoded address as a List

Implementation

@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
  List<int> addrDec = Base58Decoder.checkDecode(addr);
  final tronPrefix =
      BytesUtils.fromHexString(CoinsConf.tron.params.addrPrefix!);
  AddrDecUtils.validateBytesLength(
      addrDec, (EthAddrConst.addrLen ~/ 2) + tronPrefix.length);
  final addrNoPrefix =
      AddrDecUtils.validateAndRemovePrefixBytes(addrDec, tronPrefix);

  return EthAddrDecoder().decodeAddr(
      CoinsConf.ethereum.params.addrPrefix! +
          BytesUtils.toHexString(addrNoPrefix),
      {
        "skip_chksum_enc": true,
      });
}