Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@zoralabs/nft-hooks
Advanced tools
Generic react hooks for fetching zora auctions, nfts, and data on arbitary 721s. Powers nft-components.
Simple React hooks to load Zora NFT data. Includes on-chain data, NFT metadata, and tools for fetching NFT content if needed.
Put together, these power implementations of the zNFT protocol on any website.
This library consists of a data fetch class and associated React hooks to load NFT data is an easy, efficient manner. The API both batches and caches requests, meaning you can use the hooks across a page without needing to worry about significant performance penalties.
👯 See also: @zoralabs/nft-components a complimentary library to this one to render NFT data on a webpage.
Install:
yarn add @zoralabs/nft-hooks
Then you can import and use the hooks in your react application:
import {useZNFT, useNFTMetadata} from "@zoralabs/nft-hooks";
function MyNFT() {
const {data} = useZNFT("20");
const {metadata} = useNFTMetadata(data && data.metadataURI);
return (
<div>
<h3>{metadata.title}</h3>
<p>{metadata.description}</p>
<p>Owned by: {data.owner.id}</p>
</div>
);
}
Hook | Usage |
---|---|
useNFT | Fetches on-chain NFT data using a configured backend strategy |
useNFTQuery | Queries for NFTs using a configured backend strategy |
useNFTMetadata | Fetches off-chain metadata (not required for most indexers) |
useNFTContent | Fetches off-chain content (useful for some text content, but less often used) |
To set the network configuration, wrap the hooks used with the NFTFetchConfiguration
component.
import {Networks, NFTFetchConfiguration, Strategies} from '@zoralabs/nft-hooks';
const zdkStrategy = Strategies.ZDKFetchStrategy();
function NFTGallery() {
return (
<NFTFetchConfiguration strategy={zdkStrategy} networkId={Networks.MAINNET}>
<NFTList>
</NFTFetchConfiguration>
);
}
Provided strategies are:
Links direct to zora.co interfaces, but can be overridden to directly use the zdk instead.
git clone https://github.com/ourzora/nft-hooks
cd nft-hooks
npm i -g yarn
if you don't have yarn installedyarn
yarn run test
test your codePull requests and tickets are accepted for issues and improvements to this library.
FAQs
Generic react hooks for fetching zora auctions, nfts, and data on arbitary 721s. Powers nft-components.
The npm package @zoralabs/nft-hooks receives a total of 8 weekly downloads. As such, @zoralabs/nft-hooks popularity was classified as not popular.
We found that @zoralabs/nft-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 25 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.