use of com.hedera.hashgraph.sdk.TokenCreateTransaction in project hedera-sdk-java by hashgraph.
the class TokenCreateIntegrationTest method cannotCreateTokenWhenTokenNameIsNotSet.
@Test
@DisplayName("Cannot create token when token name is not set")
void cannotCreateTokenWhenTokenNameIsNotSet() throws Exception {
var testEnv = new IntegrationTestEnv(1).useThrowawayAccount();
assertThatExceptionOfType(PrecheckStatusException.class).isThrownBy(() -> {
new TokenCreateTransaction().setTokenSymbol("F").setTreasuryAccountId(testEnv.operatorId).execute(testEnv.client).getReceipt(testEnv.client);
}).withMessageContaining(Status.MISSING_TOKEN_NAME.toString());
testEnv.close();
}
use of com.hedera.hashgraph.sdk.TokenCreateTransaction in project hedera-sdk-java by hashgraph.
the class TokenCreateIntegrationTest method canCreateTokenWithOperatorAsAllKeys.
@Test
@DisplayName("Can create token with operator as all keys")
void canCreateTokenWithOperatorAsAllKeys() throws Exception {
var testEnv = new IntegrationTestEnv(1).useThrowawayAccount();
var response = new TokenCreateTransaction().setTokenName("ffff").setTokenSymbol("F").setDecimals(3).setInitialSupply(1000000).setTreasuryAccountId(testEnv.operatorId).setAdminKey(testEnv.operatorKey).setFreezeKey(testEnv.operatorKey).setWipeKey(testEnv.operatorKey).setKycKey(testEnv.operatorKey).setSupplyKey(testEnv.operatorKey).setFeeScheduleKey(testEnv.operatorKey).setFreezeDefault(false).execute(testEnv.client);
var tokenId = Objects.requireNonNull(response.getReceipt(testEnv.client).tokenId);
testEnv.close(tokenId);
}
use of com.hedera.hashgraph.sdk.TokenCreateTransaction in project hedera-sdk-java by hashgraph.
the class TokenDeleteIntegrationTest method canDeleteToken.
@Test
@DisplayName("Can delete token")
void canDeleteToken() throws Exception {
var testEnv = new IntegrationTestEnv(1).useThrowawayAccount();
var response = new TokenCreateTransaction().setTokenName("ffff").setTokenSymbol("F").setDecimals(3).setInitialSupply(1000000).setTreasuryAccountId(testEnv.operatorId).setAdminKey(testEnv.operatorKey).setFreezeKey(testEnv.operatorKey).setWipeKey(testEnv.operatorKey).setKycKey(testEnv.operatorKey).setSupplyKey(testEnv.operatorKey).setFreezeDefault(false).execute(testEnv.client);
var tokenId = Objects.requireNonNull(response.getReceipt(testEnv.client).tokenId);
new TokenDeleteTransaction().setTokenId(tokenId).execute(testEnv.client).getReceipt(testEnv.client);
testEnv.close();
}
use of com.hedera.hashgraph.sdk.TokenCreateTransaction in project hedera-sdk-java by hashgraph.
the class TokenDeleteIntegrationTest method canDeleteTokenWithOnlyAdminKeySet.
@Test
@DisplayName("Can delete token with only admin key set")
void canDeleteTokenWithOnlyAdminKeySet() throws Exception {
var testEnv = new IntegrationTestEnv(1).useThrowawayAccount();
var response = new TokenCreateTransaction().setTokenName("ffff").setTokenSymbol("F").setTreasuryAccountId(testEnv.operatorId).setAdminKey(testEnv.operatorKey).execute(testEnv.client);
var tokenId = Objects.requireNonNull(response.getReceipt(testEnv.client).tokenId);
testEnv.close(tokenId);
}
use of com.hedera.hashgraph.sdk.TokenCreateTransaction in project hedera-sdk-java by hashgraph.
the class TokenMintIntegrationTest method canMintTokens.
@Test
@DisplayName("Can mint tokens")
void canMintTokens() throws Exception {
var testEnv = new IntegrationTestEnv(1).useThrowawayAccount();
var tokenId = Objects.requireNonNull(new TokenCreateTransaction().setTokenName("ffff").setTokenSymbol("F").setDecimals(3).setInitialSupply(1000000).setTreasuryAccountId(testEnv.operatorId).setAdminKey(testEnv.operatorKey).setFreezeKey(testEnv.operatorKey).setWipeKey(testEnv.operatorKey).setKycKey(testEnv.operatorKey).setSupplyKey(testEnv.operatorKey).setFreezeDefault(false).execute(testEnv.client).getReceipt(testEnv.client).tokenId);
var receipt = new TokenMintTransaction().setAmount(10).setTokenId(tokenId).execute(testEnv.client).getReceipt(testEnv.client);
assertThat(receipt.totalSupply).isEqualTo(1000000 + 10);
testEnv.close(tokenId);
}
Aggregations