use of org.bcos.web3j.abi.datatypes.DynamicArray in project web3sdk by FISCO-BCOS.
the class TypeDecoder method decodeDynamicArray.
@SuppressWarnings("unchecked")
static <T extends Type> T decodeDynamicArray(String input, int offset, TypeReference<T> typeReference) {
int length = decodeUintAsInt(input, offset);
BiFunction<List<T>, String, T> function = (elements, typeName) -> {
if (elements.isEmpty()) {
return (T) DynamicArray.empty(typeName);
} else {
return (T) new DynamicArray<>(elements);
}
};
int valueOffset = offset + MAX_BYTE_LENGTH_FOR_HEX_STRING;
return decodeArrayElements(input, valueOffset, typeReference, length, function);
}
Aggregations