Introduction
#
A development kit for interacting with ZORA's smart contracts#
ZDK Key ComponentsZORA NFT Module: Provides read and write access to the ZORA NFT contracts
Auction House Module: Tools for selling an ERC-721 NFT
Utility Module: Utility tools for interacting with the ZDK
Metadata Module: Formats metadata for minting ZORA NFTs
User Info Module: Maps Ethereum addresses to ZORA user profiles
Addresses Module: Provides ZORA contract addresses for different networks
#
Installing- Yarn
- NPM
yarn add @zoralabs/zdk
npm install -S @zoralabs/zdk
#
Connecting to Ethers.jsThe ZDK exposes utilities for the ZORA Smart Contracts and uses an ethers.js interface to interact with the Zora ecosystem.
note
ethers.js is a JavaScript library that is used to interact with the Ethereum blockchain.
In order for your application to interact with the blockchain, you will need to establish a connection with a node. This can be done by passing an RPC url from a node provider into ethers.js. If you are trying to test out the SDK you can set up an Infura or Alchemy account.
In addition, users can pass in a connection to a node when they connect their wallet to your application. We also have a short guide on how to connect a wallet in React.
import { Zora } from '@zoralabs/zdk'import { Wallet } from 'ethers'
const rpcURL = // you will get this from Infura or Alchemy
const provider = new ethers.providers.JsonRpcProvider(rpcURL);
let wallet = Wallet.createRandom()wallet = wallet.connect(provider)
const zora = new Zora(wallet, 1) //passing in 1 for Ethereum Mainnetconst totalSupply = await zora.fetchTotalMedia()
console.log(totalSupply) // total supply of ZORA NFTs minted on the Ethereum Mainnet