Esempio n. 1
0
        /// <summary>
        /// Connects to blockchain using the JsonRpc client and performs a handshake
        /// </summary>
        /// <returns>String return infromation received from client</returns>
        public async Task <string> Connect()
        {
            string verStr  = null;
            string codeStr = null;

            try
            {
                var ver = new Nethereum.RPC.Web3.Web3ClientVersion(web.Client);
                verStr = await ver.SendRequestAsync();

                //check if game contract exists
                var code = new Nethereum.RPC.Eth.EthGetCode(web.Client);
                codeStr = await code.SendRequestAsync(gameCenter.Address);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString(), ex);
            }

            if (string.IsNullOrEmpty(codeStr) || (codeStr == "0x"))
            {
                throw new HoardException("Could not find Game Center contract at address: " + gameCenter.Address);
            }
            return(verStr);
        }
Esempio n. 2
0
 public EthGetCodeUnityRequest(string url, JsonSerializerSettings jsonSerializerSettings = null) : base(url, jsonSerializerSettings)
 {
     _ethGetCode = new Nethereum.RPC.Eth.EthGetCode(null);
 }
Esempio n. 3
0
 public EthGetCodeUnityRequest(string network = "mainnet", AuthProvider authProvider = null, JsonSerializerSettings jsonSerializerSettings = null) : base(network, authProvider, jsonSerializerSettings)
 {
     _ethGetCode = new Nethereum.RPC.Eth.EthGetCode(null);
 }