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

Open the Leather extension programmatically (API needed) #5800

Closed
renashah opened this issue Aug 21, 2024 · 13 comments · Fixed by #5810, #5817 or #5835
Closed

Open the Leather extension programmatically (API needed) #5800

renashah opened this issue Aug 21, 2024 · 13 comments · Fixed by #5810, #5817 or #5835
Assignees
Labels
area:api effort:small Expected to take up to 1 day of integration work sprint:2024-08-26

Comments

@renashah
Copy link
Collaborator

Hey Leather eng team! We need a way to open the Leather extension programmatically. Is there a way for Leather to allow our app to do this? Right now, Chrome will not allow it.

We'll need it to launch .locker TLD.

@renashah
Copy link
Collaborator Author

@bilalanees98 would be able to provide more context re timeline and specifications

@bilalanees98
Copy link

Hey team
Here's a little context around this.
We're using @stacks/connect v7.5.0 to interact with the leather wallet extension. While we are able to open up wallet popups for specific things e.g. transaction broadcast, message signing etc we cannot open up the extension 'generically'.

We tried hitting the chrome-extension url and opening it from there, but that ends up giving us a ERR_BLOCKED_BY_CLIENT error.
This is the url we try to hit: chrome-extension://ldinpeekobnhjjdofggfgjlcehhmanlj/index.html#/

Wondering if we can get an API that will help us open up the wallet extension. The goal is to navigate users directly from the dotlocker dashboard to either the leather extension popup or to the maximized version in a new tab (preferred).

We're on a bit of a tight deadline with the launch, would be great if this could be ready by mid next-week (28th August). Happy to work towards finding a better date as well.

@pete-watters
Copy link
Contributor

Hi @bilalanees98 ,

Thanks for providing this information. I will discuss it with the team and report back shortly.

@pete-watters pete-watters self-assigned this Aug 22, 2024
@markmhendrickson
Copy link
Collaborator

Let's look into whether we can add a generic API for opening the extension to any page / route.

@pete-watters
Copy link
Contributor

Hi @bilalanees98 ,

I have got to work on this and have a draft PR ready where I have added a new RPC call - openWallet. You will be able to access this by running LeatherProvider.request('openWallet'). There is still some work to do - adding docs, tests and extending it to accept the page you wish to open as a parameter.

If you wanted, you could download and install this build of Leather wallet from my draft PR to check if it's working for you.

@bilalanees98
Copy link

Thanks @pete-watters

I'll get someone to try this out and report back.

@pete-watters pete-watters added the effort:small Expected to take up to 1 day of integration work label Aug 26, 2024
@Imamah-Zafar
Copy link

hey @pete-watters tried this on my end and its working 👍

@pete-watters
Copy link
Contributor

pete-watters commented Aug 28, 2024

hey @pete-watters tried this on my end and its working 👍

Thanks for confirming @Imamah-Zafar 👍

FYI we have decided to rename the API as open so you can access it with LeatherProvider.request('open').

I have created a release that includes this work and will get it out ASAP

@pete-watters pete-watters linked a pull request Aug 28, 2024 that will close this issue
kyranjamie pushed a commit that referenced this issue Aug 28, 2024
## [6.47.0](v6.46.0...v6.47.0) (2024-08-28)

### Features

* add link and unlink mono script ([29f2174](29f2174))
* add mono link ui script ([717737c](717737c))
* mock hiro ft requests ([6987609](6987609))
* mock nfts and txs hiro requests ([318378d](318378d))

### Bug Fixes

* disable brc-20 sends, ref leather-io/issues[#5773](#5773) ([aafd992](aafd992))
* rename dialog as sheet, closes ref leather-io/issues[#268](#268) ([ec64755](ec64755))

### Internal

* add open API, ref leather-io/issues[#5800](#5800) ([3df62f7](3df62f7))
* icons using ui lib svgs, closes leather-io/issues[#123](#123) ([3e8314e](3e8314e))
* post-release merge back ([56d021b](56d021b))
* show BRC-20 tokens on ledger, ref [#5797](#5797) ([bcc40f7](bcc40f7))
@pete-watters
Copy link
Contributor

@bilalanees98 @Imamah-Zafar : I just published a release of Leather that includes this API update - v6.47.0. It's awaiting Chrome Store approval right now but I expect it to go live soon.

@markmhendrickson: I opened this new task for extending the API. I just wanted to get this out to meet the deadline

@pete-watters
Copy link
Contributor

I can confirm this update is now live. Let me know if you experience any issues.

Good luck with the launch 🚀

@kyranjamie
Copy link
Collaborator

Sorry for the late follow up.

@renashah @bilalanees98 Curious what the .locker user flow is. What is the user expected to do after you've opened the wallet? What page do you open on? I wonder if the API should be more narrowly scoped to the task the user needs to perform, rather than just opening it.

@pete-watters I wonder what the promise does in your implementation? If the wallet opens, and no return value is expected, I'd imagine the promise to return immediately, rather than hang indefinitely.

@pete-watters
Copy link
Contributor

this new task

Thanks @kyranjamie , let me improve it. Do you have any thoughts on this task - #5821. Mark suggested extending this to allow the page to be opened to be passed but I'm unsure if that has other security implications

@markmhendrickson
Copy link
Collaborator

kyranjamie pushed a commit that referenced this issue Sep 3, 2024
## [6.47.1](v6.47.0...v6.47.1) (2024-09-03)

### Bug Fixes

* adjust BigTitle padding and close, ref leather-io/extension[#5802](#5802) ([6b9566a](6b9566a))
* don't show send in header ([d8ed76a](d8ed76a))
* only show Send title above small view, ref [#5802](#5802) ([f45fedf](f45fedf))
* remove px for all page headers above sm, ref [#5802](#5802) ([dae0f47](dae0f47))
* send inscription formatting and InfoCardButton icon colour, ref leather-io/extension[#5828](#5828) ([afc50d5](afc50d5))
* update padding of onboarding header to align buttons, ref [#5802](#5802) ([203629d](203629d))

### Internal

* fix padding of asset list items in activity, ref [#5802](#5802) ([3e4d8a2](3e4d8a2))
* improve open API and add tests, ref leather-io/issues[#5800](#5800) ([9d52d9e](9d52d9e))
* post-release merge back ([e554376](e554376))
* update link to docs on open, ref [#5800](#5800) ([003a6ad](003a6ad))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment