From d6d43ebf12a346e2b0519d745ccd7c24aa2d4469 Mon Sep 17 00:00:00 2001 From: Michele Esposito <34438276+mikesposito@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:09:20 +0200 Subject: [PATCH] chore: bump `eth-ledger-bridge-keyring` to `^3.0.1` (#26498) --- ...-bridge-keyring-npm-2.0.1-7a5d815b2d.patch | 18 ----- .../lib/hardware-keyring-builder-factory.ts | 7 +- .../ledger-offscreen-bridge.ts | 18 ++++- lavamoat/build-system/policy.json | 2 +- package.json | 2 +- yarn.lock | 76 ++++++++----------- 6 files changed, 55 insertions(+), 68 deletions(-) delete mode 100644 .yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch diff --git a/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch b/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch deleted file mode 100644 index 786d5cd1b226..000000000000 --- a/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/dist/ledger-keyring.js b/dist/ledger-keyring.js -index 2386b2e7fe36d1e65ef74f0a19d3b41450dcfa48..f999a0ab465cce7a450a5812f1d7aa6e39b74aed 100644 ---- a/dist/ledger-keyring.js -+++ b/dist/ledger-keyring.js -@@ -150,7 +150,12 @@ class LedgerKeyring extends events_1.EventEmitter { - }); - } - catch (error) { -- throw error instanceof Error ? error : new Error('Unknown error'); -+ -+ /** -+ * For Fixing issue 22837, when ledger is locked and didnt open the ethereum app in ledger, -+ * The extension will always show `unknown error`, below change will transform the error to something meaningful. -+ */ -+ throw error instanceof Error ? error : new Error('Unlock your Ledger device and open the ETH app'); - } - if (updateHdk && payload.chainCode) { - this.hdk.publicKey = buffer_1.Buffer.from(payload.publicKey, 'hex'); diff --git a/app/scripts/lib/hardware-keyring-builder-factory.ts b/app/scripts/lib/hardware-keyring-builder-factory.ts index ab88a103510f..1b617dd62fe6 100644 --- a/app/scripts/lib/hardware-keyring-builder-factory.ts +++ b/app/scripts/lib/hardware-keyring-builder-factory.ts @@ -1,5 +1,8 @@ import type { TrezorBridge } from '@metamask/eth-trezor-keyring'; -import type { LedgerBridge } from '@metamask/eth-ledger-bridge-keyring'; +import type { + LedgerBridge, + LedgerBridgeOptions, +} from '@metamask/eth-ledger-bridge-keyring'; import { KeyringClass, Json } from '@metamask/utils'; import { FakeKeyringBridge } from '../../../test/stub/keyring-bridge'; @@ -8,7 +11,7 @@ import { FakeKeyringBridge } from '../../../test/stub/keyring-bridge'; */ export type HardwareTransportBridgeClass = | (new () => TrezorBridge) - | (new () => LedgerBridge) + | (new () => LedgerBridge) | (new () => FakeKeyringBridge); /** diff --git a/app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts b/app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts index e17178a76b25..608d1ee8156b 100644 --- a/app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts +++ b/app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts @@ -5,6 +5,12 @@ import { OffscreenCommunicationTarget, } from '../../../../shared/constants/offscreen-communication'; +/** + * The options for the LedgerOffscreenBridge are empty because the bridge + * doesn't require any options to be passed in. + */ +type LedgerOffscreenBridgeOptions = Record; + /** * This class is used as a custom bridge for the Ledger connection. Every * hardware wallet keyring also requires a bridge that has a known interface @@ -16,7 +22,9 @@ import { * ledger device via the ledger keyring iframe. The ledger keyring iframe is * added to the offscreen.html file directly. */ -export class LedgerOffscreenBridge implements LedgerBridge { +export class LedgerOffscreenBridge + implements LedgerBridge +{ isDeviceConnected = false; init() { @@ -37,6 +45,14 @@ export class LedgerOffscreenBridge implements LedgerBridge { return Promise.resolve(); } + getOptions() { + return Promise.resolve({}); + } + + setOptions() { + return Promise.resolve(); + } + attemptMakeApp() { return new Promise((resolve, reject) => { chrome.runtime.sendMessage( diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 54ce1a525794..f4927e63f48c 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -6700,7 +6700,7 @@ "tty.isatty": true }, "globals": { - "process.argv": true, + "process.argv.includes": true, "process.env": true, "process.platform": true } diff --git a/package.json b/package.json index 177563dfd4fd..1525ad54ed04 100644 --- a/package.json +++ b/package.json @@ -313,7 +313,7 @@ "@metamask/ens-controller": "^13.0.0", "@metamask/eth-json-rpc-filters": "^7.0.0", "@metamask/eth-json-rpc-middleware": "^14.0.1", - "@metamask/eth-ledger-bridge-keyring": "patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch", + "@metamask/eth-ledger-bridge-keyring": "^3.0.1", "@metamask/eth-query": "^4.0.0", "@metamask/eth-sig-util": "^7.0.1", "@metamask/eth-snap-keyring": "^4.3.1", diff --git a/yarn.lock b/yarn.lock index 3b6116012b88..f329bfada348 100644 --- a/yarn.lock +++ b/yarn.lock @@ -183,11 +183,11 @@ __metadata: linkType: hard "@babel/helper-annotate-as-pure@npm:^7.22.5": - version: 7.24.7 - resolution: "@babel/helper-annotate-as-pure@npm:7.24.7" + version: 7.22.5 + resolution: "@babel/helper-annotate-as-pure@npm:7.22.5" dependencies: - "@babel/types": "npm:^7.24.7" - checksum: 10/a9017bfc1c4e9f2225b967fbf818004703de7cf29686468b54002ffe8d6b56e0808afa20d636819fcf3a34b89ba72f52c11bdf1d69f303928ee10d92752cad95 + "@babel/types": "npm:^7.22.5" + checksum: 10/53da330f1835c46f26b7bf4da31f7a496dee9fd8696cca12366b94ba19d97421ce519a74a837f687749318f94d1a37f8d1abcbf35e8ed22c32d16373b2f6198d languageName: node linkType: hard @@ -288,7 +288,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.24.5, @babel/helper-member-expression-to-functions@npm:^7.24.7": +"@babel/helper-member-expression-to-functions@npm:^7.23.0, @babel/helper-member-expression-to-functions@npm:^7.24.5": version: 7.24.8 resolution: "@babel/helper-member-expression-to-functions@npm:7.24.8" dependencies: @@ -322,7 +322,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-optimise-call-expression@npm:^7.22.5, @babel/helper-optimise-call-expression@npm:^7.24.7": +"@babel/helper-optimise-call-expression@npm:^7.22.5": version: 7.24.7 resolution: "@babel/helper-optimise-call-expression@npm:7.24.7" dependencies: @@ -352,15 +352,15 @@ __metadata: linkType: hard "@babel/helper-replace-supers@npm:^7.22.5, @babel/helper-replace-supers@npm:^7.22.9, @babel/helper-replace-supers@npm:^7.24.1": - version: 7.24.7 - resolution: "@babel/helper-replace-supers@npm:7.24.7" + version: 7.24.1 + resolution: "@babel/helper-replace-supers@npm:7.24.1" dependencies: - "@babel/helper-environment-visitor": "npm:^7.24.7" - "@babel/helper-member-expression-to-functions": "npm:^7.24.7" - "@babel/helper-optimise-call-expression": "npm:^7.24.7" + "@babel/helper-environment-visitor": "npm:^7.22.20" + "@babel/helper-member-expression-to-functions": "npm:^7.23.0" + "@babel/helper-optimise-call-expression": "npm:^7.22.5" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10/18b7c3709819d008a14953e885748f3e197537f131d8f7ae095fec245506d854ff40b236edb1754afb6467f795aa90ae42a1d961a89557702249bacfc3fdad19 + checksum: 10/1103b28ce0cc7fba903c21bc78035c696ff191bdbbe83c20c37030a2e10ae6254924556d942cdf8c44c48ba606a8266fdb105e6bb10945de9285f79cb1905df1 languageName: node linkType: hard @@ -374,12 +374,11 @@ __metadata: linkType: hard "@babel/helper-skip-transparent-expression-wrappers@npm:^7.22.5": - version: 7.24.7 - resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.24.7" + version: 7.22.5 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.22.5" dependencies: - "@babel/traverse": "npm:^7.24.7" - "@babel/types": "npm:^7.24.7" - checksum: 10/784a6fdd251a9a7e42ccd04aca087ecdab83eddc60fda76a2950e00eb239cc937d3c914266f0cc476298b52ac3f44ffd04c358e808bd17552a7e008d75494a77 + "@babel/types": "npm:^7.22.5" + checksum: 10/1012ef2295eb12dc073f2b9edf3425661e9b8432a3387e62a8bc27c42963f1f216ab3124228015c748770b2257b4f1fda882ca8fa34c0bf485e929ae5bc45244 languageName: node linkType: hard @@ -1651,7 +1650,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.12.5, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.24.7, @babel/traverse@npm:^7.24.8": +"@babel/traverse@npm:^7.12.5, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.23.2, @babel/traverse@npm:^7.24.8": version: 7.24.8 resolution: "@babel/traverse@npm:7.24.8" dependencies: @@ -5198,29 +5197,16 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-ledger-bridge-keyring@npm:2.0.1": - version: 2.0.1 - resolution: "@metamask/eth-ledger-bridge-keyring@npm:2.0.1" - dependencies: - "@ethereumjs/rlp": "npm:^4.0.0" - "@ethereumjs/tx": "npm:^4.1.1" - "@ethereumjs/util": "npm:^8.0.0" - "@metamask/eth-sig-util": "npm:^7.0.0" - hdkey: "npm:^2.1.0" - checksum: 10/1320b6587e021a9c81697104f3accafcb3d3fc8d616a82bf8be6a4a945965dd0546a82b81fd3dbbcaab24b0eafe7d91bfbbe6081c70a78ba89035a87494fe4d8 - languageName: node - linkType: hard - -"@metamask/eth-ledger-bridge-keyring@patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch": - version: 2.0.1 - resolution: "@metamask/eth-ledger-bridge-keyring@patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch::version=2.0.1&hash=322aa0" +"@metamask/eth-ledger-bridge-keyring@npm:^3.0.1": + version: 3.0.1 + resolution: "@metamask/eth-ledger-bridge-keyring@npm:3.0.1" dependencies: "@ethereumjs/rlp": "npm:^4.0.0" "@ethereumjs/tx": "npm:^4.1.1" "@ethereumjs/util": "npm:^8.0.0" "@metamask/eth-sig-util": "npm:^7.0.0" hdkey: "npm:^2.1.0" - checksum: 10/0f8c86d1b4c323b8a79fa82e3df300034f8dea928569cc3560d1b3352e09e9397844b75b8642ca57866ef5e241b49bd190b8ba7d1b08efa248d9ca909485a674 + checksum: 10/6643cca79fd6c1d2d65ff8affed1f8a776d1455025695396970605350b2cbfd14750c5fb1913d43552a61f9a369e0904a1accd46a9b8d771f7cd0196af6c1ae4 languageName: node linkType: hard @@ -14398,9 +14384,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001587, caniuse-lite@npm:^1.0.30001599": - version: 1.0.30001643 - resolution: "caniuse-lite@npm:1.0.30001643" - checksum: 10/dddbda29fa24fbc435873309c71070461cbfc915d9bce3216180524c20c5637b2bee1a14b45972e9ac19e1fdf63fba3f63608b9e7d68de32f5ee1953c8c69e05 + version: 1.0.30001600 + resolution: "caniuse-lite@npm:1.0.30001600" + checksum: 10/4c52f83ed71bc5f6e443bd17923460f1c77915adc2c2aa79ddaedceccc690b5917054b0c41b79e9138cbbd9abcdc0db9e224e79e3e734e581dfec06505f3a2b4 languageName: node linkType: hard @@ -17853,9 +17839,9 @@ __metadata: linkType: hard "escalade@npm:^3.1.1": - version: 3.1.2 - resolution: "escalade@npm:3.1.2" - checksum: 10/a1e07fea2f15663c30e40b9193d658397846ffe28ce0a3e4da0d8e485fedfeca228ab846aee101a05015829adf39f9934ff45b2a3fca47bed37a29646bd05cd3 + version: 3.1.1 + resolution: "escalade@npm:3.1.1" + checksum: 10/afa618e73362576b63f6ca83c975456621095a1ed42ff068174e3f5cea48afc422814dda548c96e6ebb5333e7265140c7292abcc81bbd6ccb1757d50d3a4e182 languageName: node linkType: hard @@ -26117,7 +26103,7 @@ __metadata: "@metamask/eslint-plugin-design-tokens": "npm:^1.1.0" "@metamask/eth-json-rpc-filters": "npm:^7.0.0" "@metamask/eth-json-rpc-middleware": "npm:^14.0.1" - "@metamask/eth-ledger-bridge-keyring": "patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch" + "@metamask/eth-ledger-bridge-keyring": "npm:^3.0.1" "@metamask/eth-query": "npm:^4.0.0" "@metamask/eth-sig-util": "npm:^7.0.1" "@metamask/eth-snap-keyring": "npm:^4.3.1" @@ -29058,9 +29044,9 @@ __metadata: linkType: hard "picocolors@npm:^1.0.0": - version: 1.0.1 - resolution: "picocolors@npm:1.0.1" - checksum: 10/fa68166d1f56009fc02a34cdfd112b0dd3cf1ef57667ac57281f714065558c01828cdf4f18600ad6851cbe0093952ed0660b1e0156bddf2184b6aaf5817553a5 + version: 1.0.0 + resolution: "picocolors@npm:1.0.0" + checksum: 10/a2e8092dd86c8396bdba9f2b5481032848525b3dc295ce9b57896f931e63fc16f79805144321f72976383fc249584672a75cc18d6777c6b757603f372f745981 languageName: node linkType: hard