Skip to content

Commit fb03160

Browse files
refactor(web3js-transaction): 重构代码结构并添加错误处理模块
将代码拆分为多个模块以提高可维护性,包括合约部署、合约交互、事件监听和错误处理模块。添加了更细致的错误处理逻辑,便于调试和问题追踪。
1 parent f454000 commit fb03160

File tree

2 files changed

+287
-191
lines changed

2 files changed

+287
-191
lines changed

basic/02-web3js-transaction/config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// 建议添加配置文件
2+
module.exports = {
3+
networks: {
4+
sepolia: {
5+
http: `https://sepolia.infura.io/v3/${process.env.INFURA_ID}`,
6+
ws: `wss://sepolia.infura.io/ws/v3/${process.env.INFURA_ID}`,
7+
},
8+
// 可添加其他网络配置
9+
},
10+
gas: {
11+
limit: 8000000,
12+
// 可添加 gasPrice 策略
13+
},
14+
contracts: {
15+
incrementer: {
16+
initialValue: 5,
17+
},
18+
},
19+
};

0 commit comments

Comments
 (0)