Class FunctionReturnDecoder

java.lang.Object
org.fisco.bcos.sdk.abi.FunctionReturnDecoder

public class FunctionReturnDecoder
extends java.lang.Object
Decodes values returned by function or event calls.
  • Method Summary

    Modifier and Type Method Description
    static java.util.List<Type> decode​(java.lang.String rawInput, java.util.List<TypeReference<Type>> outputParameters)
    Decode ABI encoded return values from smart contract function call.
    static <T extends Type>
    Type
    decodeIndexedValue​(java.lang.String rawInput, TypeReference<T> typeReference)
    Decodes an indexed parameter associated with an event.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • decode

      public static java.util.List<Type> decode​(java.lang.String rawInput, java.util.List<TypeReference<Type>> outputParameters)
      Decode ABI encoded return values from smart contract function call.
      Parameters:
      rawInput - ABI encoded input
      outputParameters - list of return types as TypeReference
      Returns:
      List of values returned by function, Collections.emptyList() if invalid response
    • decodeIndexedValue

      public static <T extends Type> Type decodeIndexedValue​(java.lang.String rawInput, TypeReference<T> typeReference)
      Decodes an indexed parameter associated with an event. Indexed parameters are individually encoded, unlike non-indexed parameters which are encoded as per ABI-encoded function parameters and return values.

      If any of the following types are indexed, the Keccak-256 hashes of the values are returned instead. These are returned as a bytes32 value.

      • Arrays
      • Strings
      • Bytes

      See the Solidity documentation for further information.

      Type Parameters:
      T - type of TypeReference
      Parameters:
      rawInput - ABI encoded input
      typeReference - of expected result type
      Returns:
      the decode value