Search in sources :

Example 26 with NetworkTransactionResponse

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;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) ContractCreateTransaction(com.hedera.hashgraph.sdk.ContractCreateTransaction) ContractId(com.hedera.hashgraph.sdk.ContractId) TransactionRecord(com.hedera.hashgraph.sdk.TransactionRecord)

Example 27 with 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;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) ContractUpdateTransaction(com.hedera.hashgraph.sdk.ContractUpdateTransaction)

Example 28 with 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;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) ScheduleSignTransaction(com.hedera.hashgraph.sdk.ScheduleSignTransaction)

Example 29 with 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;
}
Also used : PrivateKey(com.hedera.hashgraph.sdk.PrivateKey) NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) ScheduleId(com.hedera.hashgraph.sdk.ScheduleId) ScheduleCreateTransaction(com.hedera.hashgraph.sdk.ScheduleCreateTransaction)

Example 30 with 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;
}
Also used : ScheduleDeleteTransaction(com.hedera.hashgraph.sdk.ScheduleDeleteTransaction) NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse)

Aggregations

NetworkTransactionResponse (com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse)41 PublicKey (com.hedera.hashgraph.sdk.PublicKey)3 TopicId (com.hedera.hashgraph.sdk.TopicId)3 AccountId (com.hedera.hashgraph.sdk.AccountId)2 KeyList (com.hedera.hashgraph.sdk.KeyList)2 PrivateKey (com.hedera.hashgraph.sdk.PrivateKey)2 TokenBurnTransaction (com.hedera.hashgraph.sdk.TokenBurnTransaction)2 TokenCreateTransaction (com.hedera.hashgraph.sdk.TokenCreateTransaction)2 TokenId (com.hedera.hashgraph.sdk.TokenId)2 TokenUpdateTransaction (com.hedera.hashgraph.sdk.TokenUpdateTransaction)2 TokenWipeTransaction (com.hedera.hashgraph.sdk.TokenWipeTransaction)2 TopicMessageQuery (com.hedera.hashgraph.sdk.TopicMessageQuery)2 TransactionReceipt (com.hedera.hashgraph.sdk.TransactionReceipt)2 TransactionRecord (com.hedera.hashgraph.sdk.TransactionRecord)2 TransferTransaction (com.hedera.hashgraph.sdk.TransferTransaction)2 ExpandedAccountId (com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId)2 Given (io.cucumber.java.en.Given)2 AccountAllowanceApproveTransaction (com.hedera.hashgraph.sdk.AccountAllowanceApproveTransaction)1 AccountCreateTransaction (com.hedera.hashgraph.sdk.AccountCreateTransaction)1 ContractCreateTransaction (com.hedera.hashgraph.sdk.ContractCreateTransaction)1