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

Update snap_getPreferences #3093

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Update snap_getPreferences #3093

wants to merge 7 commits into from

Conversation

hmalik88
Copy link
Contributor

Updating snap_getPreferences return type to include additional properties.

Closes #3076

@hmalik88 hmalik88 marked this pull request as ready for review February 13, 2025 09:37
@hmalik88 hmalik88 requested a review from a team as a code owner February 13, 2025 09:37
*/
export type GetPreferencesResult = {
locale: string;
currency: string;
hideBalances: boolean;
useSecurityAlerts: boolean;
useSimulations: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
useSimulations: boolean;
useTransactionSimulations: boolean;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can be signatures as well, so that's why I kept it generic.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I feel like "simulations" is too generic, but I'm not sure if there's a good name for both 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about simulateOnChainActions?

packages/snaps-sdk/src/types/methods/get-preferences.ts Outdated Show resolved Hide resolved
@@ -13,9 +13,23 @@ export type GetPreferencesParams = never;
* @property locale - The user's selected locale.
* @property currency - The user's selected currency.
* @property hideBalances - Whether the user has chosen to hide balances.
* @property useSecurityAlerts - Whether to run transactions and signatures through blockaid.
Copy link
Member

Choose a reason for hiding this comment

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

Is this relevant for Snaps? They can't hook into Blockaid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have no idea, maybe Solana team has plans to use blockaid? cc: @Montoya

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup they are integrating blockaid's API into the snap

Copy link
Member

Choose a reason for hiding this comment

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

I think we should make it more generic and not mention any providers, our Snaps may choose to use Blockaid, but other Snaps could use other providers for "security alerts"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the description.

Copy link

codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.88%. Comparing base (9525ef1) to head (881992c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3093   +/-   ##
=======================================
  Coverage   94.88%   94.88%           
=======================================
  Files         506      506           
  Lines       11123    11123           
  Branches     1709     1709           
=======================================
  Hits        10554    10554           
  Misses        569      569           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@GuillaumeRx GuillaumeRx left a comment

Choose a reason for hiding this comment

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

This PR doesn't update snap-simulation, can we update it ?

@FrederikBolding
Copy link
Member

This PR doesn't update snap-simulation, can we update it ?

Yes please, we can just return true for all the new flags tbh

@hmalik88
Copy link
Contributor Author

This PR doesn't update snap-simulation, can we update it ?

Done

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 privacy-related settings to getPreferences
4 participants