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

Wallet JSON RPC API, Request Accounts #2378

Closed
wants to merge 1 commit into from
Closed

Conversation

kyranjamie
Copy link
Collaborator

@kyranjamie kyranjamie commented Apr 20, 2022

Try out this version of the Hiro Wallet - download extension builds.

WIP.

This PR refactors the communication mechanism dApps can use to interact with the wallet. It is inspired by EIP-1102, and relates to an ongoing Wallet Protocol SIP proposal.

Rather than adding a new method to the StacksProvider object for each possible operation, a single request method should be called, which sends arguments complaint with the JSON RPC Specification. This has some benefits, such as creating a universal API that can work outside of this wallet's specific context, and also simplifies the implementation, which currently requires work across multiple script contexts to add a single action.

A uuid is created using crypto.randomUUID(); in the inpage script, which maps to the RPC spec id field, helping to map responses to their given request.

  • Add JSON RPC style request method
  • Refactor Choose Accounts flow to reuse UI
  • Refactor tx signing to allow unverified requests
  • Prevent transaction requests from unapproved apps
  • Update docs with new request method
  • Add integration test for request account return values

This screencast shows the behaviour of how transaction verification works. First, we request a transaction on a clean account before we've ever given it permissions for that app: localhost:3000. When we try again after allowing stx_requestAccounts, the transaction no longer throws an error. The exact UX/copy tbd.

Kapture.2022-04-26.at.14.18.49.mp4

@vercel
Copy link

vercel bot commented Apr 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
stacks-wallet-web ❌ Failed (Inspect) Jul 15, 2022 at 4:20PM (UTC)

@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 0a0a0f9 to 6a19a6f Compare April 20, 2022 16:34
@vercel vercel bot temporarily deployed to Preview April 20, 2022 16:34 Inactive
@vercel vercel bot temporarily deployed to Preview April 21, 2022 10:07 Inactive
@vercel vercel bot temporarily deployed to Preview April 21, 2022 16:14 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 6cc06f5 to ee98fb4 Compare April 21, 2022 17:58
@vercel vercel bot temporarily deployed to Preview April 21, 2022 18:15 Inactive
@vercel vercel bot temporarily deployed to Preview April 22, 2022 07:00 Inactive
@vercel vercel bot temporarily deployed to Preview April 22, 2022 13:13 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from beb2a51 to 1ac52ae Compare April 22, 2022 13:28
@vercel vercel bot temporarily deployed to Preview April 22, 2022 13:29 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 1ac52ae to a8fc798 Compare April 22, 2022 13:39
@vercel vercel bot temporarily deployed to Preview April 22, 2022 13:39 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from a8fc798 to 36374e9 Compare April 25, 2022 12:47
@vercel vercel bot temporarily deployed to Preview April 25, 2022 12:50 Inactive
@vercel vercel bot temporarily deployed to Preview April 26, 2022 07:39 Inactive
@andresgalante andresgalante linked an issue May 2, 2022 that may be closed by this pull request
@vercel vercel bot temporarily deployed to Preview May 2, 2022 16:34 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 5db9f56 to 89f3b43 Compare May 7, 2022 07:55
@vercel vercel bot temporarily deployed to Preview May 7, 2022 07:55 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 89f3b43 to dcab63c Compare May 9, 2022 09:53
@vercel vercel bot temporarily deployed to Preview May 9, 2022 09:56 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from dcab63c to 6fe32b4 Compare May 9, 2022 10:19
@vercel vercel bot temporarily deployed to Preview May 9, 2022 10:22 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 6fe32b4 to bcc40ab Compare May 9, 2022 10:40
@vercel vercel bot temporarily deployed to Preview May 9, 2022 10:43 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from bcc40ab to 59683e7 Compare May 9, 2022 10:44
@vercel vercel bot temporarily deployed to Preview May 9, 2022 10:47 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 59683e7 to ec36132 Compare May 9, 2022 10:52
@vercel vercel bot temporarily deployed to Preview May 9, 2022 10:55 Inactive
@aulneau
Copy link
Contributor

aulneau commented May 26, 2022

@kyranjamie this is wonderful, any expected ETA for this PR? to do something like stacksgov/sips#70 we'll want to have this kind of request accounts functionality

@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from f073b3c to de8377e Compare May 31, 2022 14:08
@vercel vercel bot temporarily deployed to Preview May 31, 2022 14:11 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from de8377e to cbd6c86 Compare May 31, 2022 15:03
@vercel vercel bot temporarily deployed to Preview May 31, 2022 15:06 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from cbd6c86 to bfc6ecb Compare May 31, 2022 15:27
@vercel vercel bot temporarily deployed to Preview May 31, 2022 15:30 Inactive
@kyranjamie
Copy link
Collaborator Author

I'll be picking this up as soon as I'm done with ledger bugs/issues

@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from bfc6ecb to ab8a9f3 Compare June 1, 2022 19:41
@vercel vercel bot temporarily deployed to Preview June 1, 2022 19:41 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from ab8a9f3 to dd4b1a4 Compare June 2, 2022 16:25
@vercel vercel bot temporarily deployed to Preview June 2, 2022 16:25 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from dd4b1a4 to 5cf51a9 Compare June 3, 2022 07:50
@vercel vercel bot temporarily deployed to Preview June 3, 2022 07:53 Inactive
@vercel vercel bot temporarily deployed to Preview June 3, 2022 10:25 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 8f519f5 to 93a8122 Compare June 6, 2022 07:41
@vercel vercel bot temporarily deployed to Preview June 6, 2022 07:41 Inactive
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from 93a8122 to bb2c367 Compare June 6, 2022 10:43
@vercel vercel bot temporarily deployed to Preview June 6, 2022 10:44 Inactive
@csykesdev
Copy link

came her from #2371

This functionality would be amazing for allowing development of simple apps that require hiro wallet authentication and don't have a need for nodejs other than stacks.

@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from bb2c367 to b6f788c Compare June 30, 2022 13:36
@vercel vercel bot temporarily deployed to Preview June 30, 2022 13:38 Inactive
Adds a new `request` mechanism through which dApps
can interact with the wallet with a JSON RPC API.
Initially, this only supports:

`stx_requestAccounts`, a method that requests
public key information from the wallet.

chore: tidy test app, adding request accounts

chore: move request account logic to new file
@kyranjamie kyranjamie force-pushed the feat/request-accounts branch from b6f788c to a0edbf1 Compare July 15, 2022 16:17
@vercel vercel bot temporarily deployed to Preview July 15, 2022 16:20 Inactive
@pete-watters pete-watters deleted the feat/request-accounts branch February 14, 2024 06:10
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.

Add API to request addresses
4 participants