use of com.hederahashgraph.api.proto.java.TokenDissociateTransactionBody in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListener method insertTokenDissociate.
private void insertTokenDissociate(RecordItem recordItem) {
if (entityProperties.getPersist().isTokens()) {
TokenDissociateTransactionBody tokenDissociateTransactionBody = recordItem.getTransactionBody().getTokenDissociate();
EntityId accountId = EntityId.of(tokenDissociateTransactionBody.getAccount());
long consensusTimestamp = recordItem.getConsensusTimestamp();
tokenDissociateTransactionBody.getTokensList().forEach(token -> {
EntityId tokenId = EntityId.of(token);
TokenAccount tokenAccount = new TokenAccount(tokenId, accountId, consensusTimestamp);
tokenAccount.setAssociated(false);
entityListener.onTokenAccount(tokenAccount);
});
}
}
use of com.hederahashgraph.api.proto.java.TokenDissociateTransactionBody in project hedera-services by hashgraph.
the class HapiTokenDissociate method opBodyDef.
@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
var aId = TxnUtils.asId(account, spec);
TokenDissociateTransactionBody opBody = spec.txns().<TokenDissociateTransactionBody, TokenDissociateTransactionBody.Builder>body(TokenDissociateTransactionBody.class, b -> {
b.setAccount(aId);
b.addAllTokens(tokens.stream().map(lit -> TxnUtils.asTokenId(lit, spec)).collect(toList()));
});
return b -> b.setTokenDissociate(opBody);
}
Aggregations