mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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:
parent
fbafffe1ba
commit
9cf7413e4b
@ -29,6 +29,7 @@ import {
|
|||||||
} from '@metamask/controllers';
|
} from '@metamask/controllers';
|
||||||
import { TRANSACTION_STATUSES } from '../../shared/constants/transaction';
|
import { TRANSACTION_STATUSES } from '../../shared/constants/transaction';
|
||||||
import { MAINNET_CHAIN_ID } from '../../shared/constants/network';
|
import { MAINNET_CHAIN_ID } from '../../shared/constants/network';
|
||||||
|
import { KEYRING_TYPES } from '../../shared/constants/hardware-wallets';
|
||||||
import { UI_NOTIFICATIONS } from '../../shared/notifications';
|
import { UI_NOTIFICATIONS } from '../../shared/notifications';
|
||||||
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
|
import { toChecksumHexAddress } from '../../shared/modules/hexstring-utils';
|
||||||
import { MILLISECOND } from '../../shared/constants/time';
|
import { MILLISECOND } from '../../shared/constants/time';
|
||||||
@ -77,16 +78,6 @@ export const METAMASK_CONTROLLER_EVENTS = {
|
|||||||
UPDATE_BADGE: 'updateBadge',
|
UPDATE_BADGE: 'updateBadge',
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 {
|
export default class MetamaskController extends EventEmitter {
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@ -2078,10 +2069,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
const address =
|
const address =
|
||||||
fromAddress || this.preferencesController.getSelectedAddress();
|
fromAddress || this.preferencesController.getSelectedAddress();
|
||||||
const keyring = await this.keyringController.getKeyringForAccount(address);
|
const keyring = await this.keyringController.getKeyringForAccount(address);
|
||||||
return (
|
return keyring.type !== KEYRING_TYPES.TREZOR;
|
||||||
keyring.type !== KEYRING_TYPES.LEDGER &&
|
|
||||||
keyring.type !== KEYRING_TYPES.TREZOR
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -103,7 +103,7 @@
|
|||||||
"@material-ui/core": "^4.11.0",
|
"@material-ui/core": "^4.11.0",
|
||||||
"@metamask/contract-metadata": "^1.28.0",
|
"@metamask/contract-metadata": "^1.28.0",
|
||||||
"@metamask/controllers": "^14.0.2",
|
"@metamask/controllers": "^14.0.2",
|
||||||
"@metamask/eth-ledger-bridge-keyring": "^0.6.0",
|
"@metamask/eth-ledger-bridge-keyring": "^0.7.0",
|
||||||
"@metamask/eth-token-tracker": "^3.0.1",
|
"@metamask/eth-token-tracker": "^3.0.1",
|
||||||
"@metamask/etherscan-link": "^2.1.0",
|
"@metamask/etherscan-link": "^2.1.0",
|
||||||
"@metamask/jazzicon": "^2.0.0",
|
"@metamask/jazzicon": "^2.0.0",
|
||||||
|
9
shared/constants/hardware-wallets.js
Normal file
9
shared/constants/hardware-wallets.js
Normal 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',
|
||||||
|
};
|
@ -8,6 +8,7 @@ import {
|
|||||||
NETWORK_TYPE_RPC,
|
NETWORK_TYPE_RPC,
|
||||||
NATIVE_CURRENCY_TOKEN_IMAGE_MAP,
|
NATIVE_CURRENCY_TOKEN_IMAGE_MAP,
|
||||||
} from '../../shared/constants/network';
|
} from '../../shared/constants/network';
|
||||||
|
import { KEYRING_TYPES } from '../../shared/constants/hardware-wallets';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SWAPS_CHAINID_DEFAULT_TOKEN_MAP,
|
SWAPS_CHAINID_DEFAULT_TOKEN_MAP,
|
||||||
@ -82,8 +83,9 @@ export function getCurrentKeyring(state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isEIP1559Account(state) {
|
export function isEIP1559Account(state) {
|
||||||
// Neither hardware wallet supports 1559 at this time
|
// Trezor does not support 1559 at this time
|
||||||
return !isHardwareWallet(state);
|
const currentKeyring = getCurrentKeyring(state);
|
||||||
|
return currentKeyring && currentKeyring.type !== KEYRING_TYPES.TREZOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function checkNetworkAndAccountSupports1559(state) {
|
export function checkNetworkAndAccountSupports1559(state) {
|
||||||
|
22
yarn.lock
22
yarn.lock
@ -1572,15 +1572,7 @@
|
|||||||
crc-32 "^1.2.0"
|
crc-32 "^1.2.0"
|
||||||
ethereumjs-util "^7.1.0"
|
ethereumjs-util "^7.1.0"
|
||||||
|
|
||||||
"@ethereumjs/tx@^3.1.1", "@ethereumjs/tx@^3.1.4", "@ethereumjs/tx@^3.2.1":
|
"@ethereumjs/tx@^3.1.4", "@ethereumjs/tx@^3.2.0", "@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0":
|
||||||
version "3.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.2.1.tgz#65f5f1c11541764f08377a94ba4b0dcbbd67739e"
|
|
||||||
integrity sha512-i9V39OtKvwWos1uVNZxdVhd7zFOyzFLjgt69CoiOY0EmXugS0HjO3uxpLBSglDKFMRriuGqw6ddKEv+RP1UNEw==
|
|
||||||
dependencies:
|
|
||||||
"@ethereumjs/common" "^2.3.1"
|
|
||||||
ethereumjs-util "^7.0.10"
|
|
||||||
|
|
||||||
"@ethereumjs/tx@^3.3.0":
|
|
||||||
version "3.3.0"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.0.tgz#14ed1b7fa0f28e1cd61e3ecbdab824205f6a4378"
|
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.0.tgz#14ed1b7fa0f28e1cd61e3ecbdab824205f6a4378"
|
||||||
integrity sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA==
|
integrity sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA==
|
||||||
@ -3142,16 +3134,14 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@metamask/eslint-config/-/eslint-config-6.0.0.tgz#ec53e8ab278073e882411ed89705bc7d06b78c81"
|
resolved "https://registry.yarnpkg.com/@metamask/eslint-config/-/eslint-config-6.0.0.tgz#ec53e8ab278073e882411ed89705bc7d06b78c81"
|
||||||
integrity sha512-LyakGYGwM8UQOGhwWa+5erAI1hXuiTgf/y7USzOomX6H9KiuY09IAUYnPh7ToPG2sedD2F48UF1bUm8yvCoZOw==
|
integrity sha512-LyakGYGwM8UQOGhwWa+5erAI1hXuiTgf/y7USzOomX6H9KiuY09IAUYnPh7ToPG2sedD2F48UF1bUm8yvCoZOw==
|
||||||
|
|
||||||
"@metamask/eth-ledger-bridge-keyring@^0.6.0":
|
"@metamask/eth-ledger-bridge-keyring@^0.7.0":
|
||||||
version "0.6.0"
|
version "0.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/@metamask/eth-ledger-bridge-keyring/-/eth-ledger-bridge-keyring-0.6.0.tgz#2f1344eb76bf880c8cfbb92b9b64510920c7e335"
|
resolved "https://registry.yarnpkg.com/@metamask/eth-ledger-bridge-keyring/-/eth-ledger-bridge-keyring-0.7.0.tgz#7d80e1e3dfab91ba2b6a1a2a5e352320e948b568"
|
||||||
integrity sha512-eP0f8Q7o5K35wVinK2EjEw/gVY/pvzkAcbk49CwQEzGPKm6d+AAURJZ0o33/8gYGIrpq4bmWZhZzgyAbphgVLw==
|
integrity sha512-0UOEb/c3/fkatDK+se3gOHaGQ0RTRLbG5DqsoeowZ/JcO4wcMxBhOiIgOY4domOqUTekKKVPNC7Pc0mHpM9sAQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ethereumjs/tx" "^3.1.1"
|
"@ethereumjs/tx" "^3.2.0"
|
||||||
eth-sig-util "^2.0.0"
|
eth-sig-util "^2.0.0"
|
||||||
ethereumjs-tx "^1.3.4"
|
|
||||||
ethereumjs-util "^7.0.9"
|
ethereumjs-util "^7.0.9"
|
||||||
events "^2.0.0"
|
|
||||||
hdkey "0.8.0"
|
hdkey "0.8.0"
|
||||||
|
|
||||||
"@metamask/eth-token-tracker@^3.0.1":
|
"@metamask/eth-token-tracker@^3.0.1":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user