public async Task RunAsync()
        {
            var web3 = new Web3(new Account(PrivateKey), "http://localhost:8545");
            var deploymentHandler = web3.Eth.GetContractDeploymentHandler <TheOtherDeployment>();
            var deploymentReceipt = await deploymentHandler.SendRequestAndWaitForReceiptAsync();

            var deploymentCallerHandler = web3.Eth.GetContractDeploymentHandler <TestDeployment>();
            var deploymentReceiptCaller = await deploymentCallerHandler.SendRequestAndWaitForReceiptAsync();;

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

            var callAnotherFunctionMessage = new CallAnotherContractFunction()
            {
                TheOther = deploymentReceipt.ContractAddress
            };


            var returnValue = await contracthandler.QueryRawAsync <CallAnotherContractFunction>(callAnotherFunctionMessage);

            var returnStartingAtData = returnValue.Skip(32).ToArray();
            var returnToString       = new StringBytes32Decoder().Decode(returnStartingAtData);


            System.Console.WriteLine(returnToString);
        }
Exemplo n.º 2
0
        public async void ShouldGetTheDaiFromMainnet()
        {
            var web3                 = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
            var contractHandler      = web3.Eth.GetContractHandler("0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359");
            var stringBytes32Decoder = new StringBytes32Decoder();
            var symbol               = await contractHandler.QueryRawAsync <SymbolFunction, StringBytes32Decoder, string>();

            var token = await contractHandler.QueryRawAsync <NameFunction, StringBytes32Decoder, string>();
        }
Exemplo n.º 3
0
        public async void ShouldGetTheDaiFromMainnet()
        {
            var web3                 = new Web3.Web3("https://mainnet.infura.io");
            var contractHandler      = web3.Eth.GetContractHandler("0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359");
            var stringBytes32Decoder = new StringBytes32Decoder();
            var symbol               = await contractHandler.QueryRawAsync <SymbolFunction, StringBytes32Decoder, string>();

            var token = await contractHandler.QueryRawAsync <NameFunction, StringBytes32Decoder, string>();
        }
Exemplo n.º 4
0
        static PurchasingExtensions()
        {
            _encoder = new Bytes32TypeEncoder();
            _decoder = new StringBytes32Decoder();

            // Mapping POs
            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <PurchasingProfile>();
            });

            _mapper = new Mapper(config);
        }
Exemplo n.º 5
0
        public async Task RunAsync()
        {
            var ethereumNetworkUrl = "https://rinkeby.infura.io/";
            var web3 = new Web3(ethereumNetworkUrl);

            // Bytes32Array contract source code see:
            // https://rinkeby.etherscan.io/address/0x55efb02d754132b16e14ae798868e976ad41380c#code
            var bytes32ArrayService = new Bytes32ArrayService(web3, "0x55efb02d754132b16e14ae798868e976ad41380c");
            var result = await bytes32ArrayService.GetStringyQueryAsync();

            var decoder = new StringBytes32Decoder();

            foreach (var item in result)
            {
                System.Console.WriteLine($"{decoder.Decode(item)}");
            }
            System.Console.ReadLine();
        }
Exemplo n.º 6
0
 static ContractExtensions()
 {
     _encoder = new Bytes32TypeEncoder();
     _decoder = new StringBytes32Decoder();
 }
 static ExtensionMethods()
 {
     _encoder = new Bytes32TypeEncoder();
     _decoder = new StringBytes32Decoder();
 }