public async Task <JsonTileMapState> GetTileMapState()
        {
            await ConnectToContract();

            TileMapStateOutput result = await this.contract.StaticCallDTOTypeOutputAsync <TileMapStateOutput>("GetTileMapState");

            if (result == null)
            {
                throw new Exception("Smart contract didn't return anything!");
            }

            JsonTileMapState jsonTileMapState = JsonUtility.FromJson <JsonTileMapState>(result.State);

            return(jsonTileMapState);
        }
Exemplo n.º 2
0
    public async void StaticCallContract()
    {
        if (this.contract == null)
        {
            throw new Exception("Not signed in!");
        }

        this.statusTextRef.text = "Calling smart contract...";

        TileMapStateOutput result = await this.contract.StaticCallDtoTypeOutputAsync <TileMapStateOutput>("GetTileMapState");

        if (result != null)
        {
            this.statusTextRef.text = "Smart contract returned: " + result.State;
        }
        else
        {
            this.statusTextRef.text = "Smart contract didn't return anything!";
        }
    }