Exemplo n.º 1
0
        public Eth(RpcClient client) : base(client)
        {
            this.Client = client;



            DeployContract = new DeployContract(client);

            Accounts        = new EthAccounts(client);
            CoinBase        = new EthCoinBase(client);
            GasPrice        = new EthGasPrice(client);
            GetBalance      = new EthGetBalance(client);
            GetCode         = new EthGetCode(client);
            GetStorageAt    = new EthGetStorageAt(client);
            ProtocolVersion = new EthProtocolVersion(client);
            Sign            = new EthSign(client);
            Syncing         = new EthSyncing(client);

            Transactions = new EthTransactionsService(client);
            Filters      = new EthFilterService(client);
            Blocks       = new EthBlockService(client);
            Uncles       = new EthUncleService(client);
            Mining       = new EthMiningService(client);
            Compile      = new EthCompilerService(client);

            this.DefaultBlock = BlockParameter.CreateLatest();
        }
        public EthApiService(IClient client, ITransactionManager transactionManager) : base(client)
        {
            Client = client;

            ChainId         = new EthChainId(client);
            Accounts        = new EthAccounts(client);
            CoinBase        = new EthCoinBase(client);
            GasPrice        = new EthGasPrice(client);
            GetBalance      = new EthGetBalance(client);
            GetCode         = new EthGetCode(client);
            GetStorageAt    = new EthGetStorageAt(client);
            ProtocolVersion = new EthProtocolVersion(client);
            Sign            = new EthSign(client);
            Syncing         = new EthSyncing(client);

            Transactions = new EthApiTransactionsService(client);
            Filters      = new EthApiFilterService(client);
            Blocks       = new EthApiBlockService(client);
            Uncles       = new EthApiUncleService(client);
            Mining       = new EthApiMiningService(client);
            Compile      = new EthApiCompilerService(client);

            DefaultBlock              = BlockParameter.CreateLatest();
            TransactionManager        = transactionManager;
            TransactionManager.Client = client; //Ensure is the same
        }
Exemplo n.º 3
0
        public Eth(RpcClient client):base(client)
        {
            this.Client = client;
           
           

            DeployContract = new DeployContract(client);

            Accounts = new EthAccounts(client);
            CoinBase = new EthCoinBase(client);
            GasPrice = new EthGasPrice(client);
            GetBalance = new EthGetBalance(client);
            GetCode = new EthGetCode(client);
            GetStorageAt = new EthGetStorageAt(client);       
            ProtocolVersion = new EthProtocolVersion(client);
            Sign = new EthSign(client);
            Syncing = new EthSyncing(client);

            Transactions = new EthTransactionsService(client);
            Filters = new EthFilterService(client);
            Blocks = new EthBlockService(client);
            Uncles = new EthUncleService(client);
            Mining = new EthMiningService(client);
            Compile = new EthCompilerService(client);

            this.DefaultBlock = BlockParameter.CreateLatest();

        }
        public async void ShouldInterceptParamsRequest()
        {
            var client = new RpcClient(new Uri("http://localhost:8545/"));

            client.OverridingRequestInterceptor = new OverridingInterceptorMock();
            var ethGetCode = new EthGetCode(client);
            var code = await ethGetCode.SendRequestAsync("address");
            Assert.Equal(code, "the code");
        }
        public async void ShouldInterceptParamsRequest()
        {
            var client = new HttpClient(new Uri("http://localhost:8545/"), defaultTimeOutForTests);

            client.OverridingRequestInterceptor = new OverridingInterceptorMock();
            var ethGetCode = new EthGetCode(client);
            var code       = await ethGetCode.SendRequestAsync("address");

            Assert.Equal("the code", code);
        }
        public async void ShouldInterceptParamsRequest()
        {
            var client = new RpcClient(new Uri("http://localhost:8545/"));

            client.OverridingRequestInterceptor = new OverridingInterceptorMock();
            var ethGetCode = new EthGetCode(client);
            var code       = await ethGetCode.SendRequestAsync("address");

            Assert.Equal(code, "the code");
        }
        public async Task <TransactionReceipt> DeployContractAndWaitForReceiptAsync(Func <Task <string> > deployFunction,
                                                                                    CancellationTokenSource tokenSource = null)
        {
            var transactionReceipt = await SendRequestAndWaitForReceiptAsync(deployFunction, tokenSource).ConfigureAwait(false);

            var contractAddress = transactionReceipt.ContractAddress;
            var ethGetCode      = new EthGetCode(_transactionManager.Client);
            var code            = await ethGetCode.SendRequestAsync(contractAddress).ConfigureAwait(false);

            if (code == "0x")
            {
                throw new ContractDeploymentException("Code not deployed succesfully", transactionReceipt);
            }
            return(transactionReceipt);
        }
Exemplo n.º 8
0
        public async Task <object> ExecuteTestAsync(IClient client)
        {
            var ethGetCode = new EthGetCode(client);

            return(await ethGetCode.SendRequestAsync("0x12890d2cce102216644c59dae5baed380d84830c"));
        }
Exemplo n.º 9
0
        public override async Task <string> ExecuteAsync(IClient client)
        {
            var ethGetCode = new EthGetCode(client);

            return(await ethGetCode.SendRequestAsync(Settings.GetContractAddress()));
        }
Exemplo n.º 10
0
 public async Task<dynamic> ExecuteTestAsync(RpcClient client)
 {
     var ethGetCode = new EthGetCode(client);
     return await ethGetCode.SendRequestAsync( "0x12890d2cce102216644c59dae5baed380d84830c");
 }