Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Nethereum/Nethereum
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfranblanco committed May 16, 2017
2 parents e461bc1 + 9f93d27 commit 78d76df
Showing 1 changed file with 35 additions and 11 deletions.
46 changes: 35 additions & 11 deletions src/Nethereum.Signer/TransactionSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,57 @@ public string GetSenderAddress(string rlp)
return transaction.Key.GetPublicAddress();
}

public string SignTransaction(string key, string to, BigInteger amount, BigInteger nonce)
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);
transaction.Sign(new EthECKey(key.HexToByteArray(), true));
return transaction.GetRLPEncoded().ToHex();
return SignTransaction(privateKey, transaction);
}

public string SignTransaction(string key, string to, BigInteger amount, BigInteger nonce, string data)
public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce, string data)
{
var transaction = new Transaction(to, amount, nonce, data);
transaction.Sign(new EthECKey(key.HexToByteArray(), true));
return transaction.GetRLPEncoded().ToHex();
return SignTransaction(privateKey, transaction);
}

public string SignTransaction(string key, string to, BigInteger amount, BigInteger nonce, BigInteger gasPrice,
public string SignTransaction(byte[] privateKey, string to, BigInteger amount, BigInteger nonce, BigInteger gasPrice,
BigInteger gasLimit)
{
var transaction = new Transaction(to, amount, nonce, gasPrice, gasLimit);
transaction.Sign(new EthECKey(key.HexToByteArray(), true));
return transaction.GetRLPEncoded().ToHex();
return SignTransaction(privateKey, transaction);
}

public string SignTransaction(string key, string to, BigInteger amount, BigInteger nonce, BigInteger gasPrice,
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);
transaction.Sign(new EthECKey(key.HexToByteArray(), true));
return SignTransaction(privateKey, transaction);
}

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

Expand Down

0 comments on commit 78d76df

Please sign in to comment.