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

@vennbuild/cli

v1.0.10

Published

Venn Network CLI

Downloads

722

Readme

Venn CLI

NPM Version TypeScript Jest ESLint
Discord X License

Venn's command line interface for quick and easy setup of Venn Security Network

👉 What is Venn?

venn enable

🚀 Quick Start

Follow these steps to secure your contracts with Venn:

  1. Install the CLI globally by running:

    npm i -g @vennbuild/cli
  2. Auto-import the Firewall into your smart contracts by running:

    venn fw integ -d contracts
  3. Deploy your contracts like you normally would to any network

  4. Finally, connect your contracts to Venn by running:

    venn enable --network holesky

Table of Contents

📦 Installation

npm install -g @vennbuild/cli

💡 Note: Venn CLI is compatible with Solidity versions >= 0.8

📚 Usage

There are 3 steps to the integration.

  1. First, add the Firewall SDK to your smart contracts, and deploy them as your would normally deploy to any network.

  2. Next, connect your deployed smart contracts to Venn.

  3. Now that your project is secure, only approved transactions will go through.
    To approve transactions, make sure to add the Venn DApp SDK to your DApp's frontend.

Firewall Integration

This integration will add the Firewall SDK to your smart contracts, making sure that they import the relevant modifiers, and apply the modifiers on external functions.

Automatic Integration With CLI

Auto-import the Firewall SDK into all of your smart contracts in one go by running:

venn fw integ -d contracts

This command will scan all your smart contracts under the contracts folder, and add an import of the VennFirewallConsumer Firewall SDK.

Before
pragma solidity ^0.8;

contract MyContract {
    
    myMethod() {
        ...
    }
}
After
pragma solidity ^0.8;

import {VennFirewallConsumer} from "@ironblocks/firewall-consumer/contracts/consumers/VennFirewallConsumer.sol";

contract MyContract is VennFirewallConsumer {

    myMethod() firewallProtected {
        ...
    }
}

See the Available Commands section below for additional integration options

Venn Integration

This integration will connect your Firewall protected smart contracts to the Venn Network onchain. It does this by sending setup transactions onchain to register your smart contracts with Venn.

Prerequisites

  1. Make sure your smart contracts are deployed and that you have completed the Firewall Integration step above

  2. You will need your private key for this step

Configuration

  1. Create a new file called venn.config.json

  2. Add the following configuration snippet to it:

    {
        "networks": {
            "holesky": {
                "contracts": {
                    "MyContract1": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
                    "MyContract2": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
                }
            }
        }
    }
    • Each key in the contracts object is the Name of the contract
    • Each value in the contracts object is the Address of the contract
  3. Create a new environment variable called VENN_PRIVATE_KEY with the private key that deployed your smart contracts

    ⚠️
    IMPORTANT: This key must be the same key that deployed the smart contracts

Connect To Venn

Run the following command to connect your Firewall protected smart contracts to Venn:

venn enable --holesky

Your Venn Policy

After successfully connecting to Venn, a new Venn Security Policy will have been created for you.
The address of the policy will be saved in venn.config.json:

{
    "networks": {
        "holesky": {
            "contracts": {
                "MyContract1": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
                "MyContract2": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
            },

            // YOUR VENN POLICY ADDRESS
            "policyAddress": "0x123..."
        }
    }
}

You will need this address when integrating the Venn DApp SDK

⚙️ Configuration File

Venn CLI uses venn.config.json as it's configuration file, expected at the root folder of your project.

Overall, the configuration file has the following structure:

{
    "fw": { /* ... */ },
    "network": { /* ... */ }
}

Firewall Configuration

For the Firewall integration, you can configure which folders to include or exclude from the integration, using the following configuration:

{
    "fw": {
        "integ": {
            "include": ["my/contracts/folder"],
            "exclude": ["tests/fixtures/**/*.sol"],
        }
    }
}

Include

Acts as a whitelist.
If this configuration is not empty, only files inside the configured folders will be integrated with the Firewall SDK.

Exclude

Acts as a blacklist.
If this configuration is not empty, files inside the configured folders will not be integrated.

Venn Configuration

For the Venn Integration, you configure which networks to integrate with, and list the contracts that you have deployed per networks:

Smart Contracts

{
    "networks": {
        "holesky": {
            "contracts": {
                "MyContract1": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
                "MyContract2": "0x1234abcd1234abcd1234abcd1234abcd1234abcd",
            }
        }
    }
}

Note that the key is the name of the contract, and the value is the address of the contract.

Private Key

When Venn CLI registers your smart contracts with Venn onchain, it sends several setup transactions for this registration to happen.

The account that signs these transactions is provided to the CLI by setting the following environment variable:

  • VENN_PRIVATE_KEY
    The account that owns the deployed contracts

⚡ Available Commands

venn

This is the root command.

Available Options

  • --help
    show help information

  • --version
    show version information

venn fw integ

Subcommand for managing the Firewall SDK integration with your smart contracts.

Available Options

  • -f, --file <file path>
    specify a single smart contract file for the integration

  • -d, --dir <folder path>
    specify a directory of smart contracts for the integration

  • -r, --rec
    if specified, will recursively look in <folder path> from --dir

  • -v, --verbose
    show verbose logging

Examples

A single contract
venn fw integ -f contracts/MyContract.sol
A single folder
venn fw integ -d contracts/vault
All contracts
venn fw integ --r -d contracts

venn enable

Register your Firewall protected smart contracts with Venn.

Available Options

  • --network <network> the network where your smart contracts are deployed to

Examples

Enable Venn
venn enable --network holskey

venn disable

Unregister your Firewall protected smart contracts from Venn.

Available Options

  • --network <network> the network where your smart contracts are deployed to

Examples

Disable Venn
venn disable --network holskey

💬 Support & Documentation

We're here to help.

📜 License

Venn CLI is released under the MIT License.

The Venn CLI showcases how to easily integrate with Ironblocks' Firewall.