Skip to content

Commit

Permalink
reversing changes so my forked 1.0 branch is in sync with the upstrea…
Browse files Browse the repository at this point in the history
…m 1.0 branch
  • Loading branch information
Nicholas Addison authored and Nicholas Addison committed Oct 21, 2017
1 parent 6305866 commit 3daf969
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
17 changes: 8 additions & 9 deletions docs/web3-eth-accounts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ signTransaction

.. code-block:: javascript
web3.eth.accounts.signTransaction(tx [, callback]);
web3.eth.accounts.signTransaction(tx, privateKey [, callback]);
Signs an Ethereum transaction with the accounts private key.
Signs an Ethereum transaction with a given private key.

----------
Parameters
Expand All @@ -162,7 +162,8 @@ Parameters
- ``value`` - ``String``: (optional) The value of the transaction in wei.
- ``gas`` - ``String``: The gas provided by the transaction.
- ``gasPrice`` - ``String``: (optional) The gas price set by this transaction, if empty, it will use :ref:`web3.eth.gasPrice() <eth-gasprice>`
2. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second.
2. ``privateKey`` - ``String``: The private key to sign with.
3. ``callback`` - ``Function``: (optional) Optional callback, returns an error object as first parameter and the result as second.


-------
Expand All @@ -184,13 +185,11 @@ Example

.. code-block:: javascript
var account = web3.eth.accounts.privateKeyToAccount('0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318');
account.signTransaction({
web3.eth.accounts.signTransaction({
to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
value: '1000000000',
gas: 2000000
})
}, '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318')
.then(console.log);
> {
messageHash: '0x88cfbd7e51c7a40540b233cf68b62ad1df3e92462f1c6018d6d67eae0f3b08f5',
Expand All @@ -201,14 +200,14 @@ Example
}
// if nonce, chainId, gas and gasPrice is given it returns synchronous
account.signTransaction({
web3.eth.accounts.signTransaction({
to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
value: '1000000000',
gas: 2000000,
gasPrice: '234567897654321',
nonce: 0,
chainId: 1
})
}, '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318')
> {
messageHash: '0x6893a6ee8df79b0f5d64a180cd1ef35d030f3e296a5361cf04d02ce720d32ec5',
r: '0x09ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9c',
Expand Down
7 changes: 4 additions & 3 deletions docs/web3-eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1167,17 +1167,18 @@ signTransaction

.. code-block:: javascript
web3.eth.signTransaction(transactionObject [, callback])
web3.eth.signTransaction(transactionObject, address [, callback])
Signs a transaction using the transactionObject.from account on the remote Ethereum node. This account needs to be unlocked.
Signs a transaction. This account needs to be unlocked.

----------
Parameters
----------


1. ``Object`` - The transaction data to sign :ref:`web3.eth.sendTransaction() <eth-sendtransaction>` for more.
2. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second.
2. ``String`` - Address to sign transaction with.
3. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second.


-------
Expand Down
12 changes: 0 additions & 12 deletions test/eth.accounts.signTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ describe("eth", function () {
});
});

it("signTransaction using passed private key", function()
{
var ethAccounts = new Accounts();

var testAccount = ethAccounts.privateKeyToAccount(tests[0].privateKey);
assert.equal(testAccount.address, tests[0].address);

var tx = testAccount.signTransaction(test.transaction);

assert.equal(tx.rawTransaction, tests[1].rawTransaction);
});

tests.forEach(function (test, i) {
it("signTransaction using the iban as \"to\" must compare to eth_signTransaction", function() {
var ethAccounts = new Accounts();
Expand Down

0 comments on commit 3daf969

Please sign in to comment.