Hardhat users have the option of using the State Space Hardhat plugin.
This example uses the Tokeny T-REX contracts.
Install Plugin
npm install @state-space/hardhat
Import Plugin
Add the following statements to your hardhat.config.ts
file:
import "@state-space/hardhat"; //import the State Space plugin
import { extractAccountNames } from "@state-space/hardhat"; //returns the names of EOAs from a custom deployment so they appear in Workbench
Update Hardhat config file
In the hardhat.config.ts
file, add the statespace
object property to the Hardhat config. Below is an example deployment setup with added lines highlighted:
Example hardhat.config.ts
import "@nomicfoundation/hardhat-toolbox";
import { HardhatUserConfig } from "hardhat/config";
import "@state-space/hardhat";
import { extractAccountNames } from "@state-space/hardhat";
const config: HardhatUserConfig = {
solidity: {
version: "0.8.17",
settings: {
},
},
statespace: {
//team: "team-slug",
//project: "Project Name",
deployments: {
"Full Suite": async () => {
const { deployFullSuiteFixture } = await import(
"./test/fixtures/deploy-full-suite.fixture"
);
const accounts = await deployFullSuiteFixture();
return {
accountNames: extractAccountNames(accounts),
};
},
},
},
...
Deploy & Upload
Run the push
command to deploy and upload your project. Login to State Space Workbench to view your project.
If this is your first time, you will be asked to authenticate using your State Space login via a web link.
npx hardhat state-space push
If you do not see your project, make sure you selected the correct team as specified in the hardhat.config.ts
file.