From d0e19106d82c8e8858fdc903033b66f2b733458b Mon Sep 17 00:00:00 2001 From: Albiona Date: Wed, 28 Aug 2024 14:25:46 +0100 Subject: [PATCH 1/6] docs: update scripts --- content/tutorials/guide-web3js/10.index.md | 27 ++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/content/tutorials/guide-web3js/10.index.md b/content/tutorials/guide-web3js/10.index.md index 08a56910..ccf44e92 100644 --- a/content/tutorials/guide-web3js/10.index.md +++ b/content/tutorials/guide-web3js/10.index.md @@ -32,13 +32,13 @@ and [register the plugin](https://docs.web3js.org/guides/web3_plugin_guide/plugi ```javascript import { Web3 } from "web3"; -import { ZkSyncPlugin } from "web3-plugin-zksync"; +import { ZKsyncPlugin } from "web3-plugin-zksync"; -const zkSyncRpcUrl: string = "https://sepolia.era.zksync.dev"; +const ZKsyncRpcUrl: string = "https://sepolia.era.zksync.dev"; -console.log(`📞 Connecting to ZKsync Era [${zkSyncRpcUrl}]`); -const web3: Web3 = new Web3(zkSyncRpcUrl); -web3.registerPlugin(new ZkSyncPlugin()); +console.log(`📞 Connecting to ZKsync Era [${ZKsyncRpcUrl}]`); +const web3: Web3 = new Web3(ZKsyncRpcUrl); +web3.registerPlugin(new ZKsyncPlugin(ZKsyncRpcUrl)); ``` ::callout{icon="i-heroicons-exclamation-circle"} @@ -52,8 +52,13 @@ Use the Web3.js `eth` package to fetch data from the ZKsync [Ethereum JSON-RPC A #### Fetch the Latest Block Number ```javascript -const blockNumber = await web3.eth.getBlockNumber(); -console.log(`Current block number: ${blockNumber}`); + +async function main() { + const blockNumber = await web3.eth.getBlockNumber(); + console.log(`Current block number: ${blockNumber}`); +} + +main().catch(console.error); ``` ### ZKsync L2-Specific JSON-RPC API @@ -65,8 +70,12 @@ from the `zks_` namespace of the [JSON-RPC API](https://docs.zksync.io/build/api ```javascript -const mainContract = await web3.zkSync.rpc.getMainContract(); -console.log(`Main contract: ${mainContract}`); +async function main() { + const mainContract = await web3.zkSync.rpc.getMainContract(); + console.log(`Main contract: ${mainContract}`); +} + +main().catch(console.error); ``` From beedfe89106ae0e4f38ba1a26ee5e6f61e4c0dcb Mon Sep 17 00:00:00 2001 From: albicodes Date: Wed, 28 Aug 2024 15:06:27 +0100 Subject: [PATCH 2/6] Update content/tutorials/guide-web3js/10.index.md Co-authored-by: Sabrina --- content/tutorials/guide-web3js/10.index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tutorials/guide-web3js/10.index.md b/content/tutorials/guide-web3js/10.index.md index ccf44e92..d6ca178e 100644 --- a/content/tutorials/guide-web3js/10.index.md +++ b/content/tutorials/guide-web3js/10.index.md @@ -34,7 +34,7 @@ and [register the plugin](https://docs.web3js.org/guides/web3_plugin_guide/plugi import { Web3 } from "web3"; import { ZKsyncPlugin } from "web3-plugin-zksync"; -const ZKsyncRpcUrl: string = "https://sepolia.era.zksync.dev"; +const zksyncRpcUrl: string = "https://sepolia.era.zksync.dev"; console.log(`📞 Connecting to ZKsync Era [${ZKsyncRpcUrl}]`); const web3: Web3 = new Web3(ZKsyncRpcUrl); From b64d9de5ab5d378c938d75b0132221bb73366208 Mon Sep 17 00:00:00 2001 From: albicodes Date: Wed, 28 Aug 2024 15:06:32 +0100 Subject: [PATCH 3/6] Update content/tutorials/guide-web3js/10.index.md Co-authored-by: Sabrina --- content/tutorials/guide-web3js/10.index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tutorials/guide-web3js/10.index.md b/content/tutorials/guide-web3js/10.index.md index d6ca178e..4d7414c7 100644 --- a/content/tutorials/guide-web3js/10.index.md +++ b/content/tutorials/guide-web3js/10.index.md @@ -36,7 +36,7 @@ import { ZKsyncPlugin } from "web3-plugin-zksync"; const zksyncRpcUrl: string = "https://sepolia.era.zksync.dev"; -console.log(`📞 Connecting to ZKsync Era [${ZKsyncRpcUrl}]`); +console.log(`📞 Connecting to ZKsync Era [${zksyncRpcUrl}]`); const web3: Web3 = new Web3(ZKsyncRpcUrl); web3.registerPlugin(new ZKsyncPlugin(ZKsyncRpcUrl)); ``` From 92846d9843bf33876c229f982e1b5f1c8798416c Mon Sep 17 00:00:00 2001 From: albicodes Date: Wed, 28 Aug 2024 15:06:38 +0100 Subject: [PATCH 4/6] Update content/tutorials/guide-web3js/10.index.md Co-authored-by: Sabrina --- content/tutorials/guide-web3js/10.index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tutorials/guide-web3js/10.index.md b/content/tutorials/guide-web3js/10.index.md index 4d7414c7..8242c586 100644 --- a/content/tutorials/guide-web3js/10.index.md +++ b/content/tutorials/guide-web3js/10.index.md @@ -38,7 +38,7 @@ const zksyncRpcUrl: string = "https://sepolia.era.zksync.dev"; console.log(`📞 Connecting to ZKsync Era [${zksyncRpcUrl}]`); const web3: Web3 = new Web3(ZKsyncRpcUrl); -web3.registerPlugin(new ZKsyncPlugin(ZKsyncRpcUrl)); +web3.registerPlugin(new ZKsyncPlugin(zksyncRpcUrl)); ``` ::callout{icon="i-heroicons-exclamation-circle"} From 87e1819e0ae9a8e9410e7996314789fe88c0def0 Mon Sep 17 00:00:00 2001 From: albicodes Date: Wed, 28 Aug 2024 15:06:43 +0100 Subject: [PATCH 5/6] Update content/tutorials/guide-web3js/10.index.md Co-authored-by: Sabrina --- content/tutorials/guide-web3js/10.index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tutorials/guide-web3js/10.index.md b/content/tutorials/guide-web3js/10.index.md index 8242c586..aa7a58ce 100644 --- a/content/tutorials/guide-web3js/10.index.md +++ b/content/tutorials/guide-web3js/10.index.md @@ -37,7 +37,7 @@ import { ZKsyncPlugin } from "web3-plugin-zksync"; const zksyncRpcUrl: string = "https://sepolia.era.zksync.dev"; console.log(`📞 Connecting to ZKsync Era [${zksyncRpcUrl}]`); -const web3: Web3 = new Web3(ZKsyncRpcUrl); +const web3: Web3 = new Web3(zksyncRpcUrl); web3.registerPlugin(new ZKsyncPlugin(zksyncRpcUrl)); ``` From 9b5c3955399329ad230e7f69a4246e8271c34f50 Mon Sep 17 00:00:00 2001 From: albicodes Date: Wed, 28 Aug 2024 15:48:46 +0100 Subject: [PATCH 6/6] Update content/tutorials/guide-web3js/10.index.md Co-authored-by: Sabrina --- content/tutorials/guide-web3js/10.index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/tutorials/guide-web3js/10.index.md b/content/tutorials/guide-web3js/10.index.md index aa7a58ce..3a8be6f9 100644 --- a/content/tutorials/guide-web3js/10.index.md +++ b/content/tutorials/guide-web3js/10.index.md @@ -71,7 +71,7 @@ from the `zks_` namespace of the [JSON-RPC API](https://docs.zksync.io/build/api ```javascript async function main() { - const mainContract = await web3.zkSync.rpc.getMainContract(); + const mainContract = await web3.ZKsync.rpc.getMainContract(); console.log(`Main contract: ${mainContract}`); }