Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'mm/main' into update-eth-sig-util-version
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Oct 10, 2023
2 parents 36d2ab4 + 30ddc3a commit f709645
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 191 deletions.
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ module.exports = {
global: {
branches: 65.42,
functions: 88.57,
lines: 81.57,
statements: 81.49,
lines: 81.63,
statements: 81.55,
},
},

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@ethereumjs/rlp": "^4.0.0",
"@ethereumjs/tx": "^4.1.1",
"@ethereumjs/util": "^8.0.0",
"@metamask/eth-sig-util": "^6.0.1",
"@metamask/utils": "^5.0.0",
"ethereumjs-util": "^7.0.9",
"hdkey": "0.8.0"
},
"devDependencies": {
Expand Down Expand Up @@ -91,11 +92,9 @@
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false,
"@ledgerhq/hw-app-eth>@ledgerhq/domain-service>eip55>keccak": false,
"ethereumjs-tx>ethereumjs-util>keccak": false,
"ethereumjs-util>ethereum-cryptography>keccak": false,
"ethereumjs-util>ethereum-cryptography>secp256k1": false,
"hdkey>secp256k1": false,
"@ledgerhq/hw-app-eth>@ledgerhq/domain-service>eip55>keccak": false
"hdkey>secp256k1": false
}
}
}
7 changes: 3 additions & 4 deletions src/ledger-keyring.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Common, Chain, Hardfork } from '@ethereumjs/common';
import { RLP } from '@ethereumjs/rlp';
import { TransactionFactory } from '@ethereumjs/tx';
import * as ethUtil from '@ethereumjs/util';
import * as sigUtil from '@metamask/eth-sig-util';
import EthereumTx from 'ethereumjs-tx';
import * as ethUtil from 'ethereumjs-util';
import HDKey from 'hdkey';

import { LedgerBridge } from './ledger-bridge';
Expand Down Expand Up @@ -544,9 +545,7 @@ describe('LedgerKeyring', function () {
.mockImplementation(async (params) => {
expect(params).toStrictEqual({
hdPath: "m/44'/60'/0'/0",
tx: ethUtil.rlp
.encode(newFakeTx.getMessageToSign(false))
.toString('hex'),
tx: RLP.encode(newFakeTx.getMessageToSign(false)).toString(),
});
return expectedRSV;
});
Expand Down
5 changes: 3 additions & 2 deletions src/ledger-keyring.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { RLP } from '@ethereumjs/rlp';
import { TransactionFactory, TxData, TypedTransaction } from '@ethereumjs/tx';
import * as ethUtil from '@ethereumjs/util';
import type { MessageTypes, TypedMessage } from '@metamask/eth-sig-util';
import {
recoverPersonalSignature,
Expand All @@ -9,7 +11,6 @@ import {
// eslint-disable-next-line import/no-nodejs-modules
import { Buffer } from 'buffer';
import type OldEthJsTransaction from 'ethereumjs-tx';
import * as ethUtil from 'ethereumjs-util';
// eslint-disable-next-line import/no-nodejs-modules
import { EventEmitter } from 'events';
import HDKey from 'hdkey';
Expand Down Expand Up @@ -339,7 +340,7 @@ export class LedgerKeyring extends EventEmitter {

rawTxHex = Buffer.isBuffer(messageToSign)
? messageToSign.toString('hex')
: ethUtil.rlp.encode(messageToSign).toString('hex');
: RLP.encode(messageToSign).toString();

return this.#signTransaction(address, rawTxHex, (payload) => {
// Because tx will be immutable, first get a plain javascript object that
Expand Down
Loading

0 comments on commit f709645

Please sign in to comment.