Package org.web3j.abi
Class FunctionReturnDecoder
java.lang.Object
org.web3j.abi.FunctionReturnDecoder
- Direct Known Subclasses:
DefaultFunctionReturnDecoder
Decodes values returned by function or event calls.
Delegates to DefaultFunctionReturnDecoder unless a FunctionReturnDecoderProvider SPI is found, in which case the first implementation found will be
used.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode(String rawInput, List<TypeReference<Type>> outputParameters) Decode ABI encoded return values from smart contract function call.static StringdecodeAddress(String rawInput) static byte[]decodeDynamicBytes(String rawInput) Decode ABI encoded return value DynamicBytes from smart contract function call.decodeEventParameter(String rawInput, TypeReference<T> typeReference) decodeFunctionResult(String rawInput, List<TypeReference<Type>> outputParameters) decodeIndexedValue(String rawInput, TypeReference<T> typeReference) Decodes an indexed parameter associated with an event.
-
Constructor Details
-
FunctionReturnDecoder
public FunctionReturnDecoder()
-
-
Method Details
-
decode
Decode ABI encoded return values from smart contract function call.- Parameters:
rawInput- ABI encoded inputoutputParameters- list of return types asTypeReference- Returns:
Listof values returned by function,Collections.emptyList()if invalid response
-
decodeDynamicBytes
Decode ABI encoded return value DynamicBytes from smart contract function call.- Parameters:
rawInput- ABI encoded input- Returns:
DynamicBytesof values returned by function, null if invalid response
-
decodeAddress
-
decodeIndexedValue
public static <T extends Type> Type decodeIndexedValue(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 inputtypeReference- of expected result type- Returns:
- the decode value
-
decodeFunctionResult
-
decodeEventParameter
protected abstract <T extends Type> Type decodeEventParameter(String rawInput, TypeReference<T> typeReference)
-