Search in sources :

Example 11 with TokenId

use of com.hedera.hashgraph.sdk.TokenId in project hedera-mirror-node by hashgraph.

the class TokenFeature method burnNft.

@Given("I burn serial number {int} from token {int}")
public void burnNft(int serialNumberIndex, int tokenIndex) {
    TokenId tokenId = tokenIds.get(tokenIndex);
    networkTransactionResponse = tokenClient.burnNonFungible(tokenId, tokenSerialNumbers.get(tokenId).get(serialNumberIndex));
    assertNotNull(networkTransactionResponse.getTransactionId());
    assertNotNull(networkTransactionResponse.getReceipt());
}
Also used : TokenId(com.hedera.hashgraph.sdk.TokenId) Given(io.cucumber.java.en.Given)

Example 12 with TokenId

use of com.hedera.hashgraph.sdk.TokenId in project hedera-mirror-node by hashgraph.

the class TokenClient method createNonFungibleToken.

public NetworkTransactionResponse createNonFungibleToken(ExpandedAccountId expandedAccountId, String symbol, int freezeStatus, int kycStatus, ExpandedAccountId treasuryAccount, TokenSupplyType tokenSupplyType, long maxSupply, List<CustomFee> customFees) {
    log.debug("Create new non-fungible token {}", symbol);
    TokenCreateTransaction tokenCreateTransaction = getTokenCreateTransaction(expandedAccountId, symbol, freezeStatus, kycStatus, treasuryAccount, TokenType.NON_FUNGIBLE_UNIQUE, tokenSupplyType, maxSupply, customFees);
    NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenCreateTransaction, KeyList.of(treasuryAccount.getPrivateKey()));
    TokenId tokenId = networkTransactionResponse.getReceipt().tokenId;
    log.debug("Created new non-fungible token {}", tokenId);
    return networkTransactionResponse;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) TokenCreateTransaction(com.hedera.hashgraph.sdk.TokenCreateTransaction) TokenId(com.hedera.hashgraph.sdk.TokenId)

Example 13 with TokenId

use of com.hedera.hashgraph.sdk.TokenId in project hedera-mirror-node by hashgraph.

the class TokenClient method createFungibleToken.

public NetworkTransactionResponse createFungibleToken(ExpandedAccountId expandedAccountId, String symbol, int freezeStatus, int kycStatus, ExpandedAccountId treasuryAccount, int initialSupply, TokenSupplyType tokenSupplyType, long maxSupply, List<CustomFee> customFees) {
    log.debug("Create new fungible token {}", symbol);
    TokenCreateTransaction tokenCreateTransaction = getTokenCreateTransaction(expandedAccountId, symbol, freezeStatus, kycStatus, treasuryAccount, TokenType.FUNGIBLE_COMMON, tokenSupplyType, maxSupply, customFees).setDecimals(10).setInitialSupply(initialSupply);
    NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenCreateTransaction, KeyList.of(treasuryAccount.getPrivateKey()));
    TokenId tokenId = networkTransactionResponse.getReceipt().tokenId;
    log.debug("Created new fungible token {}", tokenId);
    return networkTransactionResponse;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) TokenCreateTransaction(com.hedera.hashgraph.sdk.TokenCreateTransaction) TokenId(com.hedera.hashgraph.sdk.TokenId)

Example 14 with TokenId

use of com.hedera.hashgraph.sdk.TokenId in project hedera-mirror-node by hashgraph.

the class TokenFeature method verifyMirrorTokenWithCustomFeesSchedule.

@Then("the mirror node REST API should confirm token {int} with custom fees schedule")
@Retryable(value = { AssertionError.class }, backoff = @Backoff(delayExpression = "#{@restPollingProperties.minBackoff.toMillis()}"), maxAttemptsExpression = "#{@restPollingProperties.maxAttempts}")
public void verifyMirrorTokenWithCustomFeesSchedule(Integer tokenIndex) {
    MirrorTransaction transaction = verifyTransactions(200);
    TokenId tokenId = tokenIds.get(getIndexOrDefault(tokenIndex));
    verifyTokenWithCustomFeesSchedule(tokenId, transaction.getConsensusTimestamp());
}
Also used : MirrorTransaction(com.hedera.mirror.test.e2e.acceptance.props.MirrorTransaction) TokenId(com.hedera.hashgraph.sdk.TokenId) Retryable(org.springframework.retry.annotation.Retryable) Then(io.cucumber.java.en.Then)

Example 15 with TokenId

use of com.hedera.hashgraph.sdk.TokenId in project hedera-mirror-node by hashgraph.

the class TokenFeature method transferNftsToRecipient.

@Then("^I transfer serial number (?:(.*) )?of token (?:(.*) )?to recipient(?: (.*))?$")
public void transferNftsToRecipient(Integer serialNumberIndex, Integer tokenIndex, Integer recipientIndex) {
    ExpandedAccountId payer = tokenClient.getSdkClient().getExpandedOperatorAccountId();
    TokenId tokenId = tokenIds.get(getIndexOrDefault(tokenIndex));
    transferNfts(tokenId, tokenSerialNumbers.get(tokenId).get(getIndexOrDefault(serialNumberIndex)), payer, recipients.get(getIndexOrDefault(recipientIndex)).getAccountId());
}
Also used : ExpandedAccountId(com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId) TokenId(com.hedera.hashgraph.sdk.TokenId) Then(io.cucumber.java.en.Then)

Aggregations

TokenId (com.hedera.hashgraph.sdk.TokenId)17 Then (io.cucumber.java.en.Then)5 TokenCreateTransaction (com.hedera.hashgraph.sdk.TokenCreateTransaction)4 ExpandedAccountId (com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId)4 Given (io.cucumber.java.en.Given)4 Retryable (org.springframework.retry.annotation.Retryable)4 TransferTransaction (com.hedera.hashgraph.sdk.TransferTransaction)3 AccountCreateTransaction (com.hedera.hashgraph.sdk.AccountCreateTransaction)2 AccountDeleteTransaction (com.hedera.hashgraph.sdk.AccountDeleteTransaction)2 AccountId (com.hedera.hashgraph.sdk.AccountId)2 Client (com.hedera.hashgraph.sdk.Client)2 Hbar (com.hedera.hashgraph.sdk.Hbar)2 PrivateKey (com.hedera.hashgraph.sdk.PrivateKey)2 TokenAssociateTransaction (com.hedera.hashgraph.sdk.TokenAssociateTransaction)2 TokenDeleteTransaction (com.hedera.hashgraph.sdk.TokenDeleteTransaction)2 TransactionReceipt (com.hedera.hashgraph.sdk.TransactionReceipt)2 NetworkTransactionResponse (com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse)2 Var (com.google.errorprone.annotations.Var)1 AccountBalanceQuery (com.hedera.hashgraph.sdk.AccountBalanceQuery)1 CustomFee (com.hedera.hashgraph.sdk.CustomFee)1