Correct parameters for eth_sign (#2703)

* Cherry-pick eth_sign update/fix

* Correct sign documentation (signs txhash)
This commit is contained in:
Jaco Greeff 2016-10-19 11:04:26 +02:00 committed by Gav Wood
parent 6aed6a45d3
commit dadd6b1e7c
3 changed files with 9 additions and 5 deletions

View File

@ -46,6 +46,10 @@ export function inData (data) {
return inHex(data); return inHex(data);
} }
export function inHash (hash) {
return inHex(hash);
}
export function inTopics (_topics) { export function inTopics (_topics) {
let topics = (_topics || []) let topics = (_topics || [])
.filter((topic) => topic) .filter((topic) => topic)

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { inAddress, inBlockNumber, inData, inFilter, inHex, inNumber16, inOptions } from '../../format/input'; import { inAddress, inBlockNumber, inData, inFilter, inHash, inHex, inNumber16, inOptions } from '../../format/input';
import { outAddress, outBlock, outLog, outNumber, outReceipt, outTransaction } from '../../format/output'; import { outAddress, outBlock, outLog, outNumber, outReceipt, outTransaction } from '../../format/output';
export default class Eth { export default class Eth {
@ -292,9 +292,9 @@ export default class Eth {
.execute('eth_sendTransaction', inOptions(options)); .execute('eth_sendTransaction', inOptions(options));
} }
sign () { sign (address, hash) {
return this._transport return this._transport
.execute('eth_sign'); .execute('eth_sign', inAddress(address), inHash(hash));
} }
signTransaction () { signTransaction () {

View File

@ -924,7 +924,7 @@ export default {
}, },
sign: { sign: {
desc: 'Signs data with a given address.\n**Note** the address to sign must be unlocked.', desc: 'Signs transaction hash with a given address.',
params: [ params: [
{ {
type: Address, type: Address,
@ -933,7 +933,7 @@ export default {
}, },
{ {
type: Data, type: Data,
desc: 'Data to sign' desc: 'Transaction hash to sign'
} }
], ],
returns: { returns: {