@lyncworld/fuel-marketplace
Version:
Marketplace NPM SDK on Fuel blockchain. Powered by LYNC, it allows anyone to create their own decentralized marketplace which includes listing and buying of Non-fungible tokens (NFTs) and Semi-fungible tokens (SFTs) in a few lines of code.
33 lines (29 loc) • 810 B
text/typescript
import { Networks } from '@/enums';
import { SubgraphClient } from '../subgraph';
import { checkArguments } from '@/utils';
import { SubgraphCollectionData } from '@/interfaces';
const FETCH_COLLECTION_QUERY = `
query FetchCollection ($limit: Int = 100) {
Collection (
order_by: { db_write_timestamp: desc }
limit: $limit
) {
id
nftType
name
symbol
floorPrice
listed
}
}
`;
export const fetchCollections = (network: Networks, limit: number = 100) => {
checkArguments([network], 'arguments');
const subgraphClient = new SubgraphClient(network);
return subgraphClient
.setQueryString(FETCH_COLLECTION_QUERY)
.setVariables({
limit,
})
.query<SubgraphCollectionData[]>('Collection');
};