Skip to main content

Introduction

A development kit for interacting with ZORA's smart contracts#

ZDK Key Components#

Installing#

yarn add @zoralabs/zdk

Connecting to Ethers.js#

The 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