public async Task <Contract> GetContract(EthereumContractInfo contractInfo)
        {
            var resultUnlocking = await _web3.Personal.UnlockAccount.SendRequestAsync(AccountAddress, _password, 60);

            if (resultUnlocking)
            {
                return(_web3.Eth.GetContract(contractInfo.Abi, contractInfo.ContractAddress));
            }
            return(null);
        }
        public async Task <EthereumContractInfo> TryGetContractAddress(EthereumContractInfo contractInfo)
        {
            var resultUnlocking = await _web3.Personal.UnlockAccount.SendRequestAsync(AccountAddress, _password, 60);

            if (resultUnlocking)
            {
                var receipt = await _web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(contractInfo.TransactionHash);

                while (receipt == null)
                {
                    Thread.Sleep(5000);
                    receipt = await _web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(contractInfo.TransactionHash);
                }
                contractInfo.ContractAddress = receipt.ContractAddress;
                return(contractInfo);
            }
            return(null);
        }
        public async Task SaveContractInfoToTableStorage(EthereumContractInfo contractInfo)
        {
            if (!string.IsNullOrEmpty(contractInfo.ContractAddress))
            {
                contractInfo.RowKey = contractInfo.ContractAddress;
            }
            else
            {
                throw new InvalidOperationException("Can't save a contract without a TransactionHash.");
            }
            CloudStorageAccount account = CloudStorageAccount.Parse(_storageAccountConnectionstring);
            var client = account.CreateCloudTableClient();

            var tableRef = client.GetTableReference("ethtransactions");
            await tableRef.CreateIfNotExistsAsync();

            TableOperation ops = TableOperation.InsertOrMerge(contractInfo);
            await tableRef.ExecuteAsync(ops);
        }
 public async Task <string> ReleaseContract(EthereumContractInfo contractInfo, int gas, string constructorParameter)
 {
     return(await ReleaseContract(contractInfo.ContractName, contractInfo.Abi, contractInfo.Bytecode, gas, constructorParameter));
 }