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);
}
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));
}
}
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());
}
Aggregations