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: auto-add key to wallet, support for test wallet #630

Merged
merged 33 commits into from
Oct 2, 2024

Conversation

sidvishnoi
Copy link
Member

@sidvishnoi sidvishnoi commented Sep 26, 2024

Context

Changes proposed in this pull request

  • Add new content script to automate key-addition to wallets.
    • The scripts are in content/keyAutoAdd/*
    • content/keyAutoAdd/lib/* contains script integration with background, along with some helper utils.
    • These content scripts are injected only to specific wallet URLs, and not to all URLs.
    • The content scripts are written as "steps" so we can track their breakage better, and show progress to user. Some steps can be marked as "skipped".
    • content/keyAutoAdd/testWallet.ts contains a sample automation for the test wallet, via API reverse engineering.
    • The key nickname is extension name + browser name.
  • background/keyAutoAdd.ts contains background service to orchestrate key-addition. It sends the BEGIN message to content script and monitors progress via Runtime.Port based messaging.
  • connectWallet in background/openPayments.ts handles key-addition, if needed.
    • Most other changes in background/openPayments.ts are to handle rejections, tab closes, and reusing tabs for further process.
    • More errors need to be handled as we now store connect state in background's transientPopupState to give user more info if they re-open popup during connect process.
  • E2E tests:
    • add test for most common, but complex path (not logged-in)
    • refactor: move testWallet specific code to separate helper, and into smaller chunks so we can test connect process specifically.

Follow-up:

@github-actions github-actions bot added the area: background Improvements or additions to extension background script label Sep 26, 2024
@sidvishnoi sidvishnoi changed the title feat: add service to automatically add key to wallet (start with test wallet) feat: auto-add key to wallet (start with test wallet) Sep 26, 2024
Copy link
Contributor

github-actions bot commented Sep 26, 2024

Extension builds preview

Name Link
Latest commit 0ce1414
Latest job logs Run #11140350834
BadgeDownload
BadgeDownload

@github-actions github-actions bot added area: content Improvements or additions to extension content script area: popup Improvements or additions to extension popup area: i18n labels Sep 26, 2024
@github-actions github-actions bot added the area: documentation Improvements or additions to documentation label Sep 30, 2024
@sidvishnoi sidvishnoi marked this pull request as ready for review September 30, 2024 13:15
@github-actions github-actions bot added the area: tests Improvements or additions to tests label Sep 30, 2024
Copy link
Member Author

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

test-e2e

Copy link
Member Author

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

test-e2e

@sidvishnoi sidvishnoi changed the title feat: auto-add key to wallet (start with test wallet) feat: auto-add key to wallet, supporting test wallet Sep 30, 2024
Copy link
Member Author

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

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

test-e2e

@sidvishnoi sidvishnoi changed the title feat: auto-add key to wallet, supporting test wallet feat: auto-add key to wallet, support for test wallet Sep 30, 2024
Copy link
Contributor

@mkurapov mkurapov left a comment

Choose a reason for hiding this comment

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

If only we had an "auto-add" API route in rafiki.money :)

This makes sense, worked for me when logged in already and not logged in. Just some minor comments

src/content/keyAutoAdd/testWallet.ts Outdated Show resolved Hide resolved
src/content/keyAutoAdd/lib/helpers.ts Outdated Show resolved Hide resolved
src/content/keyAutoAdd/testWallet.ts Outdated Show resolved Hide resolved
@sidvishnoi sidvishnoi merged commit 1edee22 into main Oct 2, 2024
8 checks passed
@sidvishnoi sidvishnoi deleted the setup-page/key-share branch October 2, 2024 08:26
@sidvishnoi sidvishnoi restored the setup-page/key-share branch October 2, 2024 08:29
@sidvishnoi sidvishnoi deleted the setup-page/key-share branch October 2, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: background Improvements or additions to extension background script area: content Improvements or additions to extension content script area: documentation Improvements or additions to documentation area: i18n area: popup Improvements or additions to extension popup area: tests Improvements or additions to tests
Projects
None yet
3 participants