Exemplo n.º 1
0
        public void ShouldForceCorrectFormatForCallInput()
        {
            var callInput = new CallInput();
            callInput.From = "1";
            callInput.To = "2";
            callInput.Data = "3";

            Assert.Equal(callInput.From, "0x1");
            Assert.Equal(callInput.To, "0x2");
            Assert.Equal(callInput.Data, "0x3");

            callInput = new CallInput();
            
            callInput.To = "2";
            callInput.Data = "3";

            Assert.Equal(callInput.From, null);
            Assert.Equal(callInput.To, "0x2");
            Assert.Equal(callInput.Data, "0x3");

            callInput = new CallInput();
            Assert.Equal(callInput.From, null);
            Assert.Equal(callInput.To, null);
            Assert.Equal(callInput.Data, null);
        }
Exemplo n.º 2
0
 public async Task<dynamic> ExecuteTestAsync(RpcClient client)
 {
     var ethEstimateGas = new EthEstimateGas(client);
     var contractByteCode = "0xc6888fa10000000000000000000000000000000000000000000000000000000000000045";
     var to = "0x32eb97b8ad202b072fd9066c03878892426320ed";
    
     var transactionInput = new CallInput();
     transactionInput.Data = contractByteCode;
     transactionInput.To = to;
     transactionInput.From = "0x12890d2cce102216644c59dae5baed380d84830c";
    
     return await ethEstimateGas.SendRequestAsync(transactionInput);
 }
Exemplo n.º 3
0
 /*
  curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0x65180b8c813457b21dad6cc6363d195231b4d2e9","data":"0x606060405260728060106000396000f360606040526000357c010000000000000000000000000000000000000000000000000000000090048063c6888fa1146037576035565b005b604b60048080359060200190919050506061565b6040518082815260200191505060405180910390f35b6000600782029050606d565b91905056"}],"id":1}' http://localhost:8545
  */
 public async Task<dynamic> ExecuteTestAsync(RpcClient client)
 {
     //function multiply , input 69
     var contractByteCode = "0xc6888fa10000000000000000000000000000000000000000000000000000000000000045";
     var to = "0x32eb97b8ad202b072fd9066c03878892426320ed";
     var ethSendTransation = new EthCall(client);
     var transactionInput = new CallInput();
     transactionInput.Data = contractByteCode;
     transactionInput.To = to;
     transactionInput.From = "0x12890d2cce102216644c59dae5baed380d84830c";
     return await ethSendTransation.SendRequestAsync( transactionInput);
     //result
     // 0x00000000000000000000000000000000000000000000000000000000000001e3
     //483
 }
Exemplo n.º 4
0
        public IEnumerator SendRequest(Nethereum.RPC.Eth.DTOs.CallInput callInput)
        {
            var request = _ethEstimateGas.BuildRequest(callInput);

            yield return(SendRequest(request));
        }
Exemplo n.º 5
0
        public IEnumerator SendRequest(Nethereum.RPC.Eth.DTOs.CallInput callInput, Nethereum.RPC.Eth.DTOs.BlockParameter block)
        {
            var request = _ethCall.BuildRequest(callInput, block);

            yield return(SendRequest(request));
        }