Search in sources :

Example 1 with NftTransferId

use of com.hedera.mirror.common.domain.token.NftTransferId in project hedera-mirror-node by hashgraph.

the class SqlEntityListenerTest method getNftTransfer.

private NftTransfer getNftTransfer(long consensusTimestamp, String tokenId, long serialNumber, String receiverId, String senderId) {
    NftTransfer nftTransfer = new NftTransfer();
    nftTransfer.setId(new NftTransferId(consensusTimestamp, serialNumber, EntityId.of(tokenId, TOKEN)));
    nftTransfer.setReceiverAccountId(EntityId.of(receiverId, ACCOUNT));
    nftTransfer.setSenderAccountId(EntityId.of(senderId, ACCOUNT));
    nftTransfer.setPayerAccountId(TRANSACTION_PAYER);
    return nftTransfer;
}
Also used : NftTransfer(com.hedera.mirror.common.domain.token.NftTransfer) NftTransferId(com.hedera.mirror.common.domain.token.NftTransferId)

Example 2 with NftTransferId

use of com.hedera.mirror.common.domain.token.NftTransferId in project hedera-mirror-node by hashgraph.

the class EntityRecordItemListenerTokenTest method assertNftTransferInRepository.

private void assertNftTransferInRepository(long consensusTimestamp, long serialNumber, TokenID tokenID, AccountID receiverId, AccountID senderId) {
    EntityId receiver = receiverId != null ? EntityId.of(receiverId) : null;
    EntityId sender = senderId != null ? EntityId.of(senderId) : null;
    var id = new NftTransferId(consensusTimestamp, serialNumber, EntityId.of(tokenID));
    assertThat(nftTransferRepository.findById(id)).get().returns(receiver, from(com.hedera.mirror.common.domain.token.NftTransfer::getReceiverAccountId)).returns(sender, from(com.hedera.mirror.common.domain.token.NftTransfer::getSenderAccountId));
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) NftTransfer(com.hederahashgraph.api.proto.java.NftTransfer) NftTransferId(com.hedera.mirror.common.domain.token.NftTransferId)

Example 3 with NftTransferId

use of com.hedera.mirror.common.domain.token.NftTransferId in project hedera-mirror-node by hashgraph.

the class NftTransferRepositoryTest method saveMintTransfer.

@Test
void saveMintTransfer() {
    NftTransfer nftTransfer = new NftTransfer();
    nftTransfer.setId(new NftTransferId(1, 1, EntityId.of("0.0.1", EntityType.TOKEN)));
    nftTransfer.setReceiverAccountId(EntityId.of("0.0.2", EntityType.ACCOUNT));
    nftTransfer.setPayerAccountId(PAYER_ACCOUNT_ID);
    NftTransfer saved = repository.save(nftTransfer);
    assertThat(repository.findById(saved.getId())).contains(saved);
}
Also used : NftTransfer(com.hedera.mirror.common.domain.token.NftTransfer) NftTransferId(com.hedera.mirror.common.domain.token.NftTransferId) Test(org.junit.jupiter.api.Test)

Example 4 with NftTransferId

use of com.hedera.mirror.common.domain.token.NftTransferId in project hedera-mirror-node by hashgraph.

the class NftTransferRepositoryTest method save.

@Test
void save() {
    NftTransfer nftTransfer = new NftTransfer();
    nftTransfer.setId(new NftTransferId(1, 1, EntityId.of("0.0.1", EntityType.TOKEN)));
    nftTransfer.setReceiverAccountId(EntityId.of("0.0.2", EntityType.ACCOUNT));
    nftTransfer.setSenderAccountId(EntityId.of("0.0.3", EntityType.ACCOUNT));
    nftTransfer.setPayerAccountId(PAYER_ACCOUNT_ID);
    NftTransfer saved = repository.save(nftTransfer);
    assertThat(repository.findById(saved.getId())).contains(saved);
}
Also used : NftTransfer(com.hedera.mirror.common.domain.token.NftTransfer) NftTransferId(com.hedera.mirror.common.domain.token.NftTransferId) Test(org.junit.jupiter.api.Test)

Example 5 with NftTransferId

use of com.hedera.mirror.common.domain.token.NftTransferId in project hedera-mirror-node by hashgraph.

the class NftTransferRepositoryTest method saveBurnTransfer.

@Test
void saveBurnTransfer() {
    NftTransfer nftTransfer = new NftTransfer();
    nftTransfer.setId(new NftTransferId(1, 1, EntityId.of("0.0.1", EntityType.TOKEN)));
    nftTransfer.setSenderAccountId(EntityId.of("0.0.3", EntityType.ACCOUNT));
    nftTransfer.setPayerAccountId(PAYER_ACCOUNT_ID);
    NftTransfer saved = repository.save(nftTransfer);
    assertThat(repository.findById(saved.getId())).contains(saved);
}
Also used : NftTransfer(com.hedera.mirror.common.domain.token.NftTransfer) NftTransferId(com.hedera.mirror.common.domain.token.NftTransferId) Test(org.junit.jupiter.api.Test)

Aggregations

NftTransferId (com.hedera.mirror.common.domain.token.NftTransferId)12 NftTransfer (com.hedera.mirror.common.domain.token.NftTransfer)8 EntityId (com.hedera.mirror.common.domain.entity.EntityId)4 NftTransfer (com.hederahashgraph.api.proto.java.NftTransfer)4 Test (org.junit.jupiter.api.Test)4 Range (com.google.common.collect.Range)1 Entity (com.hedera.mirror.common.domain.entity.Entity)1 EntityIdEndec (com.hedera.mirror.common.domain.entity.EntityIdEndec)1 EntityType (com.hedera.mirror.common.domain.entity.EntityType)1 TOKEN (com.hedera.mirror.common.domain.entity.EntityType.TOKEN)1 TokenTransfer (com.hedera.mirror.common.domain.token.TokenTransfer)1 AssessedCustomFee (com.hedera.mirror.common.domain.transaction.AssessedCustomFee)1 CryptoTransfer (com.hedera.mirror.common.domain.transaction.CryptoTransfer)1 NonFeeTransfer (com.hedera.mirror.common.domain.transaction.NonFeeTransfer)1 TransactionType (com.hedera.mirror.common.domain.transaction.TransactionType)1 EnabledIfV1 (com.hedera.mirror.importer.EnabledIfV1)1 IntegrationTest (com.hedera.mirror.importer.IntegrationTest)1 CryptoTransferRepository (com.hedera.mirror.importer.repository.CryptoTransferRepository)1 EntityRepository (com.hedera.mirror.importer.repository.EntityRepository)1 NftTransferRepository (com.hedera.mirror.importer.repository.NftTransferRepository)1