From 49be5377dc12d3ff92c4eede7a7b19ab8cff7464 Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Fri, 31 May 2024 18:37:57 +0300 Subject: [PATCH 1/2] docs: updates for how-to tutorials --- content/tutorials/how-to-deploy-contract/10.index.md | 1 + content/tutorials/how-to-deposit-erc20/10.index.md | 2 +- content/tutorials/how-to-deposit-eth/10.index.md | 2 +- content/tutorials/how-to-test-contracts/10.index.md | 3 +-- content/tutorials/how-to-withdraw-erc20/10.index.md | 6 +++--- content/tutorials/how-to-withdraw-eth/10.index.md | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/content/tutorials/how-to-deploy-contract/10.index.md b/content/tutorials/how-to-deploy-contract/10.index.md index 7f3ebc3c..65787056 100644 --- a/content/tutorials/how-to-deploy-contract/10.index.md +++ b/content/tutorials/how-to-deploy-contract/10.index.md @@ -124,6 +124,7 @@ const config: HardhatUserConfig = { }, }, }; +export default config; ``` In the configuration above we have some important fields such as: diff --git a/content/tutorials/how-to-deposit-erc20/10.index.md b/content/tutorials/how-to-deposit-erc20/10.index.md index a3f5a7e6..d430da9b 100644 --- a/content/tutorials/how-to-deposit-erc20/10.index.md +++ b/content/tutorials/how-to-deposit-erc20/10.index.md @@ -75,7 +75,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://testnet.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet // ERC-20 Token (DAI) address in L1 const TOKEN_ADDRESS = "0x5C221E77624690fff6dd741493D735a17716c26B"; diff --git a/content/tutorials/how-to-deposit-eth/10.index.md b/content/tutorials/how-to-deposit-eth/10.index.md index e3ea84c0..fb6fd59e 100644 --- a/content/tutorials/how-to-deposit-eth/10.index.md +++ b/content/tutorials/how-to-deposit-eth/10.index.md @@ -76,7 +76,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://testnet.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet // Amount in ETH const AMOUNT = "0.00001"; diff --git a/content/tutorials/how-to-test-contracts/10.index.md b/content/tutorials/how-to-test-contracts/10.index.md index 954b8278..d4733190 100644 --- a/content/tutorials/how-to-test-contracts/10.index.md +++ b/content/tutorials/how-to-test-contracts/10.index.md @@ -161,7 +161,7 @@ With the previous steps completed, your `hardhat.config.ts` file should now be p ```ts [hardhat.config.ts] import { HardhatUserConfig } from "hardhat/config"; -import "@matterlabs/hardhat-zksync +import "@matterlabs/hardhat-zksync" import "@nomicfoundation/hardhat-chai-matchers"; const config: HardhatUserConfig = { @@ -194,7 +194,6 @@ import { expect } from "chai"; import { Wallet, Provider, Contract } from "zksync-ethers"; import { Deployer } from "@matterlabs/hardhat-zksync"; import { ZkSyncArtifact } from "@matterlabs/hardhat-zksync/src/types"; -import "@matterlabs/hardhat-zksync/dist/type-extensions"; const RICH_PRIVATE_KEY = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; diff --git a/content/tutorials/how-to-withdraw-erc20/10.index.md b/content/tutorials/how-to-withdraw-erc20/10.index.md index 410543dc..ec222797 100644 --- a/content/tutorials/how-to-withdraw-erc20/10.index.md +++ b/content/tutorials/how-to-withdraw-erc20/10.index.md @@ -72,7 +72,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://testnet.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet // ERC-20 Token address in L2 const TOKEN_ADDRESS = ""; @@ -98,7 +98,7 @@ async function main() { console.log(`Running script to bridge ERC-20 to L1`); // Initialize the wallet. - const l1provider = new ethers.Provider(L1_RPC_ENDPOINT); + const l1provider = new Provider(L1_RPC_ENDPOINT); const l2provider = new Provider(L2_RPC_ENDPOINT); const wallet = new Wallet(WALLET_PRIV_KEY, l2provider, l1provider); @@ -127,7 +127,7 @@ main() Execute the script using the following command: ```sh -npx ts-node withdraw.ts +npx ts-node withdraw-erc20.ts ``` ## Verify the Output diff --git a/content/tutorials/how-to-withdraw-eth/10.index.md b/content/tutorials/how-to-withdraw-eth/10.index.md index a55c490b..5fc1e07a 100644 --- a/content/tutorials/how-to-withdraw-eth/10.index.md +++ b/content/tutorials/how-to-withdraw-eth/10.index.md @@ -72,7 +72,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://testnet.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet // Wallet const WALLET_PRIV_KEY = process.env.WALLET_PRIV_KEY || ""; @@ -104,7 +104,7 @@ async function main() { const withdrawHandle = await wallet.withdraw({ to: wallet.address, // can bridge to a different address in L1 token: utils.ETH_ADDRESS, - amount: ethers.utils.parseEther(AMOUNT), + amount: ethers.parseEther(AMOUNT), }); console.log(`Withdraw transaction sent ${withdrawHandle.hash}`); } catch (error: any) { From 2c512f58c5bd2d81029bd556d05f26675763b792 Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Mon, 3 Jun 2024 11:38:49 +0300 Subject: [PATCH 2/2] docs: updates for how-to tutorials Fixing comments --- content/tutorials/how-to-deposit-erc20/10.index.md | 2 +- content/tutorials/how-to-deposit-eth/10.index.md | 2 +- content/tutorials/how-to-withdraw-erc20/10.index.md | 4 ++-- content/tutorials/how-to-withdraw-eth/10.index.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/content/tutorials/how-to-deposit-erc20/10.index.md b/content/tutorials/how-to-deposit-erc20/10.index.md index d430da9b..ea16172e 100644 --- a/content/tutorials/how-to-deposit-erc20/10.index.md +++ b/content/tutorials/how-to-deposit-erc20/10.index.md @@ -75,7 +75,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "%%zk_testnet_rpc_url%%"; // or the zkSync Era mainnet // ERC-20 Token (DAI) address in L1 const TOKEN_ADDRESS = "0x5C221E77624690fff6dd741493D735a17716c26B"; diff --git a/content/tutorials/how-to-deposit-eth/10.index.md b/content/tutorials/how-to-deposit-eth/10.index.md index fb6fd59e..34ace2a7 100644 --- a/content/tutorials/how-to-deposit-eth/10.index.md +++ b/content/tutorials/how-to-deposit-eth/10.index.md @@ -76,7 +76,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "%%zk_testnet_rpc_url%%"; // or the zkSync Era mainnet // Amount in ETH const AMOUNT = "0.00001"; diff --git a/content/tutorials/how-to-withdraw-erc20/10.index.md b/content/tutorials/how-to-withdraw-erc20/10.index.md index ec222797..642a3a6a 100644 --- a/content/tutorials/how-to-withdraw-erc20/10.index.md +++ b/content/tutorials/how-to-withdraw-erc20/10.index.md @@ -72,7 +72,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "%%zk_testnet_rpc_url%%"; // or the zkSync Era mainnet // ERC-20 Token address in L2 const TOKEN_ADDRESS = ""; @@ -98,7 +98,7 @@ async function main() { console.log(`Running script to bridge ERC-20 to L1`); // Initialize the wallet. - const l1provider = new Provider(L1_RPC_ENDPOINT); + const l1provider = new ethers.providers.JsonRpcProvider(L1_RPC_ENDPOINT); const l2provider = new Provider(L2_RPC_ENDPOINT); const wallet = new Wallet(WALLET_PRIV_KEY, l2provider, l1provider); diff --git a/content/tutorials/how-to-withdraw-eth/10.index.md b/content/tutorials/how-to-withdraw-eth/10.index.md index 5fc1e07a..0bd82a7d 100644 --- a/content/tutorials/how-to-withdraw-eth/10.index.md +++ b/content/tutorials/how-to-withdraw-eth/10.index.md @@ -72,7 +72,7 @@ dotenv.config(); // HTTP RPC endpoints const L1_RPC_ENDPOINT = process.env.L1_RPC_ENDPOINT || ""; // or an RPC endpoint from Infura/Chainstack/QuickNode/etc. -const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "https://sepolia.era.zksync.dev"; // or the zkSync Era mainnet +const L2_RPC_ENDPOINT = process.env.L2_RPC_ENDPOINT || "%%zk_testnet_rpc_url%%"; // or the zkSync Era mainnet // Wallet const WALLET_PRIV_KEY = process.env.WALLET_PRIV_KEY || "";