Skip to content

Commit

Permalink
Add ZKsync WebSocket support.
Browse files Browse the repository at this point in the history
Signed-off-by: bgravenorst <[email protected]>
  • Loading branch information
bgravenorst committed Jul 23, 2024
1 parent e6b8042 commit c69295b
Show file tree
Hide file tree
Showing 101 changed files with 1,262 additions and 719 deletions.
1 change: 1 addition & 0 deletions services/concepts/websockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Infura support subscriptions over WebSockets for the following networks:
- [Linea](../reference/linea/index.md)
- [Optimism](../reference/optimism/index.md)
- [Polygon](../reference/polygon-pos/index.md)
- [ZKsync Era](../reference/zksync/index.md)

:::info

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_accounts", "params": [], "id": 1}'
-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://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1}'
-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://zksync-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":1}'
```

</TabItem>
</Tabs>

20 changes: 14 additions & 6 deletions services/reference/zksync/json-rpc-methods/_eth_call-request.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 1}'
-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://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

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

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

```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"id": 1, "jsonrpc": "2.0", "method": "eth_feeHistory", "params": ["0x5", "latest", [20,30]] }'
wscat -c wss://zksync-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"id": 1, "jsonrpc": "2.0", "method": "eth_feeHistory", "params": ["0x5", "latest", [20,30]]}'
```

</TabItem>
</Tabs>

Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_gasPrice", "params": [], "id": 1}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-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
@@ -1,15 +1,23 @@
import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cURL">

```bash
curl https://zksync-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
curl https://zksync-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}'
wscat -c wss://zksync-mainnet.infura.io/ws/v3/YOUR-API-KEY -x '{"jsonrpc":"2.0","method":"eth_getCode","params": ["0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x65a8db"],"id":1}'
```

</TabItem>
</Tabs>

Loading

0 comments on commit c69295b

Please sign in to comment.