decodeAddr method

  1. @override
BuBytes decodeAddr(
  1. String addr
)
override

Decodes a given blockchain address string.

Throws AddressConverterException on invalid input.

Implementation

@override
BuBytes decodeAddr(String addr) {
  final List<int> addrDecBytes = Bech32Decoder.decode(
    AddrKeyValidator.getConfigArg(
      CoinsConf.harmonyOne.params.addrHrp,
      "addrHrp",
    ),
    addr,
  );

  // Harmony reuses Ethereum's address format under the hood.
  return EthAddrDecoder().decodeAddr(
    AddrKeyValidator.getConfigArg(
          CoinsConf.ethereum.params.addrPrefix,
          "addrPrefix",
        ) +
        BytesUtils.toHexString(addrDecBytes),
    skipChecksum: true,
  );
}