فهرست منبع

使用ipc通讯

skyfffire 3 سال پیش
والد
کامیت
2aa5555013
1فایلهای تغییر یافته به همراه8 افزوده شده و 7 حذف شده
  1. 8 7
      hardhat.config.ts

+ 8 - 7
hardhat.config.ts

@@ -2,13 +2,13 @@ import { HardhatUserConfig, extendEnvironment } from "hardhat/config";
 import "@nomicfoundation/hardhat-toolbox";
 
 import deployer from './.secret'
+import logger from "./utils/logger";
 import {HardhatRuntimeEnvironment} from "hardhat/types";
 
-// const ETH_RPC = '/ethereum/data/geth.ipc'
-// const ETH_RPC = 'http://3.227.34.41:8545'
-// const ETH_W_RPC = 'http://3.227.34.41:18545'
-const ETH_RPC = 'ws://127.0.0.1:8546'
-const ETH_W_RPC = 'ws://127.0.0.1:18546'
+const ETH_RPC = 'http://3.227.34.41:8545'
+const ETH_W_RPC = 'http://3.227.34.41:18545'
+const ETH_W_WS = 'ws://127.0.0.1:18546'
+const ETH_W_IPC = '/ethereum_pow_800/data/geth.ipc'
 
 const config: HardhatUserConfig = {
   defaultNetwork: 'eth_w',
@@ -37,10 +37,11 @@ const config: HardhatUserConfig = {
 };
 
 extendEnvironment((hre: HardhatRuntimeEnvironment) => {
-  const Web3 = require("web3");
+  const Web3 = require('web3');
   hre.Web3 = Web3;
 
-  hre.web3 = new Web3(hre.network.provider);
+  logger.debug(`use ${ETH_W_IPC}`)
+  hre.web3 = new Web3(ETH_W_IPC);
 })
 
 export default config;