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