npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@layerzerolabs/verify-contract

v1.1.31

Published

Verify Solidity contracts on supported block explorers

Downloads

568

Readme

Installation

yarn add @layerzerolabs/verify-contract

pnpm add @layerzerolabs/verify-contract

npm install @layerzerolabs/verify-contract

Usage

CLI

This package comes with a CLI interface:

npx @layerzerolabs/verify-contract --help

Using the CLI, contracts can be verified one network at a time.

Programmatic usage

The package provides two types of verification for hardhat deploy: target and non-target.

Target verification

This is suitable for verifying contracts that have been the compilation targets for a deployment, i.e. they have their own deployment file. This is the default and easiest case for which we know all the information we need from the deployment file.

import { verifyHardhatDeployTarget } from "@layerzerolabs/verify-contract";

// Programmatic usage allows for more fine-grained and multi-network verification
verifyHardhatDeployTarget({
  paths: {
    deployments: "./my/little/deployments/folder",
  },
  networks: {
    whatachain: {
      apiUrl: "https://api.whatachain.io/api",
      apiKey: "david.hasselhoff.1234",
    },
  },
  // The filter option allows you to limit the scope of verification to
  // specific contracts
  //
  // It supports several ways of scoping the verification:
  //
  // A list of case-sensitive contract names
  filter: ["Factory", "Router"],
  // A single contract name
  filter: "ONFT1155",
  // Boolean to toggle the verification as a whole
  filter: false,
  // A function that gets passed the contract name and an relative contract path and returns a boolean to signify the contract needs to be verified
  filter: (name, path) => name.startsWith("Potato721"),
});

Non-target verification

This is suitable for verifying contracts that have been e.g. deployed dynamically from other contracts within the deployment.

In this case we need to know more information - the specific deployment file to use, the address of the contract and also its constructor arguments.

import { verifyHardhatDeployNonTarget } from "@layerzerolabs/verify-contract";

// Programmatic usage allows for more fine-grained and multi-network verification
verifyHardhatDeployNonTarget({
  paths: {
    deployments: "./my/little/deployments/folder",
  },
  networks: {
    whatachain: {
      apiUrl: "https://api.whatachain.io/api",
      apiKey: "david.hasselhoff.1234",
    },
  },
  // The contracts array is used to pass the contract details
  contracts: [
    {
      address: "0x0",
      network: "whatachain",
      // We'll need to pass the name of the deployment file to use (relative to the deployments path)
      deployment: "OtherContract.json",
      constructorArguments: [1000, "0x0"],
      // In this case we'll need to pass a fully-qualified contract name
      contractName: "contracts/examples/Pool.sol",
    },
  ],
});

Default configuration

The package is preconfigured for scan API URLs for several well-known networks:

| Network | API URL | | -------------------------------------------------------------- | ------------------------------------------------ | | avalanche, avalanche-mainnet | https://api.snowtrace.io/api | | fuji, avalanche-testnet | https://api-testnet.snowtrace.io/api | | bsc | https://api.bscscan.com/api | | bsc-testnet | https://api-testnet.bscscan.com/api | | ethereum | https://api.etherscan.io/api | | ethereum-goerli | https://api-goerli.etherscan.io/api | | goerli | https://api-goerli.etherscan.io/api | | fantom | https://api.ftmscan.com/api | | fantom-testnet | https://api-testnet.ftmscan.com/api | | arbitrum | https://api.arbiscan.io/api | | arbitrum-goerli | https://api-goerli.arbiscan.io/api | | polygon | https://api.polygonscan.com/api | | mumbai | https://api-testnet.polygonscan.com/api | | optimism | https://api-optimistic.etherscan.io/api | | optimism-goerli | https://api-goerli-optimistic.etherscan.io/api | | gnosis | https://api.gnosisscan.io/api | | zkpolygon, zkpolygon-mainnet | https://api-zkevm.polygonscan.com/api | | base, base-mainnet | https://api.basescan.org/api | | base-goerli | https://api-goerli.basescan.org/api | | zkconsensys, zkconsensys-mainnet, linea, linea-mainnet | https://api.lineascan.build/api | | moonbeam | https://api-moonbeam.moonscan.io/api | | moonbeam-testnet | https://api-moonbase.moonscan.io/api | | kava, kava-mainnet | https://kavascan.com/api | | kava-testnet | https://testnet.kavascan.com/api |