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

[Task] Add wallet selector with ledger support to web4 page #254

Open
petersalomonsen opened this issue Jan 25, 2025 · 5 comments · May be fixed by #255
Open

[Task] Add wallet selector with ledger support to web4 page #254

petersalomonsen opened this issue Jan 25, 2025 · 5 comments · May be fixed by #255
Assignees

Comments

@petersalomonsen
Copy link
Collaborator

Background

Regarding ledger support, near.social doesn’t have it and dev.near.org doesn’t work at the moment.

Enabling edger on dedicated gateways like the web4 gateway for treasury instances is a use case in this scenario.

The wallet selector supports ledger, and we may enable ledger support for treasury through the wallet selector in the web4 instance.

User Story

As a treasury user
I need ledger support in the treasury application
So that I can sign transactions with my ledger device

Acceptance Criteria

  • Add wallet selector with ledger enabled to the web4 page for treasury

Resources & Additional Notes

No response

Priority

🔴 P0 : Critical

@petersalomonsen
Copy link
Collaborator Author

Ledger works with the wallet selector, which I did test successfully here: petersalomonsen/quickjs-rust-near#35. That project does not use BOS though, and that's where challenges comes up.

The following two lines in web4/public_html/index.html loads the BOS VM.

<script defer
    src="https://cdn.jsdelivr.net/npm/[email protected]/dist/main.1b3f0d7d1017de355a7c.bundle.js"></script>
  <script defer
    src="https://cdn.jsdelivr.net/npm/[email protected]/dist/runtime.25b143da327a5371509f.bundle.js"></script>

If I add Ledger to the wallet-selector, I have to remove those two lines to make it work like you can see on the screenshot below:

Image

If I reinsert those two lines, then neither the wallet-selector or BOS works anymore. I get the error as in the screenshot below:

Image

So there is a conflict with BOS and the wallet selector dependencies. It is most probably because of mis-aligned and outdated libraries, which also most probably can be solved through picking everything apart to find where the issue is. A quite time consuming task, but I've also observed that just regenerating the importmap from scratch, with the latest version of the wallet-selector, also breaks with BOS, without even adding the ledger. It might be worth spending time on this also for the sake of updating dependencies.

@petersalomonsen
Copy link
Collaborator Author

@frol @ori-near I am setting a Medium effort estimate ( 15-25 hours ) due to my findings in the comment above.

@petersalomonsen petersalomonsen moved this from 📋 Backlog to 🏗 In progress in 🚀 DevHub Products Jan 26, 2025
@petersalomonsen petersalomonsen linked a pull request Jan 26, 2025 that will close this issue
@petersalomonsen
Copy link
Collaborator Author

So.. I just tried to move importing the BOS VM bundles after loading the wallet-selector.

Somehow this seemed to do the trick, but need to verify that it actually works @ori-near @frol

Image

https://treasury-testing.near.page/

@petersalomonsen
Copy link
Collaborator Author

When testing it, the transaction is forwarded to the ledger for signing.

Image

But the SignedTransaction borsh schema is missing, probably in BOS, since this worked when testing without BOS.

Image

@petersalomonsen
Copy link
Collaborator Author

Rebuilding the importmap fixes the borsh schema issue. The following transaction was signed using ledger: https://nearblocks.io/txns/D77LJ7WnF4s1ABEp5b2q3eS5UBYBX6atCwYch1bJYYs8

@petersalomonsen petersalomonsen moved this from 🏗 In progress to 👀 In review in 🚀 DevHub Products Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

1 participant