#Could not detect network issue

1 messages · Page 1 of 1 (latest)

teal bone
#

We are students who are developing simple blockchain games for school projects.
This is our first time building a chainsafe web3 game and we are having problems with connecting smart contracts to unity games with chainsafe SDK.

We wrote some test codes to check our connection and got errors on the web console.
We're trying to fix this since march but still can't figure it out. Can you guys give us some ideas?

  • We don’t have polygon mainnet on neither our codes and unity settings. Where did that come from?
#

We are using Ethereum Sepolia testnet (11155111) and we got our RPC node via Chainlist.

#

This is our C# code on unity

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using System.Numerics;
using System;
using Newtonsoft.Json;
using Web3Unity.Scripts.Library.Ethers.Contracts;
using Web3Unity.Scripts.Library.Ethers.Providers;
using Web3Unity.Scripts.Library.ETHEREUEM.EIP;

public class GameController : MonoBehaviour
{
public static string TokenContract = "contract address"; // token contract
public static string TokenABI = "abi"; // contract ABI
public static string RPC = "RPC"; // RPC node

// System UI
public TextMeshProUGUI ConnectedWallet; 
public TextMeshProUGUI TokenBalance; 
public TextMeshProUGUI TxStatus; 

// UI for buying NFTs
public TextMeshProUGUI SellerAccount; 
public TextMeshProUGUI Price; 

private void Start()
{
    // shows account of the connected wallet
    ConnectedWallet.text = PlayerPrefs.GetString("Account");

    // Transfer of the ERC20 token
    //TransferToken();
}

// code to test our connection with smart contracts
public async void FetchBalance()
{
    // using method
    string method = "balanceOf";

    // parameter for the method
    string _owner = PlayerPrefs.GetString("Account");

    // RPC endpoint
    var provider = new JsonRpcProvider(RPC);

    // data to interact with smart contracts
    var contract = new Contract(TokenABI, TokenContract, provider);
    var data = await contract.Call(method, new object[]
    {
        // method's parameter
        _owner,
    });

    // testing sanity
    print(data[0].ToString());
}

}

#

This is our Solidity code

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

// ERC20 Token
contract GameToken is ERC20 {
constructor() ERC20("GameToken", "GT") {
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
}

// Function to check the token balance of a specific address
function balanceOf(address account) public view override returns (uint256) {
    return super.balanceOf(account);
}

}

#

Could not detect network issue

proven yoke
teal bone
#

I wanted to extend my heartfelt gratitude for your swift and insightful response to my programming issue. Your assistance has been immensely valuable, and I truly appreciate your willingness to help.

teal bone
#

Our game is using version 2.1.0 now, how do I upgrade it?