@iexec-nox/nox-hardhat-plugin
v0.1.0-beta.0
Published
Hardhat 3 plugin that spins up the Nox offchain stack and deploys NoxCompute for local end-to-end tests.
Readme
@iexec-nox/nox-hardhat-plugin
Hardhat 3 plugin that spins up the Nox offchain stack (KMS, ingestor, runner,
handle gateway, NATS, S3) with Docker Compose and injects the NoxCompute
contract bytecode on the local node, so tests and scripts can exercise the full
Nox protocol end-to-end.
Installation
pnpm add -D @iexec-nox/nox-hardhat-pluginIn your hardhat.config.ts:
import { defineConfig } from "hardhat/config";
import hardhatToolboxViemPlugin from "@nomicfoundation/hardhat-toolbox-viem";
import noxPlugin from "@iexec-nox/nox-hardhat-plugin";
export default defineConfig({
plugins: [hardhatToolboxViemPlugin, noxPlugin],
solidity: "0.8.29",
networks: {
default: {
type: "edr-simulated",
chainType: "op",
allowUnlimitedContractSize: true,
},
},
});Usage
The plugin overrides the test task so that, before running your tests, it:
- Compiles the project (including the
NoxComputecontract pulled from@iexec-nox/nox-protocol-contracts). - Starts a Hardhat node bound to
0.0.0.0:8545. - Injects the compiled
NoxComputebytecode at its well-known address viahardhat_setCodeand initializes it (owner + KMS public key + gateway). - Brings up the Nox offchain stack via Docker Compose and waits for every service to be healthy.
pnpm hardhat testThe stack is torn down when the test run finishes (or on failure).
