UNPKG

@metamask/snaps-simulation

Version:

A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment

1 lines 2.22 kB
{"version":3,"file":"get-preferences.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/get-preferences.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,qCAAqC,CAAC,EACpD,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,YAAY,GACM;IAClB,OAAO,GAAG,EAAE;QACV,OAAO;YACL,QAAQ;YACR,MAAM;YACN,YAAY;YACZ,iBAAiB;YACjB,sBAAsB;YACtB,iBAAiB;YACjB,kBAAkB;YAClB,eAAe;YACf,eAAe;YACf,sBAAsB;YACtB,YAAY;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AA5BD,sFA4BC","sourcesContent":["import type { SimulationOptions } from '../../options';\n\n/**\n * Get the implementation of the `getPreferences` hook.\n *\n * @param options - The simulation options.\n * @param options.currency - The currency to use.\n * @param options.locale - The locale to use.\n * @param options.hideBalances - Whether to hide balances.\n * @param options.useSecurityAlerts - Whether to run transactions and signatures through security providers.\n * @param options.simulateOnChainActions - Whether to simulate transactions and signatures.\n * @param options.useTokenDetection - Whether to auto-detect tokens.\n * @param options.batchCheckBalances - Whether to fetch balances in an aggregated manner.\n * @param options.displayNftMedia - Whether to display NFT media.\n * @param options.useNftDetection - Whether to auto-detect NFTs.\n * @param options.useExternalPricingData - Whether to get token price data from an external source.\n * @param options.showTestnets - Whether to show testnets.\n * @returns The implementation of the `getPreferences` hook.\n */\nexport function getGetPreferencesMethodImplementation({\n currency,\n locale,\n hideBalances,\n useSecurityAlerts,\n simulateOnChainActions,\n useTokenDetection,\n batchCheckBalances,\n displayNftMedia,\n useNftDetection,\n useExternalPricingData,\n showTestnets,\n}: SimulationOptions) {\n return () => {\n return {\n currency,\n locale,\n hideBalances,\n useSecurityAlerts,\n simulateOnChainActions,\n useTokenDetection,\n batchCheckBalances,\n displayNftMedia,\n useNftDetection,\n useExternalPricingData,\n showTestnets,\n };\n };\n}\n"]}