Skip to content
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

Feat: refactor to enable additional bridge #210

Conversation

stanleyyconsensys
Copy link
Contributor

@stanleyyconsensys stanleyyconsensys commented Nov 30, 2023

Ledger is a hardware wallet that support multiple type of integration, it can be integrate by web or by mobile (thought bluetooth)

The current eth-ledger-bridge-keyring is only support web base by using iframe, and the class LedgerKeyring is hardcoded the bridge URL to be passed to lower level bridge

Hence, this PR is focus on enable multi bridge to be integrated into ledger keyring, and moving the bridge specific configuration/parameter into the bridge itself, thus to make the ledger keyring unify

  • adding setOptions, getOptions method to configure bridge setting on the fly
  • move bridgeUrl from LedgerKeyring to LedgerIframeBridge as configuration options, hence LedgerKeyring class remain universal to support different type of bridge

@stanleyyconsensys stanleyyconsensys requested a review from a team as a code owner November 30, 2023 06:39
@legobeat
Copy link
Contributor

How does this relate to #198?

@stanleyyconsensys
Copy link
Contributor Author

stanleyyconsensys commented Nov 30, 2023

#198

Hi @legobeat
thanks for reviewing, the PR is the decouple PR for moving the bridgeURL into iframe bridge itself
hence, i will create another PR that focus on mobile bridge, how does it sounds to you?

i will close #198 anyway

Copy link
Member

@mikesposito mikesposito left a comment

Choose a reason for hiding this comment

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

These changes look very useful, thanks for tackling this work.

I left a couple of questions / comments on the implementation, but it overall looks good

src/ledger-iframe-bridge.test.ts Outdated Show resolved Hide resolved
src/ledger-iframe-bridge.test.ts Outdated Show resolved Hide resolved
src/ledger-bridge.ts Outdated Show resolved Hide resolved
src/ledger-iframe-bridge.ts Outdated Show resolved Hide resolved
src/ledger-bridge.ts Outdated Show resolved Hide resolved
src/ledger-bridge.ts Outdated Show resolved Hide resolved
src/ledger-iframe-bridge.ts Outdated Show resolved Hide resolved
src/ledger-iframe-bridge.ts Outdated Show resolved Hide resolved
src/ledger-iframe-bridge.ts Outdated Show resolved Hide resolved
Due to either bridgeOptions or bridgeUrl is not part of account data, it should be removed to remain the bridge configurated by itself but not depend on account

Remove deserializeData and serializeData due to same reason

Change bridgeUrl to be a object of configuration
src/ledger-iframe-bridge.ts Outdated Show resolved Hide resolved
src/ledger-iframe-bridge.ts Outdated Show resolved Hide resolved
src/ledger-iframe-bridge.ts Outdated Show resolved Hide resolved
legobeat

This comment was marked as resolved.

@dawnseeker8 dawnseeker8 requested a review from a team February 22, 2024 09:12
Copy link
Member

@mikesposito mikesposito left a comment

Choose a reason for hiding this comment

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

Just a small comment, looks good for the rest!

src/ledger-bridge.ts Outdated Show resolved Hide resolved
mikesposito
mikesposito previously approved these changes Feb 26, 2024
Copy link
Member

@mikesposito mikesposito left a comment

Choose a reason for hiding this comment

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

LGTM!

cryptodev-2s
cryptodev-2s previously approved these changes Feb 26, 2024
Copy link

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@stanleyyconsensys
Copy link
Contributor Author

@cryptodev-2s @mikesposito can you merge for me, i dont have the permission to do so

@legobeat legobeat merged commit 2cc856a into MetaMask:main Feb 27, 2024
17 checks passed
mikesposito pushed a commit that referenced this pull request Aug 27, 2024
- BREAKING: `LedgerIframeBridge` class constructor now takes an options object with `bridgeUrl`. 
- BREAKING: `LedgerBridge` `init` function now takes no parameters.
- BREAKING: `LedgerBridgeKeyringOptions` no longer contain `bridgeUrl`. 
- BREAKING: `LedgerBridge` interface is now parameterized over its option type
-  Add `getOptions` and `setOptions` methods to `LedgerBridge` interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants