use of com.hedera.hashgraph.sdk.TokenBurnTransaction in project hedera-mirror-node by hashgraph.
the class TokenClient method burnNonFungible.
public NetworkTransactionResponse burnNonFungible(TokenId tokenId, long serialNumber) {
log.debug("Burn serial number {} from token {}", serialNumber, tokenId);
TokenBurnTransaction tokenBurnTransaction = getTokenBurnTransaction(tokenId).addSerial(serialNumber).setTransactionMemo(getMemo("Token burn"));
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenBurnTransaction);
log.debug("Burned serial number {} from token {}", serialNumber, tokenId);
return networkTransactionResponse;
}
use of com.hedera.hashgraph.sdk.TokenBurnTransaction in project hedera-mirror-node by hashgraph.
the class TokenClient method burnFungible.
public NetworkTransactionResponse burnFungible(TokenId tokenId, long amount) {
log.debug("Burn {} tokens from {}", amount, tokenId);
TokenBurnTransaction tokenBurnTransaction = getTokenBurnTransaction(tokenId).setAmount(amount).setTransactionMemo(getMemo("Token burn"));
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenBurnTransaction);
log.debug("Burned {} extra tokens for token {}", amount, tokenId);
return networkTransactionResponse;
}
use of com.hedera.hashgraph.sdk.TokenBurnTransaction in project hedera-mirror-node by hashgraph.
the class TokenBurnTransactionSupplierTest method createWithCustomFungibleData.
@Test
void createWithCustomFungibleData() {
TokenBurnTransactionSupplier tokenBurnTransactionSupplier = new TokenBurnTransactionSupplier();
tokenBurnTransactionSupplier.setAmount(2);
tokenBurnTransactionSupplier.setMaxTransactionFee(1);
tokenBurnTransactionSupplier.setTokenId(TOKEN_ID.toString());
tokenBurnTransactionSupplier.setType(TokenType.FUNGIBLE_COMMON);
TokenBurnTransaction actual = tokenBurnTransactionSupplier.get();
assertThat(actual).returns(2L, TokenBurnTransaction::getAmount).returns(ONE_TINYBAR, TokenBurnTransaction::getMaxTransactionFee).returns(Collections.emptyList(), TokenBurnTransaction::getSerials).returns(TOKEN_ID, TokenBurnTransaction::getTokenId);
}
use of com.hedera.hashgraph.sdk.TokenBurnTransaction in project hedera-mirror-node by hashgraph.
the class TokenBurnTransactionSupplierTest method createWithMinimumData.
@Test
void createWithMinimumData() {
TokenBurnTransactionSupplier tokenBurnTransactionSupplier = new TokenBurnTransactionSupplier();
tokenBurnTransactionSupplier.setTokenId(TOKEN_ID.toString());
TokenBurnTransaction actual = tokenBurnTransactionSupplier.get();
assertThat(actual).returns(1L, TokenBurnTransaction::getAmount).returns(MAX_TRANSACTION_FEE_HBAR, TokenBurnTransaction::getMaxTransactionFee).returns(Collections.emptyList(), TokenBurnTransaction::getSerials).returns(TOKEN_ID, TokenBurnTransaction::getTokenId);
}
use of com.hedera.hashgraph.sdk.TokenBurnTransaction in project hedera-mirror-node by hashgraph.
the class TokenBurnTransactionSupplierTest method createWithCustomNonFungibleData.
@Test
void createWithCustomNonFungibleData() {
TokenBurnTransactionSupplier tokenBurnTransactionSupplier = new TokenBurnTransactionSupplier();
tokenBurnTransactionSupplier.setAmount(2);
tokenBurnTransactionSupplier.setMaxTransactionFee(1);
tokenBurnTransactionSupplier.setSerialNumber(new AtomicLong(10));
tokenBurnTransactionSupplier.setTokenId(TOKEN_ID.toString());
tokenBurnTransactionSupplier.setType(TokenType.NON_FUNGIBLE_UNIQUE);
TokenBurnTransaction actual = tokenBurnTransactionSupplier.get();
assertThat(actual).returns(0L, TokenBurnTransaction::getAmount).returns(ONE_TINYBAR, TokenBurnTransaction::getMaxTransactionFee).returns(TOKEN_ID, TokenBurnTransaction::getTokenId).returns(Arrays.asList(10L, 11L), TokenBurnTransaction::getSerials);
}
Aggregations