0.0.3 โ€ข Published 8 months ago

hardhat-pint v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Hardhat Pint

A Hardhat plugin that integrates Pint (a declarative smart contract language) with your Essential Blockchain development workflow. Write, compile, and deploy Pint contracts using familiar Hardhat commands.

Prerequisites

Before using this plugin, ensure you have the following installed:

Rust Tools

Node.js Tools

  • Node.js (v14 or later)
  • Hardhat - Ethereum development environment
    npm install --save-dev hardhat

Features

  • ๐Ÿ”ง Seamless integration with Hardhat CLI
  • ๐Ÿงช Simple testing interface with Mocha
  • ๐Ÿ“ฆ Support for both local and remote nodes
  • ๐Ÿ› ๏ธ Essential tasks: compile, deploy, test, clean, node

Installation

# Create a new Hardhat project (if needed)
npx hardhat init

# Install the plugin
npm install hardhat-pint

Configuration

Add the plugin to your Hardhat config file:

// hardhat.config.js
require("hardhat-pint");
// hardhat.config.ts
import "hardhat-pint";

Available Commands

# Compile your Pint contracts
npx hardhat compile

# Start a local Essential node
npx hardhat node

# Deploy a contract
npx hardhat deploy --contract <contract-name> [--url <node-url>]

# Run tests
npx hardhat test

# Clean compiled contracts
npx hardhat clean

Testing Guide

The plugin provides testing helpers for writing Mocha tests. Here's a basic example:

const { deploy, queryState, submitSolution } = require("hardhat-pint");

describe("Counter Contract", () => {
  it("should increment counter value", async () => {
    // Deploy the contract
    const [contractHash, IncrementHash] = await deploy(sourcePath, contractName);
    
    // Query initial state
    const initialState = await queryState(contractHash, key);
    
    // Submit a solution
    const solution = await submitSolution(
      hre.config.paths.sources,
      contractHash,
      IncrementHash,
      [],
      mutations
    );
    
    // Verify the new state
    const newState = await queryState(contractHash, key);
    expect(newState).to.not.equal(initialState);
  });
});

Default Configuration

  • Local node URL: http://localhost:3554
  • Supported networks: Local and remote Essential nodes

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago