use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-mirror-node by hashgraph.
the class TopicClient method deleteTopic.
public NetworkTransactionResponse deleteTopic(TopicId topicId) {
TopicDeleteTransaction consensusTopicDeleteTransaction = new TopicDeleteTransaction().setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setTopicId(topicId).setTransactionMemo(getMemo("Delete Topic"));
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(consensusTopicDeleteTransaction);
log.debug("Deleted topic : '{}'.", topicId);
return networkTransactionResponse;
}
use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-mirror-node by hashgraph.
the class ConsensusDeleteTopicTransactionSupplierTest method createWithMinimumData.
@Test
void createWithMinimumData() {
ConsensusDeleteTopicTransactionSupplier consensusDeleteTopicTransactionSupplier = new ConsensusDeleteTopicTransactionSupplier();
consensusDeleteTopicTransactionSupplier.setTopicId(TOPIC_ID.toString());
TopicDeleteTransaction actual = consensusDeleteTopicTransactionSupplier.get();
assertThat(actual).returns(MAX_TRANSACTION_FEE_HBAR, TopicDeleteTransaction::getMaxTransactionFee).returns(TOPIC_ID, TopicDeleteTransaction::getTopicId);
}
use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-mirror-node by hashgraph.
the class ConsensusDeleteTopicTransactionSupplierTest method createWithCustomData.
@Test
void createWithCustomData() {
ConsensusDeleteTopicTransactionSupplier consensusDeleteTopicTransactionSupplier = new ConsensusDeleteTopicTransactionSupplier();
consensusDeleteTopicTransactionSupplier.setMaxTransactionFee(1);
consensusDeleteTopicTransactionSupplier.setTopicId(TOPIC_ID.toString());
TopicDeleteTransaction actual = consensusDeleteTopicTransactionSupplier.get();
assertThat(actual).returns(ONE_TINYBAR, TopicDeleteTransaction::getMaxTransactionFee).returns(TOPIC_ID, TopicDeleteTransaction::getTopicId);
}
use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-sdk-java by hashgraph.
the class TopicCreateIntegrationTest method canCreateTopic.
@Test
@DisplayName("Can create topic")
void canCreateTopic() throws Exception {
var testEnv = new IntegrationTestEnv(1);
var response = new TopicCreateTransaction().setAdminKey(testEnv.operatorKey).setTopicMemo("[e2e::TopicCreateTransaction]").execute(testEnv.client);
var topicId = Objects.requireNonNull(response.getReceipt(testEnv.client).topicId);
new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
testEnv.close();
}
use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-sdk-java by hashgraph.
the class TopicDeleteIntegrationTest method cannotDeleteImmutableTopic.
@Test
@DisplayName("Cannot delete immutable topic")
void cannotDeleteImmutableTopic() throws Exception {
var testEnv = new IntegrationTestEnv(1);
var response = new TopicCreateTransaction().execute(testEnv.client);
var topicId = Objects.requireNonNull(response.getReceipt(testEnv.client).topicId);
assertThatExceptionOfType(ReceiptStatusException.class).isThrownBy(() -> {
new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
}).withMessageContaining(Status.UNAUTHORIZED.toString());
testEnv.close();
}
Aggregations