Skip to content

Commit f639307

Browse files
committed
Merge branch 'main' into solana-wallet-standard
# Conflicts: # docs/whats-new.md
2 parents 5eb70fd + 61c40ef commit f639307

File tree

18 files changed

+101
-118
lines changed

18 files changed

+101
-118
lines changed

docs/whats-new.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ of the [MetaMask developer page](https://metamask.io/developer/).
1313

1414
- Documented [Solana](/wallet/how-to/use-non-evm-networks/solana) dapp support via the Wallet Standard and third-party libraries.
1515
([#1940](https://github.com/MetaMask/metamask-docs/pull/1940))
16+
- Documented [how to use the Snaps sandbox](/snaps/how-to/test-a-snap/#test-in-the-sandbox).
17+
([#2030](https://github.com/MetaMask/metamask-docs/pull/2030))
1618
- Documented how to use the SDK CLI to set up a [JavaScript + Wagmi](/sdk/quickstart/javascript-wagmi) or [Dynamic SDK](/sdk/quickstart/javascript-dynamic) project.
1719
([#2010](https://github.com/MetaMask/metamask-docs/pull/2010))
1820
- Documented [how to send batch transactions via EIP-5792 and EIP-7702](/wallet/how-to/send-transactions/send-batch-transactions).

snaps/how-to/debug-a-snap/common-issues.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ plugins for several other build systems:
6060
For examples on how to set up these build systems yourself, see the
6161
[examples](https://github.com/MetaMask/snaps/tree/main/packages/examples).
6262

63-
We recommend running [`yarn mm-snap manifest --fix`](../../reference/cli/subcommands.md#m-manifest)
63+
We recommend running [`yarn mm-snap manifest --fix`](../../reference/cli.md#m-manifest)
6464
after creating your bundle to make sure your manifest `shasum` value is correct.
65-
You might also benefit from running [`yarn mm-snap eval`](../../reference/cli/subcommands.md#e-eval)
65+
You might also benefit from running [`yarn mm-snap eval`](../../reference/cli.md#e-eval)
6666
to detect any SES issues up front.
6767

6868
## Patch dependencies

snaps/how-to/debug-a-snap/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can also see the [common issues](common-issues.md) encountered by Snap devel
1212
:::
1313

1414
You can add your log statements in your source code and build your Snap, or add them directly
15-
to your Snap bundle and use [`yarn mm-snap manifest --fix`](../../reference/cli/subcommands.md#m-manifest)
15+
to your Snap bundle and use [`yarn mm-snap manifest --fix`](../../reference/cli.md#m-manifest)
1616
to update the `shasum` in your Snap manifest file.
1717
The manifest `shasum` must match the contents of your bundle at the time MetaMask fetches your Snap.
1818

snaps/how-to/publish-a-snap.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ After publishing the Snap, any dapp can connect to the Snap by using the Snap ID
2525
:::caution
2626
If you are using the Snap monorepo project generated in the [quickstart](../get-started/quickstart.md),
2727
make sure to only publish the Snap package in `/packages/snap`.
28-
You can use the [Snaps Simulator](https://metamask.github.io/snaps/snaps-simulator/staging/#/manifest) to verify
29-
that your Snap was published correctly — just select **localhost** in the top right corner and change the
30-
Snap location to **npm** and the ID of your Snap.
28+
You can use the [Snaps sandbox](test-a-snap.md#test-in-the-sandbox) to verify
29+
that your Snap was published correctly: in the sandbox settings, disable **Use current Snap ID** and specify the npm ID of your Snap.
3130

3231
Also, make sure to update the manifest file, icon file, and README to differentiate your Snap from the template.
3332
:::

snaps/how-to/test-a-snap.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,43 @@ sidebar_position: 6
55

66
# Test a Snap
77

8-
You can test your Snap by hosting it locally using `yarn start`, installing it in Flask, and calling
9-
its API methods from a dapp.
8+
You can test your Snap [locally](#test-locally), in the [Snaps sandbox](#test-in-a-sandbox), and [end-to-end using Jest](#test-end-to-end).
109

11-
For end-to-end Snap testing in a Jest environment, use the
12-
[`@metamask/snaps-jest`](https://github.com/MetaMask/snaps/tree/main/packages/snaps-jest) package
13-
as follows.
10+
## Test locally
1411

15-
## Steps
12+
1. Host your Snap locally:
13+
14+
```bash
15+
yarn start
16+
```
17+
18+
2. Install your Snap in Flask.
19+
20+
3. Test your Snap by calling its API methods from a dapp.
21+
22+
## Test in the sandbox
23+
24+
Use the Snaps sandbox to test and debug your Snap in an easy-to-use interface.
25+
26+
1. Run the [`sandbox`](../reference/cli.md#sandbox) subcommand to start the sandbox server:
27+
28+
```bash
29+
yarn mm-snap sandbox
30+
```
31+
32+
Navigate to the `localhost` URL displayed in the terminal.
33+
34+
2. Install your Snap in Flask.
35+
36+
3. Test your Snap by calling its API methods from the sandbox interface.
37+
38+
## Test end-to-end
39+
40+
Follow these steps to test your Snap end-to-end in a Jest environment.
1641

1742
### 1. Install `@metamask/snaps-jest`
1843

19-
Install the `@metamask/snaps-jest` package into your Snap project using [Yarn](https://yarnpkg.com/)
44+
Install the [`@metamask/snaps-jest`](https://github.com/MetaMask/snaps/tree/main/packages/snaps-jest) package into your Snap project using [Yarn](https://yarnpkg.com/)
2045
or [npm](https://www.npmjs.com/):
2146

2247
```bash

snaps/how-to/use-environment-variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Snaps CLI:
3232
PUBLIC_KEY=abc123 SNAP_ENV=dev
3333
```
3434

35-
2. Build your Snap using the [Snaps CLI](../reference/cli/subcommands.md):
35+
2. Build your Snap using the [Snaps CLI](../reference/cli.md):
3636

3737
```bash
3838
yarn mm-snap build

snaps/learn/about-snaps/files.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ reproduce the `source.shasum` value), and what
7878
You might need to modify some manifest fields manually.
7979
For example, if you change the location of the icon SVG file, you must update
8080
`source.location.npm.iconPath` to match.
81-
You can also use the [Snaps CLI](../../reference/cli/subcommands.md) to update some fields for you.
82-
For example, running [`yarn mm-snap build`](../../reference/cli/subcommands.md#b-build) or
83-
[`yarn mm-snap manifest --fix`](../../reference/cli/subcommands.md#m-manifest) updates `source.shasum`.
81+
You can also use the [Snaps CLI](../../reference/cli.md) to update some fields for you.
82+
For example, running [`yarn mm-snap build`](../../reference/cli.md#b-build) or
83+
[`yarn mm-snap manifest --fix`](../../reference/cli.md#m-manifest) updates `source.shasum`.
8484

8585
:::caution important
8686
Some manifest fields must match the corresponding fields of the `/snap/package.json` file.
@@ -105,7 +105,7 @@ expand to support different publishing solutions.
105105
The Snap configuration file, `snap.config.js` or `snap.config.ts`, must be placed in the project
106106
root directory.
107107
You can override the default values of the
108-
[Snaps configuration options](../../reference/cli/options.md) by specifying them in the
108+
[Snaps configuration options](../../reference/config-options.md) by specifying them in the
109109
configuration file.
110110
For example:
111111

@@ -163,7 +163,7 @@ built-ins must be bundled along with the Snap.
163163

164164
Running `yarn start` bundles your Snap for you.
165165

166-
You can also run [`yarn mm-snap build`](../../reference/cli/subcommands.md#b-build) to bundle your
166+
You can also run [`yarn mm-snap build`](../../reference/cli.md#b-build) to bundle your
167167
Snap using [webpack](https://webpack.js.org/).
168168
This command finds all dependencies using your specified main entry point and outputs a bundle
169169
file to your specified output path.

snaps/learn/best-practices/security-guidelines.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ The following are guidelines for [managing permissions](../../how-to/request-per
1515
- **Minimum permissions** - Follow the principle of least authority by only adding the minimum
1616
permissions needed by your Snap in the manifest file.
1717
Before publishing your Snap, check the permissions again and remove any unused permissions.
18-
You can validate your permissions using the [Snaps Simulator Manifest
19-
Validator](https://metamask.github.io/snaps/snaps-simulator/staging/#/manifest).
2018

2119
- **Minimum RPC access** - When adding the [`endowment:rpc`](../../reference/permissions.md#endowmentrpc)
2220
permission for Snaps or dapps, ask yourself if both are necessary.

snaps/learn/resources.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ View the following Snaps resources in addition to this documentation site.
5252
- [`snaps-jest`](https://www.npmjs.com/package/@metamask/snaps-jest) - A Jest preset for end-to-end
5353
testing MetaMask Snaps, including a Jest environment, and a set of Jest matchers.
5454
See [how to test a Snap](../how-to/test-a-snap.md) using `snaps-jest`.
55-
- [Snaps Simulator](https://metamask.github.io/snaps/snaps-simulator/latest) - A tool for simulating
56-
Snaps in the browser, streamlining the development process. It doesn't support all Snaps features
57-
but can be useful for testing certain features.
5855
- [Snapper](https://github.com/sayfer-io/Snapper) - A tool for detecting security vulnerabilities,
5956
identifying potential issues, and ensuring best coding practices in your Snap.
6057
- [MetaMask Testing Tools](https://hugomrdias.github.io/metamask/) - A collection of tools for

snaps/reference/cli/subcommands.md renamed to snaps/reference/cli.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
sidebar_label: Subcommands
3-
sidebar_position: 2
2+
sidebar_label: Snaps CLI
3+
sidebar_position: 3
44
toc_max_heading_level: 4
55
description: See the Snaps CLI subcommands reference.
66
---
77

88
import Tabs from "@theme/Tabs";
99
import TabItem from "@theme/TabItem";
1010

11-
# Snaps subcommands
11+
# Snaps CLI
1212

1313
This reference describes the syntax of the Snaps command line interface (CLI) subcommands and
1414
subcommand options.
@@ -19,6 +19,11 @@ You can specify subcommands and their options using the `yarn mm-snap` command:
1919
yarn mm-snap [SUBCOMMAND] [SUBCOMMAND OPTIONS]
2020
```
2121

22+
:::note
23+
This documentation assumes you created your Snap using the [`@metamask/create-snap`](https://github.com/MetaMask/snaps/tree/main/packages/create-snap) starter kit, which includes the Snaps CLI.
24+
You can also install the CLI directly using the [`@metamask/snaps-cli`](https://github.com/MetaMask/snaps/tree/main/packages/snaps-cli) package.
25+
:::
26+
2227
### `b`, `build`
2328

2429
```bash
@@ -41,7 +46,7 @@ yarn mm-snap build --analyze
4146
</TabItem>
4247
</Tabs>
4348

44-
Enables analyzing the Snap [bundle](../../learn/about-snaps/files.md#bundle-file).
49+
Enables analyzing the Snap [bundle](../learn/about-snaps/files.md#bundle-file).
4550
This uses [`webpack-bundle-analyzer`](https://github.com/webpack-contrib/webpack-bundle-analyzer) under the hood,
4651
which creates an interactive visualization of the contents of your bundle.
4752
The visualization is located at the URL displayed in the command line output (for example, `http://localhost:8888`).
@@ -69,8 +74,8 @@ yarn mm-snap build --config ./snap.config.build.ts
6974
</TabItem>
7075
</Tabs>
7176

72-
Path to the [configuration file](../../learn/about-snaps/files.md#configuration-file),
73-
which specifies [options](options.md) with which to the build the Snap.
77+
Path to the [configuration file](../learn/about-snaps/files.md#configuration-file),
78+
which specifies [options](config-options.md) with which to the build the Snap.
7479

7580
`-c` is an alias for `--config`.
7681

@@ -81,7 +86,7 @@ yarn mm-snap eval
8186
```
8287

8388
Attempts to evaluate the Snap bundle in
84-
[Secure ECMAScript (SES)](../../learn/about-snaps/execution-environment.md#secure-ecmascript-ses).
89+
[Secure ECMAScript (SES)](../learn/about-snaps/execution-environment.md#secure-ecmascript-ses).
8590

8691
`e` is an alias for `eval`.
8792

@@ -91,7 +96,7 @@ Attempts to evaluate the Snap bundle in
9196
yarn mm-snap manifest
9297
```
9398

94-
Validates the Snap [manifest file](../../learn/about-snaps/files.md#manifest-file).
99+
Validates the Snap [manifest file](../learn/about-snaps/files.md#manifest-file).
95100

96101
`m` is an alias for `manifest`.
97102

@@ -109,6 +114,18 @@ yarn mm-snap manifest --fix
109114

110115
Enables making any changes to fix the manifest file.
111116

117+
### `sandbox`
118+
119+
```bash
120+
yarn mm-snap sandbox
121+
```
122+
123+
Starts a [Snaps sandbox](../how-to/test-a-snap.md#test-in-the-sandbox) server, where you can interact with and test a Snap.
124+
125+
:::info
126+
This option requires [`@metamask/snaps-cli`](https://github.com/MetaMask/snaps/tree/main/packages/snaps-cli) version 7.1.0 or later.
127+
:::
128+
112129
### `s`, `serve`
113130

114131
```bash

snaps/reference/cli/_category_.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

snaps/reference/cli/options.md renamed to snaps/reference/config-options.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
sidebar_label: Options
3-
sidebar_position: 1
2+
sidebar_label: Configuration options
3+
sidebar_position: 4
44
toc_max_heading_level: 4
5-
description: See the Snaps CLI options reference.
5+
description: See the Snaps configuration options reference.
66
---
77

88
import Tabs from "@theme/Tabs";
@@ -12,7 +12,7 @@ import TabItem from "@theme/TabItem";
1212

1313
This reference describes the syntax of the Snaps command line interface (CLI) configuration options.
1414
You can specify these options in the
15-
[configuration file](../../learn/about-snaps/files.md#configuration-file).
15+
[configuration file](../learn/about-snaps/files.md#configuration-file).
1616

1717
### `customizeWebpackConfig`
1818

@@ -74,7 +74,7 @@ environment: {
7474
</Tabs>
7575

7676
The environment configuration.
77-
You can use this to [set environment variables for the Snap](../../how-to/use-environment-variables.md),
77+
You can use this to [set environment variables for the Snap](../how-to/use-environment-variables.md),
7878
which can be accessed using `process.env`.
7979

8080
### `evaluate`
@@ -167,7 +167,7 @@ features: {
167167
</TabItem>
168168
</Tabs>
169169

170-
Enables or disables [image support](../../features/custom-ui/index.md#image).
170+
Enables or disables [image support](../features/custom-ui/index.md#image).
171171
The default is `true`.
172172

173173
### `input`
@@ -195,7 +195,7 @@ The default is `"src/index.js"`.
195195

196196
### `manifest`
197197

198-
The Snap [manifest file](../../learn/about-snaps/files.md#manifest-file) configuration.
198+
The Snap [manifest file](../learn/about-snaps/files.md#manifest-file) configuration.
199199

200200
#### `manifest.path`
201201

@@ -393,7 +393,7 @@ See [the list of available polyfills](https://github.com/MetaMask/snaps/blob/51a
393393

394394
The development server configuration.
395395
The development server is used to test the Snap during development, using the
396-
[`watch`](subcommands.md#w-watch) and [`serve`](subcommands.md#s-serve) subcommands.
396+
[`watch`](cli.md#w-watch) and [`serve`](cli.md#s-serve) subcommands.
397397

398398
#### `server.enabled`
399399

src/components/Faucet/Hero.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface IHero {
1818
inputValue?: string
1919
isLoading?: boolean
2020
isLimitedUserPlan?: boolean
21+
isMaintenance?: boolean
2122
}
2223

2324
export default function Hero({
@@ -28,6 +29,7 @@ export default function Hero({
2829
handleOnInputChange,
2930
isLoading,
3031
isLimitedUserPlan,
32+
isMaintenance,
3133
}: IHero) {
3234
const {
3335
metaMaskAccount,
@@ -118,10 +120,12 @@ export default function Hero({
118120
: walletLinked === WALLET_LINK_TYPE.NO
119121
? 'Link your Developer Dashboard account to get started and request ETH.'
120122
: 'Select your Developer Dashboard account to get started and request ETH.'
121-
: 'Enter your MetaMask wallet address and request ETH.'}
123+
: !isMaintenance
124+
? 'Enter your MetaMask wallet address and request ETH.'
125+
: 'The faucet is at full capacity due to high demand. Try checking back later.'}
122126
</Text>
123127
<div className={styles.actions}>
124-
{!!Object.keys(projects).length && !showInstallButton && (
128+
{!!Object.keys(projects).length && !showInstallButton && !isMaintenance && (
125129
<div className={styles.inputCont}>
126130
<div className={styles.inputWrapper}>
127131
<Input

src/components/Faucet/Maintenance.tsx

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)