From f746dec91941e4dd428ae0b39a5a2b004c4c89e8 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 13 Feb 2025 04:32:12 -0500 Subject: [PATCH 1/8] update getPreferences --- .../src/restricted/getPreferences.test.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts b/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts index 3966b4aec4..442fdc9185 100644 --- a/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts +++ b/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts @@ -30,6 +30,13 @@ describe('snap_getPreferences', () => { locale: 'en', currency: 'usd', hideBalances: false, + useSecurityAlerts: true, + useSimulations: true, + useTokenDetection: true, + batchCheckBalances: true, + displayNftMedia: false, + useNftDetection: false, + usePriceCheck: true, }), }; @@ -42,7 +49,18 @@ describe('snap_getPreferences', () => { }, method: 'snap_getPreferences', }), - ).toStrictEqual({ locale: 'en', currency: 'usd', hideBalances: false }); + ).toStrictEqual({ + locale: 'en', + currency: 'usd', + hideBalances: false, + useSecurityAlerts: true, + useSimulations: true, + useTokenDetection: true, + batchCheckBalances: true, + displayNftMedia: false, + useNftDetection: false, + usePriceCheck: true, + }); }); }); }); From efd7279af861b969d92f73556ff43de197582646 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 13 Feb 2025 04:35:48 -0500 Subject: [PATCH 2/8] update types --- .../snaps-sdk/src/types/methods/get-preferences.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/snaps-sdk/src/types/methods/get-preferences.ts b/packages/snaps-sdk/src/types/methods/get-preferences.ts index f0a3e16af2..b2b2bede62 100644 --- a/packages/snaps-sdk/src/types/methods/get-preferences.ts +++ b/packages/snaps-sdk/src/types/methods/get-preferences.ts @@ -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. + * @property useSimulations - Whether to simulate transactions and signatures. + * @property useTokenDetection - Whether to auto-detect tokens. + * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. + * @property displayNftMedia - Whether to display NFT media. + * @property useNftDetection - Whether to auto-detect NFTs. + * @property usePriceCheck - Whether to get token price data from CoinGecko and CryptoCompare. */ export type GetPreferencesResult = { locale: string; currency: string; hideBalances: boolean; + useSecurityAlerts: boolean; + useSimulations: boolean; + useTokenDetection: boolean; + batchCheckBalances: boolean; + displayNftMedia: boolean; + useNftDetection: boolean; + usePriceCheck: boolean; }; From 00f2d4b2a8b656e1359e35eddf23214f9bf85f67 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 13 Feb 2025 05:15:48 -0500 Subject: [PATCH 3/8] update jsdoc --- packages/snaps-sdk/src/types/methods/get-preferences.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/snaps-sdk/src/types/methods/get-preferences.ts b/packages/snaps-sdk/src/types/methods/get-preferences.ts index b2b2bede62..5cb07de218 100644 --- a/packages/snaps-sdk/src/types/methods/get-preferences.ts +++ b/packages/snaps-sdk/src/types/methods/get-preferences.ts @@ -19,7 +19,7 @@ export type GetPreferencesParams = never; * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. * @property displayNftMedia - Whether to display NFT media. * @property useNftDetection - Whether to auto-detect NFTs. - * @property usePriceCheck - Whether to get token price data from CoinGecko and CryptoCompare. + * @property usePriceCheck - Whether to get token price data from an external source. */ export type GetPreferencesResult = { locale: string; From f06a34f9902a40319939e0983ea43094e0e068c0 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 13 Feb 2025 06:10:08 -0500 Subject: [PATCH 4/8] update useSecurityAlerts description --- packages/snaps-sdk/src/types/methods/get-preferences.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/snaps-sdk/src/types/methods/get-preferences.ts b/packages/snaps-sdk/src/types/methods/get-preferences.ts index 5cb07de218..f3218ece0c 100644 --- a/packages/snaps-sdk/src/types/methods/get-preferences.ts +++ b/packages/snaps-sdk/src/types/methods/get-preferences.ts @@ -13,7 +13,7 @@ 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. + * @property useSecurityAlerts - Whether to run transactions and signatures through security providers. * @property useSimulations - Whether to simulate transactions and signatures. * @property useTokenDetection - Whether to auto-detect tokens. * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. From 5a5377f8c42406fbebc89b553908228e326c170b Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Thu, 13 Feb 2025 06:41:59 -0500 Subject: [PATCH 5/8] update snaps simulation --- .../src/methods/hooks/get-preferences.test.ts | 28 +++++++++++++++++++ .../src/methods/hooks/get-preferences.ts | 27 +++++++++++++++++- packages/snaps-simulation/src/options.test.ts | 14 ++++++++++ packages/snaps-simulation/src/options.ts | 15 ++++++++++ .../src/test-utils/options.ts | 21 ++++++++++++++ .../src/features/simulation/sagas.ts | 7 +++++ 6 files changed, 111 insertions(+), 1 deletion(-) diff --git a/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts b/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts index 3132a75027..b7843f49e0 100644 --- a/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts +++ b/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts @@ -13,6 +13,13 @@ describe('getGetPreferencesMethodImplementation', () => { currency: 'usd', locale: 'en', hideBalances: false, + useSecurityAlerts: true, + useSimulations: true, + useTokenDetection: true, + batchCheckBalances: true, + displayNftMedia: true, + useNftDetection: true, + usePriceCheck: true, }); }); @@ -27,6 +34,13 @@ describe('getGetPreferencesMethodImplementation', () => { currency: 'usd', locale: 'nl', hideBalances: false, + useSecurityAlerts: true, + useSimulations: true, + useTokenDetection: true, + batchCheckBalances: true, + displayNftMedia: true, + useNftDetection: true, + usePriceCheck: true, }); }); @@ -41,6 +55,13 @@ describe('getGetPreferencesMethodImplementation', () => { currency: 'dkk', locale: 'en', hideBalances: false, + useSecurityAlerts: true, + useSimulations: true, + useTokenDetection: true, + batchCheckBalances: true, + displayNftMedia: true, + useNftDetection: true, + usePriceCheck: true, }); }); @@ -55,6 +76,13 @@ describe('getGetPreferencesMethodImplementation', () => { currency: 'usd', locale: 'en', hideBalances: true, + useSecurityAlerts: true, + useSimulations: true, + useTokenDetection: true, + batchCheckBalances: true, + displayNftMedia: true, + useNftDetection: true, + usePriceCheck: true, }); }); }); diff --git a/packages/snaps-simulation/src/methods/hooks/get-preferences.ts b/packages/snaps-simulation/src/methods/hooks/get-preferences.ts index c6ffb4b180..a4b4ec2e79 100644 --- a/packages/snaps-simulation/src/methods/hooks/get-preferences.ts +++ b/packages/snaps-simulation/src/methods/hooks/get-preferences.ts @@ -7,14 +7,39 @@ import type { SimulationOptions } from '../../options'; * @param options.currency - The currency to use. * @param options.locale - The locale to use. * @param options.hideBalances - Whether to hide balances. + * @param options.useSecurityAlerts - Whether to run transactions and signatures through security providers. + * @param options.useSimulations - Whether to simulate transactions and signatures. + * @param options.useTokenDetection - Whether to auto-detect tokens. + * @param options.batchCheckBalances - Whether to fetch balances in an aggregated manner. + * @param options.displayNftMedia - Whether to display NFT media. + * @param options.useNftDetection - Whether to auto-detect NFTs. + * @param options.usePriceCheck - Whether to get token price data from an external source. * @returns The implementation of the `getPreferences` hook. */ export function getGetPreferencesMethodImplementation({ currency, locale, hideBalances, + useSecurityAlerts, + useSimulations, + useTokenDetection, + batchCheckBalances, + displayNftMedia, + useNftDetection, + usePriceCheck, }: SimulationOptions) { return () => { - return { currency, locale, hideBalances }; + return { + currency, + locale, + hideBalances, + useSecurityAlerts, + useSimulations, + useTokenDetection, + batchCheckBalances, + displayNftMedia, + useNftDetection, + usePriceCheck, + }; }; } diff --git a/packages/snaps-simulation/src/options.test.ts b/packages/snaps-simulation/src/options.test.ts index 30e98adf0b..207bb17c37 100644 --- a/packages/snaps-simulation/src/options.test.ts +++ b/packages/snaps-simulation/src/options.test.ts @@ -6,12 +6,19 @@ describe('getOptions', () => { expect(options).toMatchInlineSnapshot(` { + "batchCheckBalances": true, "currency": "usd", + "displayNftMedia": true, "hideBalances": false, "locale": "en", "secretRecoveryPhrase": "test test test test test test test test test test test ball", "state": null, "unencryptedState": null, + "useNftDetection": true, + "usePriceCheck": true, + "useSecurityAlerts": true, + "useSimulations": true, + "useTokenDetection": true, } `); }); @@ -24,12 +31,19 @@ describe('getOptions', () => { expect(options).toMatchInlineSnapshot(` { + "batchCheckBalances": true, "currency": "eur", + "displayNftMedia": true, "hideBalances": false, "locale": "nl", "secretRecoveryPhrase": "test test test test test test test test test test test ball", "state": null, "unencryptedState": null, + "useNftDetection": true, + "usePriceCheck": true, + "useSecurityAlerts": true, + "useSimulations": true, + "useTokenDetection": true, } `); }); diff --git a/packages/snaps-simulation/src/options.ts b/packages/snaps-simulation/src/options.ts index baf322d7d3..675f15ac39 100644 --- a/packages/snaps-simulation/src/options.ts +++ b/packages/snaps-simulation/src/options.ts @@ -23,16 +23,31 @@ const SimulationOptionsStruct = object({ null, ), hideBalances: defaulted(optional(boolean()), false), + useSecurityAlerts: defaulted(optional(boolean()), true), + useSimulations: defaulted(optional(boolean()), true), + useTokenDetection: defaulted(optional(boolean()), true), + batchCheckBalances: defaulted(optional(boolean()), true), + displayNftMedia: defaulted(optional(boolean()), true), + useNftDetection: defaulted(optional(boolean()), true), + usePriceCheck: defaulted(optional(boolean()), true), }); /** * Options for the simulation. * + * @property currency - The currency to use. Defaults to `usd`. * @property secretRecoveryPhrase - The secret recovery phrase to use. This is * used to derive addresses and private keys. Defaults to a test recovery * phrase. * @property locale - The locale to use. Defaults to `en`. * @property state - The initial state of the Snap, if any. Defaults to `null`. + * @property useSecurityAlerts - Whether to run transactions and signatures through security providers. + * @property useSimulations - Whether to simulate transactions and signatures. + * @property useTokenDetection - Whether to auto-detect tokens. + * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. + * @property displayNftMedia - Whether to display NFT media. + * @property useNftDetection - Whether to auto-detect NFTs. + * @property usePriceCheck - Whether to get token price data from an external source. */ export type SimulationUserOptions = Infer; diff --git a/packages/snaps-simulation/src/test-utils/options.ts b/packages/snaps-simulation/src/test-utils/options.ts index bd680eb633..12632f6a30 100644 --- a/packages/snaps-simulation/src/test-utils/options.ts +++ b/packages/snaps-simulation/src/test-utils/options.ts @@ -11,6 +11,13 @@ import type { SimulationOptions } from '../options'; * @param options.state - The state to use. * @param options.unencryptedState - The unencrypted state to use. * @param options.hideBalances - Whether to hide balances. + * @param options.useSecurityAlerts - Whether to run transactions and signatures through security providers. + * @param options.useSimulations - Whether to simulate transactions and signatures. + * @param options.useTokenDetection - Whether to auto-detect tokens. + * @param options.batchCheckBalances - Whether to fetch balances in an aggregated manner. + * @param options.displayNftMedia - Whether to display NFT media. + * @param options.useNftDetection - Whether to auto-detect NFTs. + * @param options.usePriceCheck - Whether to get token price data from an external source. * @returns The options for the simulation. */ export function getMockOptions({ @@ -20,6 +27,13 @@ export function getMockOptions({ secretRecoveryPhrase = DEFAULT_SRP, state = null, unencryptedState = null, + useSecurityAlerts = true, + useSimulations = true, + useTokenDetection = true, + batchCheckBalances = true, + displayNftMedia = true, + useNftDetection = true, + usePriceCheck = true, }: Partial = {}): SimulationOptions { return { currency, @@ -28,5 +42,12 @@ export function getMockOptions({ state, unencryptedState, hideBalances, + useSecurityAlerts, + useSimulations, + useTokenDetection, + batchCheckBalances, + displayNftMedia, + useNftDetection, + usePriceCheck, }; } diff --git a/packages/snaps-simulator/src/features/simulation/sagas.ts b/packages/snaps-simulator/src/features/simulation/sagas.ts index bac4b699a3..c504144cba 100644 --- a/packages/snaps-simulator/src/features/simulation/sagas.ts +++ b/packages/snaps-simulator/src/features/simulation/sagas.ts @@ -131,6 +131,13 @@ export function* initSaga({ payload }: PayloadAction) { locale: 'en', currency: 'usd', hideBalances: false, + useSecurityAlerts: true, + useSimulations: true, + useTokenDetection: true, + batchCheckBalances: true, + displayNftMedia: true, + useNftDetection: true, + usePriceCheck: true, }), getUnlockPromise: async () => Promise.resolve(true), showDialog: async (...args: Parameters) => From b3fcd142d7901f55b931eb18f232070208d5333d Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Mon, 17 Feb 2025 07:45:05 -0500 Subject: [PATCH 6/8] update property name --- .../src/restricted/getPreferences.test.ts | 4 ++-- packages/snaps-sdk/src/types/methods/get-preferences.ts | 4 ++-- .../src/methods/hooks/get-preferences.test.ts | 8 ++++---- .../snaps-simulation/src/methods/hooks/get-preferences.ts | 6 +++--- packages/snaps-simulation/src/options.test.ts | 4 ++-- packages/snaps-simulation/src/options.ts | 4 ++-- packages/snaps-simulation/src/test-utils/options.ts | 6 +++--- packages/snaps-simulator/src/features/simulation/sagas.ts | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts b/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts index 442fdc9185..ce90e40827 100644 --- a/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts +++ b/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts @@ -36,7 +36,7 @@ describe('snap_getPreferences', () => { batchCheckBalances: true, displayNftMedia: false, useNftDetection: false, - usePriceCheck: true, + useExternalPricingData: true, }), }; @@ -59,7 +59,7 @@ describe('snap_getPreferences', () => { batchCheckBalances: true, displayNftMedia: false, useNftDetection: false, - usePriceCheck: true, + useExternalPricingData: true, }); }); }); diff --git a/packages/snaps-sdk/src/types/methods/get-preferences.ts b/packages/snaps-sdk/src/types/methods/get-preferences.ts index f3218ece0c..9682ca7903 100644 --- a/packages/snaps-sdk/src/types/methods/get-preferences.ts +++ b/packages/snaps-sdk/src/types/methods/get-preferences.ts @@ -19,7 +19,7 @@ export type GetPreferencesParams = never; * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. * @property displayNftMedia - Whether to display NFT media. * @property useNftDetection - Whether to auto-detect NFTs. - * @property usePriceCheck - Whether to get token price data from an external source. + * @property useExternalPricingData - Whether to get token price data from an external source. */ export type GetPreferencesResult = { locale: string; @@ -31,5 +31,5 @@ export type GetPreferencesResult = { batchCheckBalances: boolean; displayNftMedia: boolean; useNftDetection: boolean; - usePriceCheck: boolean; + useExternalPricingData: boolean; }; diff --git a/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts b/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts index b7843f49e0..f1f06a41f0 100644 --- a/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts +++ b/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts @@ -19,7 +19,7 @@ describe('getGetPreferencesMethodImplementation', () => { batchCheckBalances: true, displayNftMedia: true, useNftDetection: true, - usePriceCheck: true, + useExternalPricingData: true, }); }); @@ -40,7 +40,7 @@ describe('getGetPreferencesMethodImplementation', () => { batchCheckBalances: true, displayNftMedia: true, useNftDetection: true, - usePriceCheck: true, + useExternalPricingData: true, }); }); @@ -61,7 +61,7 @@ describe('getGetPreferencesMethodImplementation', () => { batchCheckBalances: true, displayNftMedia: true, useNftDetection: true, - usePriceCheck: true, + useExternalPricingData: true, }); }); @@ -82,7 +82,7 @@ describe('getGetPreferencesMethodImplementation', () => { batchCheckBalances: true, displayNftMedia: true, useNftDetection: true, - usePriceCheck: true, + useExternalPricingData: true, }); }); }); diff --git a/packages/snaps-simulation/src/methods/hooks/get-preferences.ts b/packages/snaps-simulation/src/methods/hooks/get-preferences.ts index a4b4ec2e79..960bff3bee 100644 --- a/packages/snaps-simulation/src/methods/hooks/get-preferences.ts +++ b/packages/snaps-simulation/src/methods/hooks/get-preferences.ts @@ -13,7 +13,7 @@ import type { SimulationOptions } from '../../options'; * @param options.batchCheckBalances - Whether to fetch balances in an aggregated manner. * @param options.displayNftMedia - Whether to display NFT media. * @param options.useNftDetection - Whether to auto-detect NFTs. - * @param options.usePriceCheck - Whether to get token price data from an external source. + * @param options.useExternalPricingData - Whether to get token price data from an external source. * @returns The implementation of the `getPreferences` hook. */ export function getGetPreferencesMethodImplementation({ @@ -26,7 +26,7 @@ export function getGetPreferencesMethodImplementation({ batchCheckBalances, displayNftMedia, useNftDetection, - usePriceCheck, + useExternalPricingData, }: SimulationOptions) { return () => { return { @@ -39,7 +39,7 @@ export function getGetPreferencesMethodImplementation({ batchCheckBalances, displayNftMedia, useNftDetection, - usePriceCheck, + useExternalPricingData, }; }; } diff --git a/packages/snaps-simulation/src/options.test.ts b/packages/snaps-simulation/src/options.test.ts index 207bb17c37..7771c43ac2 100644 --- a/packages/snaps-simulation/src/options.test.ts +++ b/packages/snaps-simulation/src/options.test.ts @@ -15,7 +15,7 @@ describe('getOptions', () => { "state": null, "unencryptedState": null, "useNftDetection": true, - "usePriceCheck": true, + "useExternalPricingData": true, "useSecurityAlerts": true, "useSimulations": true, "useTokenDetection": true, @@ -40,7 +40,7 @@ describe('getOptions', () => { "state": null, "unencryptedState": null, "useNftDetection": true, - "usePriceCheck": true, + "useExternalPricingData": true, "useSecurityAlerts": true, "useSimulations": true, "useTokenDetection": true, diff --git a/packages/snaps-simulation/src/options.ts b/packages/snaps-simulation/src/options.ts index 675f15ac39..0b639c5f74 100644 --- a/packages/snaps-simulation/src/options.ts +++ b/packages/snaps-simulation/src/options.ts @@ -29,7 +29,7 @@ const SimulationOptionsStruct = object({ batchCheckBalances: defaulted(optional(boolean()), true), displayNftMedia: defaulted(optional(boolean()), true), useNftDetection: defaulted(optional(boolean()), true), - usePriceCheck: defaulted(optional(boolean()), true), + useExternalPricingData: defaulted(optional(boolean()), true), }); /** @@ -47,7 +47,7 @@ const SimulationOptionsStruct = object({ * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. * @property displayNftMedia - Whether to display NFT media. * @property useNftDetection - Whether to auto-detect NFTs. - * @property usePriceCheck - Whether to get token price data from an external source. + * @property useExternalPricingData - Whether to get token price data from an external source. */ export type SimulationUserOptions = Infer; diff --git a/packages/snaps-simulation/src/test-utils/options.ts b/packages/snaps-simulation/src/test-utils/options.ts index 12632f6a30..6b671bb93b 100644 --- a/packages/snaps-simulation/src/test-utils/options.ts +++ b/packages/snaps-simulation/src/test-utils/options.ts @@ -17,7 +17,7 @@ import type { SimulationOptions } from '../options'; * @param options.batchCheckBalances - Whether to fetch balances in an aggregated manner. * @param options.displayNftMedia - Whether to display NFT media. * @param options.useNftDetection - Whether to auto-detect NFTs. - * @param options.usePriceCheck - Whether to get token price data from an external source. + * @param options.useExternalPricingData - Whether to get token price data from an external source. * @returns The options for the simulation. */ export function getMockOptions({ @@ -33,7 +33,7 @@ export function getMockOptions({ batchCheckBalances = true, displayNftMedia = true, useNftDetection = true, - usePriceCheck = true, + useExternalPricingData = true, }: Partial = {}): SimulationOptions { return { currency, @@ -48,6 +48,6 @@ export function getMockOptions({ batchCheckBalances, displayNftMedia, useNftDetection, - usePriceCheck, + useExternalPricingData, }; } diff --git a/packages/snaps-simulator/src/features/simulation/sagas.ts b/packages/snaps-simulator/src/features/simulation/sagas.ts index c504144cba..3b0ebf7a6e 100644 --- a/packages/snaps-simulator/src/features/simulation/sagas.ts +++ b/packages/snaps-simulator/src/features/simulation/sagas.ts @@ -137,7 +137,7 @@ export function* initSaga({ payload }: PayloadAction) { batchCheckBalances: true, displayNftMedia: true, useNftDetection: true, - usePriceCheck: true, + useExternalPricingData: true, }), getUnlockPromise: async () => Promise.resolve(true), showDialog: async (...args: Parameters) => From 1e5ca04f25201026c21cfb5dc1a818cfe549ab10 Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Mon, 17 Feb 2025 09:40:28 -0500 Subject: [PATCH 7/8] change property name to simulateOnChainActions --- .../src/restricted/getPreferences.test.ts | 4 ++-- packages/snaps-sdk/src/types/methods/get-preferences.ts | 4 ++-- .../src/methods/hooks/get-preferences.test.ts | 8 ++++---- .../snaps-simulation/src/methods/hooks/get-preferences.ts | 6 +++--- packages/snaps-simulation/src/options.test.ts | 4 ++-- packages/snaps-simulation/src/options.ts | 4 ++-- packages/snaps-simulation/src/test-utils/options.ts | 6 +++--- packages/snaps-simulator/src/features/simulation/sagas.ts | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts b/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts index ce90e40827..d809c57179 100644 --- a/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts +++ b/packages/snaps-rpc-methods/src/restricted/getPreferences.test.ts @@ -31,7 +31,7 @@ describe('snap_getPreferences', () => { currency: 'usd', hideBalances: false, useSecurityAlerts: true, - useSimulations: true, + simulateOnChainActions: true, useTokenDetection: true, batchCheckBalances: true, displayNftMedia: false, @@ -54,7 +54,7 @@ describe('snap_getPreferences', () => { currency: 'usd', hideBalances: false, useSecurityAlerts: true, - useSimulations: true, + simulateOnChainActions: true, useTokenDetection: true, batchCheckBalances: true, displayNftMedia: false, diff --git a/packages/snaps-sdk/src/types/methods/get-preferences.ts b/packages/snaps-sdk/src/types/methods/get-preferences.ts index 9682ca7903..d56ce3061e 100644 --- a/packages/snaps-sdk/src/types/methods/get-preferences.ts +++ b/packages/snaps-sdk/src/types/methods/get-preferences.ts @@ -14,7 +14,7 @@ export type GetPreferencesParams = never; * @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 security providers. - * @property useSimulations - Whether to simulate transactions and signatures. + * @property simulateOnChainActions - Whether to simulate transactions and signatures. * @property useTokenDetection - Whether to auto-detect tokens. * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. * @property displayNftMedia - Whether to display NFT media. @@ -26,7 +26,7 @@ export type GetPreferencesResult = { currency: string; hideBalances: boolean; useSecurityAlerts: boolean; - useSimulations: boolean; + simulateOnChainActions: boolean; useTokenDetection: boolean; batchCheckBalances: boolean; displayNftMedia: boolean; diff --git a/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts b/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts index f1f06a41f0..0993566c01 100644 --- a/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts +++ b/packages/snaps-simulation/src/methods/hooks/get-preferences.test.ts @@ -14,7 +14,7 @@ describe('getGetPreferencesMethodImplementation', () => { locale: 'en', hideBalances: false, useSecurityAlerts: true, - useSimulations: true, + simulateOnChainActions: true, useTokenDetection: true, batchCheckBalances: true, displayNftMedia: true, @@ -35,7 +35,7 @@ describe('getGetPreferencesMethodImplementation', () => { locale: 'nl', hideBalances: false, useSecurityAlerts: true, - useSimulations: true, + simulateOnChainActions: true, useTokenDetection: true, batchCheckBalances: true, displayNftMedia: true, @@ -56,7 +56,7 @@ describe('getGetPreferencesMethodImplementation', () => { locale: 'en', hideBalances: false, useSecurityAlerts: true, - useSimulations: true, + simulateOnChainActions: true, useTokenDetection: true, batchCheckBalances: true, displayNftMedia: true, @@ -77,7 +77,7 @@ describe('getGetPreferencesMethodImplementation', () => { locale: 'en', hideBalances: true, useSecurityAlerts: true, - useSimulations: true, + simulateOnChainActions: true, useTokenDetection: true, batchCheckBalances: true, displayNftMedia: true, diff --git a/packages/snaps-simulation/src/methods/hooks/get-preferences.ts b/packages/snaps-simulation/src/methods/hooks/get-preferences.ts index 960bff3bee..f97b7db933 100644 --- a/packages/snaps-simulation/src/methods/hooks/get-preferences.ts +++ b/packages/snaps-simulation/src/methods/hooks/get-preferences.ts @@ -8,7 +8,7 @@ import type { SimulationOptions } from '../../options'; * @param options.locale - The locale to use. * @param options.hideBalances - Whether to hide balances. * @param options.useSecurityAlerts - Whether to run transactions and signatures through security providers. - * @param options.useSimulations - Whether to simulate transactions and signatures. + * @param options.simulateOnChainActions - Whether to simulate transactions and signatures. * @param options.useTokenDetection - Whether to auto-detect tokens. * @param options.batchCheckBalances - Whether to fetch balances in an aggregated manner. * @param options.displayNftMedia - Whether to display NFT media. @@ -21,7 +21,7 @@ export function getGetPreferencesMethodImplementation({ locale, hideBalances, useSecurityAlerts, - useSimulations, + simulateOnChainActions, useTokenDetection, batchCheckBalances, displayNftMedia, @@ -34,7 +34,7 @@ export function getGetPreferencesMethodImplementation({ locale, hideBalances, useSecurityAlerts, - useSimulations, + simulateOnChainActions, useTokenDetection, batchCheckBalances, displayNftMedia, diff --git a/packages/snaps-simulation/src/options.test.ts b/packages/snaps-simulation/src/options.test.ts index 7771c43ac2..ed69a4070b 100644 --- a/packages/snaps-simulation/src/options.test.ts +++ b/packages/snaps-simulation/src/options.test.ts @@ -17,7 +17,7 @@ describe('getOptions', () => { "useNftDetection": true, "useExternalPricingData": true, "useSecurityAlerts": true, - "useSimulations": true, + "simulateOnChainActions": true, "useTokenDetection": true, } `); @@ -42,7 +42,7 @@ describe('getOptions', () => { "useNftDetection": true, "useExternalPricingData": true, "useSecurityAlerts": true, - "useSimulations": true, + "simulateOnChainActions": true, "useTokenDetection": true, } `); diff --git a/packages/snaps-simulation/src/options.ts b/packages/snaps-simulation/src/options.ts index 0b639c5f74..17cf711cca 100644 --- a/packages/snaps-simulation/src/options.ts +++ b/packages/snaps-simulation/src/options.ts @@ -24,7 +24,7 @@ const SimulationOptionsStruct = object({ ), hideBalances: defaulted(optional(boolean()), false), useSecurityAlerts: defaulted(optional(boolean()), true), - useSimulations: defaulted(optional(boolean()), true), + simulateOnChainActions: defaulted(optional(boolean()), true), useTokenDetection: defaulted(optional(boolean()), true), batchCheckBalances: defaulted(optional(boolean()), true), displayNftMedia: defaulted(optional(boolean()), true), @@ -42,7 +42,7 @@ const SimulationOptionsStruct = object({ * @property locale - The locale to use. Defaults to `en`. * @property state - The initial state of the Snap, if any. Defaults to `null`. * @property useSecurityAlerts - Whether to run transactions and signatures through security providers. - * @property useSimulations - Whether to simulate transactions and signatures. + * @property simulateOnChainActions - Whether to simulate transactions and signatures. * @property useTokenDetection - Whether to auto-detect tokens. * @property batchCheckBalances - Whether to fetch balances in an aggregated manner. * @property displayNftMedia - Whether to display NFT media. diff --git a/packages/snaps-simulation/src/test-utils/options.ts b/packages/snaps-simulation/src/test-utils/options.ts index 6b671bb93b..ad2f5fb56f 100644 --- a/packages/snaps-simulation/src/test-utils/options.ts +++ b/packages/snaps-simulation/src/test-utils/options.ts @@ -12,7 +12,7 @@ import type { SimulationOptions } from '../options'; * @param options.unencryptedState - The unencrypted state to use. * @param options.hideBalances - Whether to hide balances. * @param options.useSecurityAlerts - Whether to run transactions and signatures through security providers. - * @param options.useSimulations - Whether to simulate transactions and signatures. + * @param options.simulateOnChainActions - Whether to simulate transactions and signatures. * @param options.useTokenDetection - Whether to auto-detect tokens. * @param options.batchCheckBalances - Whether to fetch balances in an aggregated manner. * @param options.displayNftMedia - Whether to display NFT media. @@ -28,7 +28,7 @@ export function getMockOptions({ state = null, unencryptedState = null, useSecurityAlerts = true, - useSimulations = true, + simulateOnChainActions = true, useTokenDetection = true, batchCheckBalances = true, displayNftMedia = true, @@ -43,7 +43,7 @@ export function getMockOptions({ unencryptedState, hideBalances, useSecurityAlerts, - useSimulations, + simulateOnChainActions, useTokenDetection, batchCheckBalances, displayNftMedia, diff --git a/packages/snaps-simulator/src/features/simulation/sagas.ts b/packages/snaps-simulator/src/features/simulation/sagas.ts index 3b0ebf7a6e..a81e95b95b 100644 --- a/packages/snaps-simulator/src/features/simulation/sagas.ts +++ b/packages/snaps-simulator/src/features/simulation/sagas.ts @@ -132,7 +132,7 @@ export function* initSaga({ payload }: PayloadAction) { currency: 'usd', hideBalances: false, useSecurityAlerts: true, - useSimulations: true, + simulateOnChainActions: true, useTokenDetection: true, batchCheckBalances: true, displayNftMedia: true, From ca510254feecb7b0593e50908f39db4cd5226b1a Mon Sep 17 00:00:00 2001 From: Hassan Malik Date: Mon, 17 Feb 2025 10:46:27 -0500 Subject: [PATCH 8/8] fix test --- packages/snaps-simulation/src/options.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/snaps-simulation/src/options.test.ts b/packages/snaps-simulation/src/options.test.ts index ed69a4070b..9864b5ab7e 100644 --- a/packages/snaps-simulation/src/options.test.ts +++ b/packages/snaps-simulation/src/options.test.ts @@ -12,12 +12,12 @@ describe('getOptions', () => { "hideBalances": false, "locale": "en", "secretRecoveryPhrase": "test test test test test test test test test test test ball", + "simulateOnChainActions": true, "state": null, "unencryptedState": null, - "useNftDetection": true, "useExternalPricingData": true, + "useNftDetection": true, "useSecurityAlerts": true, - "simulateOnChainActions": true, "useTokenDetection": true, } `); @@ -37,12 +37,12 @@ describe('getOptions', () => { "hideBalances": false, "locale": "nl", "secretRecoveryPhrase": "test test test test test test test test test test test ball", + "simulateOnChainActions": true, "state": null, "unencryptedState": null, - "useNftDetection": true, "useExternalPricingData": true, + "useNftDetection": true, "useSecurityAlerts": true, - "simulateOnChainActions": true, "useTokenDetection": true, } `);