Skip to content

added CAIP-25 to remove the round-trip required for wallet_getCapabilities #540

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

Merged
merged 3 commits into from
Apr 22, 2024

Conversation

KannuSingh
Copy link
Contributor

on session approval, wallet capabilities data as defined for wallet_getCapabilities in EIP5792 is added to sessionProperties,
this gives another way for dapps to check wallet's capabilities without requesting via wallet_getCapabilities method.

Copy link

vercel bot commented Apr 18, 2024

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

Name Status Preview Comments Updated (UTC)
decentralized-relay-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2024 2:29pm
malicious-dapp-verify-simulation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2024 2:29pm
react-dapp-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2024 2:29pm
react-wallet-v2 ✅ Ready (Inspect) Visit Preview Apr 19, 2024 2:29pm
8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
decentralized-relay-wallet ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm
react-auth-dapp ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm
react-auth-wallet ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm
react-dapp-v2-cosmos-provider ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm
react-dapp-v2-with-ethers ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm
react-dapp-v2-with-web3js ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm
svelte-web3modal ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm
vue-dapp-auth ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 2:29pm

@lukaisailovic
Copy link
Collaborator

Are we supposed to also implement logic dapp side to check for this?

@KannuSingh
Copy link
Contributor Author

Not sure how to showcase this on dapp side.
Some suggestion
I can add a card on react-dapp-v2 showing capabilities or update the account cards with methods call such that if certain EIP5792 capabilities is not present for any account on connected chain it will don't have EIP5792 methods displayed.

Example on react-dapp-v2 for EOA account card we can remove wallet_sendCalls, wallet_getCallsStatus methods as we are not supporting batch calls for EOA.

@lukaisailovic
Copy link
Collaborator

Not sure how to showcase this on dapp side. Some suggestion I can add a card on react-dapp-v2 showing capabilities or update the account cards with methods call such that if certain EIP5792 capabilities is not present for any account on connected chain it will don't have EIP5792 methods displayed.

Example on react-dapp-v2 for EOA account card we can remove wallet_sendCalls, wallet_getCallsStatus methods as we are not supporting batch calls for EOA.

@KannuSingh Well the point was to remove additional network trip that dapps have to do with wallet_getCapabilities and offer that information in CAIP-25 response instead.

We can update react-dapp-v2 to show sessionProperties, and disable buttons that trigger batch call for example if its not available.

I like your idea of showing received sessionProperties dapp side too 👌

@KannuSingh
Copy link
Contributor Author

KannuSingh commented Apr 18, 2024

okay, I will add this in the react-dapp-v2.

One another thing I would to check is currently sessionProperties is having type Record<string, string>, will it be change to Record<string, Object> in future?

Copy link
Contributor

@arein arein left a comment

Choose a reason for hiding this comment

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

lgtm. can you add a test?

added changes in react-dapp-v2 to filters the action for an account based on capabilities in sessionProperties.
@KannuSingh
Copy link
Contributor Author

KannuSingh commented Apr 19, 2024

This change filtered the actions for account, but if we want to only want to disable buttons for those action I can also add those changes instead of removing the actions.
@arein It can now be tested with react-dapp-v2

@arein
Copy link
Contributor

arein commented Apr 19, 2024

I meant an automatic eg unit test to cover this logic and help prevent regressions would also be great

@lukaisailovic
Copy link
Collaborator

okay, I will add this in the react-dapp-v2.

One another thing I would to check is currently sessionProperties is having type Record<string, string>, will it be change to Record<string, Object> in future?

If it changes we'll update. For not its Record<string, string>

@KannuSingh KannuSingh merged commit a50c8eb into main Apr 22, 2024
@KannuSingh KannuSingh deleted the CAIP-25_support_for_wallet_getCapabilities branch April 22, 2024 12:45
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.

3 participants