Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Add eip 1559 support 2 #108

Merged
merged 16 commits into from
Nov 18, 2021
Merged

Add eip 1559 support 2 #108

merged 16 commits into from
Nov 18, 2021

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Nov 8, 2021

Builds on the work by @aloisklink in #97

This expands on that PR by adding a method for determining the model of the device, allowing us to detect whether the current model supports EIP-1559

index.js Outdated
@@ -30,6 +52,16 @@ class TrezorKeyring extends EventEmitter {
this.paths = {};
this.deserialize(opts);
TrezorConnect.manifest(TREZOR_CONNECT_MANIFEST);
TrezorConnect.getFeatures().then((features) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think having this call right here is going to be problematic. I'm seeing the Trezor connection window pop up way too frequently and when performing actions that don't relate to Trezor. I'll need to research the best place to put this.

Copy link
Contributor Author

@danjm danjm Nov 17, 2021

Choose a reason for hiding this comment

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

@darkwing I addressed this in 4018833. We can use a listener to recent Trezor device events, and the payload of those events contains the necessary data on the model

index.js Show resolved Hide resolved
@danjm danjm marked this pull request as ready for review November 17, 2021 10:28
@danjm danjm requested a review from a team as a code owner November 17, 2021 10:28
aloisklink and others added 13 commits November 17, 2021 12:40
This adds support for EIP-1559 for the Trezor T,
once we get all this library to work with it as well.

We use version "8.2.1-extended" exactly,
as we need non-browser support for local tests.
Although 3.3.0 is out, I've selected ^3.2.1 just
to match the current version of MetaMask's package.json file.

Version 3.2.0 adds support for EIP-1559 transactions.
This adds support for object-rest-spread (e.g. {...x, ...y}),
without using the babel parser, which we use in tests.

This is different from what the Metamask extension has, which
is 2017, but they're using the babel parser.
Creating an unfrozen transaction (added in #88) seems to be a change
that was only required in eth-ledger-keyring, not in Trezor,
and is fixed by @ethereumjs/tx: v3.1.4 anyway.

I've removed this part,
since it was causing issues with EIP-1559 transactions, and does
not seem necessary for non-EIP-1559 transactions either.
Co-authored-by: Alois Klink <alois.klink@gmail.com>
index.js Outdated
this.model = event.payload.features.model;
}
});
TrezorConnect.init({ manifest: TREZOR_CONNECT_MANIFEST })
Copy link
Contributor

Choose a reason for hiding this comment

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

@danjm Brilliant move with DEVICE_EVENT event listening! Unfortunately the event was never firing for me. What does work, however, is this change I've made, which puts the event listener first and then triggers the event via init.

@danjm danjm merged commit b41303b into main Nov 18, 2021
@danjm danjm deleted the add-eip-1559-support-2 branch November 18, 2021 14:58
@danjm danjm mentioned this pull request Dec 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants