Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code samples #1388

Merged
merged 17 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Crowdin Action

on:
push:
path: [ "i18n/**" ]
branches: [ main ]
path: ["i18n/**"]
branches: [main]

permissions: write-all

Expand All @@ -23,10 +23,10 @@ jobs:
localization_branch_name: l10n_crowdin_translations

create_pull_request: true
pull_request_title: 'New Crowdin translations'
pull_request_body: 'New Crowdin pull request with translations'
pull_request_base_branch_name: 'main'
pull_request_title: "New Crowdin translations"
pull_request_body: "New Crowdin pull request with translations"
pull_request_base_branch_name: "main"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
2 changes: 1 addition & 1 deletion .yarn/releases/yarn-3.4.1.cjs

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ guide in some places.
- [Style guide](#style-guide)
- [Add images](#add-images)
- [Format Markdown and MDX](#format-markdown-and-mdx)
- [Live code blocks](#live-code-blocks)
- [Live code blocks](#live-code-blocks)

## Contribution workflow

Expand All @@ -34,10 +34,10 @@ To contribute changes:
2. [Clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
this repository to your computer and navigate into it.

```bash
git clone https://github.com/MetaMask/metamask-docs.git
cd metamask-docs
```
```bash
git clone https://github.com/MetaMask/metamask-docs.git
cd metamask-docs
```

> **Note**: If you don't have write access to this repository, you must [fork the
> repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository)
Expand All @@ -56,9 +56,9 @@ To contribute changes:
We recommend including the issue number and a short description in the branch name (for example,
`183-doc-cli-option`), which is a reminder to fix only one issue in a PR.

```bash
git checkout -b <ISSUE-NUM>-<ISSUE-DESC>
```
```bash
git checkout -b <ISSUE-NUM>-<ISSUE-DESC>
```

> **Tip:** You can use a Git client such as [Fork](https://fork.dev/) instead of the command line.

Expand All @@ -68,6 +68,7 @@ To contribute changes:
and [format your Markdown correctly](https://docs-template.consensys.net/contribute/format-markdown).

> **Notes:**
>
> - All documentation content is located in the `wallet` and `snaps` directories.
> - If you add a new documentation page, make sure to edit `wallet-sidebar.js` or
> `snaps-sidebar.js` to add the page to the
Expand All @@ -81,27 +82,27 @@ To contribute changes:
6. Add and commit your changes, briefly describing your changes in the commit message.
Push your changes to the remote origin.

```bash
git add .
git commit -m "<COMMIT-MESSAGE>"
git push origin
```
```bash
git add .
git commit -m "<COMMIT-MESSAGE>"
git push origin
```

7. On [this repository on GitHub](https://github.com/MetaMask/metamask-docs), you’ll see a banner
prompting you to create a PR with your recent changes.
Create a PR, describing your changes in detail.
[Link the issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
that your PR fixes by adding `fixes #<ISSUE-NUM>` to the PR description.

9. Specific reviewers are automatically requested when you submit a PR.
8. Specific reviewers are automatically requested when you submit a PR.
You can request additional reviewers in the right sidebar of your PR – for example, the original
issue raiser.
Make any required changes to your PR based on reviewer feedback, repeating steps 5–7.

9. After your PR is approved by two reviewers, all checks have passed, and your branch has no
conflicts with the main branch, you can merge your PR.
If you don't have merge access, a maintainer will merge your PR for you.
You can delete the topic branch after your PR is merged.
conflicts with the main branch, you can merge your PR.
If you don't have merge access, a maintainer will merge your PR for you.
You can delete the topic branch after your PR is merged.

## Preview locally

Expand Down Expand Up @@ -160,8 +161,9 @@ If you need to test analytics events in your local development environment be su
```bash
export SEGMENT_ANALYTICS_KEY="<your key>"
```

Then build the project in production mode using the following command:

```bash
yarn build && yarn serve
```
```
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ Build the documentation site locally using the following steps.

1. Clone the repository.

```bash
git clone https://github.com/MetaMask/metamask-docs.git
cd metamask-docs
```

> **Note:** If you don't have write access to this repository, you must [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) to your personal account and clone your forked repository instead. [Add an upstream remote](https://docs.github.com/en/get-started/quickstart/fork-a-repo#configuring-git-to-sync-your-fork-with-the-upstream-repository) to be able to pull from and push to the original repository.
>
> ```bash
> git clone https://github.com/<YOUR-USERNAME>/metamask-docs.git
> cd metamask-docs
> git remote add upstream https://github.com/MetaMask/metamask-docs.git
> ```
```bash
git clone https://github.com/MetaMask/metamask-docs.git
cd metamask-docs
```

> **Note:** If you don't have write access to this repository, you must [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) to your personal account and clone your forked repository instead. [Add an upstream remote](https://docs.github.com/en/get-started/quickstart/fork-a-repo#configuring-git-to-sync-your-fork-with-the-upstream-repository) to be able to pull from and push to the original repository.
>
> ```bash
> git clone https://github.com/<YOUR-USERNAME>/metamask-docs.git
> cd metamask-docs
> git remote add upstream https://github.com/MetaMask/metamask-docs.git
> ```

2. Install dependencies.

```bash
yarn install
```
```bash
yarn install
```

3. Start the development server.

```bash
yarn start
```
Once the server starts, you can view the documentation at `http://localhost:3000`.
```bash
yarn start
```

Once the server starts, you can view the documentation at `http://localhost:3000`.

For more information on contributing to the documentation, see the [full contribution guidelines](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ files:
- source: /services/**/*
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/**/%original_file_name%
- source: /docs/**/*
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/**/%original_file_name%
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/**/%original_file_name%
1 change: 0 additions & 1 deletion dashboard-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ const sidebar = {
};

module.exports = sidebar;

19 changes: 10 additions & 9 deletions developer-tools/dashboard/get-started/create-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ To create an API key:
1. Open the [Infura dashboard](https://infura.io/dashboard). Enter your login details, if required.
1. Select **CREATE NEW API KEY**.

<div class="left-align-container">
<div class="img-large">
<img
src={require('../../images/create_key.png').default}
/>
</div>
</div>
<div class="left-align-container">
<div class="img-large">
<img
src={require("../../images/create_key.png").default}
/>
</div>
</div>

1. From the pop-up window, provide a name, then click **CREATE**.
1. Select the networks that you want your API key to access, and select **Save Changes**.

Expand All @@ -49,5 +50,5 @@ We recommend the following best practices when creating your API keys:
- Group API key endpoints by groups or individuals [sharing the API key](../how-to/project-sharing.md).
- Limit the number of networks or services per API key only to the necessary endpoints.
- Group the API key endpoints based on shared security considerations such as
[allowlists](../how-to/secure-an-api/use-an-allowlist.md) or
[key request volume limits](../how-to/secure-an-api/set-rate-limits.md).
[allowlists](../how-to/secure-an-api/use-an-allowlist.md) or
[key request volume limits](../how-to/secure-an-api/set-rate-limits.md).
29 changes: 15 additions & 14 deletions developer-tools/dashboard/how-to/dashboard-stats.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@ This data is crucial for optimizing your applications and ensuring they run smoo
## Specify stats to view

1. In the top menu of the [Infura dashboard](https://app.infura.io/), select **Stats**.
The stats page displays the total volume of requests sent to Infura over the specified time period.
By default, data is shown from the last 24 hours from all Web3 API keys.
The stats page displays the total volume of requests sent to Infura over the specified time period.
By default, data is shown from the last 24 hours from all Web3 API keys.

2. To change the API key, make a selection from the API keys dropdown.

3. To change the stats time range, make a selection from the time dropdown.
Time values are given in Coordinated Universal Time (UTC).
For Web3 API usage, you can choose from the following options:
- **Last 15 Minutes** - The last completed 15 minutes.
This updates once a minute.
- **Last 1 Hour** - The last fully completed hour, from 0 to 59 minutes and 59 seconds.
- **Last 24 Hours** - The last fully completed 24 consecutive hours.
This is the default.
- **Last 7 Days** - The last fully completed seven consecutive days.
A day appears once it has completed.
- **Last 30 Days** - The last fully completed 30 days.
A day appears once it has completed.
Time values are given in Coordinated Universal Time (UTC).
For Web3 API usage, you can choose from the following options:

- **Last 15 Minutes** - The last completed 15 minutes.
This updates once a minute.
- **Last 1 Hour** - The last fully completed hour, from 0 to 59 minutes and 59 seconds.
- **Last 24 Hours** - The last fully completed 24 consecutive hours.
This is the default.
- **Last 7 Days** - The last fully completed seven consecutive days.
A day appears once it has completed.
- **Last 30 Days** - The last fully completed 30 days.
A day appears once it has completed.

4. To view your IPFS usage, select **IPFS Usage** in the toggle in the top-right corner.
You can choose to show data from the **Last 24 Hours** (default) or the **Last 7 Days**.
You can choose to show data from the **Last 24 Hours** (default) or the **Last 7 Days**.

## Web3 stats charts

Expand Down
6 changes: 3 additions & 3 deletions developer-tools/dashboard/how-to/network-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ sidebar_position: 8
# View the network status

View the [Infura status page](https://status.infura.io/) to check for service outages and other incidents, as well as
scheduled maintenance notices. You can also subscribe to status updates via email, SMS, webhook, Slack and Atom/RSS.
scheduled maintenance notices. You can also subscribe to status updates via email, SMS, webhook, Slack, and Atom/RSS.

You can also select the **Status** link at the top of the Infura dashboard to view the status page.

<div class="left-align-container">
<div class="img-medium">
<img
src={require('../../images/status-page.png').default}
src={require("../../images/status-page.png").default}
/>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions developer-tools/dashboard/how-to/project-sharing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To share an API key:
<div class="left-align-container">
<div class="img-large">
<img
src={require('../../images/invite-member-button.png').default}
src={require("../../images/invite-member-button.png").default}
/>
</div>
</div>
Expand Down Expand Up @@ -82,7 +82,7 @@ You can view all keys that you own, and all keys shared with you, by selecting *
<div class="left-align-container">
<div class="img-large">
<img
src={require('../../images/update-role.png').default}
src={require("../../images/update-role.png").default}
/>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions developer-tools/dashboard/how-to/secure-an-api/_category_.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"position": 3,
"label": "Secure an API",
"collapsible": true,
"collapsed": true,
"link": {
"type": "generated-index",
"slug": "dashboard/secure-an-api",
"description": "This section provides information about how to secure your API key using Infura's security settings."
}
}
"position": 3,
"label": "Secure an API",
"collapsible": true,
"collapsed": true,
"link": {
"type": "generated-index",
"slug": "dashboard/secure-an-api",
"description": "This section provides information about how to secure your API key using Infura's security settings."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
description: Authenticate all requests to Infura with an API key secret.
---

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

# API key secret

Expand Down Expand Up @@ -34,7 +34,7 @@ In the API key's **Settings** tab, select **Require API Key secret for all reque
<div class="left-align-container">
<div class="img-large">
<img
src={require('../../../images/security-page.png').default}
src={require("../../../images/security-page.png").default}
/>
</div>
</div>
Expand All @@ -47,15 +47,15 @@ In the API key's **Settings** tab, select **Require API Key secret for all reque
```bash
curl --user :<YOUR-API-KEY-SECRET> \
https://mainnet.infura.io/v3/<YOUR-API-KEY> \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
-d '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}'
```

</TabItem>
<TabItem value="WebSocket" label="WebSocket" >

```bash
wscat -c wss://mainnet.infura.io/ws/v3/<YOUR-API-KEY> --auth ":<YOUR-API-KEY-SECRET>"
> {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}
> {"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}
```

</TabItem>
Expand Down
Loading
Loading