1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

1559 ledger (#11951)

* EIP-1559 - Provide support for Ledger

* Update ui/selectors/selectors.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

* Add shared constants for hw types

* bump eth-ledger-bridge-keyring to v0.7.0

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Alex <adonesky@gmail.com>
This commit is contained in:
Dan J Miller 2021-09-01 13:55:06 -02:30 committed by GitHub
parent 8a8ce3a0c0
commit a4c0133bc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 25 deletions

View File

@ -29,6 +29,7 @@ import {
} from '@metamask/controllers';
import { TRANSACTION_STATUSES } from '../../shared/constants/transaction';
import { MAINNET_CHAIN_ID } from '../../shared/constants/network';
import { KEYRING_TYPES } from '../../shared/constants/hardware-wallets';
import { UI_NOTIFICATIONS } from '../../shared/notifications';
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
import { MILLISECOND } from '../../shared/constants/time';
@ -79,16 +80,6 @@ export const METAMASK_CONTROLLER_EVENTS = {
APPROVAL_STATE_CHANGE: 'ApprovalController:stateChange',
};
/**
* Accounts can be instantiated from simple, HD or the two hardware wallet
* keyring types. Both simple and HD are treated as default but we do special
* case accounts managed by a hardware wallet.
*/
const KEYRING_TYPES = {
LEDGER: 'Ledger Hardware',
TREZOR: 'Trezor Hardware',
};
export default class MetamaskController extends EventEmitter {
/**
* @constructor
@ -2083,10 +2074,7 @@ export default class MetamaskController extends EventEmitter {
const address =
fromAddress || this.preferencesController.getSelectedAddress();
const keyring = await this.keyringController.getKeyringForAccount(address);
return (
keyring.type !== KEYRING_TYPES.LEDGER &&
keyring.type !== KEYRING_TYPES.TREZOR
);
return keyring.type !== KEYRING_TYPES.TREZOR;
}
//=============================================================================

View File

@ -105,7 +105,7 @@
"@material-ui/core": "^4.11.0",
"@metamask/contract-metadata": "^1.28.0",
"@metamask/controllers": "^15.0.0",
"@metamask/eth-ledger-bridge-keyring": "^0.6.0",
"@metamask/eth-ledger-bridge-keyring": "^0.7.0",
"@metamask/eth-token-tracker": "^3.0.1",
"@metamask/etherscan-link": "^2.1.0",
"@metamask/jazzicon": "^2.0.0",

View File

@ -0,0 +1,9 @@
/**
* Accounts can be instantiated from simple, HD or the two hardware wallet
* keyring types. Both simple and HD are treated as default but we do special
* case accounts managed by a hardware wallet.
*/
export const KEYRING_TYPES = {
LEDGER: 'Ledger Hardware',
TREZOR: 'Trezor Hardware',
};

View File

@ -8,6 +8,7 @@ import {
NETWORK_TYPE_RPC,
NATIVE_CURRENCY_TOKEN_IMAGE_MAP,
} from '../../shared/constants/network';
import { KEYRING_TYPES } from '../../shared/constants/hardware-wallets';
import {
SWAPS_CHAINID_DEFAULT_TOKEN_MAP,
@ -82,8 +83,9 @@ export function getCurrentKeyring(state) {
}
export function isEIP1559Account(state) {
// Neither hardware wallet supports 1559 at this time
return !isHardwareWallet(state);
// Trezor does not support 1559 at this time
const currentKeyring = getCurrentKeyring(state);
return currentKeyring && currentKeyring.type !== KEYRING_TYPES.TREZOR;
}
export function checkNetworkAndAccountSupports1559(state) {

View File

@ -1564,7 +1564,7 @@
crc-32 "^1.2.0"
ethereumjs-util "^7.1.0"
"@ethereumjs/tx@^3.1.1", "@ethereumjs/tx@^3.1.4", "@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0":
"@ethereumjs/tx@^3.1.4", "@ethereumjs/tx@^3.2.0", "@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.0.tgz#14ed1b7fa0f28e1cd61e3ecbdab824205f6a4378"
integrity sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA==
@ -2814,16 +2814,14 @@
resolved "https://registry.yarnpkg.com/@metamask/eslint-config/-/eslint-config-6.0.0.tgz#ec53e8ab278073e882411ed89705bc7d06b78c81"
integrity sha512-LyakGYGwM8UQOGhwWa+5erAI1hXuiTgf/y7USzOomX6H9KiuY09IAUYnPh7ToPG2sedD2F48UF1bUm8yvCoZOw==
"@metamask/eth-ledger-bridge-keyring@^0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@metamask/eth-ledger-bridge-keyring/-/eth-ledger-bridge-keyring-0.6.0.tgz#2f1344eb76bf880c8cfbb92b9b64510920c7e335"
integrity sha512-eP0f8Q7o5K35wVinK2EjEw/gVY/pvzkAcbk49CwQEzGPKm6d+AAURJZ0o33/8gYGIrpq4bmWZhZzgyAbphgVLw==
"@metamask/eth-ledger-bridge-keyring@^0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@metamask/eth-ledger-bridge-keyring/-/eth-ledger-bridge-keyring-0.7.0.tgz#7d80e1e3dfab91ba2b6a1a2a5e352320e948b568"
integrity sha512-0UOEb/c3/fkatDK+se3gOHaGQ0RTRLbG5DqsoeowZ/JcO4wcMxBhOiIgOY4domOqUTekKKVPNC7Pc0mHpM9sAQ==
dependencies:
"@ethereumjs/tx" "^3.1.1"
"@ethereumjs/tx" "^3.2.0"
eth-sig-util "^2.0.0"
ethereumjs-tx "^1.3.4"
ethereumjs-util "^7.0.9"
events "^2.0.0"
hdkey "0.8.0"
"@metamask/eth-token-tracker@^3.0.1":