Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ require("@nomicfoundation/hardhat-toolbox");
require("hardhat-deploy");
const path = require("path");

require("dotenv").config({
path: path.resolve(process.cwd(), process.env.HARDHAT_NETWORK === 'bittensorLocal' ? '.env.local' : '.env'),
override: true
});
// dotenv v17 is ESM-only; use createRequire to load config in CommonJS context
const { createRequire } = require('module');
const _require = createRequire(import.meta ? import.meta.url : __filename);
try {
// Preferred: load via the dotenv/config entry point with process.env overrides
const dotenv = _require('dotenv');
dotenv.config({
path: path.resolve(process.cwd(), process.env.HARDHAT_NETWORK === 'bittensorLocal' ? '.env.local' : '.env'),
override: true
});
} catch (e) {
// Fallback: manually load dotenv if module resolution fails
console.warn('dotenv config load failed:', e.message);
}

// if(!process.env.ETH_SIGN_KEY) {
// throw new Error("ETH_SIGN_KEY is not set");
Expand Down
Loading