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/wallet get capabilities cache #4486

Merged
merged 7 commits into from May 14, 2024

Conversation

ganchoradkov
Copy link
Member

Description

Implemented wallet_getCapabilities caching in universal-provider

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Draft PR (breaking/non-breaking change which needs more work for having a proper functionality [Mark this PR as ready to review only when completely ready])
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

tests

Checklist

  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Information (Optional)

Please include any additional information that may be useful for the reviewer.

@ganchoradkov ganchoradkov requested a review from arein May 2, 2024 08:26
@arein arein added the accepted label May 2, 2024
@ganchoradkov ganchoradkov requested a review from bkrem May 2, 2024 08:26
capabilities: {
...(sessionCapabilities || {}),
[address]: capabilities,
} as any, // by spec sessionProperties should be <string, string> but here are used as objects?
Copy link
Member

Choose a reason for hiding this comment

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

what do we do about this? The spec is the EIP-5792 spec. I think we do something else maybe in our CAIP-25 spec? So maybe we just cover the "right" think in our wallet docs / wallet SDK?

We probably need to expand our namespace builder for this usecase

Copy link
Member Author

Choose a reason for hiding this comment

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

according to caip-25 spec the sessionProperties (scopeProperties) is <string, string>

@@ -1001,6 +1002,78 @@ describe("UniversalProvider", function () {
expectedChainId,
});
});
it("should cache `wallet_getCapabilities` request", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

do you need a negative test here if not cached?

Copy link
Member Author

Choose a reason for hiding this comment

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

the first part of the test where the wallet receives the request covers the not cached part. If it was cached already the request wouldn't have been sent to the wallet

@ganchoradkov ganchoradkov requested a review from Cali93 May 13, 2024 12:50
@ganchoradkov ganchoradkov merged commit 8803500 into v2.0 May 14, 2024
9 checks passed
@ganchoradkov ganchoradkov deleted the feat/wallet_getCapabilities_cache branch May 14, 2024 13:04
@ganchoradkov ganchoradkov mentioned this pull request May 23, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants