Skip to content

Commit

Permalink
Add Celo WebSocket support. (MetaMask#1446)
Browse files Browse the repository at this point in the history
* Add Celo WebSocket support.

Signed-off-by: bgravenorst <[email protected]>

* Add what's new.

Signed-off-by: bgravenorst <[email protected]>

* Update  testiest

* Update link

---------

Signed-off-by: bgravenorst <[email protected]>
Co-authored-by: Joan E <[email protected]>
  • Loading branch information
bgravenorst and joaniefromtheblock authored Jul 24, 2024
1 parent 7497537 commit 188dbf4
Show file tree
Hide file tree
Showing 36 changed files with 385 additions and 45 deletions.
1 change: 1 addition & 0 deletions docs/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ of the [MetaMask developer page](https://metamask.io/developer/).

## July 2024

- Documented [Celo WebSocket support](/services/reference/celo/). ([#1446](https://github.com/MetaMask/metamask-docs/pull/1446))
- Documented [ZKsync Era WebSocket support](/services/reference/zksync). ([#1438](https://github.com/MetaMask/metamask-docs/pull/1438))
- Documented support for the [ZKsync Era network API service](/services/reference/zksync). ([#1372](https://github.com/MetaMask/metamask-docs/pull/1372))
- Added [Services](/services) and [Developer tools](/developer-tools) to MetaMask documentation. ([#1325](https://github.com/MetaMask/metamask-docs/pull/1325))
Expand Down
1 change: 1 addition & 0 deletions services/concepts/websockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Infura support subscriptions over WebSockets for the following networks:
- [Ethereum](../reference/ethereum/index.md)
- [Arbitrum](../reference/arbitrum/index.md)
- [Avalanche (C-Chain)](../reference/avalanche-c-chain/index.md)
- [Celo](../reference/celo/index.md)
- [Linea](../reference/linea/index.md)
- [Optimism](../reference/optimism/index.md)
- [Polygon](../reference/polygon-pos/index.md)
Expand Down
36 changes: 19 additions & 17 deletions services/get-started/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ request to `[email protected]` and we will assess if your request can be accommo

## Celo

| Network | Description | URL |
| ------------------- | ------------------- | ----------------------------------------------- |
| Mainnet | JSON-RPC over HTTPS | `https://celo-mainnet.infura.io/v3/<API-KEY>` |
| Testnet (Alfajores) | JSON-RPC over HTTPS | `https://celo-alfajores.infura.io/v3/<API-KEY>` |
| Network | Description | URL |
|---------------------|-------------------------|--------------------------------------------------|
| Mainnet | JSON-RPC over HTTPS | `https://celo-mainnet.infura.io/v3/<API-KEY>` |
| Mainnet | JSON-RPC over WebSocket | `wss://celo-mainnet.infura.io/ws/v3/<API-KEY>` |
| Testnet (Alfajores) | JSON-RPC over HTTPS | `https://celo-alfajores.infura.io/v3/<API-KEY>` |
| Testnet (Alfajores) | JSON-RPC over WebSocket | `wss://celo-alfajores.infura.io/ws/v3/<API-KEY>` |

## Ethereum

Expand All @@ -62,13 +64,13 @@ The Holesky testnet is supported through the
service and does not currently support WebSockets.
:::

| Network | Description | URL |
| ------- | ----------------------- | ----------------------------------------- |
| Mainnet | JSON-RPC over HTTPS | `https://mainnet.infura.io/v3/<API-KEY>` |
| Mainnet | JSON-RPC over WebSocket | `wss://mainnet.infura.io/ws/v3/<API-KEY>` |
| Holesky | JSON-RPC over HTTPS | `https://holesky.infura.io/v3/<API-KEY>` |
| Sepolia | JSON-RPC over HTTPS | `https://sepolia.infura.io/v3/<API-KEY>` |
| Sepolia | JSON-RPC over WebSocket | `wss://sepolia.infura.io/ws/v3/<API-KEY>` |
| Network | Description | URL |
| ----------------- | ----------------------- | ----------------------------------------- |
| Mainnet | JSON-RPC over HTTPS | `https://mainnet.infura.io/v3/<API-KEY>` |
| Mainnet | JSON-RPC over WebSocket | `wss://mainnet.infura.io/ws/v3/<API-KEY>` |
| Testnet (Holesky) | JSON-RPC over HTTPS | `https://holesky.infura.io/v3/<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over HTTPS | `https://sepolia.infura.io/v3/<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over WebSocket | `wss://sepolia.infura.io/ws/v3/<API-KEY>` |

## IPFS

Expand Down Expand Up @@ -96,13 +98,13 @@ Linea Goerli is being deprecated. We discourage new development with this testne
Sepolia instead.

:::
| Network | Description | URL |
| Network | Description | URL |
|-------------------|-------------------------|-------------------------------------------------|
| Mainnet | JSON-RPC over HTTPS | `https://linea-mainnet.infura.io/v3/<API-KEY>` |
| Mainnet | JSON-RPC over WebSocket | `wss://linea-mainnet.infura.io/ws/v3/<API-KEY>` |
| Testnet (Goerli) | JSON-RPC over HTTPS | `https://linea-goerli.infura.io/v3/<API-KEY>` |
| Testnet (Goerli) | JSON-RPC over WebSocket | `wss://linea-goerli.infura.io/ws/v3//<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over HTTPS | `https://linea-sepolia.infura.io/v3/<API-KEY>` |
| Mainnet | JSON-RPC over HTTPS | `https://linea-mainnet.infura.io/v3/<API-KEY>` |
| Mainnet | JSON-RPC over WebSocket | `wss://linea-mainnet.infura.io/ws/v3/<API-KEY>` |
| Testnet (Goerli) | JSON-RPC over HTTPS | `https://linea-goerli.infura.io/v3/<API-KEY>` |
| Testnet (Goerli) | JSON-RPC over WebSocket | `wss://linea-goerli.infura.io/ws/v3//<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over HTTPS | `https://linea-sepolia.infura.io/v3/<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over WebSocket | `wss://linea-sepolia.infura.io/ws/v3/<API-KEY>` |

## Mantle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

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

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_call", "params": [{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", "gasPrice": "0x9184e72a000", "value": "0x9184e72a", "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}, "latest"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_call", "params": [{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", "gasPrice": "0x9184e72a000", "value": "0x9184e72a", "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}, "latest"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_estimateGas", "params": [{"from": "0x9cE564c7d09f88E7d8233Cdd3A4d7AC42aBFf3aC", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "value": "0x9184e72a"}], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_estimateGas", "params": [{"from": "0x9cE564c7d09f88E7d8233Cdd3A4d7AC42aBFf3aC", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "value": "0x9184e72a"}], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_gasPrice", "params": [], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_gasPrice", "params": [], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBalance", "params": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35", false], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35", false], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x5BAD55", false], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x5BAD55", false], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem";
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockReceipts", "params": ["latest"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockReceipts", "params": ["latest"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByHash", "params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByNumber", "params": ["latest"], "id":1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByNumber", "params": ["latest"], "id":1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getCode", "params": ["0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x65a8db"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getCode", "params": ["0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x65a8db"], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getLogs", "params": [{"blockHash": "0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70", "topics": ["0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"]}], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getLogs", "params": [{"blockHash": "0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70", "topics": ["0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"]}], "id": 1}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getProof", "id": 1, "params": ["0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842", ["0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"], "latest"]}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getProof", "id": 1, "params": ["0x7F0d15C7FAae65896648C8273B6d7E43f58Fa842", ["0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"], "latest"]}'
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import TabItem from "@theme/TabItem"
<TabItem value="cURL">

```bash
curl https://celo-alfajores.infura.io/v3/YOUR-API-KEY \
curl https://celo-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "0x65a8db"], "id": 1}'
```

</TabItem>
<TabItem value="WSS">

```bash
wscat -c wss://celo-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc": "2.0", "method": "eth_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "0x65a8db"], "id": 1}'
```

</TabItem>
</Tabs>
Loading

0 comments on commit 188dbf4

Please sign in to comment.