Skip to main content

ERC721Enumerable

import "@thirdweb-dev/contracts/eip/interface/IERC721Enumerable.sol";

View all of the NFTs owned by a specific wallet address by implementing the IERC721Enumerable interface.

info

This extension is an interface and requires all of the functions to be implemented


Usage

This is an example smart contract demonstrating how to inherit from this extension and override the functions to add (optional) custom functionality.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@thirdweb-dev/contracts/eip/ERC721A.sol";
import "@thirdweb-dev/contracts/eip/interface/IERC721Enumerable.sol";

contract Contract is ERC721A, IERC721Enumerable {
constructor(
string memory _name,
string memory _symbol
)
ERC721A(
_name,
_symbol
)
{}

function tokenByIndex(uint256 _index) external view override returns (uint256) {
// Your custom implementation here
}

function tokenOfOwnerByIndex(address _owner, uint256 _index) external view override returns (uint256) {
// Your custom implementation here
}
}

SDK Usage

By adding this extension to a smart contract, the following features, hooks and functions are unlocked in the SDK:

Base Contracts Implementing This Extension