<commit_before>﻿using System.Numerics;
using Nethereum.Hex.HexConvertors.Extensions;

namespace Nethereum.Signer
{
    public class TransactionSigner
    {
        public byte[] GetPublicKey(string rlp)
        {
            var transaction = new Transaction(rlp.HexToByteArray());
            return transaction.Key.GetPubKey();
        }

        public string GetSenderAddress(string rlp)
        {
            var transaction = new Transaction(rlp.HexToByteArray());
            return transaction.Key.GetPublicAddress();
        }

        public bool VerifyTransaction(string rlp)
        {
            var transaction = new Transaction(rlp.HexToByteArray());
            return transaction.Key.VerifyAllowingOnlyLowS(transaction.RawHash, transaction.Signature);
        }


        public byte[] GetPublicKey(string rlp, BigInteger chainId)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), chainId);
            return transaction.Key.GetPubKey();
        }

        public string GetSenderAddress(string rlp, BigInteger chainId)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), chainId);
            return transaction.Key.GetPublicAddress();
        }

        public bool VerifyTransaction(string rlp, BigInteger chainId)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), chainId);
            return transaction.Key.VerifyAllowingOnlyLowS(transaction.RawHash, transaction.Signature);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce, data);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce, gasPrice, gasLimit);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce, gasPrice, gasLimit, data);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce)
        {
            var transaction = new Transaction(to, amount, nonce);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce, string data)
        {
            var transaction = new Transaction(to, amount, nonce, data);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit)
        {
            var transaction = new Transaction(to, amount, nonce, gasPrice, gasLimit);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            var transaction = new Transaction(to, amount, nonce, gasPrice, gasLimit, data);
            return SignTransaction(privateKey, transaction);
        }


        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce);
        }

        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce, data);
        }

        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce, gasPrice, gasLimit);
        }

        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce, gasPrice, gasLimit, data);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce)
        {
            var transaction = new TransactionChainId(to, amount, nonce, chainId);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, string data)
        {
            var transaction = new TransactionChainId(to, amount, nonce, data, chainId);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit)
        {
            var transaction = new TransactionChainId(to, amount, nonce, gasPrice, gasLimit, chainId);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            var transaction = new TransactionChainId(to, amount, nonce, gasPrice, gasLimit, data, chainId);
            return SignTransaction(privateKey, transaction);
        }

        private string SignTransaction(byte[] privateKey, Transaction transaction)
        {
            transaction.Sign(new EthECKey(privateKey, true));
            return transaction.GetRLPEncoded().ToHex();
        }

        private string SignTransaction(byte[] privateKey, TransactionChainId transaction)
        {
            transaction.Sign(new EthECKey(privateKey, true));
            return transaction.GetRLPEncoded().ToHex();
        }
    }
}<commit_msg>TransactionSigner: add Chain enum overloads<commit_after>﻿using System.Numerics;
using Nethereum.Hex.HexConvertors.Extensions;

namespace Nethereum.Signer
{
    public class TransactionSigner
    {
        public byte[] GetPublicKey(string rlp)
        {
            var transaction = new Transaction(rlp.HexToByteArray());
            return transaction.Key.GetPubKey();
        }

        public string GetSenderAddress(string rlp)
        {
            var transaction = new Transaction(rlp.HexToByteArray());
            return transaction.Key.GetPublicAddress();
        }

        public bool VerifyTransaction(string rlp)
        {
            var transaction = new Transaction(rlp.HexToByteArray());
            return transaction.Key.VerifyAllowingOnlyLowS(transaction.RawHash, transaction.Signature);
        }

        public byte[] GetPublicKey(string rlp, Chain chain)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), new BigInteger((int)chain));
            return transaction.Key.GetPubKey();
        }

        public byte[] GetPublicKey(string rlp, BigInteger chainId)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), chainId);
            return transaction.Key.GetPubKey();
        }

        public string GetSenderAddress(string rlp, Chain chain)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), new BigInteger((int)chain));
            return transaction.Key.GetPublicAddress();
        }

        public string GetSenderAddress(string rlp, BigInteger chainId)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), chainId);
            return transaction.Key.GetPublicAddress();
        }

        public bool VerifyTransaction(string rlp, Chain chain)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), new BigInteger((int)chain));
            return transaction.Key.VerifyAllowingOnlyLowS(transaction.RawHash, transaction.Signature);
        }

        public bool VerifyTransaction(string rlp, BigInteger chainId)
        {
            var transaction = new TransactionChainId(rlp.HexToByteArray(), chainId);
            return transaction.Key.VerifyAllowingOnlyLowS(transaction.RawHash, transaction.Signature);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce, data);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce, gasPrice, gasLimit);
        }

        public string SignTransaction(string privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), to, amount, nonce, gasPrice, gasLimit, data);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce)
        {
            var transaction = new Transaction(to, amount, nonce);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce, string data)
        {
            var transaction = new Transaction(to, amount, nonce, data);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit)
        {
            var transaction = new Transaction(to, amount, nonce, gasPrice, gasLimit);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce,
            BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            var transaction = new Transaction(to, amount, nonce, gasPrice, gasLimit, data);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(string privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce)
        {
            return SignTransaction(privateKey.HexToByteArray(), new BigInteger((int)chain), to, amount, nonce);
        }

        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce);
        }

        public string SignTransaction(string privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), new BigInteger((int)chain), to, amount, nonce, data);
        }

        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce, data);
        }

        public string SignTransaction(string privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit)
        {
            return SignTransaction(privateKey.HexToByteArray(), new BigInteger((int)chain), to, amount, nonce, gasPrice, gasLimit);
        }

        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce, gasPrice, gasLimit);
        }

        public string SignTransaction(string privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), new BigInteger((int)chain), to, amount, nonce, gasPrice, gasLimit, data);
        }

        public string SignTransaction(string privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            return SignTransaction(privateKey.HexToByteArray(), chainId, to, amount, nonce, gasPrice, gasLimit, data);
        }

        public string SignTransaction(byte[] privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce)
        {
            var transaction = new TransactionChainId(to, amount, nonce, new BigInteger((int)chain));
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce)
        {
            var transaction = new TransactionChainId(to, amount, nonce, chainId);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce, string data)
        {
            var transaction = new TransactionChainId(to, amount, nonce, data, new BigInteger((int)chain));
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, string data)
        {
            var transaction = new TransactionChainId(to, amount, nonce, data, chainId);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit)
        {
            var transaction = new TransactionChainId(to, amount, nonce, gasPrice, gasLimit, new BigInteger((int)chain));
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit)
        {
            var transaction = new TransactionChainId(to, amount, nonce, gasPrice, gasLimit, chainId);
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, Chain chain, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            var transaction = new TransactionChainId(to, amount, nonce, gasPrice, gasLimit, data, new BigInteger((int)chain));
            return SignTransaction(privateKey, transaction);
        }

        public string SignTransaction(byte[] privateKey, BigInteger chainId, string to, BigInteger amount,
            BigInteger nonce, BigInteger gasPrice,
            BigInteger gasLimit, string data)
        {
            var transaction = new TransactionChainId(to, amount, nonce, gasPrice, gasLimit, data, chainId);
            return SignTransaction(privateKey, transaction);
        }

        private string SignTransaction(byte[] privateKey, Transaction transaction)
        {
            transaction.Sign(new EthECKey(privateKey, true));
            return transaction.GetRLPEncoded().ToHex();
        }

        private string SignTransaction(byte[] privateKey, TransactionChainId transaction)
        {
            transaction.Sign(new EthECKey(privateKey, true));
            return transaction.GetRLPEncoded().ToHex();
        }
    }
}
{'fraction_non_alphanumeric': 0.07642048769105123, 'fraction_numerical': 0.0, 'mean_word_length': 2.609812592124658, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1071736', 'n_tokens_mistral': 4110, 'n_tokens_neox': 4053, 'n_words': 1191}