Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
feat(eip1559): upgrade to latest eth-trezor-keyring
Browse files Browse the repository at this point in the history
Fixed a breaking change with Trezor Connect v8. This commit does NOT
enable EIP-1559, but is ready to be activated once the new firmware
is available. Ref: trezor/trezor-firmware#1653
  • Loading branch information
onyb committed Sep 2, 2021
1 parent 1913ca2 commit 6bd81fa
Show file tree
Hide file tree
Showing 4 changed files with 550 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/vendor/trezor/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Passing messages from popup to background script

window.addEventListener('message', event => {
if (port && event.source === window && event.data) {
port.postMessage(event.data);
port.postMessage({ data: event.data });
}
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"eth-phishing-detect": "^1.1.4",
"eth-query": "^2.1.2",
"eth-sig-util": "^2.3.0",
"eth-trezor-keyring": "^0.4.0",
"eth-trezor-keyring": "^0.7.0",
"ethereum-ens-network-map": "^1.0.2",
"ethereumjs-abi": "^0.6.4",
"ethereumjs-util": "^7.1.0",
Expand Down
24 changes: 19 additions & 5 deletions ui/app/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,26 @@ export function isEIP1559Network (state) {
const hasEIP1559Capability =
capabilities[NetworkCapabilities.EIP1559] === true

const currentKeyring = getCurrentKeyring(state)?.type
let keyringSupportsEIP1559
switch (currentKeyring) {
case 'Trezor Hardware':
// TODO (@onyb): Enable once new firmware is released. (ETA Sep 8 '21).
//
// Ref: https://github.com/trezor/trezor-firmware/pull/1653
keyringSupportsEIP1559 = false
break
case 'Ledger Hardware':
// Ledger supports EIP-1559, but requires a major version upgrade of
// ledgerjs.
keyringSupportsEIP1559 = false
break
case 'Simple Key Pair':
default:
keyringSupportsEIP1559 = true
}

// Hardware wallets do not support EIP-1559 yet.
const isCurrentKeyringHardwareWallet = getAccountType(state) === 'hardware'
const isEIP1559SupportedAccount = !isCurrentKeyringHardwareWallet

return hasEIP1559Capability && isEIP1559SupportedAccount
return hasEIP1559Capability && keyringSupportsEIP1559
}

export function getBaseFeePerGas (state) {
Expand Down
Loading

0 comments on commit 6bd81fa

Please sign in to comment.