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

Test adding Infura to the MetaMask docs #1325

Merged
merged 47 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f8f3122
Add API section.
bgravenorst May 30, 2024
5808a1d
Add missing dependencies.
bgravenorst May 31, 2024
28a3405
Reorg structure.
bgravenorst May 31, 2024
b38266a
Merge branch 'main' into test-integrate-infura
alexandratran May 31, 2024
c7a846a
add developer tools dropdown and dashboard docs
alexandratran May 31, 2024
04af774
update yarn.lock
alexandratran May 31, 2024
f6ed27b
restructure services
alexandratran May 31, 2024
acee089
fix partial links
alexandratran Jun 1, 2024
69bc7a6
fix image errors
alexandratran Jun 1, 2024
525fe45
update branch remove conflicts
joaniefromtheblock Jun 10, 2024
cbfff3b
Add missing dependencies.
bgravenorst May 31, 2024
621f1f7
Reorg structure.
bgravenorst May 31, 2024
bc94f9c
add developer tools dropdown and dashboard docs
alexandratran May 31, 2024
b3b2e97
update yarn.lock
alexandratran May 31, 2024
15050c7
restructure services
alexandratran May 31, 2024
532638c
fix partial links
alexandratran Jun 1, 2024
75a0e34
fix image errors
alexandratran Jun 1, 2024
95b9953
fix conflict
joaniefromtheblock Jun 10, 2024
576665f
Add how-to section
joaniefromtheblock Jun 10, 2024
b112551
update location
joaniefromtheblock Jun 12, 2024
892827d
update location
joaniefromtheblock Jun 12, 2024
b6f572d
update build
joaniefromtheblock Jun 12, 2024
d4d96f1
update structure
joaniefromtheblock Jun 13, 2024
78b3628
update build
joaniefromtheblock Jun 13, 2024
2900812
Merge branch 'main' into test-integrate-infura
joaniefromtheblock Jun 13, 2024
7b41ad0
update pl
joaniefromtheblock Jun 13, 2024
fceb471
update file
joaniefromtheblock Jun 13, 2024
fc083f3
remove inconsistencies
joaniefromtheblock Jun 14, 2024
f9c93db
remove repeated pages
joaniefromtheblock Jun 18, 2024
8995591
update links
joaniefromtheblock Jun 18, 2024
dbc6331
update links
joaniefromtheblock Jun 18, 2024
eeebeee
Missing Gas link
joaniefromtheblock Jun 18, 2024
f324eb2
remove ref howtos
joaniefromtheblock Jun 20, 2024
285379c
apply feedback
joaniefromtheblock Jun 20, 2024
3a9dd85
apply suggestions
joaniefromtheblock Jun 20, 2024
3af1ece
update links to intro
joaniefromtheblock Jun 24, 2024
43c100e
Add logos and css
joaniefromtheblock Jun 24, 2024
cfbd78f
update images and links
joaniefromtheblock Jun 25, 2024
8e0f284
Merge branch 'main' into test-integrate-infura
joaniefromtheblock Jun 25, 2024
2162dca
fix build
joaniefromtheblock Jun 25, 2024
b76a655
update for failover protection
joaniefromtheblock Jun 27, 2024
4abeac9
fix typo
joaniefromtheblock Jun 27, 2024
2460cbb
Update failover note
joaniefromtheblock Jun 27, 2024
df5ce69
update description for consistency
joaniefromtheblock Jun 27, 2024
f212b63
fix websocket fail
joaniefromtheblock Jun 27, 2024
b961282
update to fix build
joaniefromtheblock Jun 27, 2024
7c8ba1d
update link for consistency
joaniefromtheblock Jun 27, 2024
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
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions dashboard-sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const sidebar = {
dashboardSidebar: [
"index",
{
type: "category",
label: "Get started",
link: { type: "generated-index", slug: "/get-started" },
collapsed: false,
items: [{ type: "autogenerated", dirName: "get-started" }],
},
{
type: "category",
label: "How to",
link: { type: "generated-index", slug: "/how-to" },
collapsed: false,
items: [{ type: "autogenerated", dirName: "how-to" }],
},
],
};

module.exports = sidebar;

53 changes: 53 additions & 0 deletions developer-tools/dashboard/get-started/create-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
description: Create a Web3 or IPFS API
sidebar_position: 2
---

# Create an API key

:::important API key restrictions

Based on your plan, Infura allows for the following amount of API keys:

- Free plan - Allows one API key.
- Developer plan - Allows up to five API keys.
- Team plans and higher - No limit on the number of API keys.

For more information, see to the [Infura pricing page](https://www.infura.io/pricing).

:::

Infura allows you to enable multiple network endpoints and expansion APIs for your API key. If calls are
made to a disabled network or service, then all requests to that network or service will fail.

To keep your account secure and cost effective, add only the necessary endpoints, as some have usage limits or charges based
on request volume.

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>
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**.

You can [configure additional security](./secure-an-api/) for your API key by requiring an API key secret or JWTs with
each API request.

## Best practices for configuring API key endpoints

We recommend the following best practices when creating your API keys:

- Group API key endpoints by environment. For example, create seperate API keys for production or development environments.
- 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).
98 changes: 98 additions & 0 deletions developer-tools/dashboard/how-to/dashboard-stats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
description: View your Infura usage stats.
---

# View API request stats

The dashboard provides detailed analytics and real-time statistics about your API usage.
You can monitor the number of requests, track the most used methods, and identify any potential
issues or bottlenecks.
This data is crucial for optimizing your applications and ensuring they run smoothly.

## 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.

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.

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**.

## Web3 stats charts

You can view your Web3 API usage stats in the following charts and tables.

### Requests Volume chart

This chart displays the total volume of requests sent to Infura using the selected API key(s) over
the selected time period.

### Product Request Volumes

This chart displays the aggregate request volumes for the top five API methods called using the
selected API key(s) over the selected time period.
To view stats for a particular product (network) instead of the default of all products, make a
selection from the products dropdown.
This change will impact what API methods are displayed in the
[Method Request Volumes](#method-request-volumes) chart.

### Method Request Volumes

This chart displays the aggregate request volumes for requests made on the top five networks using
the selected API key(s) over the selected time period.
To view stats for a particular method instead of the default of all methods, make a selection from
the methods dropdown.

### Requests Activity

This table displays the total request volumes and successful and failed requests, based on each
product (network) and method called using the selected API key(s) over the selected time period.

For more details about the failure status codes, select the two diagonal arrows to the right of the
**FAILED REQUESTS (%)** values.
This opens the Failed Requests Breakdown table, which displays an aggregated count of failed API
requests, grouped by the returned status codes.

### Eth_call activity

This table displays the activities made on the `eth_call` method, including contract addresses that
interacted with the selected API key(s).
This table only shows the `eth_call` activity for the last 30 minutes, and is not impacted by any
time period selection.

To view smart contract details on Etherscan, select any contract address.
A new tab opens with the details.

## IPFS stats charts

You can view your IPFS usage stats in the following charts.

### Data Transfer Up

This chart displays the amount of data sent to the IPFS service using the selected API key(s) over
the selected time period.

### Data Transfer Down

This chart displays the amount of data retrieved from the IPFS service using the selected API key(s)
over the selected time period.

### Total Storage

This chart displays the total amount of data stored by the selected API key(s) over the selected
time period.
19 changes: 19 additions & 0 deletions developer-tools/dashboard/how-to/network-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
description: View the network status
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.

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}
/>
</div>
</div>
101 changes: 101 additions & 0 deletions developer-tools/dashboard/how-to/project-sharing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
description: Share your Infura API key
sidebar_position: 5
---

# Share your API key with Infura users

You can share access to your Infura API keys by inviting existing Infura account members.

## Share API key access

To share an API key:

1. In the Infura dashboard, select the API that you want to share.
1. Select the **API Key Sharing** tab.
1. Select **INVITE MEMBERS** in the top right.

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

1. Input one or more user emails, select the [user role](#user-roles), and select **SUBMIT**.
1. Confirm your email address and select **CONFIRM**.

:::note

- Infura blocks non-Infura account holders from collaborating on Infura API keys.

:::

## User roles

### Owner

- The Infura account owner who created the API key.

:::note

You cannot change ownership of an API key.

:::

### Admin

- Has read/write access to the API key name, security settings, and collaborator list.
- Can edit security settings, change someone’s role, and revoke and resend invites.
- Can view the API key statistics.
- Admins cannot:
- Delete the API key or the owner.
- View billing details.
- View any other API key's stats.

### Contributor

- Has read-only access to the API key details and stats.
- Has limited access to the security settings and can only view the API key secret.
- Contributors cannot:
- View the API key sharing settings.
- View billing details
- View any other API key's stats.

## Accept an invitation

You'll receive an email invitation to access an API key. In the email invitation, select **CONFIRM EMAIL ADDRESS**
and accept the invitation.

You can view all keys that you own, and all keys shared with you, by selecting **Key Sharing** in the **Settings** menu.

## Update user role or remove user

1. In the Infura dashboard, select the API key that the user is assigned to.
1. Select the **API Key Sharing** tab.
1. Select the vertical ellipsis icon next to the relevant user.

- To remove a user, select **Remove Member**. They are removed immediately.
- To update a user's role, select **Update Role**.

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

1. Upgrade or downgrade accordingly and select **UPDATE ROLE**.

## Revoke or resend an invite

While invitations remain in a pending state, they can be revoked or sent again.

1. In the Infura dashboard, select the API key for the user.

1. Select the **API Key Sharing** tab.

1. Select the vertical ellipsis icon next to the relevant user and select
**Revoke Invitation** or **Resend Invite** and follow the steps.
11 changes: 11 additions & 0 deletions developer-tools/dashboard/how-to/secure-an-api/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +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."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
description: Authenticate all requests to Infura with an API key secret.
---

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

# API key secret

For enhanced security, you can require an API key secret for all requests to Infura. The API key
secret serves as a password accompanying the API key (which serves as a username). This two-factor
approach strengthens the authentication process, ensuring that only requests from authorized sources
are accepted.

## When to use an API key secret

Use an API key secret if your dapp includes server-side components. Storing and using the API key
secret only on the server side prevents exposure to client-side risks, such as malicious actors
gaining access through browser inspection tools or network monitoring.

If your dapp operates solely on the client side without a server, use only the API key.
The API key is exposed in client-side code, so you should secure it using [allowlists](use-an-allowlist.md).

:::tip
For customers on the Developer tier or higher, Infura supports [overriding your allowlist](use-an-allowlist.md#overide-your-allowlist-settings)
when you specify an API key secret. This allows you to apply the principle of least privilege on the
client side while allowing unrestricted access on the server side.
:::

## Enable the API key secret for requests

In the API key's **Settings** tab, select **Require API Key secret for all requests**.

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

## Call APIs using an API key secret

<Tabs>
<TabItem value="HTTPS" label="HTTPS" default>

```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}'
```

</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}
```

</TabItem>
</Tabs>
Loading