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

@rumblefishdev/hardhat-polyjuice-plugin

v1.1.0

Published

Deploy to godwoken network using hardhat-deploy

Downloads

4

Readme

hardhat-polyjuice-plugin

A plugin that allows hardhat-deploy integration with godwoken network using Polyjuice Provider

What

The goal of the plugin is to have the ability to take existing Ethereum Hardhat codebase and port it to Nervos Layer 2 network only by adding the plugin into existing codebase. All Hardhat commands and execution of Hardhat scripts used ex. for deployment should work after adding the plugin.

Known Caveats(things you should be careful about!!)

  • because polyjuice-provider doesn't support transfer of ethers, deterministicDeployment is not supported by this plugin now

  • make sure that you first import hardhat-deploy in your config. This way the plugin will inject convertion of deploy arguments, so it supports using eth addresses and works well with ethers

  • the following gw_get_account_id_by_script_hash Error is known to be a random error. If this appears make sure you enable delayAfterDeploy in config.

Error: result from jsonRPC gw_get_account_id_by_script_hash is null or undefined. unable to fetch account id from script hash 0x73d89c5d14c9d71bd9380f98fee2337dc517d19f3e41288ee9f78d25ed3e3aaf

you can learn more about that here

Installation

npm install @rumblefishdev/hardhat-polyjuice-plugin hardhat-deploy

Import the plugin in your hardhat.config.js. Make sure that it's imported after hardhat-deploy:

require("hardhat-deploy");
require("@rumblefishdev/hardhat-polyjuice-plugin");

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

import "hardhat-deploy";
import "@rumblefishdev/hardhat-polyjuice-plugin";

Required plugins

Tasks

This plugin creates no additional tasks.

Configuration

This plugin extends the HardhatUserConfig's NetworkConfig object with optional fields:

  • rollupTypeHash,
  • ethAccountLockCodeHash,
  • privateKey

This is an example of how to set it in hardhat.config.ts:

export const config: HardhatUserConfig = {
  network: {
    godwoken: {
      url: string;
      godwokenConfig: {
        privateKey: string;
        rollupTypeHash: string;
        ethAccountLockCodeHash: string;
        delayAfterDeploy?: boolean | Number;
      }
    },
  },
};

You can find ethAccountLockCodeHash, rollupTypeHash and url on localhost:6100, if you're using godwoken-kicker, or https://dev.ckb.tools/.

delayAfterDeploy is an optional field, allowing a delay after deploying each contract. It can help with dealing with gw_get_account_id_by_script_hash Error. Setting it to true will add 10000ms delay after every deploy, but you can also configure a number of ms that you want to wait.

Usage

All set! You can run

npx hardhat deploy --network godwoken

or

yarn hardhat deploy --network godwoken

to deploy your contracts.

Testing

You can find the tests/smoke-test folder, created to check if an update in godwoken chain or @polyjuice-provider/ethers package breaks the plugin functionality.

Prerequisites

  • Clone the godwoken-kicker repo, make sure that the path is the same as stated in test-config.json. You can also see there's a dummy ethereum account provided
  • jq
  • curl
  • make

Run smoke-test

Run

yarn smoke-test

It can take a while, especially if your godwoken is currently not up, it needs to build and run some containers. In that case, you will need to give the script root access (make init in godwoken-kicker requires that). The script will keep the chain running in case you want to try it several times. After you are done, run

yarn clean-up

to stop the containers.