├── .env-example
├── .gitignore
├── LICENSE
├── README.md
├── data
└── token-example.json
├── filesConfig-example.json
├── package.json
├── packages
├── chain-module
│ ├── evm-script
│ │ ├── README.md
│ │ ├── index.js
│ │ └── trade.js
│ ├── sol-script
│ │ ├── README.md
│ │ ├── index.js
│ │ └── umi.js
│ ├── sui-script
│ │ ├── README.md
│ │ └── suiKit.js
│ └── utxo-script
│ │ ├── README.md
│ │ ├── function.js
│ │ └── index.js
├── crypt-module
│ ├── README.md
│ ├── crypt.js
│ └── onepassword.js
├── exchange-module
│ ├── README.md
│ ├── binance.js
│ ├── bybit.js
│ └── okx.js
├── notification-module
│ ├── README.md
│ ├── notification.js
│ └── notifier.js
├── rpa-module
│ ├── README.md
│ ├── bitbrowser
│ │ ├── bitbrowser.js
│ │ ├── bitbrowserSelenium.js
│ │ ├── keplr.js
│ │ ├── metamask.js
│ │ ├── phantom.js
│ │ └── unisat.js
│ ├── browserConfig.js
│ ├── chrome
│ │ └── chromeBrowser
│ │ │ ├── README.md
│ │ │ ├── chromeBrowser.js
│ │ │ ├── chromeProfile.js
│ │ │ ├── config.js
│ │ │ ├── image
│ │ │ ├── avatar
│ │ │ │ ├── Chrome001.png
│ │ │ │ ├── Chrome002.png
│ │ │ │ ├── Chrome003.png
│ │ │ │ ├── Chrome004.png
│ │ │ │ ├── Chrome005.png
│ │ │ │ ├── Chrome006.png
│ │ │ │ ├── Chrome007.png
│ │ │ │ ├── Chrome008.png
│ │ │ │ ├── Chrome009.png
│ │ │ │ ├── Chrome010.png
│ │ │ │ ├── Chrome011.png
│ │ │ │ ├── Chrome012.png
│ │ │ │ ├── Chrome013.png
│ │ │ │ ├── Chrome014.png
│ │ │ │ ├── Chrome015.png
│ │ │ │ ├── Chrome016.png
│ │ │ │ ├── Chrome017.png
│ │ │ │ ├── Chrome018.png
│ │ │ │ ├── Chrome019.png
│ │ │ │ ├── Chrome020.png
│ │ │ │ ├── Chrome021.png
│ │ │ │ ├── Chrome022.png
│ │ │ │ ├── Chrome023.png
│ │ │ │ ├── Chrome024.png
│ │ │ │ ├── Chrome025.png
│ │ │ │ ├── Chrome026.png
│ │ │ │ ├── Chrome027.png
│ │ │ │ ├── Chrome028.png
│ │ │ │ ├── Chrome029.png
│ │ │ │ ├── Chrome030.png
│ │ │ │ ├── Chrome031.png
│ │ │ │ ├── Chrome032.png
│ │ │ │ ├── Chrome033.png
│ │ │ │ ├── Chrome034.png
│ │ │ │ ├── Chrome035.png
│ │ │ │ ├── Chrome036.png
│ │ │ │ ├── Chrome037.png
│ │ │ │ ├── Chrome038.png
│ │ │ │ ├── Chrome039.png
│ │ │ │ ├── Chrome040.png
│ │ │ │ ├── Chrome041.png
│ │ │ │ ├── Chrome042.png
│ │ │ │ ├── Chrome043.png
│ │ │ │ ├── Chrome044.png
│ │ │ │ ├── Chrome045.png
│ │ │ │ ├── Chrome046.png
│ │ │ │ ├── Chrome047.png
│ │ │ │ ├── Chrome048.png
│ │ │ │ ├── Chrome049.png
│ │ │ │ └── Chrome050.png
│ │ │ └── icons
│ │ │ │ ├── icons
│ │ │ │ ├── chrome.icns
│ │ │ │ ├── chrome001.icns
│ │ │ │ ├── chrome002.icns
│ │ │ │ ├── chrome003.icns
│ │ │ │ ├── chrome004.icns
│ │ │ │ ├── chrome005.icns
│ │ │ │ ├── chrome006.icns
│ │ │ │ ├── chrome007.icns
│ │ │ │ ├── chrome008.icns
│ │ │ │ ├── chrome009.icns
│ │ │ │ ├── chrome010.icns
│ │ │ │ ├── chrome011.icns
│ │ │ │ ├── chrome012.icns
│ │ │ │ ├── chrome013.icns
│ │ │ │ ├── chrome014.icns
│ │ │ │ ├── chrome015.icns
│ │ │ │ ├── chrome016.icns
│ │ │ │ ├── chrome017.icns
│ │ │ │ ├── chrome018.icns
│ │ │ │ ├── chrome019.icns
│ │ │ │ ├── chrome020.icns
│ │ │ │ ├── chrome021.icns
│ │ │ │ ├── chrome022.icns
│ │ │ │ ├── chrome023.icns
│ │ │ │ ├── chrome024.icns
│ │ │ │ ├── chrome025.icns
│ │ │ │ ├── chrome026.icns
│ │ │ │ ├── chrome027.icns
│ │ │ │ ├── chrome028.icns
│ │ │ │ ├── chrome029.icns
│ │ │ │ ├── chrome030.icns
│ │ │ │ ├── chrome031.icns
│ │ │ │ ├── chrome032.icns
│ │ │ │ ├── chrome033.icns
│ │ │ │ ├── chrome034.icns
│ │ │ │ ├── chrome035.icns
│ │ │ │ ├── chrome036.icns
│ │ │ │ ├── chrome037.icns
│ │ │ │ ├── chrome038.icns
│ │ │ │ ├── chrome039.icns
│ │ │ │ ├── chrome040.icns
│ │ │ │ ├── chrome041.icns
│ │ │ │ ├── chrome042.icns
│ │ │ │ ├── chrome043.icns
│ │ │ │ ├── chrome044.icns
│ │ │ │ ├── chrome045.icns
│ │ │ │ ├── chrome046.icns
│ │ │ │ ├── chrome047.icns
│ │ │ │ ├── chrome048.icns
│ │ │ │ ├── chrome049.icns
│ │ │ │ └── chrome050.icns
│ │ │ │ └── png
│ │ │ │ ├── chrome.png
│ │ │ │ ├── chrome001.png
│ │ │ │ ├── chrome002.png
│ │ │ │ ├── chrome003.png
│ │ │ │ ├── chrome004.png
│ │ │ │ ├── chrome005.png
│ │ │ │ ├── chrome006.png
│ │ │ │ ├── chrome007.png
│ │ │ │ ├── chrome008.png
│ │ │ │ ├── chrome009.png
│ │ │ │ ├── chrome010.png
│ │ │ │ ├── chrome011.png
│ │ │ │ ├── chrome012.png
│ │ │ │ ├── chrome013.png
│ │ │ │ ├── chrome014.png
│ │ │ │ ├── chrome015.png
│ │ │ │ ├── chrome016.png
│ │ │ │ ├── chrome017.png
│ │ │ │ ├── chrome018.png
│ │ │ │ ├── chrome019.png
│ │ │ │ ├── chrome020.png
│ │ │ │ ├── chrome021.png
│ │ │ │ ├── chrome022.png
│ │ │ │ ├── chrome023.png
│ │ │ │ ├── chrome024.png
│ │ │ │ ├── chrome025.png
│ │ │ │ ├── chrome026.png
│ │ │ │ ├── chrome027.png
│ │ │ │ ├── chrome028.png
│ │ │ │ ├── chrome029.png
│ │ │ │ ├── chrome030.png
│ │ │ │ ├── chrome031.png
│ │ │ │ ├── chrome032.png
│ │ │ │ ├── chrome033.png
│ │ │ │ ├── chrome034.png
│ │ │ │ ├── chrome035.png
│ │ │ │ ├── chrome036.png
│ │ │ │ ├── chrome037.png
│ │ │ │ ├── chrome038.png
│ │ │ │ ├── chrome039.png
│ │ │ │ ├── chrome040.png
│ │ │ │ ├── chrome041.png
│ │ │ │ ├── chrome042.png
│ │ │ │ ├── chrome043.png
│ │ │ │ ├── chrome044.png
│ │ │ │ ├── chrome045.png
│ │ │ │ ├── chrome046.png
│ │ │ │ ├── chrome047.png
│ │ │ │ ├── chrome048.png
│ │ │ │ ├── chrome049.png
│ │ │ │ └── chrome050.png
│ │ │ ├── proxyManger.js
│ │ │ └── proxyServer.js
│ └── okxWallet.js
├── social-module
│ ├── email
│ │ ├── README.md
│ │ ├── gmail.js
│ │ └── outlook.js
│ ├── galxe
│ │ └── galxe.js
│ └── x
│ │ ├── README.md
│ │ └── x.js
└── utils-module
│ ├── README.md
│ ├── captcha.js
│ ├── check.js
│ ├── formatdata.js
│ ├── generateWallet.js
│ ├── otp.js
│ ├── path.js
│ ├── retry.js
│ └── utils.js
├── pnpm-lock.yaml
└── projects
├── README.md
├── monad
└── faucet.js
└── saharaAi
├── faucet.js
└── saharaAi.js
/.env-example:
--------------------------------------------------------------------------------
1 | # personalToken是加解密密码,存储在1password中。使用的时候通过指纹来解锁1password获取personalToken
2 | # 示例:personalToken存储1password的blockchain保险库中。根据自己的实际情况修改路径
3 | personalToken = 'op://blockchain/personalToken'
4 |
5 | # 各钱包密码
6 | okxWalletPassword = 'op://blockchain/okxwallet/password'
7 | phantomPassword = 'op://blockchain/phantom/password'
8 | unsatPassword = 'op://blockchain/unisat/password'
9 | keplrPassword = 'op://blockchain/keplr/password'
10 |
11 |
12 | # infura的apiKey
13 | infuraKey = 'xxxxxxxxxx'
14 | # alchemy的apiKey
15 | alchemyKey = 'xxxxxxxxxx'
16 |
17 | # sol的rpc,轮换使用
18 | # helius的apiKey
19 | heliusKey = 'xxxxxxxxxx'
20 | # quickNode的apiKey
21 | quickNodeKey = 'xxxxxxxxxx'
22 |
23 | # 各人机验证服务商的clientKey
24 | yesCaptchaClientKey = 'xxxxxxxxxx'
25 | noCaptchaClientKey = 'xxxxxxxxxx'
26 | capSolverClientKey = 'xxxxxxxxxx'
27 |
28 | # gmail邮箱的clientId和clientSecret
29 | gmailClientId = 'xxxxxxxxxx'
30 | gmailClientSecret = 'xxxxxxxxxx'
31 | gmailRedirectUri = 'https://mail.google.com'
32 |
33 | # outlook邮箱的clientId和clientSecret
34 | outlookClientId = 'xxxxxxxxxx'
35 | outlookClientSecret = 'xxxxxxxxxx'
36 | outlookRedirectUri = 'http://localhost:3000/auth/redirect'
37 |
38 | # x的clientId和clientSecret
39 | xClientId = 'xxxxxxxxxx'
40 | xClientSecret = 'xxxxxxxxxx'
41 | xRedirectUri = 'https://x.com/home'
42 |
43 | # 钉钉机器人access_token。发送消息用于通知
44 | dingtalkAccessToken = 'xxxxxxxxxx'
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | data/*
2 | !data/token-example.json
3 | filesConfig.json
4 |
5 | # Example JS files
6 | *[eE]xample*.js
7 | example*.js
8 | *[eE]xample.js
9 |
10 | .DS_Store
11 |
12 | # Logs
13 | logs
14 | *.log
15 | npm-debug.log*
16 | yarn-debug.log*
17 | yarn-error.log*
18 | lerna-debug.log*
19 | .pnpm-debug.log*
20 |
21 | # Diagnostic reports (https://nodejs.org/api/report.html)
22 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
23 |
24 | # Runtime data
25 | pids
26 | *.pid
27 | *.seed
28 | *.pid.lock
29 |
30 | # Directory for instrumented libs generated by jscoverage/JSCover
31 | lib-cov
32 |
33 | # Coverage directory used by tools like istanbul
34 | coverage
35 | *.lcov
36 |
37 | # nyc test coverage
38 | .nyc_output
39 |
40 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
41 | .grunt
42 |
43 | # Bower dependency directory (https://bower.io/)
44 | bower_components
45 |
46 | # node-waf configuration
47 | .lock-wscript
48 |
49 | # Compiled binary addons (https://nodejs.org/api/addons.html)
50 | build/Release
51 |
52 | # Dependency directories
53 | node_modules/
54 | jspm_packages/
55 |
56 | # Snowpack dependency directory (https://snowpack.dev/)
57 | web_modules/
58 |
59 | # TypeScript cache
60 | *.tsbuildinfo
61 |
62 | # Optional npm cache directory
63 | .npm
64 |
65 | # Optional eslint cache
66 | .eslintcache
67 |
68 | # Optional stylelint cache
69 | .stylelintcache
70 |
71 | # Microbundle cache
72 | .rpt2_cache/
73 | .rts2_cache_cjs/
74 | .rts2_cache_es/
75 | .rts2_cache_umd/
76 |
77 | # Optional REPL history
78 | .node_repl_history
79 |
80 | # Output of 'npm pack'
81 | *.tgz
82 |
83 | # Yarn Integrity file
84 | .yarn-integrity
85 |
86 | # dotenv environment variable files
87 | .env
88 | .env.development.local
89 | .env.test.local
90 | .env.production.local
91 | .env.local
92 |
93 | # parcel-bundler cache (https://parceljs.org/)
94 | .cache
95 | .parcel-cache
96 |
97 | # Next.js build output
98 | .next
99 | out
100 |
101 | # Nuxt.js build / generate output
102 | .nuxt
103 | dist
104 |
105 | # Gatsby files
106 | .cache/
107 | # Comment in the public line in if your project uses Gatsby and not Next.js
108 | # https://nextjs.org/blog/next-9-1#public-directory-support
109 | # public
110 |
111 | # vuepress build output
112 | .vuepress/dist
113 |
114 | # vuepress v2.x temp and cache directory
115 | .temp
116 | .cache
117 |
118 | # Docusaurus cache and generated files
119 | .docusaurus
120 |
121 | # Serverless directories
122 | .serverless/
123 |
124 | # FuseBox cache
125 | .fusebox/
126 |
127 | # DynamoDB Local files
128 | .dynamodb/
129 |
130 | # TernJS port file
131 | .tern-port
132 |
133 | # Stores VSCode versions used for testing VSCode extensions
134 | .vscode-test
135 |
136 | # yarn v2
137 | .yarn/cache
138 | .yarn/unplugged
139 | .yarn/build-state.yml
140 | .yarn/install-state.gz
141 | .pnp.*
142 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 gaohongxiang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # web3交互系列脚本
2 |
3 |
4 |
5 |
6 | 模块类别 |
7 | 模块内容 |
8 | 功能描述 |
9 |
10 |
11 |
12 |
13 | 🔐 加解密模块 |
14 | crypt |
15 | 数据加密与解密功能 |
16 |
17 |
18 | 💱 交易所模块 |
19 | binance |
20 | 币安交易所API交互 |
21 |
22 |
23 | okx |
24 | OKX交易所API交互 |
25 |
26 |
27 | bybit |
28 | Bybit交易所API交互 |
29 |
30 |
31 | ⛓️ 链上交互模块 |
32 | utxo-script |
33 | 比特币等UTXO模型链交互 |
34 |
35 |
36 | evm-script |
37 | 以太坊等EVM兼容链交互 |
38 |
39 |
40 | sol-script |
41 | Solana链交互 |
42 |
43 |
44 | sui-script |
45 | Sui链交互 |
46 |
47 |
48 | 🤖 RPA模块 |
49 | bitbrowser |
50 | BitBrowser指纹浏览器自动化操作 |
51 |
52 |
53 | chrome |
54 | 本地Chrome浏览器多开与控制 |
55 |
56 |
57 | 🌐 社交自动化模块 |
58 | X |
59 | X自动化操作 |
60 |
61 |
62 | gmail |
63 | Gmail自动化操作 |
64 |
65 |
66 | galxe |
67 | Galxe自动化操作 |
68 |
69 |
70 | 📢 通知模块 |
71 | notification |
72 | 消息通知与日志记录 |
73 |
74 |
75 | notifier |
76 | 钉钉机器人提醒 |
77 |
78 |
79 | 🛠️ 工具库模块 |
80 | generatewallet |
81 | 多链钱包生成工具 |
82 |
83 |
84 | captcha |
85 | 验证码自动识别与解决 |
86 |
87 |
88 | otp |
89 | 两因素认证(2FA)工具 |
90 |
91 |
92 | formatdata |
93 | 数据格式化与处理 |
94 |
95 |
96 | 其他 |
97 | 一些细碎的辅助工具 |
98 |
99 |
100 |
101 |
102 | 持续完善中。。。
103 |
104 | ## 免责声明
105 |
106 | 鉴于能力有限,后续不排除有大幅度的改动,请谨慎使用。
107 |
108 | 本脚本只作为学习用途,使用风险自负!
109 |
110 | ## 准备工作
111 |
112 | #### 1、克隆并安装依赖
113 | ```
114 | git clone https://github.com/gaohongxiang/web3-script.git
115 | cd web3-script
116 |
117 | sudo npm install -g pnpm
118 | pnpm install
119 | ```
120 |
121 | 包管理器从npm迁移至pnpm
122 | - 支持同一依赖的多个版本并存,解决版本冲突问题
123 | - 严格的依赖树结构,杜绝幽灵依赖
124 | - 硬链接共享依赖,节省磁盘空间
125 | - 更快的并行安装速度
126 |
127 | 比如我的代码里用的ethersV6版本,而uniswap的sdk还用的ethersV5版本,那么就会产生冲突。可以如下解决
128 |
129 | > 注意:ethers两个版本必须起别名,否则行为未知。比如v6版本叫ethers,不改名为ethers-v6,uniswap还是会用v6版本,因为他默认找名字为ethers的包。
130 |
131 | ```json
132 | {
133 | "dependencies": {
134 | "ethers-v5": "npm:ethers@5.8.0",
135 | "ethers-v6": "npm:ethers@^6.13.5",
136 | "@uniswap/permit2-sdk": "1.3.0",
137 | "@uniswap/universal-router-sdk": "4.19.5",
138 | },
139 | "pnpm": {
140 | "overrides": {
141 | "@uniswap/universal-router-sdk>ethers": "5.8.0",
142 | "@uniswap/permit2-sdk>ethers": "5.8.0"
143 | }
144 | }
145 | }
146 | ```
147 | 查一下所有依赖包中使用的 ethers 版本。--depth=10 表示显示依赖树的深度为10层
148 | ```
149 | pnpm list ethers --depth=10
150 | ```
151 |
152 | 结果如下,可以看到uniswap的sdk使用ethersV5版本,而我自己的代码中通过`import { ethers } from 'ethers-v6';`导入即可用V6版本。
153 | ```
154 | @uniswap/permit2-sdk 1.3.0
155 | └── ethers 5.8.0
156 | @uniswap/universal-router-sdk 4.19.5
157 | ├─┬ @uniswap/permit2-sdk 1.3.0
158 | │ └── ethers 5.8.0
159 | └── ethers 5.8.0
160 | ethers 5.8.0
161 | ethers 6.13.5
162 | ```
163 |
164 | #### 2、配置文件
165 |
166 | `.env-example`是示例配置文件,实际使用中需要同目录下创建`.env`文件,内容根据实际情况修改。用到哪个模块可查看模块文档增加配置。
167 |
168 | `.filesConfig-example.json`是数据配置文件,实际使用中需要同目录下创建`.filesConfig.json`文件,内容根据实际使用到的数据文件增删。此文件是配合`utils-module/formatdata.js`来格式化数据的,将所有准备好的数据文件按照`indexId`组合到一起,方便使用。注意data目录下创建的数据文件名字需要跟此文件里的名字相同。
169 |
170 | #### 3、数据文件
171 |
172 | 数据文件全部放在`data`目录下。根据用到的模块添加相应的文件。助记词、私钥、api数据等敏感字段必须加密存储(加密方法查看`crypt-module`模块)。主要用到三种格式文件:`.csv`、`.json`、`.xlsx`
173 |
174 | ##### 代币信息文件 `token-example.json`
175 |
176 | 此文件是一些常用的token信息,实际使用中需要同目录下创建`token.json`文件。可以自行添加token。
177 |
178 |
179 | ##### 钱包文件
180 |
181 | 此类文件存放链上地址,采用`.csv`格式,如`walletBtc.csv`、`walletEth.csv`等。基本字段如下所示,根据实际情况增删。
182 |
183 | 已存在的地址可以使用`crypt-module`模块加密敏感字段。未存在的地址可以直接使用`utils-module`模块生成,敏感字段会自动加密。
184 |
185 | ```
186 | indexId,address,enPrivateKey,enMnemonic
187 | 1,地址1,加密后的私钥,加密后的助记词
188 | 2,地址2,加密后的私钥,加密后的助记词
189 | 3,地址3,加密后的私钥,加密后的助记词
190 | ...
191 | ```
192 |
193 | >注意:csv文件第一个字段统一为indexId,方便后续多文件组合数据,如果不加此字段,程序读取文件时会自动添加。除了indexId字段,其他字段不准起相同的名字,防止多文件合并数据时漏数据。编辑器可以安装一下`Rainbow CSV`插件,每个字段用不同颜色显示,很容易阅读。
194 |
195 | ##### 交易所文件
196 |
197 | 交易所文件分为两类
198 | - 一类是api文件,此类文件存放交易所api,用于转出。采用`.json`格式,如 `binance.json`、`okx.json`。
199 | - 一类是地址文件,此类文件存放交易所的收款地址,用于转入。采用`.csv`格式,如`addressBinance.csv`、`addressOkx.csv`。
200 |
201 | 交易所api文件,见`exchange-module/README.md`
202 |
203 | 交易所地址文件。以ok为例,主账户和5个子账户都能生成20个地址
204 | ```
205 | indexId,okxEthAddress,okxBtcAddress,okxSolAddress,okxSuiAddress,...
206 | 1,okx的eth地址1,okx的btc地址1,okx的sol地址1,okx的sui地址1,...
207 | 2,okx的eth地址2,okx的btc地址2,okx的sol地址2,okx的sui地址2,...
208 | 3,okx的eth地址3,okx的btc地址3,okx的sol地址3,okx的sui地址3,...
209 | ```
210 |
211 | ##### ip文件 `ip.csv`
212 |
213 | 此文件存放ip信息,自动处理成各协议需要的格式,根据需要使用。详情查看`utils-module`文档。
214 | ```
215 | proxyIp:proxyPort:proxyUsername:proxyPassword
216 | xxxxxx:xxxxxx:xxxxxx:xxxxxx
217 | xxxxxx:xxxxxx:xxxxxx:xxxxxx
218 | ......
219 | ```
220 |
221 | ## 各模块使用示例
222 |
223 | 使用示例详见各模块文档。
224 |
225 | ---
226 | ---
227 |
228 | 如果觉得本脚本对您有帮助,欢迎支持,您的鼓励是我持续更新的动力!☕☕☕
229 |
230 | ```
231 | BTC: bc1pvw4w2kj6f97kqkfsalfk804tv60lwrx5pqlf34c595m2pggwyfysr3l4ld
232 |
233 | EVM: 0xbc7fe470be2a5a1ea8db55be44e234b0224b3198
234 |
235 | SOL: 8yJyYESPppRDb67GUzC4brCaY8UVVZU3JzBJ4DtkMc45
--------------------------------------------------------------------------------
/filesConfig-example.json:
--------------------------------------------------------------------------------
1 | {
2 | "dataFiles": [
3 | "data/wallet/walletBtc.csv",
4 | "data/wallet/walletEth.csv",
5 | "data/wallet/walletSol.csv",
6 | "data/wallet/walletSui.csv",
7 |
8 | "data/exchange/addressBinance.csv",
9 | "data/exchange/addressOkx.csv",
10 |
11 | "data/social/x.csv",
12 | "data/social/discord.csv",
13 | "data/social/email.csv",
14 |
15 | "data/ip.csv",
16 |
17 | "data/bitbrowser.xlsx"
18 | ],
19 | "fingerprintConfig": {
20 | "basePath": "$HOME/Chrome多开",
21 | "fileName": "fingerprint.json"
22 | }
23 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "web3-script",
3 | "version": "1.0.0",
4 | "description": "币圈交互系列脚本",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "type": "module",
10 | "bin": {
11 | "proxy-manager": "./packages/rpa-module/chrome/chromeBrowser/proxyManger.js"
12 | },
13 | "keywords": [],
14 | "author": "gaohongxiang",
15 | "license": "MIT",
16 | "dependencies": {
17 | "@azure/msal-node": "^3.0.1",
18 | "@faker-js/faker": "^9.5.1",
19 | "@metaplex-foundation/digital-asset-standard-api": "^1.0.4",
20 | "@metaplex-foundation/mpl-token-metadata": "^3.2.1",
21 | "@metaplex-foundation/mpl-toolbox": "^0.9.4",
22 | "@metaplex-foundation/umi": "^0.9.2",
23 | "@metaplex-foundation/umi-bundle-defaults": "^0.9.2",
24 | "@metaplex-foundation/umi-rpc-web3js": "^0.9.2",
25 | "@microsoft/microsoft-graph-client": "^3.0.7",
26 | "@mysten/sui": "^1.13.0",
27 | "@scallop-io/sui-kit": "^1.3.0",
28 | "@solana/spl-token": "^0.4.9",
29 | "@solana/web3.js": "^1.95.4",
30 | "@uniswap/permit2-sdk": "1.3.0",
31 | "@uniswap/sdk-core": "^7.7.2",
32 | "@uniswap/universal-router-sdk": "4.19.5",
33 | "@uniswap/v3-sdk": "^3.25.2",
34 | "axios": "^1.7.9",
35 | "bip32": "^5.0.0-rc.0",
36 | "bip39": "^3.1.0",
37 | "bitcoinjs-lib": "^6.1.6",
38 | "bs58": "^6.0.0",
39 | "canvas": "^3.1.0",
40 | "ccxt": "^4.4.77",
41 | "clipboardy": "^4.0.0",
42 | "csv-parse": "^5.5.6",
43 | "csv-stringify": "^6.5.1",
44 | "dotenv": "^16.4.5",
45 | "ecpair": "^2.1.0",
46 | "ethers-v5": "npm:ethers@5.8.0",
47 | "ethers-v6": "npm:ethers@^6.13.5",
48 | "express": "^4.21.2",
49 | "fingerprint-generator": "^2.1.62",
50 | "fingerprint-injector": "^2.1.62",
51 | "google-auth-library": "^9.15.0",
52 | "googleapis": "^144.0.0",
53 | "https-proxy-agent": "^7.0.6",
54 | "imap": "^0.8.19",
55 | "mailparser": "^3.7.2",
56 | "minimist": "^1.2.8",
57 | "node-pop3": "^0.9.0",
58 | "otplib": "^12.0.1",
59 | "playwright": "^1.49.1",
60 | "robotjs": "^0.6.0",
61 | "socks": "^2.8.4",
62 | "socks-proxy-agent": "^8.0.4",
63 | "tiny-secp256k1": "^2.2.3",
64 | "twitter-api-v2": "^1.20.2",
65 | "xlsx": "^0.18.5"
66 | },
67 | "pnpm": {
68 | "overrides": {
69 | "@uniswap/universal-router-sdk>ethers": "5.8.0",
70 | "@uniswap/permit2-sdk>ethers": "5.8.0"
71 | },
72 | "onlyBuiltDependencies": [
73 | "bigint-buffer",
74 | "bufferutil",
75 | "canvas",
76 | "ccxt",
77 | "keccak",
78 | "robotjs",
79 | "secp256k1",
80 | "utf-8-validate"
81 | ]
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/packages/chain-module/evm-script/README.md:
--------------------------------------------------------------------------------
1 | # EVM链交互脚本
2 |
3 | ## 注意事项
4 | - 本脚本支持多个RPC提供商(Infura、Alchemy、公共节点等),私有节点需要在.env文件中配置相应的API密钥
5 | - 创建钱包文件,并加密私钥、助记词数据
6 | - erc20代币信息存储在`./data/token.json`文件,需要的token信息可自行添加
7 |
8 | ## 使用示例
9 |
10 | ```js
11 | import { evmClient } from "./index.js";
12 |
13 | // 创建客户端实例(支持自定义链配置)
14 | // 方式1: 使用现有的链和现有RPC提供商
15 | const client = await evmClient.create({
16 | chain: 'eth', // 链名称,支持多种别名,如'eth'/'ethereum'/'erc20'
17 | rpcProvider: 'infura', // RPC提供商名称,可选值:infura、alchemy、public等(取决于链支持)
18 | enPrivateKey: '加密私钥', // 通过加密模块加密过的私钥
19 | socksProxyUrl: null, // 可选,代理URL,默认null
20 | tokenFile: './data/token.json' // 可选,代币信息文件,存储代币address、abi、decimals等,默认'./data/token.json'。根据你的数据文件位置改
21 | });
22 |
23 | // 方式2: 使用现有的链和自定义RPC(可以不传nativeToken)
24 | const client = await evmClient.create({
25 | chain: 'eth',
26 | customChainOptions: {
27 | rpc: 'https://your-custom-rpc-url.com', // 自定义RPC URL,优先级高于rpcProvider
28 | }
29 | ...
30 | });
31 |
32 | // 方式3: 使用自定义链和自定义RPC
33 | const client = await evmClient.create({
34 | chain: 'custom_chain_name', // 自定义链名称
35 | customChainOptions: {
36 | rpc: 'https://your-custom-rpc-url.com', // 使用自定义链时必须提供自定义RPC
37 | nativeToken: 'token' // 使用自定义链时必须提供原生token
38 | }
39 | ...
40 | });
41 |
42 |
43 |
44 | // 获取地址余额
45 | const balance = await client.getBalance({
46 | address: '0x...', // 要查询的地址
47 | token: 'ETH' // 代币名称,如 ETH/USDT/WETH 等
48 | });
49 |
50 | // 发送代币
51 | const txHash = await client.transfer({
52 | toAddress: '0x...', // 接收地址
53 | token: 'ETH', // 代币名称,如 ETH/USDT/WETH 等
54 | value: 0.1, // 转账数量(数字类型)
55 | gasOptions: { // [可选] gas设置
56 | multiplier: 1.1, // gas价格乘数,用于加速交易
57 | useEIP1559: true // 是否使用EIP-1559交易类型
58 | }
59 | });
60 |
61 | // 授权代币
62 | await client.checkAndApproveToken({
63 | token: 'USDT', // 代币名称,如 USDT/WETH 等(ETH无需授权)
64 | amount: 100, // 交易金额(数字类型)
65 | permit2Amount: 1000, // [可选] 授权给permit2的金额,应大于amount
66 | targetContract: '0x...', // 目标合约地址
67 | gasOptions: { // [可选] gas设置
68 | multiplier: 1.1, // gas价格乘数,用于加速交易
69 | useEIP1559: true // 是否使用EIP-1559交易类型
70 | }
71 | });
72 |
73 | // 监听代币转账
74 | const contract = await client.listenContract({
75 | listenAddress: '0x...', // 要监听的地址
76 | listenToken: 'USDT', // 要监听的代币名称
77 | direction: 'in' // 监听方向:'in'=转入,'out'=转出
78 | });
79 | ```
80 |
81 | ### uniswap V3 通用路由兑换代币示例
82 | ```js
83 | import { tradeClient } from "./trade.js";
84 |
85 | // 创建客户端实例
86 | const trade = await tradeClient.create({
87 | chain: 'eth', // 链名称
88 | rpcProvider: 'infura', // RPC提供商名称,可选值:infura、alchemy、public(公共节点))
89 | enPrivateKey: '加密私钥', // 通过加密模块加密过的私钥
90 | socksProxyUrl: null, // 可选,代理URL,默认null
91 | tokenFile: './data/token.json' // 可选,代币信息文件,存储代币address、abi、decimals等,默认'./data/token.json'。根据你的数据文件位置改
92 | });
93 |
94 | // 执行代币兑换(暂不支持原生代币与包装代币互换,因为直接用WETH合约就行了,不走uniswap路由)
95 | const tx = await trade.uniswapUniversalRouterV3Swap({
96 | tokenIn: 'ETH', // 输入代币名称,如 ETH/USDT/WETH 等
97 | tokenOut: 'USDT', // 输出代币名称,如 ETH/USDT/WETH 等
98 | amountIn: 0.1, // 输入金额(数字类型,使用代币精度单位)
99 | permit2AllowanceAmount: 1, // [可选] 授权给permit2的金额,应 >= amountIn
100 | slippage: 0.5, // [可选] 滑点百分比,默认0.5%
101 | permitDeadline: 10, // [可选] 授权过期时间(分钟),默认10分钟
102 | gasOptions: { // [可选] gas设置
103 | multiplier: 1.1, // gas价格乘数,用于加速交易
104 | useEIP1559: true // 是否使用EIP-1559交易类型
105 | }
106 | });
107 | ```
108 |
109 | uniswap通用路由的写法比较灵活,但是需要自己组装命令,用到permit2签名。
110 |
111 | >路径:代币授权给permit2合约 -> permit2签名后将代币转移给路由合约 -> 组装命令 -> 路由合约执行兑换交易
112 |
113 | 理论上代币可以无限授权给permit2合约,然后每次permit2合约签名(有作用域、有有效期)后将代币转移给路由合约,因为签名不需要上链,所以就省了一笔gas费。但是正因为签名不上链,有些无感,如果被骗permit2签名,那么签名的资金就会被盗。所以最好代币不要无限授权给permit2合约,可以设置一个相对够用的量,这些量内只需要一笔gas就可以完成交易,相对也安全。兼顾效率和安全。
114 |
115 | 如有报错无法找到原因可以去`https://dashboard.tenderly.co/explorer/simulations`模拟交易,需要路由地址+交易数据(错误信息里有)。Tenderly是一个专门面向Web3开发者的开发、监控和测试平台。
116 |
117 | Uniswap各个SDK的主要作用
118 | - sdk-core:最基础的SDK,提供核心功能。包含Token、Price、Route等基础类,其他SDK都依赖于这个核心SDK
119 | - v2-sdk:Uniswap V2协议的SDK。处理V2的配对交易、流动性添加/移除等,适用于想使用V2协议的开发者
120 | - v3-sdk:Uniswap V3协议的SDK。处理V3的集中流动性、多费率池等特性,提供更复杂的定价和流动性管理功能
121 | - v4-sdk:Uniswap V4协议的SDK(新版本)。处理V4的新特性,目前还在开发中
122 | - permit2-sdk:处理代币授权的SDK。实现EIP-2612标准的permit功能,允许用户用签名而不是交易来授权代币
123 | - universal-router-sdk:统一的路由SDK。可以同时处理V2、V3的交易,支持跨协议的最优路径查找
124 |
125 | 参考
126 | - uniswap在各链部署的合约:https://docs.uniswap.org/contracts/v3/reference/deployments/
127 | - uniswap通用路由各命令:https://docs.uniswap.org/contracts/universal-router/technical-reference#transfer
128 | - permit2文档:https://docs.uniswap.org/contracts/permit2/overview
129 | - uniswap报价:https://docs.uniswap.org/sdk/v3/guides/swaps/quoting、https://github.com/Uniswap/examples/blob/main/v3-sdk/quoting/src/libs/quote.ts
130 | - uniswapV3单路径交易示例:https://docs.uniswap.org/contracts/v3/guides/swaps/single-swaps、https://www.quicknode.com/guides/defi/dexs/how-to-swap-tokens-on-uniswap-v3
131 | - uniswap各sdk:https://docs.uniswap.org/sdk/v3/guides/web3-development-basics#the-uniswap-development-suite
132 | - 参考示例:
133 | - https://github.com/saad-s/uniswap-uni-router-permit2/blob/main/src/index.js
134 | - https://github.com/Uniswap/universal-router/blob/main/test/integration-tests/UniversalRouter.test.ts
135 | - https://github.com/0xMaka/w3py/blob/main/uniswapv3/v3exactOutput.py
136 | - https://github.com/CodeWithJoe2020/UniswapUniversalRouter/blob/main/sell_token_ur.py
137 |
138 | WTF-Ethers教程
139 | - https://github.com/WTFAcademy/WTF-Ethers
140 |
141 | 调试网站
142 | - https://dashboard.tenderly.co/
143 |
144 |
--------------------------------------------------------------------------------
/packages/chain-module/sol-script/README.md:
--------------------------------------------------------------------------------
1 | # sol脚本
2 |
3 | ## 注意事项
4 | - 本脚本使用heliusKey、quickNodeKey的rpc服务,需要自己申请,将apiKey配置到.env文件
5 | - 创建钱包文件,并加密私钥、助记词数据
6 | - spl代币信息存储在`./data/token.json`文件,需要的token信息可自行添加
7 |
8 | ## 示例
9 | ```
10 | // 路径根据文件的位置自行调整
11 | import { getBalance as solanaGetBalance, transfer as solanaTransfer } from './packages/sol-script/index.js'
12 |
13 | // 获取地址余额
14 | // 参数:{ address, token='SOL', tokenFile = './data/token.json' }
15 | // const balance = await solanaGetBalance({ address: 'HgkB9gJH58zxauqwLqgGVgoHH5FWNdiiVrUsXjTFVukx', token: 'sol', tokenFile = './data/token.json' })
16 |
17 | // 几个数据就是发送给几个
18 | const toData = [
19 | ['HgkB9gJH58zxauqwLqgGVgoHH5FWNdiiVrUsXjTFVukx', 0.01],
20 | ['Fv5rwEsDoWfqC7xn6QPxZtoz73YN563rRAtCSyuX2xxy', 0.01],
21 | ]
22 |
23 | // 发送代币
24 | // 参数:{ enPrivateKey, toData, token, tokenFile='./data/token.json' }
25 | solanaTransfer({ enPrivateKey: '加密的私钥', toData, token:'sol', tokenFile:'./data/token.json' })
26 | ```
27 |
28 | ## 参考
29 |
30 | - 官方库:https://github.com/solana-labs/solana-web3.js/tree/master
31 | - 官方交易示例:https://github.com/solana-labs/solana-web3.js/blob/30f9254a9c67313f82b7bdd03f73b7543e78fc1b/examples/transfer-lamports/src/example.ts#L140
32 | - quickNode solana 文档:https://www.quicknode.com/guides/solana-development/getting-started/solana-fundamentals-reference-guide
33 | - 崔棉大师 Solana 文档:https://www.solana-cn.com/SolanaDocumention/clients/javascript-reference.html
34 | - solana中文开发课程:https://www.solanazh.com/
35 | - solana中文开发课程:https://decert.me/tutorial/sol-dev/
36 | - 如何自己写一个pump.fun狙击枪:https://chainbuff.com/d/12
37 | - 笨方法学 Solana 合约交互(gm365):https://x.com/gm365/status/1797502378230603962
38 | - Solana Web3.js 2.0:Solana 开发的新篇章:https://blog.quicknode.com/solana-web3-js-2-0-a-new-chapter-in-solana-development/
39 |
40 |
41 | 社区
42 |
43 | - https://soldev.cn/topics/node1
44 | - https://t.me/solanadevcamp
--------------------------------------------------------------------------------
/packages/chain-module/sol-script/umi.js:
--------------------------------------------------------------------------------
1 | import 'dotenv/config';
2 | import bs58 from 'bs58';
3 |
4 | import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
5 | import {
6 | createSignerFromKeypair,
7 | signerIdentity,
8 | publicKey,
9 | transactionBuilder,
10 | sol,
11 | } from '@metaplex-foundation/umi';
12 | import {
13 | TokenStandard,
14 | mplTokenMetadata,
15 | fetchDigitalAsset,
16 | findTokenRecordPda,
17 | transferV1,
18 | } from '@metaplex-foundation/mpl-token-metadata';
19 | import { findAssociatedTokenPda } from '@metaplex-foundation/mpl-toolbox';
20 | import { dasApi } from '@metaplex-foundation/digital-asset-standard-api';
21 |
22 | import { deCryptText } from '../../crypt-module/crypt.js';
23 |
24 | /**
25 | * 创建 Umi 实例并设置签名者。
26 | *
27 | * 该函数初始化 Umi 实例,连接到可用的 RPC 节点,并设置签名者身份。
28 | * 它会尝试连接多个 RPC 提供者,直到找到一个可用的连接。
29 | *
30 | * @param {string} enPrivateKey - 加密的私钥
31 | * @returns {Promise