Skip to content

RostislavLitovkin/Uniquery.Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Everything in this repo has been coded from scratch during the Polkadot Global Series hackathon (3 – 23 July 2023).

This project is production ready.

Uniquery.Net

Easy to use tool for querying indexed NFT data.

This is a c# implementation of Uniquery with many improvements on top.

Improvements

  • Overall structure has been improved:
    • confusing method getClient("name") has been replaced with static functions.
    • All types have been converted to native c# classes
  • Uniquery.Universal - very cozy way to query data from multiple endpoints at the same time.
  • Inclusion of new Networks/NftStandards, that are missing in the original uniquery: Acala, Astar, Shiden, Unique, Quartz, Opal
  • More flexible parameters

Installation

Nuget package: https://www.nuget.org/packages/Uniquery/

dotnet add package Uniquery

Supported Networks/NftStandards

  • Rmrk
  • RmrkV2
  • Basilisk
  • Glmr
  • Movr
  • Unique
  • Quartz
  • Opal
  • Acala (OnFinality BETA)
  • Astar (OnFinality BETA)
  • Shiden (OnFinality BETA)

Motivation

Originally, I just wanted query NFT data to display them in PlutoWallet. Afterwards, I received request from Kodadot to make a full c# implementation, hence, here it is.

This tool will be useful to many people and will significantly simplify the querying of NFT data.

Without Uniquery you would have to write something like this:

query itemListByCollectionIdList {
  nft: nftEntities(where: { collection: { id_eq: "7EA1DCF47E98A25067-CAVE" }}) {
    id
    metadata
    currentOwner
    issuer
  }
}

With Uniquery you can write this:

string id = "7EA1DCF47E98A25067-CAVE";
var nfts = await Uniquery.Rmrk.NftListByCollectionId(id);

Use of Uniquery.Universal

One of the major improvements over the original Kodadot/Uniquery js package is the inclusion of Uniquery.Universal

Without Uniquery.Universal you would have to write something like this:

string address = "5HGuhwGJZC5zvWQm1kGpobJxwAv6bUtKyLGjKL7m2YaJtmDQ";
List<Nft> nfts = new List<Nft>();
nfts.AddRange(await Rmrk.NftListByOwner(address, limit, offset, orderBy, forSale, eventsLimit));
nfts.AddRange(await RmrkV2.NftListByOwner(address, limit, offset, orderBy, forSale, eventsLimit));
nfts.AddRange(await Unique.NftListByOwner(address, limit, offset));
nfts.AddRange(await Quartz.NftListByOwner(address, limit, offset));
nfts.AddRange(await Opal.NftListByOwner(address, limit, offset));
nfts.AddRange(await Basilisk.NftListByOwner(address, limit, offset, orderBy, forSale, eventsLimit));
nfts.AddRange(await Glmr.NftListByOwner(address, limit, offset, orderBy, forSale, eventsLimit));
nfts.AddRange(await Movr.NftListByOwner(address, limit, offset, orderBy, forSale, eventsLimit));
nfts.AddRange(await Acala.NftListByOwner(address, limit, offset));
nfts.AddRange(await Astar.NftListByOwner(address, limit, offset));
nfts.AddRange(await Shiden.NftListByOwner(address, limit, offset));

With Uniquery.Universal you can write this:

string address = "5HGuhwGJZC5zvWQm1kGpobJxwAv6bUtKyLGjKL7m2YaJtmDQ";
List<Nft> nfts = Uniquery.Universal.NftListByOwner(address);

Documentation

Methods

  • CollectionById - Returns collection by id.
  • CollectionListByIssuer - returns collections where issuer (creator) is equal to provided address
  • CollectionListByName - returns collections where name contains provided name
  • CollectionListByOwner - returns collections where owner is equal to provided address
  • NftById - returns NFT by id
  • NftListByCollectionId - returns NFTs where collection id is equal to provided id
  • NftListByName - returns NFTs by name
  • NftListByMetadataId - returns NFTs where metadata match Nft metadata id
  • NftListByCollectionMetadataId - returns NFTs where metadata match Collection metadata id
  • NftListByOwner - returns NFTs owned by the address
  • NftList - returns NFTs
  • EventList - returns all events
  • EventListByAddress - returns events by address
  • EventListByCollectionId - returns events by collection id
  • EventListByInteraction - returns events by interaction
  • EventListByNftId - returns events by nft id

Parameters

  • <custom_parameter> = custom filter parameter
  • limit = number of returned items, Default = 25
  • offset = offset of index of the returned items, Default = 0
  • orderBy = ordering of the returned items, Default = <time_desc>

In-code documentation with wispering and examples is also included: Screenshot 2023-07-07 at 11 49 19

Techstack used

  • C#, graphql
  • Subsquid api
  • Unique network api
  • OnFinality Unified NFT api (BETA)

Inspiration

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages