Returns metadata (name, symbol, decimals, logo) for a given token contract address (asynchronous).
Options:
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
addresses (required): The address or an array of addresses to get metadata for
//Get metadata for one token. Ex: USDT token on ETHconstoptions= { chain:"eth", addresses:"0xdAC17F958D2ee523a2206206994597C13D831ec7",};consttokenMetadata=awaitMoralis.Web3API.token.getTokenMetadata(options);//Get metadata for an array of tokens. Ex: USDT and USDC tokens on BSCconstoptions= { chain:"bsc", addresses: ["0x55d398326f99059ff775485246999027b3197955","0x0a385f86059e0b2a048171d78afd1f38558121f3", ],};consttokenMetadata=awaitMoralis.Web3API.token.getTokenMetadata(options);
import React from"react";import { useMoralisWeb3Api } from"react-moralis";constWeb3Api=useMoralisWeb3Api();constfetchTokenMetadata=async () => {//Get metadata for one token. Ex: USDT token on ETHconstoptions= { chain:"eth", addresses:"0xdAC17F958D2ee523a2206206994597C13D831ec7", };consttokenMetadata=awaitWeb3Api.token.getTokenMetadata(options);console.log(tokenMetadata);//Get metadata for an array of tokens. Ex: USDT and USDC tokens on BSCconstoptions= { chain:"bsc", addresses: ["0x55d398326f99059ff775485246999027b3197955","0x0a385f86059e0b2a048171d78afd1f38558121f3", ], };consttokenArrayMetadata=awaitWeb3Api.token.getTokenMetadata(options);console.log(tokenArrayMetadata);};
Returns metadata (name, address, decimals, logo) for given symbols (asynchronous).
Options:
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
symbols (required): The token symbol or an array of symbols to get metadata for
//Get metadata for one tokenconstoptions= { chain:"bsc", symbols:"LINK" };consttokenMetadata=awaitMoralis.Web3API.token.getTokenMetadataBySymbol( options);//Get metadata for an array of tokensconstoptions= { chain:"bsc", symbols: ["LINK","AAVE"] };consttokenMetadata=awaitMoralis.Web3API.token.getTokenMetadataBySymbol( options);
import React from"react";import { useMoralisWeb3Api } from"react-moralis";constWeb3Api=useMoralisWeb3Api();constfetchTokenMetadataBySymbol=async () => {//Get metadata for one tokenconstoptions= { chain:"bsc", symbols:"LINK" };consttokenMetadata=awaitWeb3Api.token.getTokenMetadataBySymbol(options);console.log(tokenMetadata);//Get metadata for an array of tokensconstoptions= { chain:"bsc", symbols: ["LINK","AAVE"] };consttokenArrayMetadata=awaitWeb3Api.token.getTokenMetadataBySymbol( options );console.log(tokenArrayMetadata);};
Returns the price nominated in the native token and usd for a given token contract address (asynchronous).
Options:
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
exchange(optional): The factory name or address of the token exchange. Possible exchanges, for different chains are:
ETH mainnet: uniswap-v3, sushiswap, uniswap-v2
BSC mainnet: pancakeswap-v2, pancakeswap-v1
Polygon mainnet: quickswapIf no exchange is specified, all exchanges are checked (in the order as listed above) until a valid pool has been found. Note that this request can take more time. So specifying the exchange will result in faster responses most of the time.
address(required): The address of the token contract
to_block(optional): Returns the price for a given blocknumber (historical price-data)
Gets NFT transfers from a block number to a block number
Options:
Needs at least one of from_block, to_block , from_date , to_date
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
from_block(optional): The minimum block number from where to get the transfers. Provide the param 'from_block' or 'from_date'. If 'from_date' and 'from_block' are provided, 'from_block' will be used.
to_block (optional): The maximum block number from where to get the transfers. Provide the param 'to_block' or 'to_date', If 'to_date' and 'to_block' are provided, 'to_block' will be used.
from_date (optional): The date from where to get the transfers (any format that is accepted by momentjs). Provide the param 'from_block' or 'from_date'. If 'from_date' and 'from_block' are provided, 'from_block' will be used.
to_date(optional): Get transfers up until this date (any format that is accepted by momentjs). Provide the param 'to_block' or 'to_date'. If 'to_date' and 'to_block' are provided, 'to_block' will be used.
format(optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
Very powerful and fast tool for getting the NFT data based on a metadata search (asynchronous).
Options:
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
offset (optional): offset.
limit(optional): limit.
q (required): The search string parameter
filter(required): What fields the search should match on. To look into the entire metadata set the value to global. To have a better response time you can look into a specific field like name. Available values : name; description; attributes; global; name,description; name,attributes; description,attributes; name,description,attributes
using MoralisUnity;
using MoralisUnity.Web3Api.Models;
using UnityEngine;
public class Example
{
public async void fetchSearchNFTs()
{
NftMetadataCollection nft = await Moralis.Web3Api.Token.SearchNFTs(q: "Pancake", ChainList.bsc, filter: "description,attributes");
Debug.Log(nft.ToJson());
}
}
getContractNFTTransfers
Returns an object with number of NFT transfers and an array with NFT transfers for a given token contract address (asynchronous).
Options:
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
format (optional): The format of the token id. Available values : decimal, hex. Default value is decimal.
using MoralisUnity;
using MoralisUnity.Web3Api.Models;
using UnityEngine;
public class Example
{
public async void fetchContractNFTTransfers()
{
NftTransferCollection nftTransfers = await Moralis.Web3Api.Token.GetContractNFTTransfers(address: "0x7de3085b3190b3a787822ee16f23be010f5f8686", ChainList.eth);
Debug.Log(nftTransfers.ToJson());
}
}
using MoralisUnity;
using MoralisUnity.Web3Api.Models;
using UnityEngine;
public class Example
{
public async void fetchTokenIdMetadata()
{
Nft tokenIdMetadata = await Moralis.Web3Api.Token.GetTokenIdMetadata(address: "0x7de3085b3190b3a787822ee16f23be010f5f8686", tokenId: "1", ChainList.eth);
Debug.Log(tokenIdMetadata.ToJson());
}
}
using MoralisUnity;
using MoralisUnity.Web3Api.Models;
using UnityEngine;
public class Example
{
public async void fetchTokenIdOwners()
{
NftOwnerCollection tokenIdOwners = await Moralis.Web3Api.Token.GetTokenIdOwners(address: "0x7de3085b3190b3a787822ee16f23be010f5f8686", tokenId: "1", ChainList.eth);
Debug.Log(tokenIdOwners.ToJson());
}
}
using MoralisUnity;
using MoralisUnity.Web3Api.Models;
using UnityEngine;
public class Example
{
public async void fetchWalletTokenIdTransfers()
{
NftTransferCollection transfers = await Moralis.Web3Api.Token.GetWalletTokenIdTransfers(address: "0x7de3085b3190b3a787822ee16f23be010f5f8686", tokenId: "1", ChainList.eth);
Debug.Log(transfers.ToJson());
}
}
Returns an object with NFT trades for a given contract and marketplace
Options:
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
from_date (optional): The date from where to get the trades(any format that is accepted by momentjs). Provide the param 'from_block' or 'from_date' If 'from_date' and 'from_block' are provided, 'from_block' will be used.
to_date (optional): Get the trades to this date (any format that is accepted by momentjs). Provide the param 'to_block' or 'to_date' If 'to_date' and 'to_block' are provided, 'to_block' will be used.
from_block (optional): The minimum block number from where to get the tradesProvide the param 'from_block' or 'from_date' If 'from_date' and 'from_block' are provided, 'from_block' will be used.
to_block (optional): The maximum block number from where to get the trades. Provide the param 'to_block' or 'to_date' If 'to_date' and 'to_block' are provided, 'to_block' will be used.
offset(optional): Offset.
limit(optional): Limit.
marketplace (optional): Marketplace from where to get the trades (only opensea is supported at the moment).
address (required): Address of the contract(i.e. 0x1a2b3x...).
using MoralisUnity;
using MoralisUnity.Web3Api.Models;
using UnityEngine;
public class Example
{
public async void fetchNFTTrades()
{
TradeCollection trades = await Moralis.Web3Api.Token.GetNFTTrades(address: "0x7de3085b3190b3a787822ee16f23be010f5f8686", ChainList.eth, limit: 10);
Debug.Log(trades.ToJson());
}
}
using MoralisUnity;
using MoralisUnity.Web3Api.Models;
using UnityEngine;
public class Example
{
public async void fetchNFTLowestPrice()
{
Trade NFTLowestPrice = await Moralis.Web3Api.Token.GetNFTLowestPrice(address: "0x7de3085b3190b3a787822ee16f23be010f5f8686", ChainList.eth, days: 2);
Debug.Log(NFTLowestPrice.ToJson());
}
}
chain(optional): The blockchain to get data from. Valid values are listed on Supported Chains. Default value Eth.
address(required): Address of the contract.
token_id(required): The id of the token.
flag (optional): The type of resync to operate. Available values : uri, metadata. Default value : metadata. The metadata flag will resync of the metadata of nft. The uri flag will resync the token_uri of NFT.
using System.Collections.Generic;
using MoralisUnity.Web3Api.Models;
using MoralisUnity;
public async void resyncMetadata()
{
await Moralis.Web3Api.Token.ReSyncMetadata(address: "0x7de3085b3190b3a787822ee16f23be010f5f8686", tokenId: "1", chain: ChainList.eth);
}