Skip to content

Commit 066ac8f

Browse files
authored
Merge branch 'main' into nightlyCheck
2 parents 8cb4e3f + a1f32ea commit 066ac8f

File tree

834 files changed

+14323
-6233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

834 files changed

+14323
-6233
lines changed

.github/CODEOWNERS

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1-
* @MetaMask/tech-writers
1+
# This is a codeowners file. The last matching pattern takes precedence,
2+
# so the listed codeowners apply only if there is no later match.
3+
4+
# Default owner for all other files
5+
* @MetaMask/activation
6+
7+
# Docusaurus configuration
8+
docusaurus.config.js @MetaMask/activation @MetaMask/tech-writers
9+
10+
# Vercel configuration
11+
vercel.json @MetaMask/activation @MetaMask/tech-writers
12+
13+
# Sidebar files
14+
*-sidebar.js @MetaMask/activation @MetaMask/tech-writers
15+
16+
# All other Markdown files
17+
*.md @MetaMask/tech-writers
18+
*.mdx @MetaMask/tech-writers
19+
20+
# Services documentation
21+
/services/ @MetaMask/tech-writers
22+
23+
# Snaps documentation
224
/snaps/ @MetaMask/tech-writers @MetaMask/snaps
3-
/wallet/ @MetaMask/tech-writers @MetaMask/dev-ex
25+
26+
# Wallet and SDK documentation
27+
/wallet/ @MetaMask/tech-writers @MetaMask/wallet-api-platform-engineers @MetaMask/sdk-devs

CONTRIBUTING.md

Lines changed: 127 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ guide in some places.
1111
- [Preview locally](#preview-locally)
1212
- [Style guide](#style-guide)
1313
- [Add images](#add-images)
14-
- [Format Markdown and MDX](#format-markdown-and-mdx)
15-
- [Live code blocks](#live-code-blocks)
14+
- [Update the interactive API reference](#update-the-interactive-api-reference)
15+
- [Update `MetaMask/api-specs`](#update-metamaskapi-specs)
16+
- [Update `ethereum/execution-apis`](#update-ethereumexecution-apis)
17+
- [Test analytics](#test-analytics)
1618

1719
## Contribution workflow
1820

@@ -35,7 +37,7 @@ To contribute changes:
3537
this repository to your computer and navigate into it.
3638

3739
```bash
38-
git clone https://github.com/MetaMask/metamask-docs.git
40+
git clone git@github.com:MetaMask/metamask-docs.git
3941
cd metamask-docs
4042
```
4143

@@ -46,9 +48,9 @@ To contribute changes:
4648
> to be able to pull from and push to the original repository.
4749
>
4850
> ```bash
49-
> git clone https://github.com/<YOUR-USERNAME>/metamask-docs.git
51+
> git clone git@github.com:<YOUR-USERNAME>/metamask-docs.git
5052
> cd metamask-docs
51-
> git remote add upstream https://github.com/MetaMask/metamask-docs.git
53+
> git remote add upstream git@github.com:MetaMask/metamask-docs.git
5254
> ```
5355
5456
3. [Create and checkout a topic branch](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging),
@@ -69,12 +71,16 @@ To contribute changes:
6971

7072
> **Notes:**
7173
>
72-
> - All documentation content is located in the `wallet` and `snaps` directories.
73-
> - If you add a new documentation page, make sure to edit `wallet-sidebar.js` or
74-
> `snaps-sidebar.js` to add the page to the
74+
> - All documentation content is located in the `wallet`, `snaps`, `services`, and
75+
> `developer-tools` directories.
76+
> - If you add a new documentation page, edit `wallet-sidebar.js`, `snaps-sidebar.js`,
77+
> `services-sidebar.js`, or `dashboard-sidebar.js` to add the page to the
7578
> [sidebar](https://docs-template.consensys.net/contribute/configure-docusaurus#sidebar).
76-
> - If you delete, rename, or move a documentation file, make sure to add a
77-
> [redirect](https://docs-template.consensys.net/contribute/configure-docusaurus#redirects).
79+
> - If you delete, rename, or move a documentation file, add a
80+
> [redirect](https://vercel.com/docs/edge-network/redirects#configuration-redirects).
81+
> - See additional instructions for [updating the interactive API reference](#update-the-interactive-api-reference).
82+
> - If the PR contains a major change to the documentation content, add an entry to the top of
83+
> the ["What's new?"](docs/whats-new.md) page.
7884
7985
5. [Preview your changes locally](https://docs-template.consensys.net/contribute/preview) to check
8086
that the changes render correctly.
@@ -114,49 +120,129 @@ Refer to the [Consensys documentation style guide](https://docs-template.consens
114120

115121
## Add images
116122

117-
All images are located in the `wallet/assets` and `snaps/assets` directories.
123+
All images are located in the `wallet/assets`, `snaps/assets`, `services/images`, and
124+
`developer-tools/images` directories.
118125
When adding a new image, such as a screenshot or diagram, make sure the image has a white or
119126
`#1b1b1d` color background in order for it to be compatible with the site's light and dark modes.
120127

121128
Additionally, follow the [Consensys guidelines on adding images](https://docs-template.consensys.net/contribute/add-images).
122129

123-
## Format Markdown and MDX
130+
## Update the interactive API reference
124131

125-
The documentation is built using [Docusaurus](https://docusaurus.io/), which is powered by
126-
[MDX](https://mdxjs.com/), an extension to [Markdown](https://www.markdownguide.org/) that allows
127-
you to use [React JSX](https://www.w3schools.com/react/react_jsx.asp) in your Markdown content.
132+
The [Wallet JSON-RPC API reference](https://docs.metamask.io/wallet/reference/json-rpc-api/) uses the
133+
[`docusaurus-openrpc`](https://github.com/MetaMask/docusaurus-openrpc) plugin to import OpenRPC
134+
specifications from [`MetaMask/api-specs`](https://github.com/MetaMask/api-specs) (MetaMask-specific
135+
methods) and [`ethereum/execution-apis`](https://github.com/ethereum/execution-apis) (standard
136+
Ethereum methods).
137+
The site renders documentation for each method based on the specification, and displays an
138+
interactive module to test the methods in your browser.
128139

129-
Follow the [Consensys guidelines on formatting Markdown](https://docs-template.consensys.net/contribute/format-markdown).
130-
The MetaMask docs also use a plugin to implement [live code blocks](#live-code-blocks).
140+
### Update `MetaMask/api-specs`
131141

132-
### Live code blocks
142+
To update documentation for MetaMask-specific JSON-RPC API methods:
133143

134-
The [`remark-codesandbox`](https://github.com/kevin940726/remark-codesandbox/) plugin allows you to
135-
define a code block to be loaded live in a CodeSandbox iframe.
136-
This enhances the documentation by keeping the code blocks versioned and in the codebase, while
137-
using CodeSandbox to showcase any example with any dependency.
144+
1. Fork [`MetaMask/api-specs`](https://github.com/MetaMask/api-specs), clone the forked repository
145+
to your computer, and navigate into it:
138146

139-
Define a live code block by adding a `codesandbox` key to the code block.
140-
For example:
141-
142-
````jsx
143-
```javascript codesandbox=vanilla
144-
// JavaScript live code block
145-
```
146-
````
147-
148-
`remark-codesandbox` allows for simple code blocks where the content of the block replaces the
149-
CodeSandbox entry point, and more complex code blocks that can be loaded directly from the
150-
filesystem.
151-
See the
152-
[`remark-codesandbox` documentation](https://github.com/kevin940726/remark-codesandbox/#documentation)
153-
for more information.
154-
155-
## Analytics
147+
```bash
148+
git clone git@github.com:<YOUR-USERNAME>/api-specs.git
149+
cd api-specs
150+
```
151+
152+
2. Follow the repository's [`README.md`](https://github.com/MetaMask/api-specs/blob/main/README.md)
153+
instructions to edit the OpenRPC specification and generate the output file, `openrpc.json`.
154+
155+
3. To test the API updates in the MetaMask doc site's interactive reference, make the following
156+
temporary changes on a local branch of the doc site, `metamask-docs`:
157+
158+
1. Copy and paste the output file `openrpc.json` into the root directory of `metamask-docs`.
159+
2. In `docusaurus.config.js`, update the following line to point to your local output file:
160+
```diff
161+
openrpcDocument:
162+
- "https://metamask.github.io/api-specs/0.10.5/openrpc.json",
163+
+ "./openrpc.json",
164+
```
165+
3. Preview the doc site locally, navigate to the API reference, and view your updates.
166+
167+
4. Add and commit your changes to `api-specs`, and create a PR.
168+
169+
5. Once your PR is approved and merged, the following must happen to publish the changes to the
170+
MetaMask doc site:
171+
172+
1. A new version of `api-specs` must be released by a user with write access to the repository.
173+
To release, go to the [Create Release Pull Request](https://github.com/MetaMask/api-specs/actions/workflows/create-release-pr.yml)
174+
action, select **Run workflow**, and enter a specific version to bump to in the last text box
175+
(for example, `0.10.6`). This creates a PR releasing a version of `api-specs`.
176+
2. Once the release PR is merged, the [Publish Release](https://github.com/MetaMask/api-specs/actions/workflows/publish-release.yml)
177+
action must be approved by an npm publisher.
178+
You can request an approval in the **#metamask-dev** Slack channel tagging
179+
**@metamask-npm-publishers**.
180+
For example:
181+
> @metamask-npm-publishers `@metamask/api-specs@0.10.6` is awaiting deployment :rocketship:
182+
https://github.com/MetaMask/api-specs/actions/runs/10615788573
183+
3. Once the release is published on npm, `docusaurus.config.js` in `metamask-docs` must be
184+
updated with the new `api-specs` version to publish.
185+
For example:
186+
```diff
187+
openrpcDocument:
188+
- "https://metamask.github.io/api-specs/0.10.5/openrpc.json",
189+
+ "https://metamask.github.io/api-specs/0.10.6/openrpc.json",
190+
```
191+
192+
### Update `ethereum/execution-apis`
193+
194+
To update documentation for standard Ethereum JSON-RPC API methods:
195+
196+
1. Fork [`ethereum/execution-apis`](https://github.com/ethereum/execution-apis), clone the forked
197+
repository to your computer, and navigate into it:
156198

157-
The [`docusaurus-plugin-segment`](https://github.com/xer0x/docusaurus-plugin-segment) plugin enables simple usage analytics to inform documentation improvements that may be needed.
199+
```bash
200+
git clone git@github.com:<YOUR-USERNAME>/execution-apis.git
201+
cd execution-apis
202+
```
158203

159-
If you need to test analytics events in your local development environment be sure to export the appropriate key for the environment you are testing against before building and running the project:
204+
2. Follow the repository's [`README.md`](https://github.com/ethereum/execution-apis/blob/main/README.md)
205+
instructions to edit the OpenRPC specification and generate the output file, `openrpc.json`.
206+
207+
3. To test the API updates in the MetaMask doc site's interactive reference, make the following
208+
temporary changes on a local branch of the doc site, `metamask-docs`:
209+
210+
1. Copy and paste the output file `openrpc.json` into the root directory of `metamask-docs`.
211+
2. In `docusaurus.config.js`, update the following line to point to your local output file:
212+
```diff
213+
openrpcDocument:
214+
- "https://metamask.github.io/api-specs/0.10.5/openrpc.json",
215+
+ "./openrpc.json",
216+
```
217+
3. Preview the doc site locally, navigate to the API reference, and view your updates.
218+
219+
4. Add and commit your changes to `execution-apis`, and create a PR.
220+
221+
5. Once your PR is approved and merged, the following must happen to publish the changes to the
222+
MetaMask doc site:
223+
224+
1. `api-specs` must import the updated Ethereum API specification.
225+
Go to the [commit history](https://github.com/ethereum/execution-apis/commits/assembled-spec/)
226+
of the `assembled-spec` branch of `execution-apis`.
227+
Copy the full commit hash of the latest commit titled "assemble openrpc.json."
228+
Update the following line in `merge-openrpc.js` of `api-specs` with the updated commit hash,
229+
and create a PR:
230+
```diff
231+
const getFilteredExecutionAPIs = () => {
232+
- return fetch("https://raw.githubusercontent.com/ethereum/execution-apis/ac19b518a2596221cd7cd6421ee3dc654d7ff3b7/refs-openrpc.json")
233+
+ return fetch("https://raw.githubusercontent.com/ethereum/execution-apis/f75d4cc8eeb5d1952bd69f901954686b74c34c9b/refs-openrpc.json")
234+
```
235+
2. Once the change to `merge-openrpc.js` is merged, Step 5 in
236+
[Update `MetaMask/api-specs`](#update-metamaskapi-specs) must be completed to publish the
237+
changes to the MetaMask doc site.
238+
239+
## Test analytics
240+
241+
The [`docusaurus-plugin-segment`](https://github.com/xer0x/docusaurus-plugin-segment) plugin enables
242+
simple usage analytics to inform documentation improvements.
243+
244+
If you need to test analytics events in your local development environment, export the appropriate
245+
key for the environment you are testing against before building and running the project:
160246

161247
```bash
162248
export SEGMENT_ANALYTICS_KEY="<your key>"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
description: View your Infura credit usage stats.
3+
---
4+
5+
# View credit usage
6+
7+
:::info
8+
9+
The [credit pricing model](../api/learn/pricing/) replaces request-based billing for free-tier (Core)
10+
customers. Customers on Developer and Team plans will be transitioned to the credit model on
11+
September 30, 2024.
12+
13+
**Existing customers on Growth and Custom plans will remain on request-based billing**.
14+
:::
15+
16+
You can view your daily credit usage in relation to your daily credit quota limit. Daily credit usage
17+
counts are reset everyday at 00:00 UTC for all customers.
18+
19+
Select **View Usage** from the **Daily Credit Usage** section on the Infura dashboard, or select
20+
the **Usage** tab from the **Settings** > **Billing** dropdown.
21+
22+
View your usage for the previous 24 hours, 7 days, or 30 days by methods used, networks, or API key.
23+
24+
<div class="left-align-container">
25+
<div class="img-large">
26+
<img
27+
src={require('../../images/credit-usage.png').default}
28+
/>
29+
</div>
30+
</div>
31+

developer-tools/dashboard/how-to/secure-an-api/set-rate-limits.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,32 @@ description: Set rate limits to control access to the API key.
44

55
# Rate limits
66

7-
Set rate limits to control access to the API key and to limit costs in case of a leaked API key. Set rate limiting in the API key's
8-
**Settings** tab **REQUESTS** section.
7+
:::info
8+
9+
The credit pricing model replaces the request-based billing for free-tier (Core) customers.
10+
**Existing paid customers will not be immediately affected and will continue to limit the number of requests per second**.
11+
12+
:::
13+
14+
Set credit rate limits to control access to the API key and to limit costs in case of a leaked API key.
15+
Set rate limiting in the API key's **Settings** tab **Key Credit Limits** section.
916

1017
<div class="left-align-container">
11-
<div class="img-medium">
18+
<div class="img-large">
1219
<img
13-
src={require("../../../images/rate-limiting-settings.png").default}
20+
src={require('../../../images/rate-limiting-settings.png').default}
1421
/>
1522
</div>
1623
</div>
1724

18-
- **PER SECOND REQUESTS RATE-LIMITING** restricts requests per second for the API key. Set the maximum number of requests per second in decimals, e.g. 1.2. Whenever the rate of requests exceeds this value, requests are rejected. When the rate of requests drops below the limit again, requests are accepted again.
25+
- **PER SECOND CREDIT RATE-LIMITING** restricts credits per second (throughput) for the API key. Set
26+
the maximum number of credits per second in whole numbers. When credits per second rate exceeds
27+
this value, requests are rejected. When the credit rate drops below the limit, requests
28+
are accepted again.
1929

20-
Decimal value 0.0 means default limits are applied.
30+
The value `0` means default limits are applied.
2131

22-
- **PER DAY TOTAL REQUESTS** restricts total daily requests for the API key. Set a limit on number of requests per day in integers, e.g. 20000. Integer value 0 means default limits are applied.
32+
- **PER DAY TOTAL CREDITS** restricts total daily credit usage for the API key. Set a limit on number of
33+
credits per day in integers, e.g. 20000. The value `0` means default limits are applied.
2334

24-
When the number of requests reach this limit, all requests will be rejected until the next day (00:00 UTC).
35+
When the number of used credits reach this limit, all requests will be rejected until the next day (00:00 UTC).

developer-tools/dashboard/how-to/secure-an-api/use-an-allowlist.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ To allow a specific Ethereum address, click **ADD** and input it into the **CONT
6565
Test with a method from the list.
6666

6767
```bash
68-
curl https://mainnet.infura.io/v3/<PROJECT_ID> \
68+
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
6969
-H 'Content-Type: application/json' \
7070
-X POST \
7171
-d '{"jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0xfe05a3e72235c9f92fd9f2282f41a8154d6d342b", "latest"], "id": 1}'
@@ -116,7 +116,7 @@ the **USER AGENTS** allowlist.
116116
Test with a simple call from a desktop terminal.
117117

118118
```bash
119-
curl https://mainnet.infura.io/v3/<PROJECT_ID> \
119+
curl https://mainnet.infura.io/v3/<YOUR-API-KEY> \
120120
-X POST \
121121
-H "Content-Type: application/json" \
122122
-d '{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id": 1}'
@@ -214,7 +214,7 @@ This feature provides the following benefits:
214214

215215
## Best practices
216216

217-
- Ensure the `API-KEY-SECRET` is not exposed publicly, and include it in your requests.
217+
- Ensure the API key secret is not exposed publicly, and include it in your requests.
218218
- Use all allowlist options wherever possible.
219219
- Create a new API key for each application. This allows you to allowlist the contract addresses relevant to that application.
220220
- Avoid committing your project keys to a repo by using a package like [dotenv](https://www.npmjs.com/package/dotenv).
49.5 KB
Loading
2.24 KB
Loading

docs/whats-new.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,30 @@ The latest major MetaMask documentation updates are listed by the month they wer
99
For a comprehensive list of recent product changes, visit the "Release Notes" section at the bottom
1010
of the [MetaMask developer page](https://metamask.io/developer/).
1111

12+
## September 2024
13+
14+
- Documented new [Snaps custom UI JSX components](/snaps/features/custom-ui) for Flask
15+
version 12.4, and removed documentation for deprecated function-based library.
16+
([#1540](https://github.com/MetaMask/metamask-docs/pull/1540))
17+
- Documented [Snaps user-defined components](/snaps/features/custom-ui/user-defined-components).
18+
([#1557](https://github.com/MetaMask/metamask-docs/pull/1557))
19+
- Updated [Android SDK documentation](/wallet/how-to/use-sdk/mobile/android) with convenience
20+
methods and examples using coroutines.
21+
([#1546](https://github.com/MetaMask/metamask-docs/pull/1546))
22+
- Documented [Infura's credit pricing model](/services/get-started/pricing).
23+
([#1530](https://github.com/MetaMask/metamask-docs/pull/1530))
24+
- Added tutorial for [authenticating with JWT](/services/tutorials/ethereum/authenticate-with-jwt).
25+
([#1528](https://github.com/MetaMask/metamask-docs/pull/1528))
26+
- Documented [opBNB](/services/reference/opbnb) support.
27+
([#1528](https://github.com/MetaMask/metamask-docs/pull/1528))
28+
1229
## August 2024
1330

31+
- *The documentation site underwent a temporary freeze in August.*
1432
- Updated [Starknet documentation](/services/reference/starknet) with API methods supported by new partners, Bware and Chainstack. ([#1483](https://github.com/MetaMask/metamask-docs/pull/1483))
1533

1634
## July 2024
35+
1736
- Documented [Binance Smart Chain](/services/reference/bnb-smart-chain/) support. ([#1458](https://github.com/MetaMask/metamask-docs/pull/1458))
1837
- Documented [Celo WebSocket](/services/reference/celo/) support. ([#1446](https://github.com/MetaMask/metamask-docs/pull/1446))
1938
- Documented [ZKsync Era WebSocket](/services/reference/zksync) support. ([#1438](https://github.com/MetaMask/metamask-docs/pull/1438))

0 commit comments

Comments
 (0)