ZORA NFTs
Provides read and write access to the ZORA NFT contracts
NFTs minted out of ZORA are known as ZORA NFTs (zNFT) and are also referred to as media
.
To instantiate the module, an ethers.js Signer
or Provider
must be passed to the constructor
as well as the chainID
.
ZORA currently supports Ethereum Mainnet (1) and Rinkeby Testnet (4).
You can learn more about connecting to ethers.js here.
#
Constructor ArgumentsName | Type | Description |
---|---|---|
signerOrProvider | Signer | Provider | The Wallet or JSON RPC Provider connected to Ethereum |
chainId | number | The network to connect to. 1 for Mainnet, and 4 for Rinkeby. |
mediaAddress? | string | [Optional] The Media contract address |
marketAddress? | string | [Optional] The Market contract address |
import { Zora } from '@zoralabs/zdk'import { Wallet } from 'ethers'
// If you don't specify a //url//, Ethers connects to the default// (i.e. ``http:/\/localhost:8545``)const provider = new ethers.providers.JsonRpcProvider()
let wallet = Wallet.createRandom()wallet = wallet.connect(provider)
const zora = new Zora(wallet, 1) //passing in 1 for Ethereum Mainnetconst totalSupply = await zora.fetchTotalMedia()
If you are using a local blockchain, you must specify overrides for both mediaAddress
and marketAddress
. These should point
to the addresses of the deployed ZORA media and market contracts on your local environment.
const zora = new Zora(wallet, 50, mediaAddress, marketAddress)
note
For more details on connecting to a user's wallet with Metamask or WalletConnect, see our React Guide
#
Read FunctionsAll the functions that are able to read data from the ZORA NFT smart contracts. We recommend using the NFT Rendering and Zora Indexer sections if you only want to get NFT data.
#
fetchContentHashFetch the contentHash
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose content hash is being fetched |
#
fetchMetadataHashFetch the metadataHash
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose metadata hash is being fetched |
#
fetchContentURIFetch the contentURI
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose content uri is being fetched |
#
fetchMetadataURIFetch the metadataURI
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose metadata uri is being fetched |
#
fetchCreatorFetch the creator
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose creator is being fetched |
#
fetchCurrentBidSharesFetch the current bidShares
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose current bid shares are being fetched |
#
fetchCurrentAskFetch the current Ask
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose current ask is being fetched |
#
fetchCurrentBidForBidderFetch the current Bid
for a bidder on a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose metadata uri is being fetched |
bidder | string | The address of the bidder |
#
fetchPermitNonceFetch the next permit nonce for an address
Name | Type | Description |
---|---|---|
address | string | The address of the account whose permit nonce is being fetched |
#
fetchMintWithSigNoncesFetch the next mintWithSig nonce for an address
Name | Type | Description |
---|---|---|
address | string | The address of the account whose mintWithSig nonce is being fetched |
#
fetchBalanceOfFetch the balance of an address on an instance of the ZORA Media Contract
Name | Type | Description |
---|---|---|
address | string | The address of the account whose balance is being fetched |
#
fetchOwnerOfFetch the owner of a ZORA NFT on an instance of the ZORA Media Contract
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose owner is being fetched |
#
fetchMediaOfOwnerByIndexFetch the mediaId of the specified owner by index on an instance of the ZORA Media Contract
Name | Type | Description |
---|---|---|
owner | string | The owner address of the ZORA NFT |
index | BigNumberish | The ERC-721 enumerbale index of owner |
#
fetchTotalMediaFetch the total amount of non-burned ZORA NFTs that has been minted
Name | Type | Description |
---|---|---|
#
fetchMediaByIndexFetch the mediaId by index
Name | Type | Description |
---|---|---|
index | BigNumberish | The ERC-721 enumerbale index of a ZORA NFT |
#
fetchApprovedFetch the approved account for the specified ZORA NFT
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose approved address is being fetched |
#
fetchIsApprovedForAllFetch if the specified operator is approved for all ZORA NFTs owned by the specified owner
Name | Type | Description |
---|---|---|
owner | string | An address on the ZORA Protocol |
operator | string | An address on the ZORA Protocol |
#
Write FunctionsAll the functions that are able to submit transactions to interact with the ZORA NFT smart contracts
#
mintMint a new ZORA NFT.
Name | Type | Description |
---|---|---|
mediaData | MediaData | The data represented by this ZORA NFT, including SHA256 hashes for future integrity checks |
bidShares | BidShares | The percentage of bid fees that should be perpetually rewarded to the creator. |
#
mintWithSigMint a new piece of media on behalf of signed message from a creator.
Name | Type | Description |
---|---|---|
creator | BigNumberish | The creator address of the ZORA NFT |
mediaData | MediaData | The data represented by this media, including `SHA256 hashes for future integrity checks |
bidShares | BidShares | The percentage of bid fees that should be perpetually rewarded to the creator. |
sig | EIP712Signature | The eip-712 compliant signature to be verified on chain |
#
updateContentURIUpdate the contentURI
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose content uri is being updated |
#
updateMetadataURIUpdate the metadataURI
of a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose metadata uri is being updated |
#
setAskSet an Ask
on a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose ask is being set |
ask | Ask | The ask to be set |
#
removeAskRemove the Ask
from a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose ask is being removed |
#
setBidSet a Bid
on a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose bid is being set |
bid | Bid | The bid to be set |
#
removeBidRemove the Bid
from a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose bid is being removed |
#
acceptBidAccept a Bid
on a ZORA NFT.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT whose bid is being accepted |
bid | Bid | The bid to be accepted |
#
permitPermit an address to act on behalf of the owner of the ZORA NFT
Name | Type | Description |
---|---|---|
spender | string | The address that is being permitted to spend the ZORA NFT |
media Id | BigNumberish | The ID for the ZORA NFT |
sig | EIP712Signature | The eip-712 compliant signature to be verified on chain |
#
burnBurn a ZORA NFT
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT to burn |
#
revokeApprovalAs an approved address on a ZORA NFT, revoke your approval.
Name | Type | Description |
---|---|---|
mediaId | BigNumberish | The ID for the ZORA NFT to burn |
#
approveGrant approval to the specified address for the specified ZORA NFT on an instance of the ZORA Media Contract
Name | Type | Description |
---|---|---|
to | string | The address being granted approval for the ZORA NFT |
mediaId | BigNumberish | The ID for the ZORA NFT |
#
setApprovalForAllGrant approval for all ZORA NFT owner by msg.sender on an instance of the ZORA Media Contract
Name | Type | Description |
---|---|---|
operator | string | The address of the account the approvalForAll is being set |
approved | boolean | Whether or not the operator address is being granted approval |
#
transferFromTransfers the specified ZORA NFT to the specified to address on an instance of the ZORA Media Contract
Name | Type | Description |
---|---|---|
from | string | The from address of the ZORA NFT transfer |
to | string | The to address of the ZORA NFT transfer |
mediaId | BigNumberish | The ID for the ZORA NFT being transferred |
#
safeTransferFromTransfers specified ZORA NFT to the specified address if and only if it adheres to the ERC721-Receiver Interface
Name | Type | Description |
---|---|---|
from | string | The from address of the ZORA NFT transfer |
to | string | The to address of the ZORA NFT transfer |
mediaId | BigNumberish | The ID for the ZORA NFT being transferred |