Search in sources :

Example 6 with CustomFractionalFee

use of com.hedera.hashgraph.sdk.CustomFractionalFee in project hedera-sdk-java by hashgraph.

the class TokenCreateIntegrationTest method canCreateTokenWithCustomFees.

@Test
@DisplayName("Can create token with custom fees")
void canCreateTokenWithCustomFees() throws Exception {
    var testEnv = new IntegrationTestEnv(1).useThrowawayAccount();
    var customFees = new ArrayList<CustomFee>();
    customFees.add(new CustomFixedFee().setAmount(10).setFeeCollectorAccountId(testEnv.operatorId));
    customFees.add(new CustomFractionalFee().setNumerator(1).setDenominator(20).setMin(1).setMax(10).setFeeCollectorAccountId(testEnv.operatorId));
    var tokenId = new TokenCreateTransaction().setTokenName("ffff").setTokenSymbol("F").setTreasuryAccountId(testEnv.operatorId).setAdminKey(testEnv.operatorKey).setCustomFees(customFees).execute(testEnv.client).getReceipt(testEnv.client).tokenId;
    testEnv.close(tokenId);
}
Also used : CustomFractionalFee(com.hedera.hashgraph.sdk.CustomFractionalFee) ArrayList(java.util.ArrayList) CustomFixedFee(com.hedera.hashgraph.sdk.CustomFixedFee) TokenCreateTransaction(com.hedera.hashgraph.sdk.TokenCreateTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

CustomFixedFee (com.hedera.hashgraph.sdk.CustomFixedFee)6 CustomFractionalFee (com.hedera.hashgraph.sdk.CustomFractionalFee)6 TokenCreateTransaction (com.hedera.hashgraph.sdk.TokenCreateTransaction)4 TokenFeeScheduleUpdateTransaction (com.hedera.hashgraph.sdk.TokenFeeScheduleUpdateTransaction)3 ArrayList (java.util.ArrayList)3 DisplayName (org.junit.jupiter.api.DisplayName)3 Test (org.junit.jupiter.api.Test)3 AccountId (com.hedera.hashgraph.sdk.AccountId)2 CustomFee (com.hedera.hashgraph.sdk.CustomFee)2 TokenInfoQuery (com.hedera.hashgraph.sdk.TokenInfoQuery)2 Var (com.google.errorprone.annotations.Var)1 AccountBalanceQuery (com.hedera.hashgraph.sdk.AccountBalanceQuery)1 AccountCreateTransaction (com.hedera.hashgraph.sdk.AccountCreateTransaction)1 AccountDeleteTransaction (com.hedera.hashgraph.sdk.AccountDeleteTransaction)1 Client (com.hedera.hashgraph.sdk.Client)1 Hbar (com.hedera.hashgraph.sdk.Hbar)1 PrivateKey (com.hedera.hashgraph.sdk.PrivateKey)1 TokenAssociateTransaction (com.hedera.hashgraph.sdk.TokenAssociateTransaction)1 TokenDeleteTransaction (com.hedera.hashgraph.sdk.TokenDeleteTransaction)1 TokenId (com.hedera.hashgraph.sdk.TokenId)1