@@ -1,5 +1,6 @@
1import TrezorConnect from 'trezor-connect';
1import TrezorConnect from 'trezor-connect';
2import { convertToInt } from './convertToInt';
2import { convertToInt } from './convertToInt';
3+import BN from 'bn.js';
4const TREZOR_PATH = "m/44'/60'/0'/0/x";
5const TREZOR_PATH = "m/44'/60'/0'/0/x";
@@ -15,7 +16,7 @@ const trezorSignTransaction = async (txn, hdpath) => {
15 gasLimit: txn.gasLimit.toString('hex'),
16 gasLimit: txn.gasLimit.toString('hex'),
16 gasPrice: txn.gasPrice.toString('hex'),
17 gasPrice: txn.gasPrice.toString('hex'),
17 nonce: txn.nonce.length === 0 ? '00' : txn.nonce.toString('hex'),
18 nonce: txn.nonce.length === 0 ? '00' : txn.nonce.toString('hex'),
18− chainId: formatChainId(txn.getChainId()),
19+ chainId: formatChainId(txn.common.chainId()),
21 const sig = await TrezorConnect.ethereumSignTransaction({
22 const sig = await TrezorConnect.ethereumSignTransaction({
@@ -29,9 +30,9 @@ const trezorSignTransaction = async (txn, hdpath) => {
30 const payload = sig.payload;
31 const payload = sig.payload;
32− txn.v = Buffer.from(payload.v.slice(2), 'hex');
33+ txn.v = new BN(payload.v.slice(2), 'hex');
33− txn.r = Buffer.from(payload.r.slice(2), 'hex');
34+ txn.r = new BN(payload.r.slice(2), 'hex');
34− txn.s = Buffer.from(payload.s.slice(2), 'hex');
35+ txn.s = new BN(payload.s.slice(2), 'hex');
36 return txn;
37 return txn;