decode method

  1. @override
DecoderResult<SolidityAddress> decode(
  1. AbiParameter params,
  2. List<int> bytes
)
override

Decodes a BaseHexAddress from the given ABI-encoded bytes. Supports both Ethereum and Tron address formats based on the tronTypes flag.

Implementation

@override
DecoderResult<SolidityAddress> decode(AbiParameter params, List<int> bytes) {
  final addrBytes = bytes.sublist(
      ABIConst.uintBytesLength - addrLength, ABIConst.uintBytesLength);
  return DecoderResult(
      result: params.tronTypes
          ? TronAddress.fromEthAddress(addrBytes)
          : ETHAddress.fromBytes(addrBytes),
      consumed: ABIConst.uintBytesLength);
}