Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump eth-ledger-bridge-keyring to ^3.0.1 #26498

Merged
merged 12 commits into from
Sep 9, 2024
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch has been ported upstream

Copy link
Contributor

@legobeat legobeat Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikesposito Looks like the change is not present anymore after downgrading this PR to 3.0.1 as it was merged after release of v4? Should the patch be brought back for now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it all good it was merged without the patch?

This file was deleted.

7 changes: 5 additions & 2 deletions app/scripts/lib/hardware-keyring-builder-factory.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -8,7 +11,7 @@ import { FakeKeyringBridge } from '../../../test/stub/keyring-bridge';
*/
export type HardwareTransportBridgeClass =
| (new () => TrezorBridge)
| (new () => LedgerBridge)
| (new () => LedgerBridge<LedgerBridgeOptions>)
| (new () => FakeKeyringBridge);

/**
Expand Down
18 changes: 17 additions & 1 deletion app/scripts/lib/offscreen-bridge/ledger-offscreen-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<never, never>;

/**
* 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
Expand All @@ -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<LedgerOffscreenBridgeOptions>
{
isDeviceConnected = false;

init() {
Expand All @@ -37,6 +45,14 @@ export class LedgerOffscreenBridge implements LedgerBridge {
return Promise.resolve();
}

getOptions() {
return Promise.resolve({});
}

setOptions() {
return Promise.resolve();
}

attemptMakeApp() {
return new Promise<boolean>((resolve, reject) => {
chrome.runtime.sendMessage(
Expand Down
59 changes: 58 additions & 1 deletion lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@
"@metamask/eth-ledger-bridge-keyring": {
"globals": {
"addEventListener": true,
"console.log": true,
"console.error": true,
"document.createElement": true,
"document.head.appendChild": true,
"fetch": true,
Expand All @@ -1181,12 +1181,64 @@
"@ethereumjs/tx": true,
"@ethereumjs/tx>@ethereumjs/rlp": true,
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true,
"@metamask/eth-sig-util": true,
"@metamask/eth-trezor-keyring>hdkey": true,
"browserify>buffer": true,
"webpack>events": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": {
"globals": {
"console.warn": true
},
"packages": {
"@ethersproject/abi": true,
"@ethersproject/providers>@ethersproject/rlp": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/cryptoassets": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/errors": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/logs": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>axios": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>bignumber.js": true,
"browserify>buffer": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/errors": {
"globals": {
"console.warn": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/logs": {
"globals": {
"__ledgerLogsListen": "write",
"console.error": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>axios": {
"globals": {
"Blob": true,
"FormData": true,
"URLSearchParams": true,
"XMLHttpRequest": true,
"btoa": true,
"console.warn": true,
"document": true,
"location.href": true,
"navigator": true,
"setTimeout": true
},
"packages": {
"axios>form-data": true,
"browserify>buffer": true,
"process": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>bignumber.js": {
"globals": {
"crypto": true,
"define": true
}
},
"@metamask/eth-query": {
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
Expand Down Expand Up @@ -4084,6 +4136,11 @@
"process": true
}
},
"axios>form-data": {
"globals": {
"FormData": true
}
},
"base32-encode": {
"packages": {
"base32-encode>to-data-view": true
Expand Down
59 changes: 58 additions & 1 deletion lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@
"@metamask/eth-ledger-bridge-keyring": {
"globals": {
"addEventListener": true,
"console.log": true,
"console.error": true,
"document.createElement": true,
"document.head.appendChild": true,
"fetch": true,
Expand All @@ -1181,12 +1181,64 @@
"@ethereumjs/tx": true,
"@ethereumjs/tx>@ethereumjs/rlp": true,
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true,
"@metamask/eth-sig-util": true,
"@metamask/eth-trezor-keyring>hdkey": true,
"browserify>buffer": true,
"webpack>events": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": {
"globals": {
"console.warn": true
},
"packages": {
"@ethersproject/abi": true,
"@ethersproject/providers>@ethersproject/rlp": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/cryptoassets": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/errors": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/logs": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>axios": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>bignumber.js": true,
"browserify>buffer": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/errors": {
"globals": {
"console.warn": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/logs": {
"globals": {
"__ledgerLogsListen": "write",
"console.error": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>axios": {
"globals": {
"Blob": true,
"FormData": true,
"URLSearchParams": true,
"XMLHttpRequest": true,
"btoa": true,
"console.warn": true,
"document": true,
"location.href": true,
"navigator": true,
"setTimeout": true
},
"packages": {
"axios>form-data": true,
"browserify>buffer": true,
"process": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>bignumber.js": {
"globals": {
"crypto": true,
"define": true
}
},
"@metamask/eth-query": {
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
Expand Down Expand Up @@ -4084,6 +4136,11 @@
"process": true
}
},
"axios>form-data": {
"globals": {
"FormData": true
}
},
"base32-encode": {
"packages": {
"base32-encode>to-data-view": true
Expand Down
59 changes: 58 additions & 1 deletion lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@
"@metamask/eth-ledger-bridge-keyring": {
"globals": {
"addEventListener": true,
"console.log": true,
"console.error": true,
"document.createElement": true,
"document.head.appendChild": true,
"fetch": true,
Expand All @@ -1181,12 +1181,64 @@
"@ethereumjs/tx": true,
"@ethereumjs/tx>@ethereumjs/rlp": true,
"@ethereumjs/tx>@ethereumjs/util": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": true,
"@metamask/eth-sig-util": true,
"@metamask/eth-trezor-keyring>hdkey": true,
"browserify>buffer": true,
"webpack>events": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth": {
"globals": {
"console.warn": true
},
"packages": {
"@ethersproject/abi": true,
"@ethersproject/providers>@ethersproject/rlp": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/cryptoassets": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/errors": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/logs": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>axios": true,
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>bignumber.js": true,
"browserify>buffer": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/errors": {
"globals": {
"console.warn": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>@ledgerhq/logs": {
"globals": {
"__ledgerLogsListen": "write",
"console.error": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>axios": {
"globals": {
"Blob": true,
"FormData": true,
"URLSearchParams": true,
"XMLHttpRequest": true,
"btoa": true,
"console.warn": true,
"document": true,
"location.href": true,
"navigator": true,
"setTimeout": true
},
"packages": {
"axios>form-data": true,
"browserify>buffer": true,
"process": true
}
},
"@metamask/eth-ledger-bridge-keyring>@ledgerhq/hw-app-eth>bignumber.js": {
"globals": {
"crypto": true,
"define": true
}
},
"@metamask/eth-query": {
"packages": {
"@metamask/eth-query>json-rpc-random-id": true,
Expand Down Expand Up @@ -4084,6 +4136,11 @@
"process": true
}
},
"axios>form-data": {
"globals": {
"FormData": true
}
},
"base32-encode": {
"packages": {
"base32-encode>to-data-view": true
Expand Down
Loading