Skip to main content

ERC721

info

A standard interface for non-fungible tokens

Balance Of

Counts all NFTs assigned to an owner

string chain = "ethereum";
string network = "mainnet";
string contract = "0x60f80121c31a0d46b5279700f9df786054aa5ee5";
string account = "0x6b2be2106a7e883f282e2ea8e203f516ec5b77f7";

int balance = await ERC721.BalanceOf(chain, network, contract, account);
print(balance);

Owner Of

Find the owner of a NFT

string chain = "moonbeam";
string network = "testnet";
string contract = "0xcB0cbcE06860f6C30C62560f5eFBF918150e056E";
string tokenId = "1";

string ownerOf = await ERC721.OwnerOf(chain, network, contract, tokenId);
print(ownerOf);

Owner Of Batch

string chain = "ethereum";
string network = "mainnet";
string contract = "0xA74E199990FF572A320508547Ab7f44EA51e6F28";
string[] tokenIds = {"700", "791"};

List<string> batchOwners = await ERC721.OwnerOfBatch(chain, network, contract, tokenIds);
foreach (string owner in batchOwners)
{
print ("OwnerOfBatch: " + owner);
}

URI

string chain = "polygon";
string network = "mainnet";
string contract = "0xbCCaa7ACb552A2c7eb27C7eb77c2CC99580735b9";
string tokenId = "965";

string uri = await ERC721.URI(chain, network, contract, tokenId);
print(uri)

All 721s

Get all 721 tokens from an account

private class NFTs
{
public string contract { get; set; }
public string tokenId { get; set; }
public string uri { get; set; }
public string balance { get; set; }
}

async void Start()
{
string chain = "ethereum";
string network = "goerli"; // place your network here
string account = "0xebc0e6232fb9d494060acf580105108444f7c696";
string contract = "";
int first = 500;
int skip = 0;
string response = await EVM.AllErc721(chain, network, account, contract, first, skip);
try
{
NFTs[] erc721s = JsonConvert.DeserializeObject<NFTs[]>(response);
print(erc721s[0].contract);
print(erc721s[0].tokenId);
print(erc721s[0].uri);
print(erc721s[0].balance);
}
catch
{
print("Error: " + response);
}
}