use of org.fisco.bcos.web3j.protocol.core.methods.response.AbiDefinition in project web3sdk by FISCO-BCOS.
the class ContractAbiUtil method getConstructorAbiDefinition.
/**
* @param contractAbi
* @return
*/
public static AbiDefinition getConstructorAbiDefinition(String contractAbi) {
try {
ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
AbiDefinition[] abiDefinitions = objectMapper.readValue(contractAbi, AbiDefinition[].class);
for (AbiDefinition abiDefinition : abiDefinitions) {
if (TYPE_CONSTRUCTOR.equals(abiDefinition.getType())) {
return abiDefinition;
}
}
} catch (JsonProcessingException e) {
logger.warn(" invalid json, abi: {}, e: {} ", contractAbi, e);
}
return null;
}
use of org.fisco.bcos.web3j.protocol.core.methods.response.AbiDefinition in project web3sdk by FISCO-BCOS.
the class ContractAbiUtil method getEventAbiDefinitions.
/**
* @param contractAbi
* @return
*/
public static List<AbiDefinition> getEventAbiDefinitions(String contractAbi) {
List<AbiDefinition> result = new ArrayList<>();
try {
ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
AbiDefinition[] abiDefinitions = objectMapper.readValue(contractAbi, AbiDefinition[].class);
for (AbiDefinition abiDefinition : abiDefinitions) {
if (TYPE_EVENT.equals(abiDefinition.getType())) {
result.add(abiDefinition);
}
}
} catch (JsonProcessingException e) {
logger.warn(" invalid json, abi: {}, e: {} ", contractAbi, e);
}
return result;
}
Aggregations