com.openelements.hiero.base.implementation.NftRepositoryImpl Maven / Gradle / Ivy
package com.openelements.hiero.base.implementation;
import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.TokenId;
import com.openelements.hiero.base.HieroException;
import com.openelements.hiero.base.data.Nft;
import com.openelements.hiero.base.mirrornode.NftRepository;
import com.openelements.hiero.base.mirrornode.MirrorNodeClient;
import com.openelements.hiero.base.data.Page;
import java.util.Objects;
import java.util.Optional;
import org.jspecify.annotations.NonNull;
public class NftRepositoryImpl implements NftRepository {
private final MirrorNodeClient mirrorNodeClient;
public NftRepositoryImpl(@NonNull final MirrorNodeClient mirrorNodeClient) {
this.mirrorNodeClient = Objects.requireNonNull(mirrorNodeClient, "mirrorNodeClient must not be null");
}
@NonNull
@Override
public Page findByOwner(@NonNull final AccountId owner) throws HieroException {
return mirrorNodeClient.queryNftsByAccount(owner);
}
@NonNull
@Override
public Page findByType(@NonNull final TokenId tokenId) throws HieroException {
return mirrorNodeClient.queryNftsByTokenId(tokenId);
}
@NonNull
@Override
public Optional findByTypeAndSerial(@NonNull final TokenId tokenId, final long serialNumber)
throws HieroException {
return mirrorNodeClient.queryNftsByTokenIdAndSerial(tokenId, serialNumber);
}
@NonNull
@Override
public Page findByOwnerAndType(@NonNull final AccountId owner, @NonNull final TokenId tokenId)
throws HieroException {
return mirrorNodeClient.queryNftsByAccountAndTokenId(owner, tokenId);
}
@NonNull
@Override
public Optional findByOwnerAndTypeAndSerial(@NonNull final AccountId owner, @NonNull final TokenId tokenId,
final long serialNumber) throws HieroException {
return mirrorNodeClient.queryNftsByAccountAndTokenIdAndSerial(owner, tokenId, serialNumber);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy