use of com.hedera.mirror.common.domain.token.TokenAccount in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListener method insertTokenAccountUnfreeze.
private void insertTokenAccountUnfreeze(RecordItem recordItem) {
if (entityProperties.getPersist().isTokens()) {
TokenUnfreezeAccountTransactionBody tokenUnfreezeAccountTransactionBody = recordItem.getTransactionBody().getTokenUnfreeze();
EntityId tokenId = EntityId.of(tokenUnfreezeAccountTransactionBody.getToken());
EntityId accountId = EntityId.of(tokenUnfreezeAccountTransactionBody.getAccount());
long consensusTimestamp = recordItem.getConsensusTimestamp();
TokenAccount tokenAccount = new TokenAccount(tokenId, accountId, consensusTimestamp);
tokenAccount.setFreezeStatus(TokenFreezeStatusEnum.UNFROZEN);
entityListener.onTokenAccount(tokenAccount);
}
}
use of com.hedera.mirror.common.domain.token.TokenAccount 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.hedera.mirror.common.domain.token.TokenAccount in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListener method getAssociatedTokenAccount.
private TokenAccount getAssociatedTokenAccount(EntityId accountId, boolean automaticAssociation, long consensusTimestamp, TokenFreezeStatusEnum freezeStatus, TokenKycStatusEnum kycStatus, EntityId tokenId) {
TokenAccount tokenAccount = new TokenAccount(tokenId, accountId, consensusTimestamp);
tokenAccount.setAssociated(true);
tokenAccount.setAutomaticAssociation(automaticAssociation);
tokenAccount.setCreatedTimestamp(consensusTimestamp);
tokenAccount.setFreezeStatus(freezeStatus);
tokenAccount.setKycStatus(kycStatus);
return tokenAccount;
}
use of com.hedera.mirror.common.domain.token.TokenAccount in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListener method insertTokenAccountFreezeBody.
private void insertTokenAccountFreezeBody(RecordItem recordItem) {
if (entityProperties.getPersist().isTokens()) {
TokenFreezeAccountTransactionBody transactionBody = recordItem.getTransactionBody().getTokenFreeze();
EntityId tokenId = EntityId.of(transactionBody.getToken());
EntityId accountId = EntityId.of(transactionBody.getAccount());
TokenAccount tokenAccount = new TokenAccount(tokenId, accountId, recordItem.getConsensusTimestamp());
tokenAccount.setFreezeStatus(TokenFreezeStatusEnum.FROZEN);
entityListener.onTokenAccount(tokenAccount);
}
}
use of com.hedera.mirror.common.domain.token.TokenAccount in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListener method insertTokenAccountGrantKyc.
private void insertTokenAccountGrantKyc(RecordItem recordItem) {
if (entityProperties.getPersist().isTokens()) {
TokenGrantKycTransactionBody transactionBody = recordItem.getTransactionBody().getTokenGrantKyc();
EntityId tokenId = EntityId.of(transactionBody.getToken());
EntityId accountId = EntityId.of(transactionBody.getAccount());
TokenAccount tokenAccount = new TokenAccount(tokenId, accountId, recordItem.getConsensusTimestamp());
tokenAccount.setKycStatus(TokenKycStatusEnum.GRANTED);
entityListener.onTokenAccount(tokenAccount);
}
}
Aggregations