Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 2.1 KB

scripts-2.md

File metadata and controls

81 lines (60 loc) · 2.1 KB
description
A standard interface for non-fungible tokens

ERC721

This section contains the different types of ERC721 methods that can be used in the Unity SDK. For additional operations and methods please refer to the ChainSafe Documentation.

Balance Of

Counts all ERC721 tokens assigned to an owner

string chain = "cronos";
string network = "mainnet"; // mainnet or testnet
string contract = "CONTRACT_ADDRESS";
string account = "WALLET_ADDRESS";

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

Owner Of

Find the owner of an ERC721 token

string chain = "cronos";
string network = "mainnet"; // mainnet or testnet
string contract = "CONTRACT_ADDRESS";
string tokenId = "TOKEN_ID";

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

Owner Of Batch

Balance of batch will get the balance of a list of token ids

string chain = "cronos";
string network = "mainnet"; // mainnet or testnet
string contract = "CONTRACT_ADDRESS";
string[] tokenIds = {"TOKEN_ID", "TOKEN_ID"};

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

URI

Returns meta data about the token.

string chain = "cronos";
string network = "mainnet"; // mainnet or testnet
string contract = "CONTRACT_ADDRESS";
string tokenId = "TOKEN_ID";

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

All 721s

Get all 721 tokens from an account

string chain = "cronos";
string network = "mainnet"; // mainnet or testnet
string account = "WALLET_ADDRESS";
string contract = "";
int first = 500;
int skip = 0;
string response = await EVM.AllErc721(chain, network, account, contract, first, skip);
print(response);