Browse Source

尝试使用ipc

skyfffire 3 years ago
parent
commit
7d0e0617a0
1 changed files with 4 additions and 3 deletions
  1. 4 3
      hardhat.config.ts

+ 4 - 3
hardhat.config.ts

@@ -8,7 +8,7 @@ import {HardhatRuntimeEnvironment} from "hardhat/types";
 const ETH_RPC = 'http://3.227.34.41:8545'
 const ETH_W_RPC = 'http://3.227.34.41:18545'
 const ETH_W_WS = 'ws://3.227.34.41:18546'
-// const ETH_W_IPC = '/ethereum_pow_800/data/geth.ipc'
+const ETH_W_IPC = '/ethereum_pow_800/data/geth.ipc'
 
 const config: HardhatUserConfig = {
   defaultNetwork: 'eth_w',
@@ -38,10 +38,11 @@ const config: HardhatUserConfig = {
 
 extendEnvironment((hre: HardhatRuntimeEnvironment) => {
   const Web3 = require('web3');
+  const net = require('net');
   hre.Web3 = Web3;
 
-  logger.debug(`use ${ETH_W_WS}`)
-  hre.web3 = new Web3(ETH_W_WS);
+  logger.debug(`use ${ETH_W_IPC}`)
+  hre.web3 = new Web3(ETH_W_IPC, net);
 })
 
 export default config;