Search in sources :

Example 16 with NetworkTransactionResponse

use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.

the class TokenClient method dissociate.

public NetworkTransactionResponse dissociate(ExpandedAccountId accountId, TokenId token) {
    log.debug("Dissociate account {} with token {}", accountId.getAccountId(), token);
    TokenDissociateTransaction tokenDissociateTransaction = new TokenDissociateTransaction().setAccountId(accountId.getAccountId()).setTokenIds(List.of(token)).setTransactionMemo(getMemo("Dissociate token"));
    NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenDissociateTransaction, KeyList.of(accountId.getPrivateKey()));
    log.debug("Dissociated {} with token {}", accountId, token);
    return networkTransactionResponse;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) TokenDissociateTransaction(com.hedera.hashgraph.sdk.TokenDissociateTransaction)

Example 17 with NetworkTransactionResponse

use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.

the class TokenClient method wipeNonFungible.

public NetworkTransactionResponse wipeNonFungible(TokenId tokenId, long serialNumber, ExpandedAccountId expandedAccountId) {
    log.debug("Wipe serial number {} from token {}, account id {}", serialNumber, tokenId, expandedAccountId.getAccountId());
    TokenWipeTransaction transaction = getTokenWipeTransaction(tokenId, expandedAccountId).addSerial(serialNumber);
    NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(transaction);
    log.debug("Wiped serial number {} from token {}, account id {}", serialNumber, tokenId, expandedAccountId.getAccountId());
    return networkTransactionResponse;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) TokenWipeTransaction(com.hedera.hashgraph.sdk.TokenWipeTransaction)

Example 18 with NetworkTransactionResponse

use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.

the class TopicClient method createTopic.

public NetworkTransactionResponse createTopic(ExpandedAccountId adminAccount, PublicKey submitKey) {
    String memo = getMemo("Create Topic");
    TopicCreateTransaction consensusTopicCreateTransaction = new TopicCreateTransaction().setAdminKey(adminAccount.getPublicKey()).setAutoRenewAccountId(sdkClient.getExpandedOperatorAccountId().getAccountId()).setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setTopicMemo(memo).setTransactionMemo(memo).setAutoRenewPeriod(// INSUFFICIENT_TX_FEE, also unsupported
    autoRenewPeriod);
    if (submitKey != null) {
        consensusTopicCreateTransaction.setSubmitKey(submitKey);
    }
    NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(consensusTopicCreateTransaction, KeyList.of(adminAccount.getPrivateKey()));
    TopicId topicId = networkTransactionResponse.getReceipt().topicId;
    log.debug("Created new topic {}", topicId);
    return networkTransactionResponse;
}
Also used : TopicCreateTransaction(com.hedera.hashgraph.sdk.TopicCreateTransaction) NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) TopicId(com.hedera.hashgraph.sdk.TopicId)

Example 19 with NetworkTransactionResponse

use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.

the class TopicClient method updateTopic.

public NetworkTransactionResponse updateTopic(TopicId topicId) {
    String memo = getMemo("Update Topic");
    TopicUpdateTransaction consensusTopicUpdateTransaction = new TopicUpdateTransaction().setTopicId(topicId).setTopicMemo(memo).setAutoRenewPeriod(autoRenewPeriod).clearAdminKey().clearSubmitKey().clearAutoRenewAccountId().setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setTransactionMemo(memo);
    NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(consensusTopicUpdateTransaction);
    log.debug("Updated topic '{}'.", topicId);
    return networkTransactionResponse;
}
Also used : TopicUpdateTransaction(com.hedera.hashgraph.sdk.TopicUpdateTransaction) NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse)

Example 20 with NetworkTransactionResponse

use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.

the class TopicClient method getDefaultTopicId.

public TopicId getDefaultTopicId() {
    if (defaultTopicId == null) {
        NetworkTransactionResponse networkTransactionResponse = createTopic(sdkClient.getExpandedOperatorAccountId(), null);
        defaultTopicId = networkTransactionResponse.getReceipt().topicId;
        log.debug("Created TopicId: '{}' for use in current test session", defaultTopicId);
    }
    return defaultTopicId;
}
Also used : 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