52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
|
|
require("@nomicfoundation/hardhat-toolbox");
|
||
|
|
require("dotenv").config();
|
||
|
|
|
||
|
|
function vmid2103RpcUrl() {
|
||
|
|
if (process.env.RPC_URL_2103) return process.env.RPC_URL_2103;
|
||
|
|
if (process.env.RPC_TW_CORE_HTTP) return process.env.RPC_TW_CORE_HTTP;
|
||
|
|
const raw = process.env.RPC_THIRDWEB_ADMIN_CORE || "";
|
||
|
|
if (/^https?:\/\//i.test(raw)) return raw;
|
||
|
|
const lan =
|
||
|
|
process.env.RPC_THIRDWEB_ADMIN_LAN_ONLY === "1" ||
|
||
|
|
process.env.RPC_THIRDWEB_ADMIN_LAN_ONLY === "true";
|
||
|
|
if (lan) {
|
||
|
|
const host = (raw || "192.168.11.217").replace(/^https?:\/\//i, "");
|
||
|
|
return `http://${host}:8545`;
|
||
|
|
}
|
||
|
|
return "https://rpc.tw-core.d-bis.org";
|
||
|
|
}
|
||
|
|
const VMID_2103_RPC = vmid2103RpcUrl();
|
||
|
|
|
||
|
|
function resolveAccounts() {
|
||
|
|
const raw = (process.env.PRIVATE_KEY || "").trim();
|
||
|
|
if (!raw) return [];
|
||
|
|
const k = raw.startsWith("0x") ? raw : `0x${raw}`;
|
||
|
|
if (!/^0x[0-9a-fA-F]{64}$/.test(k)) {
|
||
|
|
console.warn("PRIVATE_KEY unset or not 32-byte hex; Hardhat network will have no signer.");
|
||
|
|
return [];
|
||
|
|
}
|
||
|
|
return [k];
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @type import('hardhat/config').HardhatUserConfig */
|
||
|
|
module.exports = {
|
||
|
|
solidity: {
|
||
|
|
version: "0.8.23",
|
||
|
|
settings: { optimizer: { enabled: true, runs: 200 } },
|
||
|
|
},
|
||
|
|
paths: {
|
||
|
|
sources: "./contracts",
|
||
|
|
tests: "./hh-test",
|
||
|
|
cache: "./cache_hardhat",
|
||
|
|
artifacts: "./artifacts",
|
||
|
|
},
|
||
|
|
networks: {
|
||
|
|
chain138ThirdwebCore: {
|
||
|
|
url: VMID_2103_RPC,
|
||
|
|
chainId: 138,
|
||
|
|
accounts: resolveAccounts(),
|
||
|
|
gasPrice: 1_000_000_000,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
};
|