use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class ContractClient method createContract.
public NetworkTransactionResponse createContract(FileId fileId, long gas, Hbar payableAmount, ContractFunctionParameters contractFunctionParameters) {
log.debug("Create new contract");
String memo = getMemo("Create contract");
ContractCreateTransaction contractCreateTransaction = new ContractCreateTransaction().setAdminKey(sdkClient.getExpandedOperatorAccountId().getPublicKey()).setBytecodeFileId(fileId).setContractMemo(memo).setGas(gas).setTransactionMemo(memo);
if (contractFunctionParameters != null) {
contractCreateTransaction.setConstructorParameters(contractFunctionParameters);
}
if (payableAmount != null) {
contractCreateTransaction.setInitialBalance(payableAmount);
}
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(contractCreateTransaction);
ContractId contractId = networkTransactionResponse.getReceipt().contractId;
log.debug("Created new contract {}", contractId);
TransactionRecord transactionRecord = getTransactionRecord(networkTransactionResponse.getTransactionId());
logContractFunctionResult("constructor", transactionRecord.contractFunctionResult);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class ContractClient method updateContract.
public NetworkTransactionResponse updateContract(ContractId contractId) {
log.debug("Update contract {}", contractId);
String memo = getMemo("Update contract");
ContractUpdateTransaction contractUpdateTransaction = new ContractUpdateTransaction().setContractId(contractId).setContractMemo(memo).setTransactionMemo(memo);
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(contractUpdateTransaction);
log.debug("Updated contract {}", contractId);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class ScheduleClient method signSchedule.
public NetworkTransactionResponse signSchedule(ExpandedAccountId expandedAccountId, ScheduleId scheduleId) {
ScheduleSignTransaction scheduleSignTransaction = new ScheduleSignTransaction().setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setScheduleId(scheduleId).setTransactionMemo(getMemo("Sign schedule"));
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(scheduleSignTransaction, KeyList.of(expandedAccountId.getPrivateKey()));
log.debug("Signed schedule {}", scheduleId);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class ScheduleClient method createSchedule.
public NetworkTransactionResponse createSchedule(ExpandedAccountId payerAccountId, Transaction transaction, KeyList signatureKeyList) {
String memo = getMemo("Create schedule");
ScheduleCreateTransaction scheduleCreateTransaction = new ScheduleCreateTransaction().setAdminKey(payerAccountId.getPublicKey()).setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setPayerAccountId(payerAccountId.getAccountId()).setScheduleMemo(memo).setScheduledTransaction(transaction).setTransactionMemo(memo);
if (signatureKeyList != null) {
scheduleCreateTransaction.setNodeAccountIds(List.of(sdkClient.getRandomNodeAccountId())).freezeWith(client);
// add initial set of required signatures to ScheduleCreate transaction
signatureKeyList.forEach(k -> {
PrivateKey pk = (PrivateKey) k;
byte[] signature = pk.signTransaction(scheduleCreateTransaction);
scheduleCreateTransaction.addSignature(pk.getPublicKey(), signature);
});
}
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(scheduleCreateTransaction);
ScheduleId scheduleId = networkTransactionResponse.getReceipt().scheduleId;
log.debug("Created new schedule {}", scheduleId);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class ScheduleClient method deleteSchedule.
public NetworkTransactionResponse deleteSchedule(ScheduleId scheduleId) {
log.debug("Delete schedule {}", scheduleId);
ScheduleDeleteTransaction scheduleDeleteTransaction = new ScheduleDeleteTransaction().setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setScheduleId(scheduleId).setTransactionMemo(getMemo("Delete schedule"));
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(scheduleDeleteTransaction);
log.debug("Deleted schedule {}", scheduleId);
return networkTransactionResponse;
}
Aggregations