Search in sources :

Example 6 with NftId

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

the class NftRepositoryTest method updateAccountIdMissingNft.

@Test
void updateAccountIdMissingNft() {
    NftId nftId = new NftId(1L, EntityId.of("0.0.1", EntityType.TOKEN));
    EntityId accountId = EntityId.of("0.0.10", EntityType.ACCOUNT);
    nftRepository.transferNftOwnership(nftId, accountId, 3L);
    assertThat(nftRepository.findById(nftId)).isNotPresent();
}
Also used : EntityId(com.hedera.mirror.common.domain.entity.EntityId) NftId(com.hedera.mirror.common.domain.token.NftId) Test(org.junit.jupiter.api.Test)

Example 7 with NftId

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

the class NftRepositoryTest method nft.

private Nft nft(String tokenId, long serialNumber, long consensusTimestamp) {
    Nft nft = new Nft();
    nft.setAccountId(EntityId.of("0.0.1", EntityType.ACCOUNT));
    nft.setCreatedTimestamp(consensusTimestamp);
    nft.setId(new NftId(serialNumber, EntityId.of(tokenId, EntityType.TOKEN)));
    nft.setMetadata(new byte[] { 1 });
    nft.setModifiedTimestamp(consensusTimestamp);
    return nft;
}
Also used : NftId(com.hedera.mirror.common.domain.token.NftId) Nft(com.hedera.mirror.common.domain.token.Nft)

Example 8 with NftId

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

the class DomainBuilder method nft.

public DomainWrapper<Nft, Nft.NftBuilder> nft() {
    var createdTimestamp = timestamp();
    var builder = Nft.builder().accountId(entityId(ACCOUNT)).createdTimestamp(createdTimestamp).deleted(false).id(new NftId(id(), entityId(TOKEN))).metadata(bytes(16)).modifiedTimestamp(createdTimestamp);
    return new DomainWrapperImpl<>(builder, builder::build);
}
Also used : NftId(com.hedera.mirror.common.domain.token.NftId)

Example 9 with NftId

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

the class BatchUpserterTest method getNft.

private Nft getNft(String tokenId, long serialNumber, String accountId, Long createdTimestamp, long modifiedTimeStamp, String metadata, Boolean deleted) {
    Nft nft = new Nft();
    nft.setAccountId(accountId == null ? null : EntityId.of(accountId, EntityType.ACCOUNT));
    nft.setCreatedTimestamp(createdTimestamp);
    nft.setDeleted(deleted);
    nft.setId(new NftId(serialNumber, EntityId.of(tokenId, TOKEN)));
    nft.setMetadata(metadata == null ? null : metadata.getBytes(StandardCharsets.UTF_8));
    nft.setModifiedTimestamp(modifiedTimeStamp);
    return nft;
}
Also used : NftId(com.hedera.mirror.common.domain.token.NftId) Nft(com.hedera.mirror.common.domain.token.Nft)

Example 10 with NftId

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

the class NftRepositoryTest method updateDeletedMissingNft.

@Test
void updateDeletedMissingNft() {
    NftId nftId = new NftId(1L, EntityId.of("0.0.1", EntityType.TOKEN));
    nftRepository.burnOrWipeNft(nftId, 1L);
    assertThat(nftRepository.findById(nftId)).isNotPresent();
}
Also used : NftId(com.hedera.mirror.common.domain.token.NftId) Test(org.junit.jupiter.api.Test)

Aggregations

NftId (com.hedera.mirror.common.domain.token.NftId)12 Test (org.junit.jupiter.api.Test)6 Nft (com.hedera.mirror.common.domain.token.Nft)4 Transaction (com.hederahashgraph.api.proto.java.Transaction)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 EntityId (com.hedera.mirror.common.domain.entity.EntityId)2 NftAllowance (com.hederahashgraph.api.proto.java.NftAllowance)2 TokenTransferList (com.hederahashgraph.api.proto.java.TokenTransferList)2 LinkedList (java.util.LinkedList)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 BoolValue (com.google.protobuf.BoolValue)1 ByteString (com.google.protobuf.ByteString)1 Int32Value (com.google.protobuf.Int32Value)1 StringValue (com.google.protobuf.StringValue)1 AccountIdConverter (com.hedera.mirror.common.converter.AccountIdConverter)1 Contract (com.hedera.mirror.common.domain.contract.Contract)1 Entity (com.hedera.mirror.common.domain.entity.Entity)1 CryptoTransfer (com.hedera.mirror.common.domain.transaction.CryptoTransfer)1 ErrataType (com.hedera.mirror.common.domain.transaction.ErrataType)1 LiveHash (com.hedera.mirror.common.domain.transaction.LiveHash)1