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);
            EstimateGasAndCollateral = new EthEstimateGasAndCollateral(client);
            GetBalance      = new EthGetBalance(client);
            GetEpochNumber  = new EthGetEpochNumber(client);
            GetNextNonce    = new EthGetNextNonce(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
        }
Esempio n. 2
0
        public virtual Task <HexBigInteger> EstimateGasAsync(CallInput callInput)
        {
            if (Client == null)
            {
                throw new NullReferenceException("Client not configured");
            }
            if (callInput == null)
            {
                throw new ArgumentNullException(nameof(callInput));
            }
            var ethEstimateGas = new EthEstimateGasAndCollateral(Client);

            return(ethEstimateGas.SendRequestAsync(new object[] {
                new{ from = callInput.From, to = callInput.From
                     , data = callInput.Data, gasPrice = callInput.GasPrice, nonce = "0x1000" }
            }));
            //var ethEstimateGas = new EthEstimateGas(Client);
            //return ethEstimateGas.SendRequestAsync(callInput);
        }