Issue with SendTransactionAsync Function , C#

Hey ,

I am working on a Unity C# project , I am facing an issue in function below :

result = await function.SendTransactionAsync(fromAddress, gas, value, args);

My target platform is mobile devices ( Android and Ios ) …currently the code halts at the line above and never reach the code below it , neither returns a value to the ( result ) variable .
Neither coming back with an error or exception .

I tried to change the build to : Windows build , instead of phone build ( APK ) , and I found that the line above sends a transaction to my wallet , with two options : Confirm , and reject .

Yet the ( confirm ) buttons never work …and reject is rejecting the transaction and it returns an empty result ( which is expected upon rejection ) . Please check the link below for a demo video of the transaction pop up , and the fact that the confirm button is not working .

So my issues here are :

  1. The confirm button doesn’t do any action , so I am not getting any result , and I am not able to complete the Transaction .

  2. Upon running the game on my phone , it didn’t even send the transaction to the wallet app , so on phone …nothing happens at all …And upon digging the code , this is related to Moralis SDK code itself , so It’s critical to know how to solve that .

Will wait for your help .
Regards ,

Which Unity game kit version are you running? Can you also post your full code involving SendTransactionAsync (and params).

I use Unity 2022.1.16f1 , and Moralis SDK version : 1.2.7

And SentTransactionAysnc is being called from inside ExectureContractfunction( param ) , which is located in Moralis.cs ( it’s part of Moralis Sdk , and I didn’t change it , I use it as it’s is ) .

This is ExecuteContractFunction denotion anyway :

public async static UniTask ExecuteContractFunction(string contractAddress,
string abi,
string functionName,
object[] args,
HexBigInteger value,
HexBigInteger gas,
HexBigInteger gasPrice)

So here is the function I wrote , that call ( ExecuteContractFunction) :

static async UniTask OnSendTransaction(string functionName, object[] args)
{
//Defining contract data
string address = LeaderBoardContractData.Address;
string abi = “[{“inputs”:[{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”},{“internalType”:“uint256”,“name”:“nonce”,“type”:“uint256”},{“internalType”:“bytes”,“name”:“signature”,“type”:“bytes”}],“name”:“addScore”,“outputs”:[{“internalType”:“bool”,“name”:“status”,“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”}]”;

        //Ensure WalletConnect
        if (WalletConnect.Instance == null)
        {
            throw new Exception("Method failed. WalletConnect.Instance must not be null. Add the WalletConnect.prefab to your scene.");
        }

        //Setup Web3
        await Moralis.SetupWeb3();

        //Estimate the gas
        HexBigInteger value = new HexBigInteger("0x0");
        //FIXME: Without gas Wallet i.e Meta mask returns an error JSON-RPC
        HexBigInteger gas = new HexBigInteger("800000");
        HexBigInteger gasPrice = new HexBigInteger("0");
        try
        {
            string result = await Moralis.ExecuteContractFunction(address, abi, functionName, args, value, gas, gasPrice);

            return result;
        }
        catch (Exception e)
        {
            throw new Exception(e.Message);
        }


    }

Please check the attached screenshot , it’s the real-time data on my android device for the parameters of ExecuteContractFunction , which is passed to SendTransactionAysnc

Have you tried using the latest SDK version (1.2.10)?

Well , I updated the Moralis SDK to the latest version , and seems if fixes the issue that the ( confirm ) transaction button wasn’t working . But this shows another issue .

So I made two tests to sendTransaction . The first one is from the Unity editor ( in the PC build mode ) , and the second was from my phone ( android build ) .

Please check screenshots , even if one transaction is ( confirmed ) , and the second one is ( failed ) , but both returns a status : fail with error 'ECDSA : Invalid signature length "

Both transactions are being made with identical (or similar) transaction code? Which one failed on which device (PC/phone)?

Can you post both transaction hashes here? Make sure your syntax is similar to the example here.

The one with status ( confirmed ) is the one for pc .

The one with status ( failed ) is the one from the android phone .

The screenshot from testnet in my previous reply was for the pc transaction , and the screenshot in the current post ( attached to this post ) is for the mobile phone transaction .

The transaction hash for pc is :
0x4f7986cc184759a76a610546948586bbe145591102538d4e1c8dbf2d41bd6139

for for mobile is :

0x40adbc6758e9ea1d1d1a4d98a32c1f687cd6f0ac365148cc72038d2dad08fde0

Ok they both failed but it still shows confirmed on PC? Is it for the same transaction hash? Maybe an issue with your ExecuteContractFunction, can you try another function on that same contract to test.

Otherwise can you verify that contract or paste the full ABI here so I can try some things on my end.

Here is full ABI :

“[{“inputs”:[{“internalType”:“address”,“name”:”_gameAddress",“type”:“address”},{“internalType”:“address”,“name”:"_rewardKeeper",“type”:“address”},{“internalType”:“address”,“name”:"_coinInstance",“type”:“address”}],“stateMutability”:“nonpayable”,“type”:“constructor”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“coin”,“type”:“address”},{“indexed”:false,“internalType”:“uint8”,“name”:“decimals”,“type”:“uint8”}],“name”:“CoinInstanceUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“newKeeper”,“type”:“address”}],“name”:“KeeperUpdated”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:true,“internalType”:“address”,“name”:“previousOwner”,“type”:“address”},{“indexed”:true,“internalType”:“address”,“name”:“newOwner”,“type”:“address”}],“name”:“OwnershipTransferred”,“type”:“event”},{“anonymous”:false,“inputs”:[{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader1”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader2”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader3”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader4”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader5”,“type”:“tuple”},{“indexed”:false,“internalType”:“address”,“name”:“keeper”,“type”:“address”},{“indexed”:false,“internalType”:“uint256”,“name”:“currentOrder”,“type”:“uint256”}],“name”:“PayoutAndReset”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“string”,“name”:“kindof”,“type”:“string”},{“indexed”:false,“internalType”:“uint256”,“name”:“price”,“type”:“uint256”}],“name”:“PriceUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[],“name”:“PrizesUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“signer”,“type”:“address”}],“name”:“SignerUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“user”,“type”:“address”},{“indexed”:false,“internalType”:“uint256”,“name”:“price”,“type”:“uint256”}],“name”:“StartSession”,“type”:“event”},{“stateMutability”:“nonpayable”,“type”:“fallback”},{“inputs”:[],“name”:“coinInstance”,“outputs”:[{“internalType”:“contract IERC20”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“owner”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“name”:“prizes”,“outputs”:[{“internalType”:“uint8”,“name”:"",“type”:“uint8”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“renounceOwnership”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[],“name”:“rewardKeeper”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“startGamePrice”,“outputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“newOwner”,“type”:“address”}],“name”:“transferOwnership”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“stateMutability”:“payable”,“type”:“receive”},{“inputs”:[],“name”:“payToPlay”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:“new_price”,“type”:“uint256”}],“name”:“updateStartPrice”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“new_signer”,“type”:“address”}],“name”:“updateSigner”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:“index”,“type”:“uint256”}],“name”:“getPrizes”,“outputs”:[{“internalType”:“uint8”,“name”:“prize”,“type”:“uint8”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“currentKeeper”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint8[]”,“name”:“new_prizes”,“type”:“uint8[]”}],“name”:“updatePrizes”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“new_coin”,“type”:“address”},{“internalType”:“uint8”,“name”:"_decimals",“type”:“uint8”}],“name”:“updateCoinInstance”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“newKeeper”,“type”:“address”}],“name”:“updateKeeper”,“outputs”:[{“internalType”:“bool”,“name”:"",“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”},{“internalType”:“uint256”,“name”:“nonce”,“type”:“uint256”},{“internalType”:“bytes”,“name”:“signature”,“type”:“bytes”}],“name”:“addScore”,“outputs”:[{“internalType”:“bool”,“name”:“status”,“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[],“name”:“payoutReset”,“outputs”:[{“internalType”:“bool”,“name”:“success”,“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[],“name”:“getCoinsBalance”,“outputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“getSigner”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint8”,“name”:“position”,“type”:“uint8”}],“name”:“readStructFromMapping”,“outputs”:[{“internalType”:“address”,“name”:“refUser”,“type”:“address”},{“internalType”:“uint256”,“name”:“refScore”,“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint8”,“name”:“position”,“type”:“uint8”},{“internalType”:“uint256”,“name”:“order”,“type”:“uint256”}],“name”:“readStructFromMappingByOrder”,“outputs”:[{“internalType”:“address”,“name”:“refUser”,“type”:“address”},{“internalType”:“uint256”,“name”:“refScore”,“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”}]";

( Confirmed ) is shown in the MetaMask app , but ( fail with error ECDSA : invalid signature length ) is shown on the TestNet for this transaction . This is for the PC transaction …the mobile transaction failed on both . But since the app is mainly for mobile devices , I would care more about the mobile version transaction .

  • when you said ( Maybe an issue with your ExecuteContractFunction, can you try another function on that same contract to test ) …what other function(s) you want me to try ? I am not sure if you want me to try some specific scenario …but you got the full ABI anyway , probably it’s better for you to test different scenarios at your side .

Can you post this ABI as code - I can’t use that as it is.

what other function(s) you want me to try

Any other function, just to test if you can get any contract transaction working.

Yes , I tried : moralisClient.Web3Api.Native.RunContractFunction

And it worked well . I used it on various internal functions inside my game logic ( get prizes , get start price , pay start price ) …and all worked .

string Abi = “[{“inputs”:[{“internalType”:“address”,“name”:”_gameAddress",“type”:“address”},{“internalType”:“address”,“name”:"_rewardKeeper",“type”:“address”},{“internalType”:“address”,“name”:"_coinInstance",“type”:“address”}],“stateMutability”:“nonpayable”,“type”:“constructor”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“coin”,“type”:“address”},{“indexed”:false,“internalType”:“uint8”,“name”:“decimals”,“type”:“uint8”}],“name”:“CoinInstanceUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“newKeeper”,“type”:“address”}],“name”:“KeeperUpdated”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:true,“internalType”:“address”,“name”:“previousOwner”,“type”:“address”},{“indexed”:true,“internalType”:“address”,“name”:“newOwner”,“type”:“address”}],“name”:“OwnershipTransferred”,“type”:“event”},{“anonymous”:false,“inputs”:[{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader1”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader2”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader3”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader4”,“type”:“tuple”},{“components”:[{“internalType”:“address”,“name”:“user”,“type”:“address”},{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”}],“indexed”:false,“internalType”:“struct MavatrixLeaderboard.User”,“name”:“leader5”,“type”:“tuple”},{“indexed”:false,“internalType”:“address”,“name”:“keeper”,“type”:“address”},{“indexed”:false,“internalType”:“uint256”,“name”:“currentOrder”,“type”:“uint256”}],“name”:“PayoutAndReset”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“string”,“name”:“kindof”,“type”:“string”},{“indexed”:false,“internalType”:“uint256”,“name”:“price”,“type”:“uint256”}],“name”:“PriceUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[],“name”:“PrizesUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“signer”,“type”:“address”}],“name”:“SignerUpdate”,“type”:“event”},{“anonymous”:false,“inputs”:[{“indexed”:false,“internalType”:“address”,“name”:“user”,“type”:“address”},{“indexed”:false,“internalType”:“uint256”,“name”:“price”,“type”:“uint256”}],“name”:“StartSession”,“type”:“event”},{“stateMutability”:“nonpayable”,“type”:“fallback”},{“inputs”:[],“name”:“coinInstance”,“outputs”:[{“internalType”:“contract IERC20”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“owner”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“name”:“prizes”,“outputs”:[{“internalType”:“uint8”,“name”:"",“type”:“uint8”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“renounceOwnership”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[],“name”:“rewardKeeper”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“startGamePrice”,“outputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“newOwner”,“type”:“address”}],“name”:“transferOwnership”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“stateMutability”:“payable”,“type”:“receive”},{“inputs”:[],“name”:“payToPlay”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:“new_price”,“type”:“uint256”}],“name”:“updateStartPrice”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“new_signer”,“type”:“address”}],“name”:“updateSigner”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:“index”,“type”:“uint256”}],“name”:“getPrizes”,“outputs”:[{“internalType”:“uint8”,“name”:“prize”,“type”:“uint8”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“currentKeeper”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint8[]”,“name”:“new_prizes”,“type”:“uint8[]”}],“name”:“updatePrizes”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“new_coin”,“type”:“address”},{“internalType”:“uint8”,“name”:"_decimals",“type”:“uint8”}],“name”:“updateCoinInstance”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:“newKeeper”,“type”:“address”}],“name”:“updateKeeper”,“outputs”:[{“internalType”:“bool”,“name”:"",“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”},{“internalType”:“uint256”,“name”:“nonce”,“type”:“uint256”},{“internalType”:“bytes”,“name”:“signature”,“type”:“bytes”}],“name”:“addScore”,“outputs”:[{“internalType”:“bool”,“name”:“status”,“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[],“name”:“payoutReset”,“outputs”:[{“internalType”:“bool”,“name”:“success”,“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[],“name”:“getCoinsBalance”,“outputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[],“name”:“getSigner”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint8”,“name”:“position”,“type”:“uint8”}],“name”:“readStructFromMapping”,“outputs”:[{“internalType”:“address”,“name”:“refUser”,“type”:“address”},{“internalType”:“uint256”,“name”:“refScore”,“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“uint8”,“name”:“position”,“type”:“uint8”},{“internalType”:“uint256”,“name”:“order”,“type”:“uint256”}],“name”:“readStructFromMappingByOrder”,“outputs”:[{“internalType”:“address”,“name”:“refUser”,“type”:“address”},{“internalType”:“uint256”,“name”:“refScore”,“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”}]";

This is the Abi as a preformatted text .

I still can’t use that ABI - you need to copy it from your code file and format it like in that thread I posted, not copy your previous post of it and change the formatting.

Yes , I tried : moralisClient.Web3Api.Native.RunContractFunction

How about any other transaction (contract write, not read)? Because that’s where the issue is (signature length).

public const string Abi = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_gameAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_rewardKeeper\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_coinInstance\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"coin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"}],\"name\":\"CoinInstanceUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newKeeper\",\"type\":\"address\"}],\"name\":\"KeeperUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"score\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct MavatrixLeaderboard.User\",\"name\":\"leader1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"score\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct MavatrixLeaderboard.User\",\"name\":\"leader2\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"score\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct MavatrixLeaderboard.User\",\"name\":\"leader3\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"score\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct MavatrixLeaderboard.User\",\"name\":\"leader4\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"score\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct MavatrixLeaderboard.User\",\"name\":\"leader5\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"keeper\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"currentOrder\",\"type\":\"uint256\"}],\"name\":\"PayoutAndReset\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"kindof\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"PriceUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"PrizesUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"}],\"name\":\"SignerUpdate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"StartSession\",\"type\":\"event\"},{\"stateMutability\":\"nonpayable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"coinInstance\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"prizes\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardKeeper\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startGamePrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"},{\"inputs\":[],\"name\":\"payToPlay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"new_price\",\"type\":\"uint256\"}],\"name\":\"updateStartPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"new_signer\",\"type\":\"address\"}],\"name\":\"updateSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getPrizes\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"prize\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentKeeper\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8[]\",\"name\":\"new_prizes\",\"type\":\"uint8[]\"}],\"name\":\"updatePrizes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"new_coin\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_decimals\",\"type\":\"uint8\"}],\"name\":\"updateCoinInstance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newKeeper\",\"type\":\"address\"}],\"name\":\"updateKeeper\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"score\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"addScore\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"payoutReset\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCoinsBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getSigner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"position\",\"type\":\"uint8\"}],\"name\":\"readStructFromMapping\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"refUser\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"refScore\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"position\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"order\",\"type\":\"uint256\"}],\"name\":\"readStructFromMappingByOrder\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"refUser\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"refScore\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]";

Let me know if this worked . Thanks ,

I have tried - I got a failed transaction with a different error as the params/args for the function are different. Can you copy and paste the exact options you’re using? Or make everything hardcoded into ExecuteContractFunction so I can copy the code and run it directly.

Also could you verify this contract on testnet.bscscan.com as well.

Did you try making another transaction on a different contract function?

Well , here is the head of the function :
string result = await Moralis.ExecuteContractFunction(address, abi, functionName, args, value, gas, gasPrice);

Here are the params I am using :

string Abi = [{“inputs”:[{“internalType”:“uint256”,“name”:“score”,“type”:“uint256”},{“internalType”:“uint256”,“name”:“nonce”,“type”:“uint256”},{“internalType”:“bytes”,“name”:“signature”,“type”:“bytes”}],“name”:“addScore”,“outputs”:[{“internalType”:“bool”,“name”:“status”,“type”:“bool”}],“stateMutability”:“nonpayable”,“type”:“function”}]

address :0x7FdA92A7B4F1090C4Aa654b71DBABbF8AE71f17a
function name:addScore
value:0
gas:8388608
gas price:0

For the args , it’s being passed as
//Define contract request
object[] args= { finalScore, nonce, signature };

With hard coded values :
finalScore = 10 ;
nonce = 5 ;
signature is a byte[]

finalScore = 10 ;
nonce = 5 ;
signature is a byte[]

I’m not sure how nonce and signature are used here in this contract function (or what message is meant to be signed) but you need to check how you’re getting your signature.