Пример #1
0
        public ValueTask <(Keccak, AcceptTxResult?)> SendTransaction(Transaction tx, TxHandlingOptions txHandlingOptions)
        {
            UInt256 gasPriceEstimated = _gasPriceOracle.GetGasPriceEstimate() * _percentDelta / 100;

            tx.DecodedMaxFeePerGas = gasPriceEstimated;
            tx.GasPrice            = gasPriceEstimated;
            return(_txSender.SendTransaction(tx, txHandlingOptions));
        }
        public void SendTransaction_sets_correct_gas_price(ulong gasEstimate, uint percentDelta, ulong expectedGasPrice)
        {
            IGasPriceOracle gasPriceOracle = Substitute.For <IGasPriceOracle>();

            gasPriceOracle.GetGasPriceEstimate().Returns(gasEstimate);
            ITxSender        txSender         = Substitute.For <ITxSender>();
            TxGasPriceSender txGasPriceSender = new(txSender, gasPriceOracle, percentDelta);
            Transaction      transaction      = Build.A.Transaction.WithGasPrice(0).TestObject;

            txGasPriceSender.SendTransaction(transaction, TxHandlingOptions.None);
            Assert.AreEqual((UInt256)expectedGasPrice, transaction.GasPrice);
        }
Пример #3
0
 public ResultWrapper <UInt256?> eth_gasPrice()
 {
     return(ResultWrapper <UInt256?> .Success(_gasPriceOracle.GetGasPriceEstimate()));
 }