Canto Name Service
  • Welcome to Canto Name Service (CNS)
  • 🤓Technicals
    • Integrating
      • Get Primary Name
      • Get TokenId From Name
      • Get Name from TokenId
      • Get All Tokens Owned by an Address
    • Contract Address
Powered by GitBook
On this page
  1. Technicals
  2. Integrating

Get Name from TokenId

given a tokenId, how do I get the name?

Using the mapping:

mapping(uint256 => string) public tokenToName;

Example:

To find the name for tokenId 12345

One can call tokenToName(12345) and if the given tokenId has been registered, the contract will return the registered name as a string.

PreviousGet TokenId From NameNextGet All Tokens Owned by an Address

Last updated 2 years ago

🤓