Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zoralabs/zdk

Package Overview
Dependencies
Maintainers
22
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zoralabs/zdk

ZDK: ZORA Developer Kit

  • 2.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
decreased by-10.71%
Maintainers
22
Weekly downloads
 
Created
Source

ZDK 2.0

If you're looking for 1.0 branch use v1-archive

Getting started

// assuming you set API_ENDPOINT to https://api.zora.co/graphql

const { API_ENDPOINT } = process.env.API_ENDPOINT;

const zdk = new ZDK(API_ENDPOINT, [
  {
    chain: Chain.Mainnet,
    network: Network.Ethereum,
  },
]);

ZDK

ZDK Main Interface class

Kind: global class

Examples Here

zdK.tokens(where, filter, pagination, networks, sort, includeFullDetails, includeSalesDetails) ⇒

Gets data on a group of tokens based on query parameters.

Returns: Promise of response from tokens of type TokensQuery

ParamDescription
whereArguments to filter tokens by, required.
where.collectionAddressesList of collection addresses to filter by
where.ownerAddressesList of owner addresses to filter by
where.tokens:Tuple of token and id to filter by an exact match as a list
filterFilter query parameters after the where query
paginationSettings for pagination
networksNetworks to query on
sortSorting information for tokens
includeFullDetailsinclude entire token details (full uris, history etc.)
includeSalesDetailsinclude full token sale details for the last 10 sales

zdK.token(args) ⇒ Promise.<TokenQuery>

Gets data on a single NFT give a contract address and tokenId.

Returns: Promise.<TokenQuery> - Token graphql response

ParamTypeDescription
argsarguemnts for query object
args.tokenToken parameters
args.token.addressstringaddress of the token (req'd)
args.token.tokenIdstringstring ID of the token (req'd)
args.networkthe network to use to retrieve the token
args.network.chainChainChain to use (default ETHEREUM)
args.network.networkNetworkNetwork on the given chain to use (default MAINNET)
args.includeFullDetailsboolshould full details be added to the response

zdK.events(where, filter, pagination, networks, sort) ⇒

Gets all the events associated with a collection, token, or owner address e.g. Transfers, Mints, Sales, Approvals

Returns: Promise.<EventsQuery> - Events graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.collectionAddressesList of collection addresses to filter by
where.tokens:Tuple of token and id to filter by an exact match as a list
filterFilter query parameters after the where query
filter.bidderAddressesA string array of addresses that have bid on this NFT
filter.eventTypesAn array of EventTypes
filter.recipientAddressesA string array of addresses that have received this NFT
filter.sellerAddressesA string array of addresses that have sold this NFT
filter.senderAddressesA string array of addresses that have sent this NFT
filter.timeFilterAn input of type TimeFilter for time partitioned event responses.
paginationSettings for pagination
pagination.afterA string specifying which record to begin pagination
pagination.limitAn int setting the number of event records per page
networksNetwork info to query on as an array of enums
networks.chainChain to query on (currently only MAINNET)
networks.networkNetwork to query on (currently only ETHEREUM)
sortSorting information for tokens
sort.directionAn enum value specifying the direction of resultsASC, DESC
sort.sortKeyAn enum value specifying the value to sort results byChainTokenPrice, Created, NativePrice, None, TimeSaleEnding

zdK.markets(where, filter, pagination, networks, sort, includeFullDetails) ⇒

Gets NFTs that are active on the Zora markets e.g. Buy Now, Offers, Auctions

Returns: Promise.<MarketsQuery> - Markets graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.collectionAddressesList of collection addresses to filter by
where.tokens:Tuple of token and id to filter by an exact match as a list
filterFilter query parameters after the where query
filter.marketQueryFilterArguments for filtering market info expectations
marketQueryFilter.bidderAddressesA string array of addresses that have bid for this NFT
marketQueryFilter.marketTypeAn enum specifying the version of Zora the order is made onV1Ask, V1BidShare, V1Offer, V2Auction, V3Ask
marketQueryFilter.statusesAn enum specifying status of orders being returnedActive, Canceled, Completed
filter.priceFilterArguments for filtering price ranges
priceFilter.currencyAddressA string specifying the currency being used for the market transaction to be returned
priceFilter.maximumChainTokenPriceA string specifying the maximum price of the native chain token (ETH, MATIC, etc) to return
priceFilter.maximumNativePriceA string specifying the minimum price of the native chain token (ETH in our case) to return
priceFilter.minimumChainTokenPriceA string specifying the minimum price of the native chain token (ETH, MATIC, etc) to return
priceFilter.minimumNativePriceA string specifying the minimum price of the native chain token (ETH in our case) to return
sortSorting information for tokens
sort.sortDirectionAn enum value specifying the direction of resultsASC, DESC
sort.sortKeyAn enum value specifying the value to sort results byChainTokenPrice, Created, NativePrice, None, TimeSaleEnding
networksArgument for chain to query as an array of enums
networks.chainChain to query on (currently only MAINNET)
networks.networkNetwork to query on (currently only ETHEREUM)
includeFullDetailsinclude entire token details (full uris, history etc.)

zdK.mints(where, filter, pagination, networks, sort, includeFullDetails, includeMarkets) ⇒

Gets historic minting data for any NFT or any group of NFTs.

Returns: Promise.<MintsQuery> - Mints graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.collectionAddressesList of collection addresses to filter by
where.minterAddresses:List of minter addresses to filter by
where.recipientAddressesList of receiver addresses to filter by
where.tokens:Tuple of token and id to filter by an exact match as a list
filterFilter query parameters after the where query
filter.timeFilterAn input of type TimeFilter for time partitioned event responses.
timeFilter.endDateA date string specifying when to stop collecting mint data
timeFilter.lookbackHoursA string specifying how many hours to look back from an end date
timeFilter.startDateA date string specifying when to start collecting mint data
filter.priceFilterArguments for filtering price ranges
priceFilter.currencyAddressA string specifying the currency being used for the market transaction to be returned
priceFilter.maximumChainTokenPriceA string specifying the maximum price of the native chain token (ETH, MATIC, etc) to return
priceFilter.maximumNativePriceA string specifying the minimum price of the native chain token (ETH in our case) to return
priceFilter.minimumChainTokenPriceA string specifying the minimum price of the native chain token (ETH, MATIC, etc) to return
priceFilter.minimumNativePriceA string specifying the minimum price of the native chain token (ETH in our case) to return
paginationSettings for pagination
pagination.afterA string specifying which record to begin pagination
pagination.limitAn int setting the number of event records per page
sortSorting information for tokens
sort.sortDirectionAn enum value specifying the direction of resultsASC, DESC
sort.sortKeyAn enum value specifying the value to sort results byChainTokenPrice, Created, NativePrice, None, TimeSaleEnding
networksArgument for chain to query as an array of enums
networks.chainChain to query on (currently only MAINNET)
networks.networkNetwork to query on (currently only ETHEREUM)
includeFullDetailsinclude entire token details (full uris, history etc.)
includeMarketsinclude entire market details for these contracts

zdK.sales(where, filter, pagination, networks, sort, includeFullDetails) ⇒

Gets sales data for any NFT or collection across multiple marketplaces e.g. Zora, OpenSea, LooksRare, Foundation, etc.

Returns: Promise.<SalesQuery> - Sales graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.buyerAddresses:List of minter addresses to filter by
where.collectionAddressesList of collection addresses to filter by
where.sellerAddressesList of receiver addresses to filter by
where.tokens:Tuple of token and id to filter by an exact match as a list
filter.timeFilterAn input of type TimeFilter for time partitioned event responses.
timeFilter.endDateA date string specifying when to stop collecting mint data
timeFilter.lookbackHoursA string specifying how many hours to look back from an end date
timeFilter.startDateA date string specifying when to start collecting mint data
filter.priceFilterArguments for filtering price ranges
priceFilter.currencyAddressA string specifying the currency being used for the market transaction to be returned
priceFilter.maximumChainTokenPriceA string specifying the maximum price of the native chain token (ETH, MATIC, etc) to return
priceFilter.maximumNativePriceA string specifying the minimum price of the native chain token (ETH in our case) to return
priceFilter.minimumChainTokenPriceA string specifying the minimum price of the native chain token (ETH, MATIC, etc) to return
priceFilter.minimumNativePriceA string specifying the minimum price of the native chain token (ETH in our case) to return
sortSorting information for tokens
sort.sortDirectionAn enum value specifying the direction of resultsASC, DESC
sort.sortKeyAn enum value specifying the value to sort results byChainTokenPrice, Created, NativePrice, None, TimeSaleEnding
networksArgument for chain to query as an array of enums
networks.chainChain to query on (currently only MAINNET)
networks.networkNetwork to query on (currently only ETHEREUM)
includeFullDetailsinclude entire token details (full uris, history etc.)
includeMarketsinclude entire market details for these contracts

zdK.collections(where, pagination, networks, sort, includeFullDetails) ⇒

Gets data for a group of NFT collections.

Returns: Promise.<CollectionsQuery> - Collections graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.collectionAddressesList of collection addresses to filter by
paginationSettings for pagination
pagination.afterA string specifying which record to begin pagination
pagination.limitAn int setting the number of event records per page
networksArgument for chain to query as an array of enums
networks.chainChain to query on (currently only MAINNET)
networks.networkNetwork to query on (currently only ETHEREUM)
sortSorting information for tokens
sort.sortDirectionAn enum value specifying the direction of resultsASC, DESC
sort.sortKeyAn enum value specifying the value to sort results byChainTokenPrice, Created, NativePrice, None, TimeSaleEnding
includeFullDetailsinclude entire token details (full uris, history etc.)

zdK.collectionStatsAggregate(collectionAddress, network) ⇒

Gets statistics for a specific collection such as the total supply, number of owners and sales volume.

Returns: Promise.<CollectionStatsAggregateQuery> - Collection stats graphql response

ParamDescriptionType
collectionAddressesList of collection addresses to filter by
networkArgument for chain to query as an array of enums
network.chainChain to query on (currently only MAINNET)
network.networkNetwork to query on (currently only ETHEREUM)

zdK.collection(address, network) ⇒

Gets data for a specific NFT collection based on an address.

Returns: Promise.<CollectionQuery> - Collection graphql response

ParamDescriptionType
addressString of collection address to filter by
networkArgument for chain to query as an array of enums
network.chainChain to query on (currently only MAINNET)
network.networkNetwork to query on (currently only ETHEREUM)

zdK.ownersByCount(where, pagination, networks) ⇒

Gets the number of NFTs held be certain owner addresses e.g. Top holders of a collection.

Returns: Promise.<OwnersByCountQuery> - Owners by count graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.attributesAn array of the CollectionAttributes
attributes.traitTypeA string to set the trait type to return by
attributes.valueA string of a trait's possible value(s) to return by
where.collectionAddressesList of collection addresses to filter by
paginationSettings for pagination
pagination.afterA string specifying which record to begin pagination
pagination.limitAn int setting the number of event records per page
networksArgument for chain to query as an array of enums
network.chainsChain to query on (currently only MAINNET)
network.networksNetwork to query on (currently only ETHEREUM)

zdK.aggregateAttributes(where, networks) ⇒

Gets statistics on all the attributes for a collection.

Returns: Promise.<AggregateAttributesQuery> - Aggregate attributes graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.collectionAddressesList of collection addresses to filter by
where.ownerAddressesList of owner addresses to filter by
where.tokens:Tuple of token and id to filter by an exact match as a list
tokens.addressA string for the contract address to return a token for
tokens.tokenIdA string for the tokenId to return a token for
networksArgument for chain to query as an array of enums
network.chainChain to query on (currently only MAINNET)
network.networkNetwork to query on (currently only ETHEREUM)

zdK.salesVolume(where, networks, timeFilter) ⇒

Gets the total sales volume for a collection across all marketplaces.

Returns: Promise.<SalesVolumeQuery> - Sales volume graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.attributesAn array of the CollectionAttributes
attributes.traitTypeA string to set the trait type to return by
attributes.valueA string of a trait's possible value(s) to return by
where.collectionAddressesList of collection addresses to filter by
networksArgument for chain to query as an array of enums
network.chainsChain to query on (currently only MAINNET)
network.networksNetwork to query on (currently only ETHEREUM)
timeFilterNetwork to query on (currently only ETHEREUM)
timeFilter.endDateA string array of addresses that have bid for this NFT
timeFilter.lookbackHoursAn enum specifying the version of Zora the order is made onV1Ask, V1BidShare, V1Offer, V2Auction, V3Ask
timeFilter.startDateAn enum specifying status of orders being returnedActive, Canceled, Completed

zdK.ownerCount(where, networks) ⇒

Gets the number of NFTs held be certain owner addresses e.g. Top holders of a collection.

Returns: Promise.<OwnerCountQuery> - Owner count graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.attributesAn array of the CollectionAttributes
attributes.traitTypeA string to set the trait type to return by
attributes.valueA string of a trait's possible value(s) to return by
where.collectionAddressesList of collection addresses to filter by
networksArgument for chain to query as an array of enums
network.chainsChain to query on (currently only MAINNET)
network.networksNetwork to query on (currently only ETHEREUM)

zdK.floorPrice(where, networks) ⇒

Gets data on the cheapest available NFT across all Zora marketplaces.

Returns: Promise.<FloorPriceQuery> - Floor price graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.attributesAn array of the CollectionAttributes
attributes.traitTypeA string to set the trait type to return by
attributes.valueA string of a trait's possible value(s) to return by
where.collectionAddressesList of collection addresses to filter by
networksArgument for chain to query as an array of enums
network.chainsChain to query on (currently only MAINNET)
network.networksNetwork to query on (currently only ETHEREUM)

zdK.nftCount(where, networks) ⇒

Gets data on the total supply of NFTs in a collection.

Returns: Promise.<NftCountQuery> - NFT count graphql response

ParamDescriptionType
whereArguments to filter tokens by, required.
where.attributesAn array of the CollectionAttributes
attributes.traitTypeA string to set the trait type to return by
attributes.valueA string of a trait's possible value(s) to return by
where.collectionAddressesList of collection addresses to filter by
where.ownerAddressesList of owner addresses to filter by
networksArgument for chain to query as an array of enums
network.chainsChain to query on (currently only MAINNET)
network.networksNetwork to query on (currently only ETHEREUM)

zdK.search(pagination, query, filter) ⇒

Searchs for an NFT or collection based on a string input.

Returns: Promise.<SearchQuery> - Search query graphql response

ParamDescriptionType
paginationSettings for pagination
pagination.afterA string specifying which record to begin pagination
pagination.limitAn int setting the number of event records per page
queryA text string to query with
filterParameters for setting query filter
filter.collectionAddressesAn array of string addresses to query with
filter.entityTypeAn enum specifying the entity type being queriedCOLLECTION, TOKEN

FAQs

Package last updated on 01 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc