import { ethers } from "ethers"; import { Wallet, Provider, utils } from "zksync-web3"; async function orbiter() { const provider = new ethers.providers.InfuraProvider( "goerli", "6e36ce031e304b79af723a0a28789083" ); const signer = new ethers.Wallet( "0xd768b0b3f8dedcb465ad680268453391f7da6ec4e1942a13fdfcdea8773aab3e", provider ); const tx = await signer.sendTransaction({ from: "0x69b01ecc793b8fb33d5a1199bedfdc47dc55d968", to: "0x0043d60e87c5dd08C86C3123340705a1556C4719", value: "6000000000009514", gasLimit: 21000, }); console.log("Mining transaction..."); console.log(`https://goerli.etherscan.io/tx/${tx.hash}`); // Waiting for the transaction to be mined const receipt = await tx.wait(); // The transaction is now on chain! console.log(`Mined in block ${receipt.blockNumber}`); } async function official() { const provider = new Provider("https://testnet.era.zksync.dev"); const ethProvider = new ethers.providers.InfuraProvider( "goerli", "6e36ce031e304b79af723a0a28789083" ); const wallet = new Wallet( "0xd768b0b3f8dedcb465ad680268453391f7da6ec4e1942a13fdfcdea8773aab3e", provider, ethProvider ); // const deposit = await wallet.deposit({ // token: utils.ETH_ADDRESS, // amount: ethers.utils.parseEther("0.005"), // }); // console.log("Deposit sent. Awaiting confirmation..."); // // Await processing of the deposit on L1 // const ethereumTxReceipt = await deposit.waitL1Commit(); // console.log("L1 deposit confirmed! Waiting for zkSync..."); // // Await processing the deposit on zkSync // const depositReceipt = await deposit.wait(); // console.log("zkSync deposit committed."); console.log("Checking zkSync account balance"); // Retrieving the current (committed) zkSync ETH balance of an account const committedEthBalance = await wallet.getBalance(utils.ETH_ADDRESS); console.log("committedEthBalance", ethers.utils.formatEther(committedEthBalance)); // Retrieving the ETH balance of an account in the last finalized zkSync block. const finalizedEthBalance = await wallet.getBalance( utils.ETH_ADDRESS, "finalized" ); console.log("finalizedEthBalance", ethers.utils.formatEther(finalizedEthBalance)); } await official();