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 ERC7715 grant_permissions support on lab #2500

Merged
merged 21 commits into from
Jul 10, 2024

Conversation

KannuSingh
Copy link
Collaborator

@KannuSingh KannuSingh commented Jul 3, 2024

Description

This PR is enabling support for ERC 7715 new JSON-RPC method wallet_grantPermissions for DApp to request permissions from a wallet in order to execute transactions on users’s behalf. This enables :

  • Executing transactions for users without a wallet connection.

The PR would need addition of one manadory .env values NEXT_PUBLIC_PIMLICO_KEY which is used to submit userOperation.

This PR also enable testing this on a local AA infra running over forked sepolia chain.
For more information on how to set up local testing, refer to how to setup local-testing.

When running the project locally and wanting to use the local forked network and AA setup, just add the .env variable values, and the project will automatically use the local setup:

NEXT_PUBLIC_LOCAL_BUNDLER_URL=
NEXT_PUBLIC_LOCAL_PAYMASTER_URL=
NEXT_PUBLIC_LOCAL_CLIENT_URL=

Interface changes

Page: /library/wagmi-permissions

# Breaking Changes

Changes

  • feat: ERC7715 grant_permissions support on lab
  • fix:
  • chore:

Associated Issues

Closes RES-6

Copy link

vercel bot commented Jul 3, 2024

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

Name Status Preview Updated (UTC)
web3modal-gallery ✅ Ready (Inspect) Visit Preview Jul 10, 2024 5:20pm
web3modal-laboratory ✅ Ready (Inspect) Visit Preview Jul 10, 2024 5:20pm

@KannuSingh KannuSingh marked this pull request as ready for review July 3, 2024 15:54
@KannuSingh KannuSingh requested a review from tomiir July 3, 2024 15:54
@KannuSingh KannuSingh changed the title WIP: Feat ERC7715 grant_permissions support on lab Feat ERC7715 grant_permissions support on lab Jul 3, 2024
Copy link

linear bot commented Jul 8, 2024

@lukaisailovic
Copy link
Collaborator

PR is missing description

function onCreateNewPrivateKey() {
try {
const privateKey = generatePrivateKey()
setItem(LOCAL_SIGNER_KEY, privateKey)
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we remove this at some point?

Copy link
Collaborator

@tomiir tomiir left a comment

Choose a reason for hiding this comment

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

@lukaisailovic do we want a test for this? It's not appkit specific behavior but if we want it to be tested it would require a playwright test

@lukaisailovic
Copy link
Collaborator

@lukaisailovic do we want a test for this? It's not appkit specific behavior but if we want it to be tested it would require a playwright test

@tomiir I don't think its necessary now, since its not a part of AppKit. This is the preparation for integration of Sessions in our Universal Wallet. At that point we will add tests.

enabled using local AA infra by setting env variables
Comment on lines 80 to 83
const userOpHash = getUserOperationHash({
userOperation: {
...userOp
},
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't pass any other fields here, we don't have to destruct the object and directly use the ref. (In case it's not required for cloning object purposes)

Suggested change
const userOpHash = getUserOperationHash({
userOperation: {
...userOp
},
const userOpHash = getUserOperationHash({
userOperation: userOp,

Copy link
Collaborator

@tomiir tomiir left a comment

Choose a reason for hiding this comment

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

My only question is: do we need to clear the signer when the user disconnects?
Else looks good!

@KannuSingh KannuSingh merged commit 7efcaa0 into main Jul 10, 2024
9 checks passed
@KannuSingh KannuSingh deleted the feat-erc7715-permissions-support branch July 10, 2024 17:39
This was referenced Jul 17, 2024
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.

5 participants