コード例 #1
0
        public async Task <Fee1559> SuggestFeeAsync(BigInteger?maxPriorityFeePerGas = null)
        {
            var lastBlock = await _ethGetBlockWithTransactionsHashes.SendRequestAsync(BlockParameter.CreateLatest()).ConfigureAwait(false);

            if (lastBlock.BaseFeePerGas == null)
            {
                return(FallbackFeeSuggestion);
            }

            var baseFee = lastBlock.BaseFeePerGas;

            if (maxPriorityFeePerGas == null)
            {
                var estimatedPriorityFee = await EstimatePriorityFeeAsync(
                    baseFee,
                    lastBlock.Number
                    );

                if (estimatedPriorityFee == null)
                {
                    return(FallbackFeeSuggestion);
                }

                maxPriorityFeePerGas = BigInteger.Max(estimatedPriorityFee.Value, DefaultPriorityFee);
            }

            return(SuggestMaxFeeUsingMultiplier(maxPriorityFeePerGas, baseFee));
        }
コード例 #2
0
        public static Task <BlockWithTransactionHashes> SendRequestAsync(
            this IEthGetBlockWithTransactionsHashesByNumber ethGetBlockWithTransactionsHashesByNumber,
            long blockNumber,
            object id = null)
        {
            var bockNumberHex = new HexBigInteger(new BigInteger(blockNumber));

            return(ethGetBlockWithTransactionsHashesByNumber.SendRequestAsync(bockNumberHex, id));
        }