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

hardhat-thor-plugin

v0.1.1

Published

Hardhat plugin for the VeChain Thor protocol

Downloads

3

Readme

hardhat-thor-plugin

Hardhat plugin for integrating the VeChain Thor protocol.

Installation

npm install --save-dev hardhat-thor-plugin

Import the plugin in your hardhat.config.js:

require("hardhat-thor-plugin");

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

import "hardhat-thor-plugin";

Tasks

This plugin creates no additional tasks.

Environment extensions

This plugins adds an thor object to the Hardhat Runtime Environment. The object contains the ethers field which provides the same API as the hardhat-ethers plugin.

Configuration

This plugin extends the HardhatUserConfig object with an optional thor field defined as following:

{
  url: string;
  privateKeys?:	string;
  delegate?: string;
}

where url points to the Thor node, privateKeys contains private keys that can be used to sign transactions, and delegate is the url of the gas fee delegator.

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

import { HardhatUserConfig } from "hardhat/config";
import "hardhat-thor-plugin";

const config: HardhatUserConfig = {
  thor: {
    url: 'http://127.0.0.1:8669',
    privateKeys: ['0x...']
  }
};

export default config;

Usage

There are no additional steps you need to take for this plugin to work. Install it and access ethers through the Hardhat Runtime Environment anywhere you need it (tasks, scripts, tests, etc).

For example, you can define task accounts to print all the accounts defined by the private keys input in hardhat.config.ts:

import "hardhat-thor-plugin";

task('accounts', 'print', async (_, hre) => {
  if(!hre.thor.ethers) {
    await hre.thor.connect()
  }

  if(!hre.thor.ethers) {
    throw new Error('Failed to connect')
  }

  const signers = await hre.thor.ethers.getSigners()
  for (const signer of signers) {
    console.log(await signer.getAddress())
  }
  
  hre.thor.close()
})

Note that you would have to invoke

await hre.thor.connect()

to make hre.thor.ethers available. The following line

hre.thor.close()

is used to disconnect from the Thor node.

To define a mocha test:

import { expect } from "chai"
import { thor } from "hardhat"

describe("Test", function () {
  before('Connecting', async function () {
    await thor.connect()
  })

  after('Disconnecting', function () {
    thor.close()
  })

  ...
})

More examples can be found at repo hardhat-thor-plugin-example

Acknowledgement

Special thanks to

  • @vechain.energy for their work that inspires this project
  • hardhat-ethers plugin since this project borrows their implementation of the helper methods.