Exemplo n.º 1
0
        public async Task RunAsync()
        {
            var web3 = new Web3(new Account(PrivateKey), "http://localhost:8545");
            var contractDeployment = new Constructor10Deployment()
            {
                F = 10
            };

            var deploymentHandler = web3.Eth.GetContractDeploymentHandler <Constructor10Deployment>();
            var deploymentReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(contractDeployment);

            var contracthandler = web3.Eth.GetContractHandler(deploymentReceipt.ContractAddress);


            var returnValue = await contracthandler.QueryAsync <FFunction, BigInteger>();

            //Assert F == 10
            System.Console.WriteLine(returnValue);
        }
Exemplo n.º 2
0
 public static Task <string> DeployContractAsync(Web3 web3, Constructor10Deployment constructor10Deployment)
 {
     return(web3.Eth.GetContractDeploymentHandler <Constructor10Deployment>().SendRequestAsync(constructor10Deployment));
 }
Exemplo n.º 3
0
        public static async Task <Constructor10Service> DeployContractAndGetServiceAsync(Web3 web3, Constructor10Deployment constructor10Deployment, CancellationTokenSource cancellationTokenSource = null)
        {
            var receipt = await DeployContractAndWaitForReceiptAsync(web3, constructor10Deployment, cancellationTokenSource);

            return(new Constructor10Service(web3, receipt.ContractAddress));
        }
Exemplo n.º 4
0
 public static Task <TransactionReceipt> DeployContractAndWaitForReceiptAsync(Web3 web3, Constructor10Deployment constructor10Deployment, CancellationTokenSource cancellationTokenSource = null)
 {
     return(web3.Eth.GetContractDeploymentHandler <Constructor10Deployment>().SendRequestAndWaitForReceiptAsync(constructor10Deployment, cancellationTokenSource));
 }