Exemplo n.º 1
0
        public TransactionForRpc(Keccak?blockHash, long?blockNumber, int?txIndex, Transaction transaction)
        {
            Hash             = transaction.Hash;
            Nonce            = transaction.Nonce;
            BlockHash        = blockHash;
            BlockNumber      = blockNumber;
            TransactionIndex = txIndex;
            From             = transaction.SenderAddress;
            To         = transaction.To;
            Value      = transaction.Value;
            GasPrice   = transaction.GasPrice;
            Gas        = transaction.GasLimit;
            Input      = Data = transaction.Data;
            Type       = transaction.Type;
            AccessList = transaction.AccessList is null ? null : AccessListItemForRpc.FromAccessList(transaction.AccessList);

            Signature?signature = transaction.Signature;

            if (signature != null)
            {
                R = new UInt256(signature.R, true);
                S = new UInt256(signature.S, true);
                V = (UInt256?)signature.V;
            }
        }
Exemplo n.º 2
0
        public TransactionForRpc(Keccak?blockHash, long?blockNumber, int?txIndex, Transaction transaction, UInt256?baseFee = null)
        {
            Hash             = transaction.Hash;
            Nonce            = transaction.Nonce;
            BlockHash        = blockHash;
            BlockNumber      = blockNumber;
            TransactionIndex = txIndex;
            From             = transaction.SenderAddress;
            To       = transaction.To;
            Value    = transaction.Value;
            GasPrice = transaction.GasPrice;
            Gas      = transaction.GasLimit;
            Input    = Data = transaction.Data;
            if (transaction.IsEip1559)
            {
                GasPrice = baseFee != null
                    ? transaction.CalculateEffectiveGasPrice(true, baseFee.Value)
                    : transaction.MaxFeePerGas;

                MaxFeePerGas         = transaction.MaxFeePerGas;
                MaxPriorityFeePerGas = transaction.MaxPriorityFeePerGas;
            }
            ChainId    = transaction.ChainId;
            Type       = transaction.Type;
            AccessList = transaction.AccessList is null ? null : AccessListItemForRpc.FromAccessList(transaction.AccessList);

            Signature?signature = transaction.Signature;

            if (signature != null)
            {
                YParity = (transaction.IsEip1559 || transaction.IsEip2930) ? signature.RecoveryId : null;
                R       = new UInt256(signature.R, true);
                S       = new UInt256(signature.S, true);
                V       = transaction.Type == TxType.Legacy ? (UInt256?)signature.V : (UInt256?)signature.RecoveryId;
            }
        }
Exemplo n.º 3
0
 private AccessList?TryGetAccessList() =>
 Type != TxType.AccessList || AccessList == null
         ? null
         : AccessListItemForRpc.ToAccessList(AccessList);