static async System.Threading.Tasks.Task Main(string[] args) { try { var url = "http://remix.ethereum.org/#optimize=false&evmVersion=null&version=soljson-v0.6.12+commit.27d51765.js"; var privateKey = "0x116abfc463299a1b7ff7504a9f6d6c8006f59508"; var account = new Account(privateKey); var web3 = new Web3(account, url); Console.WriteLine("Deploying..."); var deployment = new AtestadoDeployment(); deployment.PacienteItem = "Guilherme"; deployment.DataItem = DateTime.Now.ToString(); var receipt = await AtestadoService.DeployContractAndWaitForReceiptAsync(web3, deployment); var service = new AtestadoService(web3, receipt.ContractAddress); Console.WriteLine($"Contract Deployment Tx Status: {receipt.Status.Value}"); Console.WriteLine($"Contract Address: {service.ContractHandler.ContractAddress}"); } catch (Exception e) { var a = e; } }
public static Task <string> DeployContractAsync(Nethereum.Web3.Web3 web3, AtestadoDeployment atestadoDeployment) { return(web3.Eth.GetContractDeploymentHandler <AtestadoDeployment>().SendRequestAsync(atestadoDeployment)); }
public static async Task <AtestadoService> DeployContractAndGetServiceAsync(Nethereum.Web3.Web3 web3, AtestadoDeployment atestadoDeployment, CancellationTokenSource cancellationTokenSource = null) { var receipt = await DeployContractAndWaitForReceiptAsync(web3, atestadoDeployment, cancellationTokenSource); return(new AtestadoService(web3, receipt.ContractAddress)); }
public static Task <TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.Web3 web3, AtestadoDeployment atestadoDeployment, CancellationTokenSource cancellationTokenSource = null) { return(web3.Eth.GetContractDeploymentHandler <AtestadoDeployment>().SendRequestAndWaitForReceiptAsync(atestadoDeployment, cancellationTokenSource)); }