Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Incorrect Default Provider for zkSync Era SDK #41

Open
samui68400 opened this issue Jan 20, 2024 · 0 comments
Open

Incorrect Default Provider for zkSync Era SDK #41

samui68400 opened this issue Jan 20, 2024 · 0 comments

Comments

@samui68400
Copy link

samui68400 commented Jan 20, 2024

Description:

The current default provider in the example code connects to the Goerli testnet, which gonna be deprecated. The zkSync Era is using the Sepolia network, and the example should reflect this change.

Steps to Reproduce:

Use the provided example code.
Observe that it connects to the Goerli testnet instead of Sepolia.

Expected Behavior:
The example code should connect to the Sepolia network, which is the zkSync Era testnet.

Actual Behavior:
The code connects to the Goerli testnet.

Code Snippet:

import { Provider, types } from "zksync-ethers";
import { ethers } from "ethers";

async function getLatestBlockNumber() {
   try {
       const provider = Provider.getDefaultProvider(types.Network.Goerli); // Incorrect: connects to Goerli
       const ethProvider = ethers.getDefaultProvider("goerli"); // Incorrect: connects to Goerli

       // Get the latest block number
       const blockNumber = await provider.getBlockNumber();

       console.log("Latest block number:", blockNumber);
   } catch (error) {
       console.error("Error:", error.message);
   }
}

// Call the function
getLatestBlockNumber();

Proposed Solution:
Update the default providers in the example code to connect to the Sepolia network.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant