@metamask/snaps-cli 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.6.1]
10
+ ### Fixed
11
+ - `mm-snap init` Snap `snap_confirm` call ([#168](https://github.com/MetaMask/snaps-skunkworks/pull/168))
12
+ - The generated Snap was passing invalid parameters to the method.
13
+
9
14
  ## [0.6.0]
10
15
  ### Added
11
16
  - Snap SVG icon support ([#163](https://github.com/MetaMask/snaps-skunkworks/pull/163))
@@ -60,7 +65,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
60
65
  - Example snaps ([#72](https://github.com/MetaMask/snaps-skunkworks/pull/72))
61
66
  - The examples now live in their own package, [`@metamask/snap-examples`](https://npmjs.com/package/@metamask/snap-examples).
62
67
 
63
- [Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.0...HEAD
68
+ [Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.1...HEAD
69
+ [0.6.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.0...v0.6.1
64
70
  [0.6.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.5.0...v0.6.0
65
71
  [0.5.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.4.0...v0.5.0
66
72
  [0.4.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.3.1...v0.4.0
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "html": "<!doctype html>\n<html>\n </head>\n <title>Hello, Snaps!</title>\n </head>\n\n <body>\n <h1>Hello, Snaps!</h1>\n <details>\n <summary>Instructions</summary>\n <ul>\n <li>First, click \"Connect\". Then, try out the other buttons!</li>\n <li>Please note that:</li>\n <ul>\n <li>\n The <code>snap.manifest.json</code> and <code>package.json</code> must be located in located in the server root directory..\n </li>\n <li>\n The Snap bundle must be hosted at the location specified by the <code>location</code> field of <code>snap.manifest.json</code>.\n </li>\n </ul>\n </ul>\n </details>\n <br/>\n\n <button class=\"connect\">Connect</button>\n <button class=\"sendHello\">Send Hello</button>\n </body>\n\n <script>\n\n // When developing locally, we identify Snaps like this\n const snapId = `local:${window.location.href}`;\n\n const connectButton = document.querySelector('button.connect')\n const sendButton = document.querySelector('button.sendHello')\n\n connectButton.addEventListener('click', connect)\n sendButton.addEventListener('click', send)\n\n // here we get permissions to interact with and install the snap\n async function connect () {\n await ethereum.request({\n method: 'wallet_enable',\n params: [{\n wallet_snap: { [snapId]: {} },\n }]\n })\n }\n\n // here we call the snap's \"hello\" method\n async function send () {\n try {\n const response = await ethereum.request({\n method: 'wallet_invokeSnap',\n params: [snapId, {\n method: 'hello'\n }]\n })\n } catch (err) {\n console.error(err)\n alert('Problem happened: ' + err.message || err)\n }\n }\n\n </script>\n</html>\n",
3
- "source": "wallet.registerRpcMessageHandler(async (originString, requestObject) => {\n switch (requestObject.method) {\n case 'hello':\n return wallet.request({\n method: 'snap_confirm',\n params: [`Hello, ${originString}!`],\n });\n default:\n throw new Error('Method not found.');\n }\n});\n"
3
+ "source": "wallet.registerRpcMessageHandler(async (originString, requestObject) => {\n switch (requestObject.method) {\n case 'hello':\n return wallet.request({\n method: 'snap_confirm',\n params: [{ prompt: `Hello, ${originString}!` }],\n });\n default:\n throw new Error('Method not found.');\n }\n});\n"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/snaps-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "A CLI for developing MetaMask Snaps.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,26 +16,27 @@
16
16
  "scripts": {
17
17
  "setup": "yarn install && yarn allow-scripts",
18
18
  "shasum": "node ./scripts/computeSnapShasum.js",
19
- "build:init-template": "node ./scripts/createInitTemplate.js",
19
+ "build:init-template": "node ./scripts/createInitTemplate.js && yarn prettier --check src/cmds/init/init-template.json",
20
20
  "build:typescript": "tsc --project ./tsconfig.local.json",
21
21
  "build:chmod": "chmod +x ./dist/main.js",
22
22
  "build": "yarn build:init-template && yarn build:typescript && yarn build:chmod",
23
+ "build:pre-tsc": "echo 'N/A'",
24
+ "build:post-tsc": "./scripts/publish-prep.sh",
23
25
  "build:clean": "yarn clean && yarn build",
24
26
  "build:watch": "tsc-watch --onSuccess 'yarn build:chmod'",
25
27
  "clean": "rimraf dist/*",
26
- "test": "jest",
27
- "test:watch": "jest --watch",
28
+ "test": "yarn build:init-template && jest",
29
+ "test:watch": "yarn test --watch",
28
30
  "test:ci": "yarn test",
29
31
  "lint:changelog": "yarn auto-changelog validate",
30
32
  "lint:eslint": "eslint . --cache --ext js,ts",
31
33
  "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",
32
34
  "lint": "yarn lint:eslint && yarn lint:misc --check",
33
35
  "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
34
- "publish": "../../scripts/publish-package.sh",
35
- "publish:prep": "./scripts/publish-prep.sh"
36
+ "publish": "../../scripts/publish-package.sh"
36
37
  },
37
38
  "dependencies": {
38
- "@metamask/snap-controllers": "^0.6.0",
39
+ "@metamask/snap-controllers": "^0.6.1",
39
40
  "browserify": "^17.0.0",
40
41
  "chokidar": "^3.0.2",
41
42
  "fast-deep-equal": "^2.0.1",