Search in sources :

Example 1 with ContractGetBytecodeQuery

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();
}
Also used : ContractGetBytecodeQuery(com.hederahashgraph.api.proto.java.ContractGetBytecodeQuery) ContractID(com.hederahashgraph.api.proto.java.ContractID)

Aggregations

ContractGetBytecodeQuery (com.hederahashgraph.api.proto.java.ContractGetBytecodeQuery)1 ContractID (com.hederahashgraph.api.proto.java.ContractID)1