use of com.hederahashgraph.api.proto.java.ContractGetBytecodeQuery in project hedera-services by hashgraph.
the class HapiGetContractBytecode method getContractBytecodeQuery.
private Query getContractBytecodeQuery(HapiApiSpec spec, Transaction payment, boolean costOnly) {
final ContractID resolvedTarget;
if (contract.length() == HEXED_EVM_ADDRESS_LEN) {
resolvedTarget = ContractID.newBuilder().setEvmAddress(ByteString.copyFrom(unhex(contract))).build();
} else {
resolvedTarget = TxnUtils.asContractId(contract, spec);
}
ContractGetBytecodeQuery query = ContractGetBytecodeQuery.newBuilder().setHeader(costOnly ? answerCostHeader(payment) : answerHeader(payment)).setContractID(resolvedTarget).build();
return Query.newBuilder().setContractGetBytecode(query).build();
}
Aggregations