Support external eth_sign (#5481)

* Display a QR for eth_sign requests.

* Support raw confirmation of eth_sign

* Fix ethkey issue on nightly.

* Fixing test.

* Fixing test.
This commit is contained in:
Tomasz Drwięga
2017-04-27 18:23:22 +02:00
committed by Gav Wood
parent 43175f17e4
commit 28dcbc6426
17 changed files with 313 additions and 93 deletions

View File

@@ -19,8 +19,8 @@ import Transaction from 'ethereumjs-tx';
import { inAddress, inHex, inNumber10 } from '~/api/format/input';
import { sha3 } from '~/api/util/sha3';
export function createUnsignedTx (api, netVersion, gasStore, transaction) {
const { data, from, gas, gasPrice, to, value } = gasStore.overrideTransaction(transaction);
export function createUnsignedTx (api, netVersion, transaction) {
const { data, from, gas, gasPrice, to, value } = transaction;
return api.parity
.nextNonce(from)
@@ -111,8 +111,18 @@ export function generateQr (from, tx, hash, rlp) {
});
}
export function generateTxQr (api, netVersion, gasStore, transaction) {
return createUnsignedTx(api, netVersion, gasStore, transaction)
export function generateDataQr (data) {
return Promise.resolve({
data,
value: JSON.stringify({
action: 'signData',
data
})
});
}
export function generateTxQr (api, netVersion, transaction) {
return createUnsignedTx(api, netVersion, transaction)
.then((qr) => {
qr.value = generateQr(transaction.from, qr.tx, qr.hash, qr.rlp);