feat(iframe): implement wallet_getCapabilities method#525
Open
ultraviolet10 wants to merge 5 commits intomasterfrom
Open
feat(iframe): implement wallet_getCapabilities method#525ultraviolet10 wants to merge 5 commits intomasterfrom
wallet_getCapabilities method#525ultraviolet10 wants to merge 5 commits intomasterfrom
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Mar 14, 2025
ultraviolet10
commented
Mar 14, 2025
| @@ -0,0 +1,3 @@ | |||
| export enum HappyWalletCapability { | |||
| BoopPaymaster = "boopPaymaster", | |||
Contributor
Author
There was a problem hiding this comment.
only capability we currently support!
Deploying happychain with
|
| Latest commit: |
be88f94
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b7e710ff.happychain.pages.dev |
| Branch Preview URL: | https://aritra-5792-get-capabilities.happychain.pages.dev |
fcdfc53 to
3f44845
Compare
752fc7c to
7e34c0c
Compare
3f44845 to
11ef2c8
Compare
937da6c to
439b03a
Compare
11ef2c8 to
7502930
Compare
439b03a to
dcb5165
Compare
7502930 to
06f22f5
Compare
d1589ca to
a60eeb7
Compare
dcb5165 to
24ad267
Compare
24ad267 to
eb3e520
Compare
a60eeb7 to
af3fd5b
Compare
not-reed
reviewed
May 21, 2025
wallet_getCapabilities method
af3fd5b to
dfe3f5a
Compare
eb3e520 to
99ced7c
Compare
dfe3f5a to
be88f94
Compare
99ced7c to
45cb2b1
Compare
not-reed
reviewed
Jun 6, 2025
| checkAndChecksumAddress(request.payload.params[0]) | ||
|
|
||
| const currentChainId = getCurrentChain().chainId | ||
| if (request.payload.params[1].length > 1) { |
Contributor
There was a problem hiding this comment.
i guess should also check if the length is one, and if any of the chains are happyChain/currentChain (if they only request mainnet right now, it would not behave correctly)
not-reed
reviewed
Jun 6, 2025
Comment on lines
+123
to
+125
| [currentChainId]: Object.fromEntries( | ||
| Object.values(HappyWalletCapability).map((capability) => [capability, { supported: true }]), | ||
| ), |
Contributor
There was a problem hiding this comment.
you could compute this once at a global level, instead on each request
// support/wallet-common/lib/interfaces/eip5792.ts
export const walletCapabilities = Object.fromEntries(
Object.values(HappyWalletCapability)
.map((capability) => [capability, { supported: true }])
)
Suggested change
| [currentChainId]: Object.fromEntries( | |
| Object.values(HappyWalletCapability).map((capability) => [capability, { supported: true }]), | |
| ), | |
| [currentChainId]: walletCapabilities, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Linked Issues
Description
Implements the spec for
wallet_getCapabilitiesfor the wallet to be able to specify the same to developers.spec | porto docs for the same
🎲 demo(react): the demo's namesake button prompts the user to check the console for the expected payload.

Checklist
Basics
norswap/build-system-caching).Reminder: PR review guidelines
Correctness
testnet, mainnet, standalone wallet, ...).
< INDICATE BROWSER, DEMO APP & OTHER ENV DETAILS USED FOR TESTING HERE >
< INDICATE TESTED SCENARIOS (USER INTERFACE INTERACTION, CODE FLOWS) HERE >
and have updated the code & comments accordingly.
Architecture & Documentation
(2) commenting these boundaries correctly, (3) adding inline comments for context when needed.
comments.
in a Markdown document.
pacakges/coreandpackages/react), see here for more info.