UNPKG

@metamask/snaps-simulation

Version:

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

48 lines 1.75 kB
import { SnapStatus } from "@metamask/snaps-utils"; /** * Get a method that gets a Snap by its ID. * * @param preinstalled - Whether the Snap is preinstalled. If `true`, the Snap * will be returned as a preinstalled Snap. * @returns A method that gets a Snap by its ID. It will always return a mock * Snap for simulation purposes. */ export function getGetSnapImplementation(preinstalled = true) { return (_snapId) => { // This is a mock Snap for simulation purposes. Most of the fields are not // actually used, but returned for type-safety sake. return { id: 'npm:@metamask/snaps-simulation', version: '0.1.0', enabled: true, blocked: false, status: SnapStatus.Running, versionHistory: [], initialPermissions: {}, sourceCode: '', manifest: { version: '0.1.0', proposedName: 'Test Snap', description: 'A test Snap for simulation purposes.', repository: { type: 'git', url: 'https://github.com/MetaMask/snaps.git', }, source: { shasum: 'unused', location: { npm: { filePath: 'dist/index.js', packageName: '@metamask/snaps-simulation', registry: 'https://registry.npmjs.org', }, }, }, initialPermissions: {}, manifestVersion: '0.1', }, preinstalled, }; }; } //# sourceMappingURL=get-snap.mjs.map