{"id":20306676,"url":"https://github.com/montoya/random-snap","last_synced_at":"2026-05-07T22:38:10.731Z","repository":{"id":37698683,"uuid":"492988518","full_name":"Montoya/random-snap","owner":"Montoya","description":"An example Snap that returns simple random numbers and a random question answer feature.","archived":false,"fork":false,"pushed_at":"2023-11-10T03:44:30.000Z","size":771,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-26T14:07:06.653Z","etag":null,"topics":["javascript","metamask","npm","snaps"],"latest_commit_sha":null,"homepage":"https://montoya.github.io/random-snap/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Montoya.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-16T20:23:29.000Z","updated_at":"2023-09-04T00:48:24.000Z","dependencies_parsed_at":"2023-02-10T20:46:03.546Z","dependency_job_id":"12dd2a88-4504-431f-a438-77a40655a12f","html_url":"https://github.com/Montoya/random-snap","commit_stats":{"total_commits":48,"total_committers":3,"mean_commits":16.0,"dds":0.125,"last_synced_commit":"5035abfa25205a81d4fbced1b45402d298160f21"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":"MetaMask/template-snap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Montoya%2Frandom-snap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Montoya%2Frandom-snap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Montoya%2Frandom-snap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Montoya%2Frandom-snap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Montoya","download_url":"https://codeload.github.com/Montoya/random-snap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241803058,"owners_count":20022766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","metamask","npm","snaps"],"created_at":"2024-11-14T17:14:28.405Z","updated_at":"2026-05-07T22:38:10.675Z","avatar_url":"https://github.com/Montoya.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mystery Snap\n\nThis is a simple MetaMask Snap that returns random numbers and answers. Below are the steps for publishing a Snap to NPM for anyone to use.\n\n## Prerequisite\n\nBefore you begin, you should familiarize yourself with the npm documentation for [Contributing packages to the registry](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry).\n\nYou will also need an npm account. \n\n## Setup\n\n`snap.manifest.json`: \n\n```JSON\n{\n  \"version\": \"1.0.0\",\n  \"proposedName\": \"Mystery Snap\",\n  \"description\": \"A simple MetaMask Snap that returns random numbers and answers.\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/Montoya/random-snap.git\"\n  },\n  \"source\": {\n    \"shasum\": \"05E9ZMYL2tHWlHoTF9z4vnDqbxMFw3KfeEvHyfQeMRE=\",\n    \"location\": {\n      \"npm\": {\n        \"filePath\": \"dist/bundle.js\",\n        \"iconPath\": \"images/icon.svg\",\n        \"packageName\": \"mystery-snap\",\n        \"registry\": \"https://registry.npmjs.org/\"\n      }\n    }\n  },\n  \"initialPermissions\": {\n    \"snap_confirm\": {}\n  },\n  \"manifestVersion\": \"0.1\"\n}\n```\n\n`source` contains what will be published to NPM for distributing the Snap. Proposed package name is `mystery-snap` (this is the only field that needs to be modified from `template-snap`). Also, the icon at `images/icon.svg` should be changed to something unique.\n\n`package.json` (partial): \n\n```JSON\n{\n  \"name\": \"mystery-snap\",\n  \"version\": \"1.0.0\",\n  \"description\": \"A simple MetaMask Snap that returns random numbers and answers.\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/Montoya/random-snap.git\"\n  },\n```\n\n*Make sure that the version numbers in `snap.manifest.json` and `package.json` match.*\n\n## Publishing\n\nOnce your Snap is ready for release, use the following command to publish: \n\n`npm publish`\n\n*If you are running this for the first time, you may have to log in via the command line, then run this command again.*\n\nYou should see output like this: \n\n```Bash\n% npm publish\n📦  mystery-snap@1.0.0\n=== Tarball Contents === \n2.7kB README.md         \n1.7kB dist/bundle.js    \n2.1kB images/icon.svg   \n1.6kB package.json      \n617B  snap.manifest.json\n1.3kB src/index.js      \n=== Tarball Details === \nname:          mystery-snap                            \nversion:       1.0.0                                   \nfilename:      mystery-snap-1.0.0.tgz                  \npackage size:  3.6 kB                                  \nunpacked size: 10.1 kB                                 \nshasum:        ...\nintegrity:     ...\ntotal files:   6                                       \n\nPublishing to https://registry.npmjs.org/\n+ mystery-snap@1.0.0\n```\n\nAfter publishing, you can visit your npm account dashboard and see your newly published Snap package:\n\n\u003cimg src=\"tutorial-assets/tutorial-publish.png\" width=\"492\" height=\"184\" alt=\"Published Snap\"\u003e\n\nThen, any dApp can use the published Snap ID to connect to this Snap: \n\n```JavaScript\nconst snapId = `npm:mystery-snap`;\n```\n\nMetaMask will automatically fetch the Snap from the npm registry. \n\nThis repository includes a simple dApp website that uses the Snap published to npm. You can try it here: [https://montoya.github.io/random-snap](https://montoya.github.io/random-snap).\n\n## Acknowledgements\n\nCrystal Ball icon by [OpenMoji](https://openmoji.org/).\n\nFox Image by [pch.vector](https://www.freepik.com/free-vector/set-cartoon-fox-character-getting-angry-meditating-sitting-lotus-pose-smiling_35159972.htm#page=3\u0026query=fox%20svg\u0026position=20\u0026from_view=keyword\u0026track=ais) on Freepik\n\n## License\n\nThis project is dual-licensed under Apache 2.0 and MIT terms:\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontoya%2Frandom-snap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmontoya%2Frandom-snap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontoya%2Frandom-snap/lists"}