Skip to content

Commit

Permalink
Update tabs syntax to Docusaurus default in snaps (#1152)
Browse files Browse the repository at this point in the history
* fix: update tabs syntax to docusaurus default

Additionally, included Tabs and TabItem imports in gas-api/eip1559,
which were previously missing, causing tabs not to render.

* fix(snaps): update tabs syntax to docusaurus default

* Apply suggestions from code review

---------

Co-authored-by: Alexandra Tran Carrillo <[email protected]>
  • Loading branch information
chairulakmal and alexandratran authored Feb 19, 2024
1 parent 6b3b924 commit 2fc7871
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 87 deletions.
3 changes: 3 additions & 0 deletions services/gas-api/api-reference/gasprices-type2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
description: Get the estimated gas prices for a chain.
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Get EIP-1559 gas prices

Returns the estimated [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) gas fees for the specified
Expand Down
14 changes: 9 additions & 5 deletions snaps/how-to/debug-a-snap/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description: Solve common issues.
sidebar_position: 1
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Troubleshoot common issues

This page describes common issues you may encounter when developing a Snap, and how to resolve them.
Expand Down Expand Up @@ -169,9 +172,8 @@ The following is an example of how you can rewrite your dependency to use `fetch
In a production environment this may be a large task depending on the usage of `axios`.
:::

<!--tabs-->

# axios
<Tabs>
<TabItem value="axios">

```javascript
const instance = axios.create({
Expand All @@ -194,7 +196,8 @@ instance
});
```

# fetch
</TabItem>
<TabItem value="fetch">

```javascript
fetch('https://api.github.com/users/MetaMask')
Expand All @@ -208,7 +211,8 @@ fetch('https://api.github.com/users/MetaMask')
.catch((err) => console.error(err));
```

<!--/tabs-->
</TabItem>
</Tabs>

For more information, see how to
[replace axios with a simple custom fetch wrapper](https://kentcdodds.com/blog/replace-axios-with-a-simple-custom-fetch-wrapper).
66 changes: 36 additions & 30 deletions snaps/reference/cli/subcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,68 @@ yarn mm-snap [SUBCOMMAND] [OPTIONS]

## b, build

<!--tabs-->

# Syntax
<Tabs>
<TabItem value="Syntax">

```bash
yarn mm-snap build [options]
```

# Example
</TabItem>
<TabItem value="Example">

```bash
yarn mm-snap b -s lib/index.js -d out -n snap.js
```

<!--/tabs-->
</TabItem>
</Tabs>

Builds a Snap from source.

`b` is an alias for `build`.

## e, eval

<!--tabs-->

# Syntax
<Tabs>
<TabItem value="Syntax">

```bash
yarn mm-snap eval [options]
```

# Example
</TabItem>
<TabItem value="Example">

```bash
yarn mm-snap e -b out/snap.js
```

<!--/tabs-->
</TabItem>
</Tabs>

Attempts to evaluate the Snap bundle in SES.

`e` is an alias for `eval`.

## i, init

<!--tabs-->

# Syntax
<Tabs>
<TabItem value="Syntax">

```bash
yarn mm-snap init [directory]
```

# Example
</TabItem>
<TabItem value="Example">

```bash
yarn mm-snap i my-snap
```

<!--/tabs-->
</TabItem>
</Tabs>

Initializes a Snap project in the specified directory.
If no directory is specified, the Snap project is initialized in the current directory.
Expand All @@ -86,65 +89,68 @@ If no directory is specified, the Snap project is initialized in the current dir

## m, manifest

<!--tabs-->

# Syntax
<Tabs>
<TabItem value="Syntax">

```bash
yarn mm-snap manifest [options]
```

# Example
</TabItem>
<TabItem value="Example">

```bash
yarn mm-snap m --fix false
```

<!--/tabs-->
</TabItem>
</Tabs>

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

`m` is an alias for `manifest`.

## s, serve

<!--tabs-->

# Syntax
<Tabs>
<TabItem value="Syntax">

```bash
yarn mm-snap serve [options]
```

# Example
</TabItem>
<TabItem value="Example">

```bash
yarn mm-snap s -r out -p 9000
```

<!--/tabs-->
</TabItem>
</Tabs>

Locally serves Snap files for testing.

`s` is an alias for `serve`.

## w, watch

<!--tabs-->

# Syntax
<Tabs>
<TabItem value="Syntax">

```bash
yarn mm-snap watch [options]
```

# Example
</TabItem>
<TabItem value="Example">

```bash
yarn mm-snap w -s lib/index.js -d out
```

<!--/tabs-->
</TabItem>
</Tabs>

Rebuilds a Snap from source upon changes to the files in the parent and child directories of the
source directory.
Expand Down
Loading

0 comments on commit 2fc7871

Please sign in to comment.