Search in sources :

Example 1 with TokenBurnTransactionBody

use of com.hederahashgraph.api.proto.java.TokenBurnTransactionBody in project hedera-services by hashgraph.

the class HapiTokenBurn method opBodyDef.

@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
    var tId = TxnUtils.asTokenId(token, spec);
    TokenBurnTransactionBody opBody = spec.txns().<TokenBurnTransactionBody, TokenBurnTransactionBody.Builder>body(TokenBurnTransactionBody.class, b -> {
        b.setToken(tId);
        b.setAmount(amount);
        b.addAllSerialNumbers(serialNumbers);
    });
    return b -> b.setTokenBurn(opBody);
}
Also used : Transaction(com.hederahashgraph.api.proto.java.Transaction) TokenOpsUsage(com.hedera.services.usage.token.TokenOpsUsage) TOKEN_OPS_USAGE_UTILS(com.hedera.services.usage.token.TokenOpsUsageUtils.TOKEN_OPS_USAGE_UTILS) HapiTxnOp(com.hedera.services.bdd.spec.transactions.HapiTxnOp) FeeData(com.hederahashgraph.api.proto.java.FeeData) MoreObjects(com.google.common.base.MoreObjects) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) Key(com.hederahashgraph.api.proto.java.Key) List(java.util.List) AdapterUtils(com.hedera.services.bdd.spec.fees.AdapterUtils) TxnUtils(com.hedera.services.bdd.spec.transactions.TxnUtils) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) TxnUtils.suFrom(com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom) SubType(com.hederahashgraph.api.proto.java.SubType) TransactionResponse(com.hederahashgraph.api.proto.java.TransactionResponse) TokenBurnTransactionBody(com.hederahashgraph.api.proto.java.TokenBurnTransactionBody) SigValueObj(com.hederahashgraph.fee.SigValueObj) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) TokenBurnTransactionBody(com.hederahashgraph.api.proto.java.TokenBurnTransactionBody)

Example 2 with TokenBurnTransactionBody

use of com.hederahashgraph.api.proto.java.TokenBurnTransactionBody in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListener method insertTokenBurn.

private void insertTokenBurn(RecordItem recordItem) {
    if (entityProperties.getPersist().isTokens()) {
        TokenBurnTransactionBody tokenBurnTransactionBody = recordItem.getTransactionBody().getTokenBurn();
        EntityId tokenId = EntityId.of(tokenBurnTransactionBody.getToken());
        long consensusTimestamp = recordItem.getConsensusTimestamp();
        updateTokenSupply(tokenId, recordItem.getRecord().getReceipt().getNewTotalSupply(), consensusTimestamp);
        tokenBurnTransactionBody.getSerialNumbersList().forEach(serialNumber -> updateNftDeleteStatus(consensusTimestamp, serialNumber, tokenId));
    }
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) TokenBurnTransactionBody(com.hederahashgraph.api.proto.java.TokenBurnTransactionBody)

Example 3 with TokenBurnTransactionBody

use of com.hederahashgraph.api.proto.java.TokenBurnTransactionBody in project hedera-services by hashgraph.

the class OpUsageCtxHelperTest method getMetaForTokenBurnWorks.

@Test
void getMetaForTokenBurnWorks() {
    TokenBurnTransactionBody burnTxnBody = getFungibleCommonTokenBurnOp();
    TransactionBody txn = getTxnBody(burnTxnBody);
    given(accessor.getTxn()).willReturn(txn);
    given(accessor.getSubType()).willReturn(TOKEN_FUNGIBLE_COMMON);
    final var tokenBurnMeta = subject.metaForTokenBurn(accessor);
    // then:
    assertEquals(32, tokenBurnMeta.getBpt());
    assertEquals(SubType.TOKEN_FUNGIBLE_COMMON, tokenBurnMeta.getSubType());
    assertEquals(0, tokenBurnMeta.getSerialNumsCount());
    assertEquals(56, tokenBurnMeta.getTransferRecordDb());
}
Also used : TokenBurnTransactionBody(com.hederahashgraph.api.proto.java.TokenBurnTransactionBody) FileAppendTransactionBody(com.hederahashgraph.api.proto.java.FileAppendTransactionBody) TokenFeeScheduleUpdateTransactionBody(com.hederahashgraph.api.proto.java.TokenFeeScheduleUpdateTransactionBody) TokenMintTransactionBody(com.hederahashgraph.api.proto.java.TokenMintTransactionBody) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) TokenWipeAccountTransactionBody(com.hederahashgraph.api.proto.java.TokenWipeAccountTransactionBody) TokenBurnTransactionBody(com.hederahashgraph.api.proto.java.TokenBurnTransactionBody) Test(org.junit.jupiter.api.Test)

Aggregations

TokenBurnTransactionBody (com.hederahashgraph.api.proto.java.TokenBurnTransactionBody)3 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)2 MoreObjects (com.google.common.base.MoreObjects)1 EntityId (com.hedera.mirror.common.domain.entity.EntityId)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 AdapterUtils (com.hedera.services.bdd.spec.fees.AdapterUtils)1 HapiTxnOp (com.hedera.services.bdd.spec.transactions.HapiTxnOp)1 TxnUtils (com.hedera.services.bdd.spec.transactions.TxnUtils)1 TxnUtils.suFrom (com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom)1 BaseTransactionMeta (com.hedera.services.usage.BaseTransactionMeta)1 UsageAccumulator (com.hedera.services.usage.state.UsageAccumulator)1 TokenOpsUsage (com.hedera.services.usage.token.TokenOpsUsage)1 TOKEN_OPS_USAGE_UTILS (com.hedera.services.usage.token.TokenOpsUsageUtils.TOKEN_OPS_USAGE_UTILS)1 FeeData (com.hederahashgraph.api.proto.java.FeeData)1 FileAppendTransactionBody (com.hederahashgraph.api.proto.java.FileAppendTransactionBody)1 HederaFunctionality (com.hederahashgraph.api.proto.java.HederaFunctionality)1 Key (com.hederahashgraph.api.proto.java.Key)1 SubType (com.hederahashgraph.api.proto.java.SubType)1 TokenFeeScheduleUpdateTransactionBody (com.hederahashgraph.api.proto.java.TokenFeeScheduleUpdateTransactionBody)1 TokenMintTransactionBody (com.hederahashgraph.api.proto.java.TokenMintTransactionBody)1