@@ -1,5 +1,6 @@
11import TrezorConnect from 'trezor-connect';
22import { convertToInt } from './convertToInt';
3+import BN from 'bn.js';
34
45const TREZOR_PATH = "m/44'/60'/0'/0/x";
56
@@ -15,7 +16,7 @@ const trezorSignTransaction = async (txn, hdpath) => {
1516 gasLimit: txn.gasLimit.toString('hex'),
1617 gasPrice: txn.gasPrice.toString('hex'),
1718 nonce: txn.nonce.length === 0 ? '00' : txn.nonce.toString('hex'),
18− chainId: formatChainId(txn.getChainId()),
19+ chainId: formatChainId(txn.common.chainId()),
1920 };
2021
2122 const sig = await TrezorConnect.ethereumSignTransaction({
@@ -29,9 +30,9 @@ const trezorSignTransaction = async (txn, hdpath) => {
2930
3031 const payload = sig.payload;
3132
32− txn.v = Buffer.from(payload.v.slice(2), 'hex');
33− txn.r = Buffer.from(payload.r.slice(2), 'hex');
34− txn.s = Buffer.from(payload.s.slice(2), 'hex');
33+ txn.v = new BN(payload.v.slice(2), 'hex');
34+ txn.r = new BN(payload.r.slice(2), 'hex');
35+ txn.s = new BN(payload.s.slice(2), 'hex');
3536
3637 return txn;
3738};