AllErc1155.cs 804 B

123456789101112131415161718192021222324
  1. using System.Numerics;
  2. using UnityEngine;
  3. using Web3Unity.Scripts.Library.ETHEREUEM.EIP;
  4. public class AllErc1155 : MonoBehaviour
  5. {
  6. string account;
  7. public string tokenIdHex;
  8. public string[] nftContracts;
  9. async void Start()
  10. {
  11. // This is the account taken from the user login scene
  12. account = PlayerPrefs.GetString("Account");
  13. // Searches through your listed contracts for balance and uri of the chosen tokenId
  14. foreach (string contract in nftContracts)
  15. {
  16. BigInteger balance = await ERC1155.BalanceOf(contract, account, tokenIdHex);
  17. Debug.Log("Balance of contract " + contract + ": " + balance);
  18. string uri = await ERC1155.URI(contract, tokenIdHex);
  19. Debug.Log("Token URI: " + uri);
  20. }
  21. }
  22. }