web3.unity icon indicating copy to clipboard operation
web3.unity copied to clipboard

EVM.AllErc721 and EVM.AllErc1155 not working

Open vmunhoz opened this issue 4 years ago • 12 comments

Describe the bug I've managed to execute methods like ERC721.OwnerOf and ERC721.BalanceOf, but when I try to use EVM.AllErc721 it returns an empty array. "[]"

I tested using the mainnet (ERC721) and testnets (ERC1155)

To Reproduce Steps to reproduce the behavior:

  1. import v1.0.14 on unity
  2. import the AllErc721 prefab to the scene
  3. Fill the fields:
        string chain = "ethereum";
        string network = "mainnet"; // mainnet ropsten kovan rinkeby goerli
        string account = "0xAb5634C69dd424bE66f21Dd661A3E90B5e867B42";
        string contract = "";

It is not clear if the contract should be filled or not. I tried with both scenarios. 4. save the file and run the scene on unity. 5. It returns: Error: "[]"

Expected behavior It should print information from the first found item that this address has.

Desktop (please complete the following information):

  • OS: Windows 10
  • Unity 2021.1.11f1

Additional context This is the ERC721 that I expect to return: https://opensea.io/assets/0x91673149ffae3274b32997288395d07a8213e41f/1142

This code runs just fine, and returns the expected URI

        string chain = "ethereum";
        string network = "mainnet";
        string contract = "0x91673149FFae3274b32997288395D07A8213e41F";
        string tokenId = "1142";

        string uri = await ERC721.URI(chain, network, contract, tokenId);
        print(uri);

vmunhoz avatar Dec 18 '21 04:12 vmunhoz

This is noted as we are seeing this on some of our synched indexers. Leaving this issue open until indexers are fully synched and this issue should be resolved.

KBryan avatar Dec 20 '21 16:12 KBryan

i tried to use EVM.allerc1155 but didn't get expected result

  1. it only shows 27 token IDs but i have more than 80
  2. it shows balance 0 or -1 can you tell me how can i fix this problem?

legend9447 avatar Dec 23 '21 17:12 legend9447

Are you working on mainnet/testnet and also what chain are you working with Ethereum/BSC etc.

KBryan avatar Dec 23 '21 17:12 KBryan

Any idea on when the synched indexers thing will be resolved? Still getting the original bug happening. Working with ethereum on mainnet. The rinkeby example seems to be working fine.

matt-heavy avatar Dec 28 '21 16:12 matt-heavy

I am working on rinkeby network. Chain is ethereum

legend9447 avatar Dec 29 '21 04:12 legend9447

@matt-heavy https://thegraph.com/hosted-service/subgraph/ryry79261/mainnet-erc721-erc1155/

rinkeby should be synced

leon-do avatar Jan 11 '22 00:01 leon-do

Hi everybody! The original bug is happening as well in binance mainnet. Is it because of the sync too?

Thanks

Miki-84 avatar Jan 11 '22 14:01 Miki-84

@Miki-84 correct https://thegraph.com/hosted-service/subgraph/ryry79261/bsc-erc721-erc1155/

leon-do avatar Jan 11 '22 16:01 leon-do

@leon-do how often are these synch issues likely to crop up? I assume we're waiting until 100% for ethereum main net to work?

Heavy-io avatar Jan 11 '22 16:01 Heavy-io

@Heavy-io It's a one time sync. Once it's 100%, it'll stay synced indefinitely

leon-do avatar Jan 11 '22 17:01 leon-do

mainnet Ethereum is fully synced now. closing this issue.

KBryan avatar Feb 18 '22 22:02 KBryan

@vmunhoz I tried with this code and I did not got the error. But when I put a space before or after the address I got the same error as you.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Newtonsoft.Json;

public class AllErc721Example : MonoBehaviour
{
    private class NFTs
    {
        public string contract { get; set; }
        public string tokenId { get; set; }
        public string uri { get; set; }
        public string balance { get; set; }
    }

    async void Start()
    {
        string chain = "ethereum";
        string network = "mainnet"; // mainnet ropsten kovan rinkeby goerli
        string account = "0xAb5634C69dd424bE66f21Dd661A3E90B5e867B42";
        string contract = "";
        int first = 500;
        int skip = 0;
        string response = await EVM.AllErc721(chain, network, account, contract, first, skip);
        try
        {
            NFTs[] erc721s = JsonConvert.DeserializeObject<NFTs[]>(response);
            print(erc721s[0].contract);
            print(erc721s[0].tokenId);
            print(erc721s[0].uri);
            print(erc721s[0].balance);
        }
        catch
        {
           print("Error: " + response);
        }
    }
}

rarcif avatar Mar 17 '22 09:03 rarcif