public string GetTxByHash(string transactionHash)
 {
     if (transactionHash != null)
     {
         return(UtilityHelper.Dump(ServiceSync.Sync(this.Web3.Eth.Transactions.GetTransactionByHash.SendRequestAsync(transactionHash))));
     }
     return(null);
 }
        public string DeployContract(string abi, string byteCode, string senderAddress)
        {
            var txHash = ServiceSync.Sync(this.Web3.Eth.DeployContract.SendRequestAsync(abi, byteCode, senderAddress,
                                                                                        Constants.MaxGas, 40,
                                                                                        60, "0x6aa1210e1a0faa952b465b019f6a7554fc67b8e8"));

            return(ContractHelper.Instance.GetReceiptHash(txHash));
        }
 public string SendRawTx(string encodedTx)
 {
     if (!string.IsNullOrEmpty(encodedTx))
     {
         var transactionHash = ServiceSync.Sync(this.Web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + encodedTx));
         return(transactionHash);
     }
     return(null);
 }
Example #4
0
        public bool UnlockAccount()
        {
            var pass = GetPass();

            if (!String.IsNullOrEmpty(pass))
            {
                return(ServiceSync.Sync(ContractHelper.Instance.Web3.Personal.UnlockAccount.SendRequestAsync(Constants.AddressFrom, pass, 120)));
            }
            return(false);
        }
        public string GetReceiptHash(string transactionHash)
        {
            if (transactionHash != null)
            {
                var receipt = ServiceSync.Sync(this.Web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash));

                while (receipt == null)
                {
                    Thread.Sleep(1000);
                    receipt = ServiceSync.Sync(this.Web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash));
                }
                return("Mined in block:" + receipt.BlockNumber.Value + Environment.NewLine + "tx hash:" + receipt.TransactionHash + Environment.NewLine + "Contract Addr:" + receipt.ContractAddress);
            }
            return(null);
        }
 public BigInteger GetTransactionCount()
 {
     return(ServiceSync.Sync(this.Web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(Constants.AddressFrom)).Value);
 }