C# .Core for Discord Bot (Get list NFTs)

Hi all. I know that Moralis supports Unity, but working with Unity is in the long run. At the moment I need a discord bot to verify users according to the number of NFTs purchased. I know how to do everything with the 721 protocol, however I have no information on how to do it 1155. Several developers advised me to come to moralis, I hope to get some help here. The bottom line is Moralis requires “ServerConnectionData” inside should contain ApplicationID, ServerURI, Web3ApiClient and Headers. Here is the difficulty of Headers is as I understand from the documentation of my wallet number, signature, and response wallet data. However I have console application, I don’t need this functionality for my task (to get NFT list even if it’s just Count() knowing address of my smart contract, and wallet owner’s address). Can you advise and suggest something?

Hello, so what can you do specifically with ERC721 that you can’t with ERC1155? How are you getting the number of NFTs purchased currently?

With Moralis you can use the GetNfts API, this should give you the amounts for each ERC1155 token. You can make HTTP requests to this API within Unity directly without using the SDK or a server.

Hi. Thanks for replying. For 721 I use etherscan api, the usual get request: https://docs.etherscan.io/api-endpoints/accounts#get-a-list-of-erc721-token-transfer-events-by-address
Regarding Moralis, look the trick is I just need a bot that will verify in discord, based on the number of purchased NFTs from a specific collection. That is, I don’t need to buy something, I don’t need to sell something and as a consequence I don’t need Unity in its entirety, hence, I have only C# left. Since originally the bot is in it.

Ideally, I would like to get the same thing on Moralis. Just the disadvantage is that I’m not going to connect Metamask or other wallets to the bot. And to implement the NFTOwner inside Moralis, which is available on NuGet, requires ServerConnectionData:

Dictionary<string, object> authData = new Dictionary<string, object> { { “id”, “ADDRESS_HERE”.ToLower() }, { “signature”, “SIGNATURE_DATA_HERE” }, { “data”, “MESSAGE_HERE” } };

MoralisClient moralis = new MoralisClient(new ServerConnectionData() { ApplicationID = “Np0u3egcRkIDAxRuG4oMHmut7pG4DAp16uTp9Th7”, ServerURI = “myuri”, Headers = authData }, new Web3ApiClient());
NftOwnerCollection resp = moralis.Web3Api.Account.GetNFTsForContract(“address”.ToLower(), “addresstwo”, ChainList.eth);
Console.WriteLine($“GetNFTsForContract Count: {resp.Total}”);

That’s the difficulty, I simply do not have this data, as my program does not require and do not need authorization in the wallet or anywhere else.

Hi as I said you can just connect to the API directly by making HTTP GET requests to get the NFT data you need. You just need an API key by signing up for an account. You don’t need a wallet connection or the SDK.

Can you give me a code example? I’m just new to blockchain and don’t understand without examples.

Since you already know how to make requests as you’re using Etherscan, you just use Moralis’s REST API (https://deep-index.moralis.io/api/v2....).

If you sign up for an account and go to this page, you can find examples.

Thank you very much, I will try it now.

Can you help me make a proper Get Query string?
My string (/nft/{address}/owners):
public static string reqNFT = “https://deep-index.moralis.io/api/v2/MY_API/” +
“/nft/SMART_CONTRACT_ADDRESS” +
“/owners” +
“?chain=eth” +
“&format=decimal&” +
“&address=SMART_CONTRACT_ADDRESS”;
In short, I’m confused where to put what

It’s just that if you showed me once how to do it right, I could use it as an example for all the other GET and POST requests. Sorry for the cluelessness.

/{address}/nft/{token_address}
I found this one, this is the one.

Please show me an example with this, just a line, I can understand how to do a proper GET morals request and all.

Sorry I’m not familiar with C# syntax; what is an example of your Etherscan API call? We can work off that.

Also your API key will need to go inside the headers. I’m not sure what MY_API is referring to in this line public static string reqNFT = “https://deep-index.moralis.io/api/v2/MY_API/” +