Skip to content

Commit

Permalink
Remove References to Specific Providers
Browse files Browse the repository at this point in the history
  • Loading branch information
danforbes committed Aug 14, 2024
1 parent 6d47f5e commit 181a86d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/docs/guides/web3_providers_guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { Web3, HttpProvider } from 'web3';

// supply an HTTP provider as a URL string
// highlight-next-line
const web3 = new Web3('https://mainnet.infura.io/v3/YOUR_INFURA_ID');
const web3 = new Web3('https://<PROVIDER_URL>');

await web3.eth.getBlockNumber()
// ↳ 18849658n
Expand All @@ -51,7 +51,7 @@ await web3.eth.getBlockNumber()

// supply an HTTP provider by constructing a new HttpProvider
// highlight-next-line
const web3_2 = new Web3(new HttpProvider('https://mainnet.infura.io/v3/YOUR_INFURA_ID'));
const web3_2 = new Web3(new HttpProvider('https://<PROVIDER_URL>'));

await web3.eth.getBlockNumber()
// ↳ 18849658n
Expand Down Expand Up @@ -84,7 +84,7 @@ const httpOptions = {
} as RequestInit,
};

const web3 = new Web3(new HttpProvider('https://eth.llamarpc.com', httpOptions));
const web3 = new Web3(new HttpProvider('https://<PROVIDER_URL>', httpOptions));
```

### WebSocket Provider
Expand All @@ -96,7 +96,7 @@ import { Web3, WebSocketProvider } from 'web3';

// supply a WebSocket provider as a URL string
// highlight-next-line
const web3 = new Web3('wss://mainnet.infura.io/ws/v3/YOUR_INFURA_ID');
const web3 = new Web3('wss://<PROVIDER_URL>');

await web3.eth.getBlockNumber();
// ↳ 18849658n
Expand All @@ -105,7 +105,7 @@ await web3.eth.getBlockNumber();

// supply a WebSocket provider by constructing a new WebSocketProvider
// highlight-next-line
const web3_2 = new Web3(new WebSocketProvider('wss://mainnet.infura.io/ws/v3/YOUR_INFURA_ID'));
const web3_2 = new Web3(new WebSocketProvider('wss://<PROVIDER_URL>'));

await web3.eth.getBlockNumber();
// ↳ 18849658n
Expand All @@ -118,7 +118,7 @@ The [`WebSocketProvider` constructor](/api/web3-providers-ws/class/WebSocketProv
```ts title='Configuring a WebSocket Provider'
// include both optional parameters
const provider = new WebSocketProvider(
`ws://localhost:8545`,
`wss://<PROVIDER_URL>`,
{
headers: {
// for node services that require an API key in a header
Expand All @@ -134,7 +134,7 @@ const provider = new WebSocketProvider(

// OR include only ReconnectOptions
const provider = new WebSocketProvider(
`ws://localhost:8545`,
`wss://<PROVIDER_URL>`,
{},
{
delay: 500,
Expand Down Expand Up @@ -230,11 +230,11 @@ web3.setProvider(new Web3.providers.WebsocketProvider('ws://localhost:8546'));

### Remote Provider

Services like [Alchemy](https://www.alchemy.com/), [Infura](https://www.infura.io/), and [QuickNode](https://www.quicknode.com/) offer Ethereum node services that can be accessed via HTTP or Websocket.
Services like [QuickNode](https://www.quicknode.com/), [Alchemy](https://www.alchemy.com/), and [Infura](https://www.infura.io/), offer Ethereum node services that can be accessed via HTTP or Websocket.

```ts title='Alchemy, Infura, etc'
```ts title='QuickNode, Alchemy, Infura, etc'
import { Web3 } from 'web3';
const web3 = new Web3('https://eth-mainnet.alchemyapi.io/v2/your-api-key');
const web3 = new Web3('https://<REMOTE_PROVIDER_URL>');
```

Web3.js provides helpful utilities for working with certain well-known remote providers. Read more about these utilities in the [Web3.js External Providers](#web3js-external-providers) section.
Expand Down

0 comments on commit 181a86d

Please sign in to comment.