Search in sources :

Example 1 with TokenWipeAccountTransactionBody

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

the class EntityRecordItemListener method insertTokenAccountWipe.

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

Example 2 with TokenWipeAccountTransactionBody

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

the class OpUsageCtxHelperTest method getMetaForTokenWipeWorks.

@Test
void getMetaForTokenWipeWorks() {
    TokenWipeAccountTransactionBody wipeTxnBody = getUniqueTokenWipeOp();
    TransactionBody txn = getTxnBody(wipeTxnBody);
    given(accessor.getTxn()).willReturn(txn);
    given(accessor.getSubType()).willReturn(TOKEN_NON_FUNGIBLE_UNIQUE);
    final var tokenWipeMeta = subject.metaForTokenWipe(accessor);
    // then:
    assertEquals(32, tokenWipeMeta.getBpt());
    assertEquals(TOKEN_NON_FUNGIBLE_UNIQUE, tokenWipeMeta.getSubType());
    assertEquals(1, tokenWipeMeta.getSerialNumsCount());
    assertEquals(80, tokenWipeMeta.getTransferRecordDb());
}
Also used : TokenWipeAccountTransactionBody(com.hederahashgraph.api.proto.java.TokenWipeAccountTransactionBody) 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)

Example 3 with TokenWipeAccountTransactionBody

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

the class HapiTokenWipe method opBodyDef.

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

Aggregations

TokenWipeAccountTransactionBody (com.hederahashgraph.api.proto.java.TokenWipeAccountTransactionBody)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 TokenBurnTransactionBody (com.hederahashgraph.api.proto.java.TokenBurnTransactionBody)1 TokenFeeScheduleUpdateTransactionBody (com.hederahashgraph.api.proto.java.TokenFeeScheduleUpdateTransactionBody)1