示例#1
0
        public ResultWrapper <UInt256?> eth_estimateGas(TransactionForRpc transactionCall)
        {
            BlockHeader head = _blockchainBridge.FindLatestHeader();

            FixCallTx(transactionCall, head);

            long result = _blockchainBridge.EstimateGas(head, transactionCall.ToTransaction());

            return(ResultWrapper <UInt256?> .Success((UInt256)result));
        }
示例#2
0
        public ResultWrapper <UInt256?> eth_estimateGas(TransactionForRpc transactionCall)
        {
            BlockHeader head = _blockchainBridge.FindLatestHeader();

            FixCallTx(transactionCall, head);

            BlockchainBridge.CallOutput result = _blockchainBridge.EstimateGas(head, transactionCall.ToTransaction());
            if (result.Error == null)
            {
                return(ResultWrapper <UInt256?> .Success((UInt256)result.GasSpent));
            }

            return(ResultWrapper <UInt256?> .Fail(result.Error));
        }
示例#3
0
        public ResultWrapper <UInt256?> eth_estimateGas(TransactionForRpc transactionCall)
        {
            BlockHeader head = _blockchainBridge.FindLatestHeader();

            if (!HasStateForBlock(head))
            {
                return(ResultWrapper <UInt256?> .Fail($"No state available for block {head.Hash}", ErrorCodes.ResourceUnavailable));
            }

            FixCallTx(transactionCall, head);

            BlockchainBridge.CallOutput result = _blockchainBridge.EstimateGas(head, transactionCall.ToTransaction());
            if (result.Error == null)
            {
                return(ResultWrapper <UInt256?> .Success((UInt256)result.GasSpent));
            }

            return(ResultWrapper <UInt256?> .Fail(result.Error));
        }