using System; using System.Collections.Generic; using Newtonsoft.Json; using Cysharp.Threading.Tasks; using MoralisUnity.Web3Api.Models; namespace MoralisUnity.Web3Api.Interfaces { /// /// Represents a collection of functions to interact with the API endpoints /// public interface ITokenApi { /// /// Returns metadata (name, symbol, decimals, logo) for a given token contract address. /// /// The addresses to get metadata for /// The chain to query /// The subdomain of the moralis server to use (Only use when selecting local devchain as chain) /// web3 provider url to user when using local dev chain /// Returns metadata (name, symbol, decimals, logo) for a given token contract address. UniTask> GetTokenMetadata (List addresses, ChainList chain, string subdomain=null, string providerUrl=null); /// /// Get the nft trades for a given contracts and marketplace /// /// Address of the contract /// The chain to query /// 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 get the reserves at this block number /// 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. /// /// Get the reserves 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. /// /// web3 provider url to user when using local dev chain /// marketplace from where to get the trades (only opensea is supported at the moment) /// offset /// limit /// Returns the trades UniTask GetNFTTrades (string address, ChainList chain, string cursor = "", int? fromBlock=null, string toBlock=null, string fromDate=null, string toDate=null, string providerUrl=null, string marketplace=null, int? limit=null); /// /// Get the lowest price found for a nft token contract for the last x days (only trades paid in ETH) /// /// Address of the contract /// The chain to query /// The number of days to look back to find the lowest price /// If not provided 7 days will be the default /// /// web3 provider url to user when using local dev chain /// marketplace from where to get the trades (only opensea is supported at the moment) /// Returns the trade with the lowest price UniTask GetNFTLowestPrice (string address, ChainList chain, int? days=null, string providerUrl=null, string marketplace=null); /// /// Returns metadata (name, symbol, decimals, logo) for a given token contract address. /// /// The symbols to get metadata for /// The chain to query /// The subdomain of the moralis server to use (Only use when selecting local devchain as chain) /// Returns metadata (name, symbol, decimals, logo) for a given token contract address. UniTask> GetTokenMetadataBySymbol (List symbols, ChainList chain, string subdomain=null); /// /// Returns the price nominated in the native token and usd for a given token contract address. /// /// The address of the token contract /// The chain to query /// web3 provider url to user when using local dev chain /// The factory name or address of the token exchange /// to_block /// Returns the price nominated in the native token and usd for a given token contract address UniTask GetTokenPrice (string address, ChainList chain, string providerUrl=null, string exchange=null, int? toBlock=null); /// /// Gets ERC20 token contract transactions in descending order based on block number /// /// The address of the token contract /// The chain to query /// The subdomain of the moralis server to use (Only use when selecting local devchain as chain) /// 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. /// /// 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. /// /// 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. /// /// Get the transfers 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. /// /// offset /// limit /// Returns a collection of token contract transactions. UniTask GetTokenAddressTransfers (string address, ChainList chain, string subdomain=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? offset=null, int? limit=null); /// /// Gets the amount which the spender is allowed to withdraw from the spender /// /// The address of the token contract /// The address of the token owner /// The address of the token spender /// The chain to query /// web3 provider url to user when using local dev chain /// Returns the amount which the spender is allowed to withdraw from the owner.. UniTask GetTokenAllowance (string address, string ownerAddress, string spenderAddress, ChainList chain, string providerUrl=null); /// /// Gets NFTs that match a given metadata search. /// /// The search string /// The chain to query /// The format of the token id /// 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 /// The minimum block number from where to start the search /// * Provide the param 'from_block' or 'from_date' /// * If 'from_date' and 'from_block' are provided, 'from_block' will be used. /// /// The maximum block number from where to end the search /// * Provide the param 'to_block' or 'to_date' /// * If 'to_date' and 'to_block' are provided, 'to_block' will be used. /// /// The date from where to start the search (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. /// /// Get search results 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. /// /// offset /// limit /// Returns the matching NFTs UniTask SearchNFTs (string q, ChainList chain, string cursor = "", string format =null, string filter=null, int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, int? limit=null); /// /// Gets the transfers of the tokens from a block number to a block number /// /// The chain to query /// 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. /// /// 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. /// /// 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. /// /// 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. /// /// The format of the token id /// offset /// limit /// Returns a collection of NFT transfers UniTask GetNftTransfersFromToBlock (ChainList chain, string cursor = "", int? fromBlock=null, int? toBlock=null, string fromDate=null, string toDate=null, string format=null, int? limit=null); /// /// Gets data, including metadata (where available), for all token ids for the given contract address. /// * Results are sorted by the block the token id was minted (descending) and limited to 100 per page by default /// * Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection /// /// /// Address of the contract /// The chain to query /// The format of the token id /// offset /// limit /// Returns a collection of nfts UniTask GetAllTokenIds (string address, ChainList chain, string cursor = "", string format=null, int? limit=null); /// /// Gets the transfers of the tokens matching the given parameters /// /// Address of the contract /// The chain to query /// The format of the token id /// offset /// limit /// Returns a collection of NFT transfers UniTask GetContractNFTTransfers (string address, ChainList chain, string cursor = "", string format=null, int? limit=null); /// /// Gets all owners of NFT items within a given contract collection /// * Use after /nft/contract/{token_address} to find out who owns each token id in a collection /// * Make sure to include a sort parm on a column like block_number_minted for consistent pagination results /// * Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection /// /// /// Address of the contract /// The chain to query /// The format of the token id /// offset /// limit /// Returns a collection of nft owners UniTask GetNFTOwners (string address, ChainList chain, string cursor = "", string format=null, int? limit=null); /// /// Gets the contract level metadata (name, symbol, base token uri) for the given contract /// * Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection /// /// /// Address of the contract /// The chain to query /// Returns a collection NFT collections. UniTask GetNFTMetadata (string address, ChainList chain); /// /// Gets data, including metadata (where available), for the given token id of the given contract address. /// * Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection /// /// /// Address of the contract /// The id of the token /// The chain to query /// The format of the token id /// Returns the specified NFT UniTask GetTokenIdMetadata (string address, string tokenId, ChainList chain, string format=null); /// /// Gets all owners of NFT items within a given contract collection /// * Use after /nft/contract/{token_address} to find out who owns each token id in a collection /// * Make sure to include a sort parm on a column like block_number_minted for consistent pagination results /// * Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection /// /// /// Address of the contract /// The id of the token /// The chain to query /// The format of the token id /// offset /// limit /// Returns a collection of NFTs with their respective owners UniTask GetTokenIdOwners (string address, string tokenId, ChainList chain, string cursor = "", string format=null, int? limit=null); /// /// Gets the transfers of the tokens matching the given parameters /// /// Address of the contract /// The id of the token /// The chain to query /// The format of the token id /// offset /// limit /// The field(s) to order on and if it should be ordered in ascending or descending order. Specified by: fieldName1.order,fieldName2.order. Example 1: "block_number", "block_number.ASC", "block_number.DESC", Example 2: "block_number and contract_type", "block_number.ASC,contract_type.DESC" /// Returns a collection of NFT transfers UniTask GetWalletTokenIdTransfers (string address, string tokenId, ChainList chain, string cursor = "", string format=null, int? limit=null, string order=null); /// /// ReSync the metadata for an NFT /// /// Address of the contract /// The id of the token /// The chain to query /// UniTask ReSyncMetadata(string address, string tokenId, ChainList chain); /// /// Sync a Contract for NFT Index /// /// Address of the contract /// The chain to query /// UniTask SyncNFTContract(string address, ChainList chain); } }