Skip to content

zoro-protocol/hardhat-zksync-web3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hardhat-zksync-web3

Hardhat plugin that extends the Hardhat Runtime Environment with the zksync-web3 wallet.

Developers can create the zksync-web3.Wallet with either a private key or keystore file. If a keystore file is used, the user is prompted for the keystore password. Keystores are best for secure scripts that do not pollute project directories with plaintext private keys stored in .env files.

Installation

npm install hardhat-zksync-web3 hardhat @nomiclabs/hardhat-ethers ethers @matterlabs/hardhat-zksync-deploy zksync-web3

Import the plugin in your hardhat.config.js:

require("hardhat-zksync-web3");

Or if you are using TypeScript, in your hardhat.config.ts:

import "hardhat-zksync-web3";

Required plugins

Environment extensions

This plugin extends the Hardhat Runtime Environment by adding a getZkWallet() function that returns a zksync-web3.Wallet connected to a zksync-web3.Provider and ethers.Provider for the current L1 and L2 network.

Configuration

This plugin extends the HardhatUserConfig's NetworkUserConfig object with an optional zkWallet field.

This is an example of how to set it:

const config: HardhatUserConfig = {
  networks: {
    zkLocal: {
      url: "http://localhost:3050",
      ethNetwork: "http://localhost:8545",
      chainId: 270,
      zksync: true,
      zkWallet: {
        privateKey: ETH_PK // Account private key
      }
    },
    zkTestnet: {
      url: "https://testnet.era.zksync.dev",
      ethNetwork: "goerli", // RPC URL of the network (e.g. `https://goerli.infura.io/v3/<API_KEY>`)
      chainId: 280,
      zksync: true,
      verifyURL:
        "https://zksync2-testnet-explorer.zksync.dev/contract_verification", // Verification endpoint
      zkWallet: {
        keystore: ETH_KEYSTORE // Path to password protected keystore file
      }
    }
  }
};

Usage

There are no additional steps you need to take for this plugin to work.

Install it and access the wallet through the Hardhat Runtime Environment anywhere you need it (tasks, scripts, tests, etc).

If using a keystore file, enter the password when prompted by the task, script, test, etc.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published