-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Update gh-pages to receive chainId, update Ledger library to 6.5.0 #95
Conversation
ledger-bridge.js
Outdated
if (to) { | ||
const isKnownERC20Token = byContractAddress(to) | ||
if (to && chainId) { | ||
const isKnownERC20Token = byContractAddressAndChainId(to, chainId) | ||
if (isKnownERC20Token) await this.app.provideERC20TokenInformation(isKnownERC20Token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently we don't need to call this anymore, as of v5.52.0? https://github.com/LedgerHQ/ledgerjs/releases/tag/v5.52.0
I'm not 100% sure though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that we do not need this any more. The PR where this was fixed was:
The provideERC20TokenInformation
method had the description:
- This commands provides a trusted description of an ERC 20 token
- to associate a contract address with a ticker and number of decimals.
- It shall be run immediately before performing a transaction involving a contract
- calling this contract address to display the proper token information to the user if necessary.
The PR made a change so that the method is run before every transaction: https://github.com/LedgerHQ/ledgerjs/pull/587/files#diff-2a96855bc41e2457f03a382c30057bb9257533493bad6acba9730305db50dd60R252-R279
Meanwhile, the need to get the chainId is also covered by that library internally. It gets the chainId from the transaction data: https://github.com/LedgerHQ/ledgerjs/pull/647/files#diff-d69d98013c437f5ecea9591706f3c1319cfa49c1ec50130f8a6346291517ba3dL229
Finally, I tested ERC20 token sends with ledger + metamask + this current branch of github pages, and it works the same as prod today, with the token symbol displaying on the device.
So no changes to |
Right |
Also a dependency: https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/93/files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not review the diff of the package-lock.json files and bundle.js files
I did verify that the same diff (in terms of line count) is produced when I build locally
I did review the ledgerjs changelog to see that this change is safe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs changes actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get another review because I ended up authoring a chunk of this PR, but I'm removing my requested change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the lockfile and the bundle require updating. When I checkout this branch and run npm install
, the package-lock.json
file changes. Then when I run npm run build
, the bundle changes.
@Gudahtt Interesting. I run: There are no changes in git. What versions of npm and node are you on? |
@@ -1,13 +1,11349 @@ | |||
{ | |||
"name": "gupltest", | |||
"version": "0.0.0", | |||
"lockfileVersion": 1, | |||
"lockfileVersion": 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is the issue. You must be using npm v7 - previously this repo was using v6 (which is what I was using).
v7 is fine but we should bump the npm
version in the engines
field at least, so this mistake can be prevented.
The lockfile is still dirty, because the new |
ledger-bridge.js
Outdated
@@ -143,10 +142,6 @@ export default class LedgerBridge { | |||
async signTransaction (replyAction, hdPath, tx, to) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The to
parameter is now unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 231bd5d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
… signTransaction (#98) * Safe property access / allow transaction with undefined to fields, in signTransaction * Revert "Safe property access / allow transaction with undefined to fields, in signTransaction" This reverts commit 3c148ba. * Remove passage of to param to ledger bridge, which will not be needed after PR #95
Thanks for your work! I think #90 can be closed now! However I would like to point out that Ledgerjs recently released Bumping this version does not introduce any breaking changes, and would benefit the whole ecosystem, hence this message! Thank you! |
… signTransaction (MetaMask#98) * Safe property access / allow transaction with undefined to fields, in signTransaction * Revert "Safe property access / allow transaction with undefined to fields, in signTransaction" This reverts commit 3c148ba. * Remove passage of to param to ledger bridge, which will not be needed after PR MetaMask#95
…etaMask#95) * Update gh-pages to receive chainId, update Ledger library to 6.4.1 * Add safety so that old and new lookup work properly * Address feedback: check for chainId * Pin to specific version to avoid semver issues * v6.5.0 bycontractaddress removal * Removed unused import * Specificy npm v7.6.1 in engines property of package.json * Update lockfile * Remove unused parameter from signTransaction in ledger-bridge Co-authored-by: Dan Miller <[email protected]> Co-authored-by: Mark Stacey <[email protected]>
…etaMask#95) * Update gh-pages to receive chainId, update Ledger library to 6.4.1 * Add safety so that old and new lookup work properly * Address feedback: check for chainId * Pin to specific version to avoid semver issues * v6.5.0 bycontractaddress removal * Removed unused import * Specificy npm v7.6.1 in engines property of package.json * Update lockfile * Remove unused parameter from signTransaction in ledger-bridge Co-authored-by: Dan Miller <[email protected]> Co-authored-by: Mark Stacey <[email protected]>
It's been requested that we update to 6.5.0 to fix Ledger issues with Palm. This PR:
6.5.0
of the core Ledger library for thegh-pages
branchReceives thechainId
from theeth-ledger-bridge-keyring
package, since this version has a breaking change that seesbyContractAddress
becomebyContractAddressAndChainId
.provideERC20TokenInformation
as it is no longer needed, after v5.52.0edited by Dan M on Aug 26