public async void ShouldCallDifferentContractsUsingDataBytesArraysFixedAndVariable() { var web3 = _ethereumClientIntegrationFixture.GetWeb3(); var deploymentHandler = web3.Eth.GetContractDeploymentHandler <TheOtherDeployment>(); var deploymentReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync(); var deploymentCallerHandler = web3.Eth.GetContractDeploymentHandler <TestDeployment>(); var deploymentReceiptCaller = await deploymentCallerHandler.SendRequestAndWaitForReceiptAsync(); var callMeFunction1 = new CallMeFunction() { Name = "Hi", Greeting = "From the other contract" }; var contracthandler = web3.Eth.GetContractHandler(deploymentReceiptCaller.ContractAddress); var callManyOthersFunctionMessage = new CallManyContractsSameQueryFunction() { Destination = new string[] { deploymentReceipt.ContractAddress, deploymentReceipt.ContractAddress, deploymentReceipt.ContractAddress }.ToList(), Data = callMeFunction1.GetCallData() }; var returnVarByteArray = await contracthandler.QueryAsync <CallManyContractsSameQueryFunction, List <byte[]> >(callManyOthersFunctionMessage).ConfigureAwait(false); var expected = "Hello Hi From the other contract"; var firstVar = new StringTypeDecoder().Decode(returnVarByteArray[0]); var secondVar = new StringTypeDecoder().Decode(returnVarByteArray[1]); var thirdVar = new StringTypeDecoder().Decode(returnVarByteArray[2]); Assert.Equal(expected, firstVar); Assert.Equal(expected, secondVar); Assert.Equal(expected, thirdVar); callMeFunction1.Name = ""; callMeFunction1.Greeting = ""; var expectedShort = "Hello "; callManyOthersFunctionMessage = new CallManyContractsSameQueryFunction() { Destination = new string[] { deploymentReceipt.ContractAddress, deploymentReceipt.ContractAddress, deploymentReceipt.ContractAddress }.ToList(), Data = callMeFunction1.GetCallData() }; returnVarByteArray = await contracthandler.QueryAsync <CallManyContractsSameQueryFunction, List <byte[]> >(callManyOthersFunctionMessage).ConfigureAwait(false); firstVar = new StringTypeDecoder().Decode(returnVarByteArray[0]); secondVar = new StringTypeDecoder().Decode(returnVarByteArray[1]); thirdVar = new StringTypeDecoder().Decode(returnVarByteArray[2]); Assert.Equal(expectedShort, firstVar); Assert.Equal(expectedShort, secondVar); Assert.Equal(expectedShort, thirdVar); }
public Task <List <byte[]> > CallManyContractsSameQueryQueryAsync(CallManyContractsSameQueryFunction callManyContractsSameQueryFunction, BlockParameter blockParameter = null) { return(ContractHandler.QueryAsync <CallManyContractsSameQueryFunction, List <byte[]> >(callManyContractsSameQueryFunction, blockParameter)); }