All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.openelements.hiero.base.protocol.TokenBurnRequest Maven / Gradle / Ivy

package com.openelements.hiero.base.protocol;

import com.hedera.hashgraph.sdk.Hbar;
import com.hedera.hashgraph.sdk.PrivateKey;
import com.hedera.hashgraph.sdk.TokenId;
import java.time.Duration;
import java.util.Objects;
import java.util.Set;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

public record TokenBurnRequest(@NonNull Hbar maxTransactionFee,
                               @NonNull Duration transactionValidDuration,
                               @NonNull TokenId tokenId,
                               @NonNull PrivateKey supplyKey,
                               @Nullable Long amount,
                               @Nullable Set serials) implements TransactionRequest {

    public TokenBurnRequest {
        Objects.requireNonNull(maxTransactionFee, "Max transaction fee cannot be null");
        Objects.requireNonNull(transactionValidDuration, "Transaction valid duration cannot be null");
        Objects.requireNonNull(tokenId, "Token ID cannot be null");
        Objects.requireNonNull(supplyKey, "Supply key cannot be null");
    }

    public static TokenBurnRequest of(TokenId tokenId, long serial, PrivateKey supplyKey) {
        return of(tokenId, Set.of(serial), supplyKey);
    }

    public static TokenBurnRequest of(TokenId tokenId, Set serials, PrivateKey supplyKey) {
        return new TokenBurnRequest(TransactionRequest.DEFAULT_MAX_TRANSACTION_FEE,
                TransactionRequest.DEFAULT_TRANSACTION_VALID_DURATION, tokenId, supplyKey, null, serials);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy