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

Commit

Permalink
Merge branch main into deps-hdkey
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Oct 10, 2023
2 parents 53ccd9a + 30ddc3a commit 595db42
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 22 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
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@ethereumjs/rlp": "^4.0.0",
"@ethereumjs/tx": "^4.1.1",
"@ethereumjs/util": "^8.0.0",
"@metamask/utils": "^5.0.0",
"eth-sig-util": "^2.0.0",
"ethereumjs-util": "^7.0.9",
Expand Down Expand Up @@ -90,12 +92,10 @@
"lavamoat": {
"allowScripts": {
"@lavamoat/preinstall-always-fail": false,
"eth-sig-util>ethereumjs-abi>ethereumjs-util>keccak": false,
"eth-sig-util>ethereumjs-util>keccak": false,
"ethereumjs-tx>ethereumjs-util>keccak": false,
"ethereumjs-util>ethereum-cryptography>keccak": false,
"ethereumjs-util>ethereum-cryptography>secp256k1": false,
"hdkey>secp256k1": false
"eth-sig-util>ethereumjs-util>ethereum-cryptography>keccak": false,
"eth-sig-util>ethereumjs-util>ethereum-cryptography>secp256k1": false,
"hdkey>secp256k1": false,
"ethereumjs-util>ethereum-cryptography>keccak": 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 sigUtil from '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 @@ -536,9 +537,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,9 +1,10 @@
import { RLP } from '@ethereumjs/rlp';
import { TransactionFactory, TxData, TypedTransaction } from '@ethereumjs/tx';
import * as ethUtil from '@ethereumjs/util';
// eslint-disable-next-line import/no-nodejs-modules
import { Buffer } from 'buffer';
import * as sigUtil from 'eth-sig-util';
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 @@ -333,7 +334,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
90 changes: 82 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ __metadata:
languageName: node
linkType: hard

"@ethereumjs/rlp@npm:^4.0.1":
"@ethereumjs/rlp@npm:^4.0.0, @ethereumjs/rlp@npm:^4.0.1":
version: 4.0.1
resolution: "@ethereumjs/rlp@npm:4.0.1"
bin:
Expand Down Expand Up @@ -535,14 +535,14 @@ __metadata:
languageName: node
linkType: hard

"@ethereumjs/util@npm:^8.0.5":
version: 8.0.5
resolution: "@ethereumjs/util@npm:8.0.5"
"@ethereumjs/util@npm:^8.0.0, @ethereumjs/util@npm:^8.0.5":
version: 8.1.0
resolution: "@ethereumjs/util@npm:8.1.0"
dependencies:
"@chainsafe/ssz": 0.9.4
"@ethereumjs/rlp": ^4.0.1
ethereum-cryptography: ^1.1.2
checksum: 318386785295b4584289b1aa576d2621392b3a918d127890db62d3f74184f3377694dd9e951e19bfb9ab80e8dc9e38e180236cac2651dead26097d10963731f9
ethereum-cryptography: ^2.0.0
micro-ftch: ^0.3.1
checksum: 9ae5dee8f12b0faf81cd83f06a41560e79b0ba96a48262771d897a510ecae605eb6d84f687da001ab8ccffd50f612ae50f988ef76e6312c752897f462f3ac08d
languageName: node
linkType: hard

Expand Down Expand Up @@ -1369,7 +1369,9 @@ __metadata:
resolution: "@metamask/eth-ledger-bridge-keyring@workspace:."
dependencies:
"@ethereumjs/common": ^3.1.1
"@ethereumjs/rlp": ^4.0.0
"@ethereumjs/tx": ^4.1.1
"@ethereumjs/util": ^8.0.0
"@lavamoat/allow-scripts": ^2.3.0
"@ledgerhq/hw-app-eth": ^6.32.0
"@metamask/auto-changelog": ^3.1.0
Expand Down Expand Up @@ -1423,13 +1425,36 @@ __metadata:
languageName: node
linkType: hard

"@noble/curves@npm:1.1.0, @noble/curves@npm:~1.1.0":
version: 1.1.0
resolution: "@noble/curves@npm:1.1.0"
dependencies:
"@noble/hashes": 1.3.1
checksum: 2658cdd3f84f71079b4e3516c47559d22cf4b55c23ac8ee9d2b1f8e5b72916d9689e59820e0f9d9cb4a46a8423af5b56dc6bb7782405c88be06a015180508db5
languageName: node
linkType: hard

"@noble/hashes@npm:1.2.0, @noble/hashes@npm:~1.2.0":
version: 1.2.0
resolution: "@noble/hashes@npm:1.2.0"
checksum: 8ca080ce557b8f40fb2f78d3aedffd95825a415ac8e13d7ffe3643f8626a8c2d99a3e5975b555027ac24316d8b3c02a35b8358567c0c23af681e6573602aa434
languageName: node
linkType: hard

"@noble/hashes@npm:1.3.1":
version: 1.3.1
resolution: "@noble/hashes@npm:1.3.1"
checksum: 7fdefc0f7a0c1ec27acc6ff88841793e3f93ec4ce6b8a6a12bfc0dd70ae6b7c4c82fe305fdfeda1735d5ad4a9eebe761e6693b3d355689c559e91242f4bc95b1
languageName: node
linkType: hard

"@noble/hashes@npm:~1.3.0, @noble/hashes@npm:~1.3.1":
version: 1.3.2
resolution: "@noble/hashes@npm:1.3.2"
checksum: fe23536b436539d13f90e4b9be843cc63b1b17666a07634a2b1259dded6f490be3d050249e6af98076ea8f2ea0d56f578773c2197f2aa0eeaa5fba5bc18ba474
languageName: node
linkType: hard

"@noble/secp256k1@npm:1.7.1, @noble/secp256k1@npm:~1.7.0":
version: 1.7.1
resolution: "@noble/secp256k1@npm:1.7.1"
Expand Down Expand Up @@ -1544,6 +1569,17 @@ __metadata:
languageName: node
linkType: hard

"@scure/bip32@npm:1.3.1":
version: 1.3.1
resolution: "@scure/bip32@npm:1.3.1"
dependencies:
"@noble/curves": ~1.1.0
"@noble/hashes": ~1.3.1
"@scure/base": ~1.1.0
checksum: 394d65f77a40651eba21a5096da0f4233c3b50d422864751d373fcf142eeedb94a1149f9ab1dbb078086dab2d0bc27e2b1afec8321bf22d4403c7df2fea5bfe2
languageName: node
linkType: hard

"@scure/bip39@npm:1.1.1":
version: 1.1.1
resolution: "@scure/bip39@npm:1.1.1"
Expand All @@ -1554,6 +1590,16 @@ __metadata:
languageName: node
linkType: hard

"@scure/bip39@npm:1.2.1":
version: 1.2.1
resolution: "@scure/bip39@npm:1.2.1"
dependencies:
"@noble/hashes": ~1.3.0
"@scure/base": ~1.1.0
checksum: c5bd6f1328fdbeae2dcdd891825b1610225310e5e62a4942714db51066866e4f7bef242c7b06a1b9dcc8043a4a13412cf5c5df76d3b10aa9e36b82e9b6e3eeaa
languageName: node
linkType: hard

"@sinclair/typebox@npm:^0.24.1":
version: 0.24.51
resolution: "@sinclair/typebox@npm:0.24.51"
Expand Down Expand Up @@ -1655,7 +1701,7 @@ __metadata:
languageName: node
linkType: hard

"@types/bn.js@npm:*, @types/bn.js@npm:^5.1.0":
"@types/bn.js@npm:*":
version: 5.1.1
resolution: "@types/bn.js@npm:5.1.1"
dependencies:
Expand All @@ -1673,6 +1719,15 @@ __metadata:
languageName: node
linkType: hard

"@types/bn.js@npm:^5.1.0":
version: 5.1.2
resolution: "@types/bn.js@npm:5.1.2"
dependencies:
"@types/node": "*"
checksum: 8d9fdb43836646c2ecd445041de03e057f9b459885be57faee64104160487a63730b9f371e8ad7d33f360b3cc6dc0e323543962fc5fa296b92b322b946732be0
languageName: node
linkType: hard

"@types/debug@npm:^4.1.7":
version: 4.1.7
resolution: "@types/debug@npm:4.1.7"
Expand Down Expand Up @@ -3833,6 +3888,18 @@ __metadata:
languageName: node
linkType: hard

"ethereum-cryptography@npm:^2.0.0":
version: 2.1.2
resolution: "ethereum-cryptography@npm:2.1.2"
dependencies:
"@noble/curves": 1.1.0
"@noble/hashes": 1.3.1
"@scure/bip32": 1.3.1
"@scure/bip39": 1.2.1
checksum: 2e8f7b8cc90232ae838ab6a8167708e8362621404d26e79b5d9e762c7b53d699f7520aff358d9254de658fcd54d2d0af168ff909943259ed27dc4cef2736410c
languageName: node
linkType: hard

"ethereumjs-abi@npm:0.6.8":
version: 0.6.8
resolution: "ethereumjs-abi@npm:0.6.8"
Expand Down Expand Up @@ -5874,6 +5941,13 @@ __metadata:
languageName: node
linkType: hard

"micro-ftch@npm:^0.3.1":
version: 0.3.1
resolution: "micro-ftch@npm:0.3.1"
checksum: 0e496547253a36e98a83fb00c628c53c3fb540fa5aaeaf718438873785afd193244988c09d219bb1802984ff227d04938d9571ef90fe82b48bd282262586aaff
languageName: node
linkType: hard

"micromatch@npm:^4.0.4":
version: 4.0.5
resolution: "micromatch@npm:4.0.5"
Expand Down

0 comments on commit 595db42

Please sign in to comment.