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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ghostchain1/hardhat-ghost

v0.0.2

Published

Hardhat plugin — injects the Ghost SDK namespace into the Hardhat Runtime Environment

Downloads

437

Readme

@ghostchain1/hardhat-ghost

Hardhat plugin that injects the Ghost SDK namespace (hre.ghost) into the Hardhat Runtime Environment, replacing the raw hre.ethers surface with Ghost-branded helpers.

Install

npm install @ghostchain1/hardhat-ghost
# or
pnpm add @ghostchain1/hardhat-ghost

Configure the registry for GitHub Package Registry:

# .npmrc
@ghostchain:registry=https://npm.pkg.github.com

Setup

In hardhat.config.ts, load @nomicfoundation/hardhat-ethers first, then this plugin:

import "@nomicfoundation/hardhat-ethers";   // must come first
import "@ghostchain1/hardhat-ghost";

Usage

import { ghost } from "hardhat";

async function main() {
  const [deployer] = await ghost.getSigners();

  // Deploy a contract
  const factory = await ghost.getContractFactory("GhostToken");
  const token = await factory.deploy();
  await token.waitForDeployment();

  // Parse / format Ghost amounts
  const oneGST = ghost.parseGhost("1.0");           // 1e18n
  console.log(ghost.formatGhost(oneGST));            // "1.0"

  // Utilities
  const addr = ghost.getAddress("0xabc...");
  const hash = ghost.keccak256(ghost.toUtf8Bytes("hello"));
  const hex  = ghost.toBeHex(255n);                  // "0xff"
}

hre.ghost API

Signers & Contracts

| Method | Description | |---|---| | ghost.getSigners() | Returns all unlocked test node signers | | ghost.getSigner(address) | Returns a specific signer by address | | ghost.getContractFactory(name, signer?) | Deploy-ready factory for a named artifact | | ghost.getContractFactoryFromArtifact(artifact, signer?) | Factory from raw ABI + bytecode | | ghost.getContractAt(name, address, signer?) | Attach to a deployed contract | | ghost.getContract(name, address, signer?) | Alias for getContractAt |

Ghost Unit Helpers

| Property / Method | Description | |---|---| | ghost.parseGhost(value) | Parse a human-readable GST string to GhostWei (bigint) | | ghost.formatGhost(value) | Format GhostWei to a GST string | | ghost.parseGhostGwei(value) | Parse GhostGwei string to GhostWei | | ghost.formatGhostGwei(value) | Format GhostWei to GhostGwei string | | ghost.parseEther(value) | ethers parseEther | | ghost.parseUnits(value, unit?) | ethers parseUnits | | ghost.units | { GhostWei, GhostGwei, GhostOne } constants |

Gas

| Property | Description | |---|---| | ghost.GasEngine | GhostGasEngine class — getFeeData(), estimateGas(tx) |

Classes

| Property | Description | |---|---| | ghost.Contract | ethers Contract class | | ghost.ContractFactory | ethers ContractFactory class | | ghost.Interface | ethers Interface class | | ghost.AbiCoder | ethers AbiCoder class | | ghost.TypedDataEncoder | ethers TypedDataEncoder class | | ghost.JsonRpcProvider | GhostJsonRpcProvider — L1/L2/L3-aware provider | | ghost.Wallet | GhostWallet |

Utilities

| Property | Description | |---|---| | ghost.getAddress(addr) | Checksum an address | | ghost.getCreateAddress(addr, nonce) | Derive a CREATE contract address | | ghost.isAddress(value) | Type guard for addresses | | ghost.isHexString(value, length?) | Type guard for hex strings | | ghost.keccak256(data) | keccak256 hash | | ghost.id(text) | keccak256 of a UTF-8 string | | ghost.solidityPacked(types, values) | ABI-packed encoding | | ghost.toBeHex(value, width?) | Convert bigint to hex string | | ghost.toUtf8Bytes(text) | Encode a string as UTF-8 bytes | | ghost.zeroPadValue(value, length) | Zero-pad a hex value to length bytes | | ghost.dataSlice(data, start?, end?) | Slice hex data |

Constants

| Property | Value | |---|---| | ghost.ZeroAddress | "0x0000000000000000000000000000000000000000" | | ghost.ZeroHash | "0x0000...0000" (32 bytes) | | ghost.MaxUint256 | 2n ** 256n - 1n |

Network

| Property | Description | |---|---| | ghost.Networks | GhostNetworks — L1/L2/L3 network configs | | ghost.provider | Hardhat network provider |


ghost:generate Task

Generate a GhostChain Solidity contract from a template:

npx hardhat ghost:generate --type token   --name GhostGovToken --symbol GGT
npx hardhat ghost:generate --type nft     --name GhostBadge   --symbol GBDG
npx hardhat ghost:generate --type staking --name MyStaking
npx hardhat ghost:generate --type dao     --name MyCouncil
npx hardhat ghost:generate --type dex     --name GhostX --no-deploy

Options:

| Flag | Default | Description | |---|---|---| | --type | (required) | token | nft | staking | dao | dex | | --name | (required) | PascalCase contract name | | --symbol | "" | Token/NFT symbol (for token and nft types) | | --out-dir | generated | Output subdirectory under contracts/src/ | | --max-supply | "" | Max total supply for token type | | --no-deploy | false | Skip generating a Hardhat deploy script | | --emit-sdk | false | Also emit a TypeScript SDK wrapper stub |

Requires @ghostchain1/ghost-contract-factory (optional peer dependency):

pnpm add @ghostchain1/ghost-contract-factory

License

MIT © GhostChain Team