Fix Trezor signing + stronger typing (#723)

This commit is contained in:
William O'Beirne 2018-01-04 11:07:10 -05:00 committed by Daniel Ternyak
parent 42b16155c5
commit 18695d0936
2 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import Ledger3 from 'vendor/ledger3';
import LedgerEth from 'vendor/ledger-eth';
import EthTx from 'ethereumjs-tx';
import EthTx, { TxObj } from 'ethereumjs-tx';
import { addHexPrefix, bufferToHex, toBuffer } from 'ethereumjs-util';
import { DeterministicWallet } from './deterministic';
import { getTransactionFields } from 'libs/transaction';
@ -34,7 +34,7 @@ export class LedgerWallet extends DeterministicWallet implements IFullWallet {
}
const strTx = getTransactionFields(t);
const txToSerialize = {
const txToSerialize: TxObj = {
...strTx,
v: addHexPrefix(result.v),
r: addHexPrefix(result.r),

View File

@ -1,10 +1,9 @@
import BN from 'bn.js';
import EthTx from 'ethereumjs-tx';
import EthTx, { TxObj } from 'ethereumjs-tx';
import { addHexPrefix } from 'ethereumjs-util';
import { stripHexPrefixAndLower, padLeftEven } from 'libs/values';
import TrezorConnect from 'vendor/trezor-connect';
import { DeterministicWallet } from './deterministic';
import { getTransactionFields } from 'libs/transaction';
import mapValues from 'lodash/mapValues';
@ -35,8 +34,8 @@ export class TrezorWallet extends DeterministicWallet implements IFullWallet {
// TODO: Explain what's going on here? Add tests? Adapted from:
// https://github.com/kvhnuke/etherwallet/blob/v3.10.2.6/app/scripts/uiFuncs.js#L24
const txToSerialize = {
...tx,
const txToSerialize: TxObj = {
...strTx,
v: addHexPrefix(new BN(result.v).toString(16)),
r: addHexPrefix(result.r),
s: addHexPrefix(result.s)