UNPKG

@metamask/snaps-simulation

Version:

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

48 lines 3.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getOptions = void 0; const superstruct_1 = require("@metamask/superstruct"); const utils_1 = require("@metamask/utils"); const constants_1 = require("./constants.cjs"); const SimulationAccountStruct = (0, superstruct_1.object)({ address: (0, superstruct_1.string)(), id: (0, superstruct_1.string)(), scopes: (0, superstruct_1.array)(utils_1.CaipChainIdStruct), selected: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), false), owned: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), false), assets: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.array)(utils_1.CaipAssetTypeStruct)), []), }); const SimulationAssetStruct = (0, superstruct_1.object)({ name: (0, superstruct_1.string)(), symbol: (0, superstruct_1.string)(), }); const SimulationOptionsStruct = (0, superstruct_1.object)({ currency: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.string)()), constants_1.DEFAULT_CURRENCY), secretRecoveryPhrase: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.string)()), constants_1.DEFAULT_SRP), locale: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.string)()), constants_1.DEFAULT_LOCALE), state: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.nullable)((0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct))), null), unencryptedState: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.nullable)((0, superstruct_1.record)((0, superstruct_1.string)(), utils_1.JsonStruct))), null), accounts: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.array)(SimulationAccountStruct)), constants_1.DEFAULT_ACCOUNTS), assets: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.record)(utils_1.CaipAssetTypeStruct, SimulationAssetStruct)), constants_1.DEFAULT_ASSETS), hideBalances: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), false), useSecurityAlerts: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), simulateOnChainActions: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), useTokenDetection: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), batchCheckBalances: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), displayNftMedia: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), useNftDetection: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), useExternalPricingData: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), showTestnets: (0, superstruct_1.defaulted)((0, superstruct_1.optional)((0, superstruct_1.boolean)()), true), }); /** * Get the options for the simulation. * * @param options - The user options. Any options not specified will be filled * in with default values. * @returns The simulation options. */ function getOptions(options) { return (0, superstruct_1.create)(options, SimulationOptionsStruct); } exports.getOptions = getOptions; //# sourceMappingURL=options.cjs.map