decodeAddr method

  1. @override
List<int> decodeAddr(
  1. String addr
)
override

Decodes a Tron address from its encoded representation.

Implementation

@override
List<int> decodeAddr(String addr) {
  final List<int> addrDec = Base58Decoder.checkDecode(addr);
  final tronPrefix = BytesUtils.fromHexString(
    AddrKeyValidator.getConfigArg(
      CoinsConf.tron.params.addrPrefix,
      "addrPrefix",
    ),
  );
  AddrDecUtils.validateBytesLength(
    addrDec,
    (EthAddrConst.addrLen ~/ 2) + tronPrefix.length,
  );
  final addrNoPrefix = AddrDecUtils.validateAndRemovePrefixBytes(
    addrDec,
    tronPrefix,
  );

  return EthAddrDecoder().decodeAddr(
    AddrKeyValidator.getConfigArg(
          CoinsConf.ethereum.params.addrPrefix,
          "addrPrefix",
        ) +
        BytesUtils.toHexString(addrNoPrefix),
    skipChecksum: true,
  );
}