Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alexandra Carrillo <[email protected]>
  • Loading branch information
joaniefromtheblock and alexandratran authored Jul 1, 2024
1 parent fe874ed commit bf8c048
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 106 deletions.
2 changes: 1 addition & 1 deletion services/get-started/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Sepolia instead.
| Mainnet | JSON-RPC over HTTPS | `https://starknet-mainnet.infura.io/v3/<API-KEY>` |
| Testnet (Sepolia) | JSON-RPC over HTTPS | `https://starknet-sepolia.infura.io/v3/<API-KEY>` |

## ZkSync Era
## ZKsync Era

| Network | Description | URL |
|-------------------|---------------------|-------------------------------------------------|
Expand Down
2 changes: 1 addition & 1 deletion services/reference/blast/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In these examples, you'll use [NPM](https://docs.npmjs.com/downloading-and-insta

#### Node Fetch

1. In your project folder, install the `node-fetch package using `npm`:
1. In your project folder, install the `node-fetch` package using `npm`:

```bash
npm i node-fetch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import TabItem from '@theme/TabItem';

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

</Tabs>

10 changes: 5 additions & 5 deletions services/reference/zksync/json-rpc-methods/_eth_call-request.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ 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}'
```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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import TabItem from '@theme/TabItem';

```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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ 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}'
```
```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>
</Tabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ 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}'
```
```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>
</Tabs>
Expand Down
38 changes: 20 additions & 18 deletions services/reference/zksync/json-rpc-methods/zks_estimatefee.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,32 @@ Replace `YOUR-API-KEY` with an API key from your [Infura dashboard](https://infu
<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", "id":2, "method": "zks_estimateFee", "params": [ { "from": "0x1111111111111111111111111111111111111111", "to":"0x2222222222222222222222222222222222222222", "data": "0xffffffff" } ] }'
```
```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0", "id":2, "method": "zks_estimateFee", "params": [ { "from": "0x1111111111111111111111111111111111111111", "to":"0x2222222222222222222222222222222222222222", "data": "0xffffffff" } ] }'
```
</TabItem>
</Tabs>

### Response

<Tabs>
<TabItem value="JSON">
```json
{
"jsonrpc": "2.0",
"result": {
"gas_limit": "0x156c00",
"gas_per_pubdata_limit": "0x143b",
"max_fee_per_gas": "0xee6b280",
"max_priority_fee_per_gas": "0x0"
},
"id": 2
}
```

```json
{
"jsonrpc": "2.0",
"result": {
"gas_limit": "0x156c00",
"gas_per_pubdata_limit": "0x143b",
"max_fee_per_gas": "0xee6b280",
"max_priority_fee_per_gas": "0x0"
},
"id": 2
}
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,30 @@ Replace `YOUR-API-KEY` with an API key from your [Infura dashboard](https://infu
<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", "id": 1, "method": "zks_getAllAccountBalances", "params": [ "0x98E9D288743839e96A8005a6B51C770Bbf7788C0" ]}'
```
```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "zks_getAllAccountBalances", "params": [ "0x98E9D288743839e96A8005a6B51C770Bbf7788C0" ]}'
```

</TabItem>
</Tabs>

## Response

<Tabs>
<TabItem value="JSON">
```json
{
"jsonrpc": "2.0",
"result": {
"0x0000000000000000000000000000000000000000": "0x2fbd72a1121b3100"
},
"id": 2
}
```

```json
{
"jsonrpc": "2.0",
"result": {
"0x0000000000000000000000000000000000000000": "0x2fbd72a1121b3100"
},
"id": 2
}
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ Replace `YOUR-API-KEY` with an API key from your [Infura dashboard](https://infu
<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", "id": 1, "method": "zks_getBridgeContracts", "params": []}' \
```
```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "zks_getBridgeContracts", "params": []}' \
```

</TabItem>
</Tabs>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,26 @@ Replace `YOUR-API-KEY` with an API key from your [Infura dashboard](https://infu

<Tabs>
<TabItem value="JSON">
```json
{
"jsonrpc": "2.0",
"result": [
0,
4,
0,
0,
0,
0,
0,
2,
0,
11,
...,
...
],
"id": 1
}
```

```json
{
"jsonrpc": "2.0",
"result": [
0,
4,
0,
0,
0,
0,
0,
2,
0,
11,
...
],
"id": 1
}
```

</TabItem>
</Tabs>
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ Replace `YOUR-API-KEY` with an API key from your [Infura dashboard](https://infu
<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", "id": 1, "method": "zks_getRawBlockTransactions", "params": [5817]}'
```
```bash
curl https://zksync-mainnet.infura.io/v3/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "zks_getRawBlockTransactions", "params": [5817]}'
```

</TabItem>
</Tabs>

Expand Down
30 changes: 15 additions & 15 deletions services/reference/zksync/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Run the following command in your terminal, replacing `YOUR-API-KEY` with your a

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

### Node (JavaScript)
Expand Down Expand Up @@ -91,11 +91,11 @@ In these examples, you'll use [npm](https://docs.npmjs.com/downloading-and-insta
Replace `YOUR-API-KEY` with your actual Infura API key.
```javascript title="index.js"
const axios = require('axios');
const axios = require("axios");

axios.post('https://zksync-mainnet.infura.io/v3/YOUR-API-KEY', {
jsonrpc: '2.0',
method: 'eth_blockNumber',
axios.post("https://zksync-mainnet.infura.io/v3/YOUR-API-KEY", {
jsonrpc: "2.0",
method: "eth_blockNumber",
params: [],
id: 1
})
Expand Down Expand Up @@ -126,9 +126,9 @@ In these examples, you'll use [npm](https://docs.npmjs.com/downloading-and-insta
Replace `YOUR-API-KEY` with your actual Infura API key.
```javascript title="index.js"
const ethers = require('ethers');
const ethers = require("ethers");

const provider = new ethers.providers.JsonRpcProvider('https://zksync-mainnet.infura.io/v3/YOUR-API-KEY');
const provider = new ethers.providers.JsonRpcProvider("https://zksync-mainnet.infura.io/v3/YOUR-API-KEY");

provider.getBlockNumber()
.then(blockNumber => {
Expand Down Expand Up @@ -161,16 +161,16 @@ In these examples, you'll use [npm](https://docs.npmjs.com/downloading-and-insta
import requests
import json

url = 'https://zksync-mainnet.infura.io/v3/YOUR-API-KEY'
url = "https://zksync-mainnet.infura.io/v3/YOUR-API-KEY"

payload = {
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}

headers = {'content-type': 'application/json'}
headers = {"content-type": "application/json"}

response = requests.post(url, data=json.dumps(payload), headers=headers).json()

Expand Down

0 comments on commit bf8c048

Please sign in to comment.