use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccountThrows.
@Test
void lookupAccountThrows() {
AccountID accountId = AccountID.newBuilder().setRealmNum(1).build();
assertThrows(InvalidDatasetException.class, () -> entityIdService.lookup(accountId));
}
use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccountNum.
@Test
void lookupAccountNum() {
AccountID accountId = AccountID.newBuilder().setAccountNum(100).build();
assertThat(entityIdService.lookup(accountId)).isEqualTo(EntityId.of(100, ACCOUNT));
}
use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccountWithEvmAddress.
@Test
void lookupAccountWithEvmAddress() {
AccountID accountId = AccountID.newBuilder().setAlias(DomainUtils.fromBytes(PARSABLE_EVM_ADDRESS)).build();
assertThat(entityIdService.lookup(accountId)).isEqualTo(EntityId.of(100, CONTRACT));
}
use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class EntityIdServiceImplTest method lookupAccounts.
@Test
void lookupAccounts() {
AccountID nullAccountId = null;
AccountID accountId = AccountID.newBuilder().setAccountNum(100).build();
AccountID accountIdInvalid = AccountID.newBuilder().setRealmNum(1).build();
Entity accountDeleted = domainBuilder.entity().customize(e -> e.deleted(true)).persist();
EntityId entityId = entityIdService.lookup(nullAccountId, AccountID.getDefaultInstance(), getProtoAccountId(accountDeleted), accountIdInvalid, accountId);
assertThat(entityId).isEqualTo(EntityId.of(accountId));
}
use of com.hederahashgraph.api.proto.java.AccountID in project hedera-mirror-node by hashgraph.
the class TokenUpdateTransactionHandlerTest method updateTreasury.
@Test
void updateTreasury() {
AbstractEntity entity = getExpectedUpdatedEntity();
AccountID previousAccountId = AccountID.newBuilder().setAccountNum(1L).build();
AccountID newAccountId = AccountID.newBuilder().setAccountNum(2L).build();
TokenID tokenID = TokenID.newBuilder().setTokenNum(3L).build();
long consensusTimestamp = DomainUtils.timestampInNanosMax(MODIFIED_TIMESTAMP);
TokenTransferList tokenTransferList = TokenTransferList.newBuilder().setToken(tokenID).addNftTransfers(NftTransfer.newBuilder().setReceiverAccountID(newAccountId).setSenderAccountID(previousAccountId).setSerialNumber(NftTransferId.WILDCARD_SERIAL_NUMBER).build()).build();
TransactionRecord record = getDefaultTransactionRecord().addTokenTransferLists(tokenTransferList).build();
RecordItem recordItem = getRecordItem(getDefaultTransactionBody().build(), record);
when(entityIdService.lookup(AccountID.newBuilder().setAccountNum(DEFAULT_AUTO_RENEW_ACCOUNT_NUM).build())).thenReturn(EntityIdEndec.decode(DEFAULT_AUTO_RENEW_ACCOUNT_NUM, EntityType.ACCOUNT));
Transaction transaction = new Transaction();
transaction.setEntityId(entity.toEntityId());
transactionHandler.updateTransaction(transaction, recordItem);
TransactionBody body = recordItem.getTransactionBody();
var payerAccount = EntityId.of(body.getTransactionID().getAccountID()).toEntity().getId();
verify(nftRepository).updateTreasury(tokenID.getTokenNum(), previousAccountId.getAccountNum(), newAccountId.getAccountNum(), consensusTimestamp, payerAccount, false);
}
Aggregations