Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on Avax Fuji Testnet #3

Open
devon-bfs opened this issue Jan 22, 2024 · 0 comments
Open

Does not work on Avax Fuji Testnet #3

devon-bfs opened this issue Jan 22, 2024 · 0 comments

Comments

@devon-bfs
Copy link

I copied the mint function and deployed the same contract on chain id 43113.

Changed the contract address based on the chain id selected.

Function works fine on Goerli but when I use 43113 and the associated contract address the console prints the following error

Transaction Hash: {"message":"Error: network changed: 5 => 43113  (event=\"changed\", code=NETWORK_ERROR, version=6.9.0)","errJson":"{\"code\":\"NETWORK_ERROR\",\"event\":\"changed\",\"shortMessage\":\"network changed: 5 => 43113 \"}"}
UnityEngine.MonoBehaviour:print (object)

This is the modified function

async public void OnMintToken()
    {

        string contractAddress = "0xDD6ff2bA7fD02D19e8e4e1d99b65802eD9705437";
        if (ChainId == 5) {
            contractAddress = "0xDD6ff2bA7fD02D19e8e4e1d99b65802eD9705437";
        }
        if (ChainId == 43113) {
            contractAddress = "0x883482eD25eaFad619e20f4A7A93C828B126D9EE";
        }
        // string account = await GetAccount();

        // call publicMint function https://docs.hyperplaygaming.com/api/send-contract-endpoint
        string jsonString = "{ \"contractAddress\": \""+contractAddress+"\", \"functionName\": \"publicMint\", \"params\": [], \"abi\": [{ \"inputs\": [], \"name\": \"publicBurn\", \"outputs\": [], \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"inputs\": [], \"name\": \"publicMint\", \"outputs\": [], \"stateMutability\": \"nonpayable\", \"type\": \"function\" }], \"valueInWei\": \"0\", \"chain\": { \"chainId\": \""+ChainId+"\" } }";
        byte[] jsonBytes = System.Text.Encoding.UTF8.GetBytes(jsonString);

        UnityWebRequest request = new UnityWebRequest("localhost:9680/sendContract", "POST");
        request.uploadHandler = new UploadHandlerRaw(jsonBytes);
        request.downloadHandler = new DownloadHandlerBuffer();
        request.SetRequestHeader("Content-Type", "application/json");

        await request.SendWebRequest();
        print("Error: " + request.error);
        print("Transaction Hash: " + request.downloadHandler.text);
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant