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; } }
private static AccessListItemForRpc[] GetResultAccessList(Transaction tx, BlockchainBridge.CallOutput result) { AccessList?accessList = result.AccessList ?? tx.AccessList; return(accessList is null?Array.Empty <AccessListItemForRpc>() : AccessListItemForRpc.FromAccessList(accessList)); }