├── .env ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .vscode └── launch.json ├── LICENSE.md ├── README.md ├── btcord.js ├── config.json ├── confighandle.js ├── dealContract.js ├── duoxiancheng.js ├── duoxiancheng_v1.js ├── erc20.js ├── img ├── 1.jpg ├── 10.jpg ├── 11.jpg ├── 2.png ├── 20.jpg ├── 21.jpg ├── 23.png ├── 24.jpg └── 3.jpg ├── main.js ├── package-lock.json ├── package.json ├── preload.js ├── punk.csv ├── punknftid.csv ├── renderer.js ├── startblock.txt ├── taskconfig.json └── web ├── abi ├── stakehop.json ├── test.json ├── token.json ├── uniswap.json └── xen.json ├── css ├── bootstrap.min.css └── styles.css ├── index.html └── js ├── btcpunk.js ├── privatemanage.js ├── taskmanage.js └── webmain.js /.env: -------------------------------------------------------------------------------- 1 | PROXYUSE = 1 2 | PROXYURL = http://127.0.0.1:7890 3 | PROXYIP = 127.0.0.1 4 | PROXYPORT = 7890 -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build Electron App 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' # 当推送一个带有 "v" 前缀的标签时触发(例如:v1.0.0) 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v2 15 | 16 | - name: Set up Node.js 17 | uses: actions/setup-node@v2 18 | with: 19 | node-version: 16 # 根据您的项目需求更改 Node.js 版本 20 | 21 | - name: Install dependencies 22 | run: npm ci 23 | 24 | - name: Install Wine 25 | run: | 26 | sudo dpkg --add-architecture i386 27 | sudo apt-get update 28 | sudo apt-get install -y wine64 29 | 30 | - name: Install Electron Packager 31 | run: npm install electron-packager -g 32 | 33 | - name: Build Electron app for Linux 34 | run: | 35 | electron-packager . --platform=linux --arch=x64 --out=dist-linux 36 | tar -czvf dist-linux/nftqianggou-linux-x64.tar.gz -C dist-linux/nftqianggou-linux-x64 . 37 | 38 | 39 | - name: Build Electron app for Windows 40 | run: | 41 | electron-packager . --platform=win32 --arch=x64 --out=dist-windows 42 | cd dist-windows && zip -r nftqianggou-win32-x64.zip nftqianggou-win32-x64 && cd .. 43 | 44 | - name: Build Electron app for macOS 45 | if: startsWith(github.ref, 'refs/tags/') # 可选:仅在创建新标签时构建 macOS 应用程序 46 | run: | 47 | electron-packager . --platform=darwin --arch=x64 --out=dist-macos 48 | cd dist-macos && zip -r nftqianggou-darwin-x64.zip nftqianggou-darwin-x64 && cd .. 49 | 50 | - name: Create Release 51 | id: create_release 52 | uses: actions/create-release@v1 53 | env: 54 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用 GitHub 提供的默认 token 55 | with: 56 | tag_name: ${{ github.ref }} 57 | release_name: Release ${{ github.ref }} 58 | draft: false 59 | prerelease: false 60 | 61 | - name: Upload Linux Asset 62 | uses: actions/upload-release-asset@v1 63 | env: 64 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 65 | with: 66 | upload_url: ${{ steps.create_release.outputs.upload_url }} 67 | asset_path: ./dist-linux/nftqianggou-linux-x64.tar.gz 68 | asset_name: nftqianggou-linux-x64.tar.gz 69 | asset_content_type: application/gzip 70 | 71 | - name: Upload Windows Asset 72 | uses: actions/upload-release-asset@v1 73 | env: 74 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 75 | with: 76 | upload_url: ${{ steps.create_release.outputs.upload_url }} 77 | asset_path: ./dist-windows/nftqianggou-win32-x64.zip 78 | asset_name: nftqianggou-win32-x64.zip 79 | asset_content_type: application/zip 80 | 81 | - name: Upload macOS Asset 82 | if: startsWith(github.ref, 'refs/tags/') 83 | uses: actions/upload-release-asset@v1 84 | env: 85 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 86 | with: 87 | upload_url: ${{ steps.create_release.outputs.upload_url }} 88 | asset_path: ./dist-macos/nftqianggou-darwin-x64.zip 89 | asset_name: nftqianggou-darwin-x64.zip -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | duoxiancheng - 副本.js 3 | *.prikey 4 | cmd.exe.lnk 5 | img/11.jpg_temp.bmp 6 | electron-quick-start-win32-x64 7 | out 8 | qianggounft 9 | qianggounft.zip 10 | jilu.csv 11 | prikey.prikey3 12 | punk.json 13 | deal.js 14 | web/abi/tokenfacut.json 15 | swap.js 16 | liquidity.js 17 | swap_v1.js 18 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Debug Main Process", 6 | "type": "node", 7 | "request": "launch", 8 | "cwd": "${workspaceRoot}", 9 | "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", 10 | "windows": { 11 | "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" 12 | }, 13 | "program": "${workspaceRoot}/main.js", 14 | "protocol": "inspector" 15 | }, 16 | { 17 | "name": "Debug Renderer Process", 18 | "type": "chrome", 19 | "request": "launch", 20 | "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", 21 | "windows": { 22 | "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" 23 | }, 24 | "runtimeArgs": [ 25 | "${workspaceRoot}/main.js", 26 | "--remote-debugging-port=9222" 27 | ], 28 | "webRoot": "${workspaceRoot}" 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | ================== 3 | 4 | Statement of Purpose 5 | --------------------- 6 | 7 | The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). 8 | 9 | Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. 10 | 11 | For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. 12 | 13 | 1. Copyright and Related Rights. 14 | -------------------------------- 15 | A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: 16 | 17 | i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; 18 | ii. moral rights retained by the original author(s) and/or performer(s); 19 | iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; 20 | iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; 21 | v. rights protecting the extraction, dissemination, use and reuse of data in a Work; 22 | vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and 23 | vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. 24 | 25 | 2. Waiver. 26 | ----------- 27 | To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. 28 | 29 | 3. Public License Fallback. 30 | ---------------------------- 31 | Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. 32 | 33 | 4. Limitations and Disclaimers. 34 | -------------------------------- 35 | 36 | a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. 37 | b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. 38 | c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. 39 | d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NFT批量mint程序,带源代码 2 | 3 | node.js编写,可以自己手动编译 4 | ---------------------------------------2022-10-23----------------------- 5 | 6 | **新版本使用方法** 7 | 8 | 主要是方便使用,交互逻辑优化 9 | 10 | 1、可以自动创建私钥,也可以从别的地方生成私钥之后导入 11 | 12 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/20.jpg) 13 | 14 | 2、更新EIP1559调用gas的方法,可以实时动态的设置gas price 15 | 16 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/21.jpg) 17 | 18 | 3、可以选择使用二进制方式直接跟别人的单子 19 | 20 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/23.png) 21 | 22 | 4、也可以选择像在区块链游览器交互那样通过ABI交互,ABI模式分为开源的和闭源的两种模式 23 | 24 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/24.jpg) 25 | 26 | ---------------------------------------------旧版本------------------------ 27 | 28 | 29 | 30 | **第一步配置私钥** 31 | 32 | 创建prikey.prikey ,将私钥填进去,每行填一个私钥 33 | 34 | 这个文件力的私钥一定要是新建的,私钥不能给任何人!!!! 35 | 36 | 这个文件力的私钥一定要是新建的,私钥不能给任何人!!!! 37 | 38 | 这个文件力的私钥一定要是新建的,私钥不能给任何人!!!! 39 | 40 | 41 | 42 | 43 | **第二步程序使用方法** 44 | **二进制mint方法** 45 | 46 | 47 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/1.jpg) 48 | 49 | **批量查询 balanceof NFT方法** 50 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/2.png) 51 | 52 | **开源智能合约 mint NFT方法** 53 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/3.jpg) 54 | 55 | 56 | **新版界面** 57 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/11.jpg) 58 | 59 | **注意事项** 60 | 61 | 1、敲黑板!!!!!!!!!!!! 62 | ![image](https://raw.githubusercontent.com/robotchangzhang/nftqianggou/main/img/10.jpg) 63 | 2、修复智能合约方法有重名的情况 64 | 65 | 66 | **特别感谢** 67 | 68 | 感谢西蒙斯对本项目界面优化做出的支持!!! 69 | 70 | 71 | 厂长支持地址:0x100422cdf07c187eb6a67ae931db62e35f8773ce 72 | 各条链都可以 73 | -------------------------------------------------------------------------------- /btcord.js: -------------------------------------------------------------------------------- 1 | //通过访问ord 的区块链浏览器,抓取所有ord nft的编号,id,以及图片hash 2 | //存储每次区块读写高度 3 | //获得当前最大区块 4 | 5 | const got = require('got'); 6 | const cheerio = require('cheerio'); 7 | const { imageHash } = require('image-hash'); 8 | const schedule = require('node-schedule'); 9 | 10 | var btcrpc = "http://127.0.0.1:8332" 11 | var cookiefilename = "E:\\btc\\data\\.cookie" 12 | 13 | //这里的端口号我自己修改过 14 | var serveraddr = "http://127.0.0.1:13468" 15 | var renwuj = null 16 | var fs = require("fs"); 17 | 18 | const crypto = require('crypto'); 19 | var mainWindow= null 20 | var startblock = 775633; 21 | var endblock = 778775; 22 | const lock = {}; 23 | var renwu = 0 24 | var renwuall = 0; 25 | 26 | function loadstartblock() { 27 | try { 28 | startblock = Number(fs.readFileSync('startblock.txt', 'utf8')) 29 | } catch (error) { 30 | console.log("未找到文件,请忽略该问题"); 31 | } 32 | } 33 | 34 | function writestartblock(blockid) { 35 | fs.writeFileSync('startblock.txt', blockid.toString(), 'utf8'); 36 | } 37 | 38 | 39 | async function getblockhigh() { 40 | 41 | //读取本地cookie文件 42 | const cookieStr = fs.readFileSync(cookiefilename, 'utf-8'); 43 | 44 | 45 | try 46 | { 47 | const response = await got.post(btcrpc, { 48 | headers: { 49 | 'Content-Type': 'application/json', 50 | Authorization: 51 | 'Basic ' + Buffer.from(cookieStr).toString('base64'), 52 | }, 53 | body: JSON.stringify({ 54 | method: 'getblockcount', 55 | params: [], 56 | jsonrpc: '2.0', 57 | id: Date.now(), 58 | }), 59 | }); 60 | var resluts = JSON.parse( response.body) 61 | endblock = resluts.result; 62 | console.log("btc 区块高度:"+resluts.result) 63 | } 64 | catch(e) 65 | { 66 | console.log(e); 67 | } 68 | } 69 | 70 | 71 | async function getbolck(blockid) { 72 | try { 73 | let response = await got(serveraddr + "/block/" + blockid); 74 | 75 | const $ = cheerio.load(response.body); 76 | const ul = $('body > main > ul'); 77 | const lis = ul.find('li'); 78 | const hrefs = []; 79 | lis.each(function () { 80 | const href = $(this).find('a').attr('href'); 81 | hrefs.push(href); 82 | }); 83 | return [true, hrefs]; 84 | 85 | } 86 | catch (error) { 87 | 88 | return [false] 89 | 90 | } 91 | 92 | } 93 | 94 | async function gettx(tx) { 95 | try { 96 | let response = await got(serveraddr + tx); 97 | 98 | const $ = cheerio.load(response.body); 99 | const ul = $('body > main > ul'); 100 | const lis = ul.find('li'); 101 | const hrefs = []; 102 | lis.each(function () { 103 | const href = $(this).find('a').attr('href'); 104 | hrefs.push(href); 105 | }); 106 | 107 | const div = $('body > main > div'); 108 | var link = null 109 | var herf = div.find('a').attr('href'); 110 | if (herf != null) { 111 | 112 | if (herf.indexOf("inscription") != -1) { 113 | link = herf 114 | } 115 | } 116 | 117 | return [true, hrefs, link]; 118 | 119 | } 120 | catch (error) { 121 | 122 | return [false] 123 | 124 | } 125 | 126 | } 127 | 128 | async function getoutputs(output) { 129 | try { 130 | 131 | let response = await got(serveraddr + output); 132 | 133 | const $ = cheerio.load(response.body); 134 | const ul = $('body > main > dl > dd.thumbnails'); 135 | 136 | 137 | var href = ul.find('a').attr('href'); 138 | 139 | 140 | if (href != null) { 141 | 142 | return [true, href]; 143 | 144 | 145 | } 146 | else { 147 | 148 | return [false] 149 | 150 | 151 | } 152 | 153 | } 154 | catch (error) { 155 | 156 | return [false] 157 | 158 | } 159 | 160 | } 161 | 162 | async function getInscription(inscriptionid) { 163 | try { 164 | // body > main > h1 165 | // body > main > div > iframe 166 | let response = await got(serveraddr + inscriptionid); 167 | 168 | const $ = cheerio.load(response.body); 169 | const h1 = $('body > main > h1'); 170 | var bianhao = h1.html(); 171 | var bianhaoid = Number(bianhao.replace("Inscription", "").replace(" ", "")); 172 | 173 | const niframe = $('body > main > div > iframe'); 174 | var imgsrc = niframe.attr("src"); 175 | 176 | 177 | 178 | 179 | 180 | if (bianhaoid > 0) { 181 | return [true, bianhaoid, imgsrc]; 182 | } 183 | else { 184 | return [false] 185 | } 186 | 187 | } 188 | catch (error) { 189 | 190 | return [false] 191 | 192 | } 193 | 194 | } 195 | 196 | 197 | 198 | async function getjpghash(src) { 199 | try { 200 | let response = await got(serveraddr + src); 201 | 202 | const $ = cheerio.load(response.body); 203 | const ming = $('body > img'); 204 | var imgsrc = ming.attr("src"); 205 | 206 | if (imgsrc != null) { 207 | return await getimghash(serveraddr + imgsrc) 208 | } 209 | return [false] 210 | 211 | 212 | } 213 | catch (error) { 214 | 215 | return [false] 216 | 217 | } 218 | } 219 | //775633 220 | 221 | 222 | function writeFileSyncWithLock(filePath, data) { 223 | // 获取同步锁 224 | while (lock[filePath]) { 225 | // 如果同步锁已被占用,则等待一段时间再尝试获取 226 | setTimeout(() => { }, 10); 227 | } 228 | 229 | try { 230 | // 立即占用同步锁 231 | // 先把文件清空 232 | 233 | lock[filePath] = true; 234 | fs.writeFileSync(filePath, ''); 235 | for (var i = 0; i < data.length; i++) { 236 | fs.appendFileSync(filename, data[i]) 237 | //fs.writeFileSync(filePath, data); 238 | } 239 | // 使用同步写入方式写入文件 240 | 241 | } finally { 242 | // 释放同步锁 243 | lock[filePath] = false; 244 | } 245 | } 246 | 247 | function shuchurenwu() { 248 | filePath = "renwu" 249 | while (lock[filePath]) { 250 | // 如果同步锁已被占用,则等待一段时间再尝试获取 251 | setTimeout(() => { }, 10); 252 | } 253 | 254 | try { 255 | // 立即占用同步锁 256 | // 先把文件清空 257 | 258 | lock[filePath] = true; 259 | renwu++; 260 | str = "任务进度:" + renwu + "/" + renwuall 261 | console.log(str) 262 | sendmsg(str) 263 | // 使用同步写入方式写入文件 264 | 265 | } finally { 266 | // 释放同步锁 267 | lock[filePath] = false; 268 | } 269 | } 270 | 271 | 272 | //var json = {} 273 | //分 3层,第一层 key:{} 274 | //第二层, {lowest:"id",hashes:{}} 275 | //第三层 hashes {id:inscription} 276 | async function getjson() { 277 | var json = {} 278 | for (var key of punkinfo.keys()) { 279 | 280 | 281 | var map = punkinfo.get(key) 282 | if (map.size > 0) { 283 | var keys = {} 284 | var hashes = {} 285 | var lowest = 100000000000; 286 | for (var id of map.keys()) { 287 | try { 288 | if (id < lowest) { 289 | lowest = id; 290 | } 291 | hashes[(id)] = map.get(id)[0].replace("/inscription/", ""); 292 | //str = key + "," + id + "," + map.get(id)[0].replace("/inscription/","") +","+ map.get(id)[1]+ "\n" 293 | //console.log("id:" + key + "|numberid:" + id +"|Inscription:" + map.get(id)) 294 | //addxml(str,filename); 295 | //data.push(str); 296 | } 297 | catch (e) { 298 | console.log(e); 299 | } 300 | 301 | } 302 | keys["lowest"] = (lowest); 303 | keys["hashes"] = hashes; 304 | json[(key)] = keys; 305 | 306 | } 307 | } 308 | var string = JSON.stringify(json) 309 | //console.log(string) 310 | filePath = "punk.json" 311 | fs.writeFileSync(filePath, ''); 312 | addxml(string, filePath) 313 | } 314 | 315 | async function getallinfo() { 316 | filename = "punknftid.csv" 317 | var data = [] 318 | for (var key of punkinfo.keys()) { 319 | var map = punkinfo.get(key) 320 | if (map.size > 0) { 321 | for (var id of map.keys()) { 322 | try { 323 | str = key + "," + id + "," + map.get(id)[0].replace("/inscription/", "") + "," + map.get(id)[1] + "\n" 324 | //console.log("id:" + key + "|numberid:" + id +"|Inscription:" + map.get(id)) 325 | //addxml(str,filename); 326 | data.push(str); 327 | } 328 | catch (e) { 329 | console.log(e); 330 | } 331 | 332 | } 333 | 334 | } 335 | } 336 | writeFileSyncWithLock(filename, data); 337 | shuchurenwu(); 338 | getjson(); 339 | } 340 | 341 | async function loadblockdata() { 342 | 343 | 344 | if (lock["loadblockdata"]) { 345 | // 如果有任务在执行,就直接返回 346 | return; 347 | } 348 | lock["loadblockdata"] = true; 349 | 350 | 351 | 352 | 353 | //挨个区块链遍历 354 | //var blockid = 775633; 355 | //await checkpunk(blockid); 356 | 357 | //return 358 | //getjpghash(src) 359 | 360 | //for(var blockid = 775633;blockid<778184;blockid++ ) 361 | var start = startblock; 362 | var end = endblock; 363 | renwuall = end - start; 364 | for (var blockid = start; blockid < end; blockid++) { 365 | console.log(blockid) 366 | await checkpunk(blockid); 367 | startblock = blockid; 368 | writestartblock(startblock) 369 | } 370 | lock["loadblockdata"] = false; 371 | 372 | } 373 | 374 | 375 | 376 | async function checkpunk(blockid) { 377 | let value = await getbolck(blockid); 378 | if (value[0] == true) { 379 | var list = value[1]; 380 | for (var i = 0; i < list.length; i++) { 381 | //每比交易遍历 382 | if (list[i] == "/tx/8cbc84854e03e456c1cd425329ec5d976f07ca4cf68fb0f3ede865f1029fc4f5") { 383 | i = i 384 | } 385 | let tx = await gettx(list[i]); 386 | //每笔交易又有几个output 387 | if (tx[0] == true) { 388 | var outputs = tx[1]; 389 | if (outputs.length != 1) { 390 | continue 391 | } 392 | for (var j = 0; j < outputs.length; j++) { 393 | let Inscription = await getoutputs(outputs[j]); 394 | if (Inscription[0] == true) { 395 | await getNft(Inscription[1], blockid); 396 | 397 | } 398 | else if (tx[2] != null) { 399 | await getNft(tx[2], blockid); 400 | } 401 | 402 | } 403 | } 404 | } 405 | 406 | } 407 | getallinfo() 408 | } 409 | 410 | async function getNft(Inscription, blockid) { 411 | let info = await getInscription(Inscription); 412 | if (info[0] == true) { 413 | let hash = await getjpghash(info[2]); 414 | if (hash[0] == true) { 415 | 416 | if (hashpunk.has(hash[1])) { 417 | //console.log("blockid:" + blockid + "\n" + "tx:" + list[i] + "\n" + "output:" + outputs[j] + "\n" + "Inscription:" + Inscription[1]); 418 | //console.log("编号id:" + info[1] + "\n" + "图片地址:" + info[2]); 419 | //console.log("hash:" + hash[1]); 420 | var id = hashpunk.get(hash[1]); 421 | var mymap = punkinfo.get(id); 422 | var inscriptioninfo = mymap.get(info[1]); 423 | if (inscriptioninfo == null) { 424 | mymap.set(info[1], [Inscription, blockid]); 425 | } 426 | 427 | else { 428 | if (blockid > inscriptioninfo[1]) { 429 | mymap.set(info[1], [Inscription, blockid]); 430 | } 431 | } 432 | 433 | hashpunk.set(id, mymap); 434 | } 435 | } 436 | 437 | } 438 | } 439 | 440 | function addxml(str, filename) { 441 | fs.appendFile(filename, str, (err, data) => { 442 | if (err) throw err; 443 | }); 444 | } 445 | 446 | const punkinfo = new Map() 447 | const hashpunk = new Map() 448 | 449 | 450 | function read_csv_line(csvfile) { 451 | try { 452 | let csvstr = fs.readFileSync(csvfile, "utf8", 'r+'); 453 | let arr = csvstr.split('\n'); 454 | 455 | 456 | for (var i = 0; i < arr.length; i++) { 457 | var line = arr[i]; 458 | let data = line.split(','); 459 | punkinfo.set(Number(data[0]), new Map()); 460 | hashpunk.set(data[1], Number(data[0])); 461 | } 462 | } 463 | catch (e) { 464 | console.log("没找到文件:" + csvfile) 465 | } 466 | 467 | } 468 | //urlstart = "C:\\Users\\laoxia\\Desktop\\punk" 469 | // hash1 = urlstart + "7901" + urlend 470 | // hash2 = urlstart + "8191" + urlend 471 | // let varhash = await getimghash(hash1); 472 | // let varhash2 = await getimghash(hash2); 473 | // if(varhash[1] == varhash2[1]) 474 | // { 475 | // console.log("相同") 476 | // } 477 | 478 | //加载所有map 479 | function loadpunk(csvfile) { 480 | try { 481 | let csvstr = fs.readFileSync(csvfile, "utf8", 'r+'); 482 | let arr = csvstr.split('\n'); 483 | 484 | 485 | for (var i = 0; i < arr.length; i++) { 486 | var line = arr[i]; 487 | let data = line.split(','); 488 | var id = Number(data[0]) 489 | if (id > 0) { 490 | var map = punkinfo.get(id) 491 | map.set(Number(data[1]), [data[2], data[3]]) 492 | punkinfo.set(id, map); 493 | } 494 | 495 | } 496 | } 497 | catch (e) { 498 | console.log("没找到文件:" + csvfile) 499 | } 500 | 501 | 502 | 503 | } 504 | 505 | function getHashInfo() { 506 | var filename = "punk.csv" 507 | read_csv_line(filename) 508 | loadpunk("punknftid.csv") 509 | } 510 | 511 | //下载整个btc punk的数据,进行md5运算,并存入csv 512 | async function testpunk() { 513 | //读取已经下载过的数据,防止重复下载 514 | getHashInfo() 515 | //拼接整个下载地址 516 | urlstart = "https://cryptopunks.app/public/images/cryptopunks/punk" 517 | urlend = ".png" 518 | for (var i = 1001; i < 10000; i++) { 519 | if (punkinfo.has(i)) { //如果已经下载过了,就跳过 520 | continue 521 | } 522 | url = urlstart + i + urlend; 523 | download(url, i, filename); 524 | } 525 | } 526 | //下载并存csv函数 527 | async function download(url, i, filename) { 528 | let hash = await getimghash(url); 529 | if (hash[0] == true) { 530 | // 写入格式为 nft编号,hash值 531 | var msg = i + "," + hash[1] + "\n"; 532 | addxml(msg, filename); 533 | } 534 | } 535 | //对图片进行下载并且进行md5加密获得一串hash值 536 | async function getimghash(src) { 537 | try { 538 | let response = await got(src); 539 | const hash = crypto.createHash('md5'); 540 | hash.update(response.body); 541 | const md5 = "0x" + hash.digest('hex'); 542 | return [true, md5] 543 | } 544 | catch (error) { 545 | 546 | return [false] 547 | } 548 | } 549 | 550 | //初始化 551 | 552 | async function punkselect() 553 | { 554 | //如果第一次跑,要多下载几次punk数据 555 | //await testpunk() 556 | 557 | //加载上一次执行的任务 558 | loadstartblock(); 559 | //获取最新区块高度 560 | await getblockhigh(); 561 | //加载punk hash文件以及 punk nft 统计文件 562 | getHashInfo() 563 | 564 | //开始遍历整个区块链的数据 565 | loadblockdata() 566 | 567 | //开启定时任务 568 | if(renwuj == null) 569 | { 570 | renwuj = task() 571 | } 572 | 573 | } 574 | 575 | const task = async () => { 576 | //每分钟的1-10秒都会触发,其它通配符依次类推 577 | //console.log("123111"); 578 | //console.log(value); 579 | //console.log(count); 580 | console.log('start'); 581 | 582 | //每分钟执行一次 583 | const j = schedule.scheduleJob('0 * * * * *', async () => { 584 | try { 585 | //获取最新区块高度 586 | await getblockhigh(); 587 | 588 | 589 | //开始遍历整个区块链的数据 590 | loadblockdata() 591 | } 592 | catch (e) { 593 | console.log(e); 594 | } 595 | 596 | 597 | }) 598 | return j; 599 | } 600 | 601 | //启动程序 602 | //Init() 603 | function setmainWindow(newmainWindow) { 604 | mainWindow = newmainWindow; 605 | } 606 | 607 | function sendmsg(msg) { 608 | if (mainWindow != null) { 609 | mainWindow.webContents.send("info:msg", { msg }); 610 | } 611 | } 612 | 613 | function setInit(value) 614 | { 615 | btcrpc = value.btcrpc; 616 | cookiefilename = value.cookiefilename; 617 | serveraddr = value.btcordrpc; 618 | sendmsg("设置完成。") 619 | 620 | } 621 | 622 | async function punkimgdownload() 623 | { 624 | await testpunk() 625 | } 626 | 627 | function punkidselect(punkid) 628 | { 629 | var json = {} 630 | var key = Number(punkid); 631 | if(punkinfo.has(key)) 632 | { 633 | 634 | 635 | var map = punkinfo.get(key) 636 | if (map.size > 0) { 637 | var keys = {} 638 | var hashes = {} 639 | var lowest = 100000000000; 640 | for (var id of map.keys()) { 641 | try { 642 | if (id < lowest) { 643 | lowest = id; 644 | } 645 | hashes[(id)] = map.get(id)[0].replace("/inscription/", ""); 646 | //str = key + "," + id + "," + map.get(id)[0].replace("/inscription/","") +","+ map.get(id)[1]+ "\n" 647 | //console.log("id:" + key + "|numberid:" + id +"|Inscription:" + map.get(id)) 648 | //addxml(str,filename); 649 | //data.push(str); 650 | } 651 | catch (e) { 652 | console.log(e); 653 | } 654 | 655 | } 656 | keys["lowest"] = (lowest); 657 | keys["hashes"] = hashes; 658 | json[(key)] = keys; 659 | 660 | } 661 | } 662 | else 663 | { 664 | json = {"result":"notfind"} 665 | } 666 | var string = JSON.stringify(json) 667 | sendmsg(string) 668 | return string; 669 | } 670 | //导出函数 671 | module.exports = { 672 | setInit:setInit, 673 | setmainWindow: setmainWindow, 674 | punkimgdownload:punkimgdownload, 675 | punkselectblockinfo:punkselect, 676 | punkidselect:punkidselect 677 | 678 | } 679 | 680 | 681 | 682 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "network": "eth", 4 | "rpc": "https://mainnet.infura.io/v3/e1d0b7dea53643a194cadb6ed123f88e", 5 | "ws": "wss://mainnet.infura.io/v3/e1d0b7dea53643a194cadb6ed123f88e", 6 | "chainid": "1", 7 | "apiurl": "https://api.etherscan.com/api?module=contract&action=getsourcecode&address=" 8 | }, 9 | { 10 | "network": "Avalanche C", 11 | "rpc": "https://avalanche-mainnet.infura.io/v3/e1d0b7dea53643a194cadb6ed123f88e", 12 | "ws": "", 13 | "chainid": "43114", 14 | "apiurl": "https://api.snowtrace.io/api?module=contract&action=getsourcecode&address=" 15 | }, 16 | { 17 | "network": "Goerli", 18 | "rpc": "https://eth-goerli.g.alchemy.com/v2/ogul4IQr3nQ_8qJ2U7ddatxz9cyfIZXQ", 19 | "ws": "", 20 | "chainid": "5", 21 | "apiurl": "https://api-goerli.etherscan.io/api?module=contract&action=getsourcecode&address=" 22 | }, 23 | { 24 | "network": "ropsten", 25 | "rpc": "https://ropsten.infura.io/v3/e1d0b7dea53643a194cadb6ed123f88e", 26 | "ws": "wss://ropsten.infura.io/v3/e1d0b7dea53643a194cadb6ed123f88e", 27 | "chainid": "3", 28 | "apiurl": "https://api-ropsten.etherscan.io/api?module=contract&action=getsourcecode&address=" 29 | }, 30 | { 31 | "network": "matic", 32 | "rpc": "https://polygon-rpc.com/", 33 | "ws": "", 34 | "chainid": "137", 35 | "apiurl": "https://api.polygonscan.com/api?module=contract&action=getsourcecode&address=" 36 | }, 37 | { 38 | "network": "op", 39 | "rpc": "https://mainnet.optimism.io", 40 | "ws": "", 41 | "chainid": "10", 42 | "apiurl": "https://api-optimistic.etherscan.io/api?module=contract&action=getsourcecode&address=" 43 | }, 44 | { 45 | "network": "bsc", 46 | "rpc": "https://bsc-dataseed1.binance.org", 47 | "ws": "", 48 | "chainid": "56", 49 | "apiurl": "https://api.bscscan.com/api?module=contract&action=getsourcecode&address=" 50 | }, 51 | { 52 | "network": "Sepolia", 53 | "rpc": "https://sepolia.infura.io/v3/e1d0b7dea53643a194cadb6ed123f88e", 54 | "ws": "wss://sepolia.infura.io/v3/e1d0b7dea53643a194cadb6ed123f88e", 55 | "chainid": "11155111", 56 | "apiurl": "https://sepolia.etherscan.io/api?module=contract&action=getsourcecode&address=" 57 | } 58 | 59 | ] -------------------------------------------------------------------------------- /confighandle.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | // 读取JSON配置文件 4 | function readConfigFile(filePath) { 5 | try { 6 | const data = fs.readFileSync(filePath, 'utf8'); 7 | const jsonData = JSON.parse(data); 8 | return jsonData; 9 | } catch (error) { 10 | console.error('Error reading the config file:', error); 11 | } 12 | } 13 | 14 | // 写入JSON配置文件 15 | function writeConfigFile(filePath, data) { 16 | try { 17 | const jsonData = JSON.stringify(data, null, 4); 18 | fs.writeFileSync(filePath, jsonData, 'utf8'); 19 | } catch (error) { 20 | console.error('Error writing the config file:', error); 21 | } 22 | } 23 | 24 | function getElementById(configData,id) 25 | { 26 | 27 | const existingTaskIndex = configData.findIndex(item => item.id === id); 28 | if (existingTaskIndex !== -1) { 29 | return configData[existingTaskIndex] ; 30 | } else { 31 | return null; 32 | } 33 | 34 | } 35 | 36 | 37 | // 更新或添加任务 38 | function updateOrAddTask(configData, task) { 39 | const existingTaskIndex = configData.findIndex(item => item.id === task.id); 40 | 41 | if (existingTaskIndex !== -1) { 42 | configData[existingTaskIndex] = task; 43 | return false; 44 | } else { 45 | configData.push(task); 46 | return true; 47 | } 48 | } 49 | 50 | // 根据ID删除任务 51 | function deleteTaskById(configData, taskId) { 52 | const taskIndex = configData.findIndex(item => item.id === taskId); 53 | 54 | if (taskIndex !== -1) { 55 | configData.splice(taskIndex, 1); 56 | } else { 57 | console.log(`Task with ID ${taskId} not found.`); 58 | } 59 | } 60 | 61 | 62 | module.exports={ 63 | readConfigFile:readConfigFile, 64 | writeConfigFile:writeConfigFile, 65 | updateOrAddTask:updateOrAddTask, 66 | deleteTaskById:deleteTaskById, 67 | getElementById:getElementById 68 | 69 | } 70 | -------------------------------------------------------------------------------- /dealContract.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | var fs = require('fs'); 3 | //bsc 4 | //tokenaddress = "0x6B653D6dC0EECbb94256fb269593AA0A8736a3bD" 5 | //apiurl = 'https://api.bscscan.com/api?module=contract&action=getsourcecode&address=' 6 | 7 | //eth 8 | //tokenaddress = "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85" 9 | //apiurl = 'https://api.etherscan.com/api?module=contract&action=getsourcecode&address=' 10 | 11 | 12 | //matic 13 | //tokenaddress = "0x2f85e99067ddefb7f6d0f71efa32cc0056d322bb" 14 | //apiurl = 'https://api.polygonscan.com/api?module=contract&action=getsourcecode&address=' 15 | require('dotenv').config() 16 | const { env } = process 17 | 18 | const useproxy = Number(env.PROXYUSE) 19 | 20 | let opts = { 21 | 22 | host: env.PROXYIP, 23 | 24 | port: Number(env.PROXYPORT) 25 | 26 | } 27 | 28 | 29 | async function getContract(url, address) { 30 | return new Promise((resolve, reject) => { 31 | if(useproxy==1) 32 | { 33 | axios.post(url + address,{proxy:opts}).then(res => { 34 | if (res.data.status == 1) { 35 | resolve([true, res.data.result[0]]); 36 | 37 | } 38 | else { 39 | reject([false, "未找到"]); 40 | } 41 | }) 42 | } 43 | else 44 | { 45 | axios.post(url + address).then(res => { 46 | if (res.data.status == 1) { 47 | resolve([true, res.data.result[0]]); 48 | 49 | } 50 | else { 51 | reject([false, "未找到"]); 52 | } 53 | }) 54 | } 55 | }) 56 | } 57 | 58 | async function startEx(apiurl, tokenaddress) { 59 | console.log('good!') 60 | let sourcecode = await getContract(apiurl, tokenaddress); 61 | console.log(sourcecode) 62 | // 获取开源智能合约的ABI 63 | if (sourcecode[0] && sourcecode[1].ABI != "Contract source code not verified") { 64 | var stringABI = sourcecode[1].ABI; 65 | //将string abi 转换成json; 66 | var jsonabi = JSON.parse(stringABI); 67 | console.log(jsonabi); 68 | //将json 转换成3种可调用的function 69 | /* 70 | abi type=function分为三种情况: 71 | 1、只读函数 , "stateMutability": "view" 72 | 2、写函数,不需要主币支付费用  "stateMutability": "nonpayable", 73 | 3、写函数,需要主币支付费用  "stateMutability": "payable", 74 | */ 75 | return fenxiabi(jsonabi); 76 | } 77 | else { 78 | return [false] 79 | } 80 | //console.log(sourcecode); 81 | } 82 | 83 | function fenxiabi(jsonabi) { 84 | var viewabi = new Map(); 85 | var payableabi = new Map(); 86 | var nonpayable = new Map(); 87 | var i = 0; 88 | jsonabi.forEach(element => { 89 | if (element.type == 'function') { 90 | if (element.stateMutability == 'view') { 91 | element.id = i; 92 | viewabi.set(element.name + ":" + i, element); 93 | } 94 | else if (element.stateMutability == 'nonpayable') { 95 | element.id = i; 96 | nonpayable.set(element.name + ":" + i, element); 97 | } 98 | else if (element.stateMutability == 'payable') { 99 | element.id = i; 100 | payableabi.set(element.name + ":" + i, element); 101 | } 102 | i++; 103 | } 104 | }); 105 | //这三种方法没问题了,查询没问题了 106 | console.log("----------------------------------------------"); 107 | console.log("view"); 108 | console.log(viewabi); 109 | 110 | console.log("----------------------------------------------"); 111 | console.log("nonpayable"); 112 | console.log(nonpayable); 113 | 114 | console.log("----------------------------------------------"); 115 | console.log("payable"); 116 | console.log(payableabi); 117 | return [true, viewabi, nonpayable, payableabi]; 118 | } 119 | 120 | async function start(value) { 121 | return await startEx(value.apiurl, value.contractaddress); 122 | } 123 | 124 | function loadlocalABI(filename) 125 | { 126 | 127 | //读取 abi 128 | var abi = fs.readFileSync(filename).toString(); 129 | var jsonabi = JSON.parse(abi); 130 | console.log(jsonabi); 131 | return fenxiabi(jsonabi); 132 | } 133 | 134 | module.exports = { 135 | start:start, 136 | loadlocalABI:loadlocalABI, 137 | } -------------------------------------------------------------------------------- /erc20.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "string", 6 | "name": "_name", 7 | "type": "string" 8 | }, 9 | { 10 | "internalType": "string", 11 | "name": "_symbol", 12 | "type": "string" 13 | }, 14 | { 15 | "internalType": "uint8", 16 | "name": "_decimals", 17 | "type": "uint8" 18 | }, 19 | { 20 | "internalType": "address", 21 | "name": "_owner", 22 | "type": "address" 23 | } 24 | ], 25 | "stateMutability": "nonpayable", 26 | "type": "constructor" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "address", 34 | "name": "owner", 35 | "type": "address" 36 | }, 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "spender", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": false, 45 | "internalType": "uint256", 46 | "name": "value", 47 | "type": "uint256" 48 | } 49 | ], 50 | "name": "Approval", 51 | "type": "event" 52 | }, 53 | { 54 | "anonymous": false, 55 | "inputs": [ 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "oldOwner", 60 | "type": "address" 61 | }, 62 | { 63 | "indexed": true, 64 | "internalType": "address", 65 | "name": "newOwner", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": true, 70 | "internalType": "uint256", 71 | "name": "effectiveTime", 72 | "type": "uint256" 73 | } 74 | ], 75 | "name": "LogChangeDCRMOwner", 76 | "type": "event" 77 | }, 78 | { 79 | "anonymous": false, 80 | "inputs": [ 81 | { 82 | "indexed": true, 83 | "internalType": "bytes32", 84 | "name": "txhash", 85 | "type": "bytes32" 86 | }, 87 | { 88 | "indexed": true, 89 | "internalType": "address", 90 | "name": "account", 91 | "type": "address" 92 | }, 93 | { 94 | "indexed": false, 95 | "internalType": "uint256", 96 | "name": "amount", 97 | "type": "uint256" 98 | } 99 | ], 100 | "name": "LogSwapin", 101 | "type": "event" 102 | }, 103 | { 104 | "anonymous": false, 105 | "inputs": [ 106 | { 107 | "indexed": true, 108 | "internalType": "address", 109 | "name": "account", 110 | "type": "address" 111 | }, 112 | { 113 | "indexed": true, 114 | "internalType": "address", 115 | "name": "bindaddr", 116 | "type": "address" 117 | }, 118 | { 119 | "indexed": false, 120 | "internalType": "uint256", 121 | "name": "amount", 122 | "type": "uint256" 123 | } 124 | ], 125 | "name": "LogSwapout", 126 | "type": "event" 127 | }, 128 | { 129 | "anonymous": false, 130 | "inputs": [ 131 | { 132 | "indexed": true, 133 | "internalType": "address", 134 | "name": "from", 135 | "type": "address" 136 | }, 137 | { 138 | "indexed": true, 139 | "internalType": "address", 140 | "name": "to", 141 | "type": "address" 142 | }, 143 | { 144 | "indexed": false, 145 | "internalType": "uint256", 146 | "name": "value", 147 | "type": "uint256" 148 | } 149 | ], 150 | "name": "Transfer", 151 | "type": "event" 152 | }, 153 | { 154 | "inputs": [ ], 155 | "name": "DOMAIN_SEPARATOR", 156 | "outputs": [ 157 | { 158 | "internalType": "bytes32", 159 | "name": "", 160 | "type": "bytes32" 161 | } 162 | ], 163 | "stateMutability": "view", 164 | "type": "function" 165 | }, 166 | { 167 | "inputs": [ ], 168 | "name": "PERMIT_TYPEHASH", 169 | "outputs": [ 170 | { 171 | "internalType": "bytes32", 172 | "name": "", 173 | "type": "bytes32" 174 | } 175 | ], 176 | "stateMutability": "view", 177 | "type": "function" 178 | }, 179 | { 180 | "inputs": [ 181 | { 182 | "internalType": "bytes32", 183 | "name": "txhash", 184 | "type": "bytes32" 185 | }, 186 | { 187 | "internalType": "address", 188 | "name": "account", 189 | "type": "address" 190 | }, 191 | { 192 | "internalType": "uint256", 193 | "name": "amount", 194 | "type": "uint256" 195 | } 196 | ], 197 | "name": "Swapin", 198 | "outputs": [ 199 | { 200 | "internalType": "bool", 201 | "name": "", 202 | "type": "bool" 203 | } 204 | ], 205 | "stateMutability": "nonpayable", 206 | "type": "function" 207 | }, 208 | { 209 | "inputs": [ 210 | { 211 | "internalType": "uint256", 212 | "name": "amount", 213 | "type": "uint256" 214 | }, 215 | { 216 | "internalType": "address", 217 | "name": "bindaddr", 218 | "type": "address" 219 | } 220 | ], 221 | "name": "Swapout", 222 | "outputs": [ 223 | { 224 | "internalType": "bool", 225 | "name": "", 226 | "type": "bool" 227 | } 228 | ], 229 | "stateMutability": "nonpayable", 230 | "type": "function" 231 | }, 232 | { 233 | "inputs": [ ], 234 | "name": "TRANSFER_TYPEHASH", 235 | "outputs": [ 236 | { 237 | "internalType": "bytes32", 238 | "name": "", 239 | "type": "bytes32" 240 | } 241 | ], 242 | "stateMutability": "view", 243 | "type": "function" 244 | }, 245 | { 246 | "inputs": [ 247 | { 248 | "internalType": "address", 249 | "name": "", 250 | "type": "address" 251 | }, 252 | { 253 | "internalType": "address", 254 | "name": "", 255 | "type": "address" 256 | } 257 | ], 258 | "name": "allowance", 259 | "outputs": [ 260 | { 261 | "internalType": "uint256", 262 | "name": "", 263 | "type": "uint256" 264 | } 265 | ], 266 | "stateMutability": "view", 267 | "type": "function" 268 | }, 269 | { 270 | "inputs": [ 271 | { 272 | "internalType": "address", 273 | "name": "spender", 274 | "type": "address" 275 | }, 276 | { 277 | "internalType": "uint256", 278 | "name": "value", 279 | "type": "uint256" 280 | } 281 | ], 282 | "name": "approve", 283 | "outputs": [ 284 | { 285 | "internalType": "bool", 286 | "name": "", 287 | "type": "bool" 288 | } 289 | ], 290 | "stateMutability": "nonpayable", 291 | "type": "function" 292 | }, 293 | { 294 | "inputs": [ 295 | { 296 | "internalType": "address", 297 | "name": "spender", 298 | "type": "address" 299 | }, 300 | { 301 | "internalType": "uint256", 302 | "name": "value", 303 | "type": "uint256" 304 | }, 305 | { 306 | "internalType": "bytes", 307 | "name": "data", 308 | "type": "bytes" 309 | } 310 | ], 311 | "name": "approveAndCall", 312 | "outputs": [ 313 | { 314 | "internalType": "bool", 315 | "name": "", 316 | "type": "bool" 317 | } 318 | ], 319 | "stateMutability": "nonpayable", 320 | "type": "function" 321 | }, 322 | { 323 | "inputs": [ 324 | { 325 | "internalType": "address", 326 | "name": "", 327 | "type": "address" 328 | } 329 | ], 330 | "name": "balanceOf", 331 | "outputs": [ 332 | { 333 | "internalType": "uint256", 334 | "name": "", 335 | "type": "uint256" 336 | } 337 | ], 338 | "stateMutability": "view", 339 | "type": "function" 340 | }, 341 | { 342 | "inputs": [ 343 | { 344 | "internalType": "address", 345 | "name": "newOwner", 346 | "type": "address" 347 | } 348 | ], 349 | "name": "changeDCRMOwner", 350 | "outputs": [ 351 | { 352 | "internalType": "bool", 353 | "name": "", 354 | "type": "bool" 355 | } 356 | ], 357 | "stateMutability": "nonpayable", 358 | "type": "function" 359 | }, 360 | { 361 | "inputs": [ ], 362 | "name": "decimals", 363 | "outputs": [ 364 | { 365 | "internalType": "uint8", 366 | "name": "", 367 | "type": "uint8" 368 | } 369 | ], 370 | "stateMutability": "view", 371 | "type": "function" 372 | }, 373 | { 374 | "inputs": [ ], 375 | "name": "name", 376 | "outputs": [ 377 | { 378 | "internalType": "string", 379 | "name": "", 380 | "type": "string" 381 | } 382 | ], 383 | "stateMutability": "view", 384 | "type": "function" 385 | }, 386 | { 387 | "inputs": [ 388 | { 389 | "internalType": "address", 390 | "name": "", 391 | "type": "address" 392 | } 393 | ], 394 | "name": "nonces", 395 | "outputs": [ 396 | { 397 | "internalType": "uint256", 398 | "name": "", 399 | "type": "uint256" 400 | } 401 | ], 402 | "stateMutability": "view", 403 | "type": "function" 404 | }, 405 | { 406 | "inputs": [ ], 407 | "name": "owner", 408 | "outputs": [ 409 | { 410 | "internalType": "address", 411 | "name": "", 412 | "type": "address" 413 | } 414 | ], 415 | "stateMutability": "view", 416 | "type": "function" 417 | }, 418 | { 419 | "inputs": [ 420 | { 421 | "internalType": "address", 422 | "name": "target", 423 | "type": "address" 424 | }, 425 | { 426 | "internalType": "address", 427 | "name": "spender", 428 | "type": "address" 429 | }, 430 | { 431 | "internalType": "uint256", 432 | "name": "value", 433 | "type": "uint256" 434 | }, 435 | { 436 | "internalType": "uint256", 437 | "name": "deadline", 438 | "type": "uint256" 439 | }, 440 | { 441 | "internalType": "uint8", 442 | "name": "v", 443 | "type": "uint8" 444 | }, 445 | { 446 | "internalType": "bytes32", 447 | "name": "r", 448 | "type": "bytes32" 449 | }, 450 | { 451 | "internalType": "bytes32", 452 | "name": "s", 453 | "type": "bytes32" 454 | } 455 | ], 456 | "name": "permit", 457 | "outputs": [ ], 458 | "stateMutability": "nonpayable", 459 | "type": "function" 460 | }, 461 | { 462 | "inputs": [ ], 463 | "name": "symbol", 464 | "outputs": [ 465 | { 466 | "internalType": "string", 467 | "name": "", 468 | "type": "string" 469 | } 470 | ], 471 | "stateMutability": "view", 472 | "type": "function" 473 | }, 474 | { 475 | "inputs": [ ], 476 | "name": "totalSupply", 477 | "outputs": [ 478 | { 479 | "internalType": "uint256", 480 | "name": "", 481 | "type": "uint256" 482 | } 483 | ], 484 | "stateMutability": "view", 485 | "type": "function" 486 | }, 487 | { 488 | "inputs": [ 489 | { 490 | "internalType": "address", 491 | "name": "to", 492 | "type": "address" 493 | }, 494 | { 495 | "internalType": "uint256", 496 | "name": "value", 497 | "type": "uint256" 498 | } 499 | ], 500 | "name": "transfer", 501 | "outputs": [ 502 | { 503 | "internalType": "bool", 504 | "name": "", 505 | "type": "bool" 506 | } 507 | ], 508 | "stateMutability": "nonpayable", 509 | "type": "function" 510 | }, 511 | { 512 | "inputs": [ 513 | { 514 | "internalType": "address", 515 | "name": "to", 516 | "type": "address" 517 | }, 518 | { 519 | "internalType": "uint256", 520 | "name": "value", 521 | "type": "uint256" 522 | }, 523 | { 524 | "internalType": "bytes", 525 | "name": "data", 526 | "type": "bytes" 527 | } 528 | ], 529 | "name": "transferAndCall", 530 | "outputs": [ 531 | { 532 | "internalType": "bool", 533 | "name": "", 534 | "type": "bool" 535 | } 536 | ], 537 | "stateMutability": "nonpayable", 538 | "type": "function" 539 | }, 540 | { 541 | "inputs": [ 542 | { 543 | "internalType": "address", 544 | "name": "from", 545 | "type": "address" 546 | }, 547 | { 548 | "internalType": "address", 549 | "name": "to", 550 | "type": "address" 551 | }, 552 | { 553 | "internalType": "uint256", 554 | "name": "value", 555 | "type": "uint256" 556 | } 557 | ], 558 | "name": "transferFrom", 559 | "outputs": [ 560 | { 561 | "internalType": "bool", 562 | "name": "", 563 | "type": "bool" 564 | } 565 | ], 566 | "stateMutability": "nonpayable", 567 | "type": "function" 568 | }, 569 | { 570 | "inputs": [ 571 | { 572 | "internalType": "address", 573 | "name": "target", 574 | "type": "address" 575 | }, 576 | { 577 | "internalType": "address", 578 | "name": "to", 579 | "type": "address" 580 | }, 581 | { 582 | "internalType": "uint256", 583 | "name": "value", 584 | "type": "uint256" 585 | }, 586 | { 587 | "internalType": "uint256", 588 | "name": "deadline", 589 | "type": "uint256" 590 | }, 591 | { 592 | "internalType": "uint8", 593 | "name": "v", 594 | "type": "uint8" 595 | }, 596 | { 597 | "internalType": "bytes32", 598 | "name": "r", 599 | "type": "bytes32" 600 | }, 601 | { 602 | "internalType": "bytes32", 603 | "name": "s", 604 | "type": "bytes32" 605 | } 606 | ], 607 | "name": "transferWithPermit", 608 | "outputs": [ 609 | { 610 | "internalType": "bool", 611 | "name": "", 612 | "type": "bool" 613 | } 614 | ], 615 | "stateMutability": "nonpayable", 616 | "type": "function" 617 | } 618 | ]; -------------------------------------------------------------------------------- /img/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/1.jpg -------------------------------------------------------------------------------- /img/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/10.jpg -------------------------------------------------------------------------------- /img/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/11.jpg -------------------------------------------------------------------------------- /img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/2.png -------------------------------------------------------------------------------- /img/20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/20.jpg -------------------------------------------------------------------------------- /img/21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/21.jpg -------------------------------------------------------------------------------- /img/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/23.png -------------------------------------------------------------------------------- /img/24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/24.jpg -------------------------------------------------------------------------------- /img/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robotchangzhang/nftqianggou/12c81439b4920d98047a21fad616e45728215b2c/img/3.jpg -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | // Modules to control application life and create native browser window 2 | const electron = require('electron') 3 | const path = require('path') 4 | const duoxiancheng = require('./duoxiancheng_v1') 5 | const queryContract = require("./dealContract") 6 | const schedule = require('node-schedule'); 7 | const { dialog } = require('electron') 8 | const punk = require('./btcord') 9 | const ipcMain = electron.ipcMain 10 | const app = electron.app 11 | const BrowserWindow = electron.BrowserWindow 12 | const confighelper = require("./confighandle") 13 | 14 | 15 | 16 | let mainWindow = null 17 | const qianggou =new duoxiancheng.EthereumManager(); 18 | const configFilePath = "./taskconfig.json" 19 | const configData = confighelper.readConfigFile(configFilePath); 20 | 21 | const tasklist =[] //用来管理任务队列,新增任务,删除任务的是,要从这里面增加删除。 22 | function createWindow() { 23 | // Create the browser window. 24 | mainWindow = new BrowserWindow({ 25 | width: 1900, 26 | height: 1000, 27 | webPreferences: { 28 | preload: path.join(__dirname, 'preload.js'), 29 | 30 | nodeIntegration: true, 31 | contextIsolation: false 32 | 33 | } 34 | }) 35 | 36 | // and load the index.html of the app. 37 | mainWindow.loadFile('./web/index.html') 38 | duoxiancheng.setmainWindow(mainWindow); 39 | 40 | punk.setmainWindow(mainWindow); 41 | //const mainMenu = Menu.buildFromTemplate(menuTemplate); 42 | //Menu.setApplicationMenu(mainMenu); 43 | // Open the DevTools. 44 | //mainWindow.webContents.openDevTools() 45 | 46 | 47 | } 48 | 49 | // This method will be called when Electron has finished 50 | // initialization and is ready to create browser windows. 51 | // Some APIs can only be used after this event occurs. 52 | app.whenReady().then(() => { 53 | createWindow() 54 | 55 | app.on('activate', function () { 56 | // On macOS it's common to re-create a window in the app when the 57 | // dock icon is clicked and there are no other windows open. 58 | if (BrowserWindow.getAllWindows().length === 0) createWindow() 59 | }) 60 | }) 61 | 62 | // Quit when all windows are closed, except on macOS. There, it's common 63 | // for applications and their menu bar to stay active until the user quits 64 | // explicitly with Cmd + Q. 65 | app.on('window-all-closed', function () { 66 | if (process.platform !== 'darwin') app.quit() 67 | }) 68 | 69 | //app.commandLine.appendSwitch('proxy-server', 'socks5://127.0.0.1:10808'); 70 | 71 | // In this file you can include the rest of your app's specific main process 72 | // code. You can also put them in separate files and require them here. 73 | var bInitTask = false; 74 | 75 | async function alltask() 76 | { 77 | if(bInitTask) 78 | { 79 | return 80 | } 81 | bInitTask = true; 82 | //启动 task 83 | for(var i=0;i { 129 | 130 | timeresult = gettime(data.exectime) 131 | if(timeresult[0]) 132 | { 133 | const j = schedule.scheduleJob(timeresult[1], async () => { 134 | //脚本地址 135 | data = confighelper.getElementById(configData,data.id); 136 | 137 | if(data == null || Number(data.rematimes)<1) 138 | { 139 | return; 140 | } 141 | filename = data.scriptpath 142 | try { 143 | const dynamicModule = require(filename); 144 | if (typeof dynamicModule.start === 'function') { 145 | 146 | await dynamicModule.start(data); 147 | } else { 148 | console.error(`Error: The file ${filename} does not have a start function.`); 149 | } 150 | data.rematimes = Number(data.rematimes)-1; 151 | data.lastExecTime = formatDate( new Date()); 152 | confighelper.updateOrAddTask(configData,data); 153 | confighelper.writeConfigFile(configFilePath, configData); 154 | //给页面发送通知 155 | mainWindow.webContents.send("info:taskInit", { configData}); 156 | clearModuleCache(filename); 157 | } catch (error) { 158 | clearModuleCache(filename); 159 | console.error(`Error loading and executing file: ${filename}`, error); 160 | } 161 | 162 | }) 163 | tasklist.push({"id":data.id,"renwuj":j}) 164 | return j; 165 | } 166 | 167 | } 168 | 169 | async function addTask(taskData) { 170 | // Update configData and save it to the file 171 | 172 | 173 | // Create a new task and add it to the tasklist 174 | const newTask = await taskcreate(taskData); 175 | 176 | } 177 | 178 | const eventListener = async () => { 179 | ipcMain.on('info:initweb3', async (e, value) => { 180 | console.log("info:initweb3"); 181 | console.log(value) 182 | result = qianggou.initWeb3(value) 183 | 184 | mainWindow.webContents.send("info:initweb3", { result }); 185 | }) 186 | 187 | ipcMain.on('info:qianggou', async (e, value) => { 188 | console.log("info:qianggou"); 189 | console.log(value) 190 | result = qianggou.qianggou(value) 191 | 192 | mainWindow.webContents.send("info:qianggou", { result }); 193 | }) 194 | 195 | ipcMain.on('info:test', async (e, value) => { 196 | console.log("info:test"); 197 | console.log(value) 198 | result = qianggou.test(value) 199 | 200 | mainWindow.webContents.send("info:test", { result }); 201 | }) 202 | 203 | ipcMain.on('info:queryabi', async (e, value) => { 204 | console.log("info:queryabi"); 205 | console.log(value) 206 | 207 | result = await queryContract.start(value) 208 | 209 | mainWindow.webContents.send("info:queryabi", { result }); 210 | }) 211 | 212 | ipcMain.on('info:abishiyong', async (e, value) => { 213 | console.log("info:abishiyong"); 214 | console.log(value) 215 | result = qianggou.abishiyong(value) 216 | //result = await queryContract.abishiyong(value) 217 | 218 | //mainWindow.webContents.send("info:abishiyong", { result }); 219 | }) 220 | 221 | ipcMain.on('info:accounts', async (e, value) => { 222 | console.log("info:accounts"); 223 | console.log(value) 224 | result = qianggou.accounts(); 225 | 226 | console.log(result); 227 | 228 | mainWindow.webContents.send("info:accounts", { result }); 229 | }) 230 | 231 | ipcMain.on('info:creatpriatenumber', async (e, value) => { 232 | console.log("info:creatpriatenumber"); 233 | console.log(value) 234 | result = qianggou.creatpriatenumber(value); 235 | 236 | 237 | mainWindow.webContents.send("info:creatpriatenumber", { result }); 238 | }) 239 | 240 | ipcMain.on('info:importprikey', async (e, value) => { 241 | console.log("info:importprikey"); 242 | 243 | 244 | filename = await dialog.showOpenDialog({ properties: ['openFile'] }); 245 | if (filename.canceled == false) { 246 | qianggou.importprikey(filename.filePaths); 247 | } 248 | 249 | //result = 250 | 251 | 252 | //mainWindow.webContents.send("info:importprikey", { }); 253 | }) 254 | 255 | 256 | 257 | ipcMain.on('info:exportprikey', async (e, value) => { 258 | console.log("info:exportprikey"); 259 | 260 | 261 | filename = await dialog.showOpenDialog({ properties: ['openDirectory'] }); 262 | if (filename.canceled == false) { 263 | qianggou.exportprikey(filename.filePaths); 264 | } 265 | 266 | //result = 267 | 268 | 269 | //mainWindow.webContents.send("info:importprikey", { }); 270 | }) 271 | 272 | 273 | ipcMain.on('info:pilianglingshui', async (e, value) => { 274 | console.log("info:pilianglingshui"); 275 | filename = await dialog.showOpenDialog({ properties: ['openFile'] }); 276 | if (filename.canceled == false) { 277 | try { 278 | const dynamicModule = require(filename.filePaths[0]); 279 | if (typeof dynamicModule.start === 'function') { 280 | dynamicModule.start(value); 281 | } else { 282 | console.error(`Error: The file ${filename} does not have a start function.`); 283 | } 284 | clearModuleCache(filename.filePaths[0]); 285 | } catch (error) { 286 | clearModuleCache(filename.filePaths[0]); 287 | console.error(`Error loading and executing file: ${filename}`, error); 288 | } 289 | 290 | } 291 | 292 | }) 293 | 294 | 295 | ipcMain.on('info:selectpath', async (e, value) => { 296 | console.log("info:selectpath"); 297 | filename = await dialog.showOpenDialog({ properties: ['openFile'] }); 298 | if (filename.canceled == false) { 299 | 300 | value.filepath = filename.filePaths[0] 301 | mainWindow.webContents.send("info:selectpath", value); 302 | } 303 | else 304 | { 305 | 306 | } 307 | 308 | 309 | }) 310 | 311 | ipcMain.on('info:getmaxgasprice', async (e, value) => { 312 | console.log("info:getmaxgasprice"); 313 | qianggou.CalcGasPrice(); 314 | 315 | 316 | }) 317 | 318 | 319 | 320 | ipcMain.on('info:boxcheck', async (e, value) => { 321 | console.log("info:boxcheck"); 322 | qianggou.boxcheck(value); 323 | 324 | 325 | 326 | 327 | }) 328 | 329 | ipcMain.on('info:loadlocalABI', async (e, value) => { 330 | console.log("info:loadlocalABI"); 331 | 332 | 333 | 334 | filename = await dialog.showOpenDialog({ properties: ['openFile'] }); 335 | if (filename.canceled == false) { 336 | result = await queryContract.loadlocalABI(filename.filePaths[0]) 337 | 338 | mainWindow.webContents.send("info:queryabi", { result }); 339 | } 340 | 341 | 342 | }) 343 | 344 | 345 | var renwu = null; 346 | 347 | //启动定时监控,关闭定时监控 348 | ipcMain.on('info:startgetmaxgasprice', async (e, value) => { 349 | console.log("info:startgetmaxgasprice"); 350 | qianggou.CalcGasPrice(); 351 | //开启定时任务 352 | if (renwu == null) { 353 | renwu = task1() 354 | } 355 | 356 | else { 357 | 358 | } 359 | }) 360 | 361 | ipcMain.on('info:mytest', async (e, value) => { 362 | console.log("info:mytest"); 363 | qianggou.mytest(); 364 | 365 | }) 366 | 367 | const task1 = async ()=>{ 368 | //每分钟的1-10秒都会触发,其它通配符依次类推 369 | //console.log("123111"); 370 | //console.log(value); 371 | //console.log(count); 372 | const j = schedule.scheduleJob('*/5 * * * * *', async ()=>{ 373 | 374 | await qianggou.CalcGasPrice(); 375 | }) 376 | return j; 377 | } 378 | 379 | 380 | ipcMain.on('info:getbtccookiepath', async (e, value) => { 381 | console.log("info:getbtccookiepath"); 382 | filename = await dialog.showOpenDialog({ properties: ['openFile'] }); 383 | if (filename.canceled == false) { 384 | 385 | mainWindow.webContents.send("info:getbtccookiepath", { "filename":filename.filePaths }); 386 | } 387 | }) 388 | ipcMain.on('info:taskInit', async (e, value) => { 389 | console.log("info:taskInit"); 390 | alltask() 391 | mainWindow.webContents.send("info:taskInit", { configData}); 392 | 393 | }) 394 | 395 | ipcMain.on('info:taskedit', async (e, value) => { 396 | console.log("info:taskedit"); 397 | var result = confighelper.updateOrAddTask(configData, value.editdata); 398 | 399 | confighelper.writeConfigFile(configFilePath, configData); 400 | if(result) 401 | { 402 | //说明新增了任务 403 | await taskcreate(value.editdata); 404 | } 405 | else 406 | { 407 | //说明修改了任务,需要删除旧任务,然后增加新任务 408 | const taskIndex = tasklist.findIndex((task) => task.id === value.editdata.id); 409 | if (taskIndex !== -1) { 410 | tasklist[taskIndex].renwuj.cancel(); 411 | tasklist.splice(taskIndex, 1); 412 | } 413 | 414 | await taskcreate(value.editdata); 415 | } 416 | //mainWindow.webContents.send("info:taskInit", { configData}); 417 | 418 | }) 419 | 420 | ipcMain.on('info:taskdelete', async (e, value) => { 421 | console.log("info:taskdelete"); 422 | confighelper.deleteTaskById(configData, value.id); 423 | 424 | confighelper.writeConfigFile(configFilePath, configData); 425 | 426 | //任务队列需要取消之前的任务 427 | const taskIndex = tasklist.findIndex((task) => task.id === value.id); 428 | if (taskIndex !== -1) { 429 | tasklist[taskIndex].renwuj.cancel(); 430 | tasklist.splice(taskIndex, 1); 431 | } 432 | //mainWindow.webContents.send("info:taskInit", { configData}); 433 | 434 | }) 435 | 436 | 437 | 438 | 439 | 440 | 441 | ipcMain.on('info:btcsetting', async (e, value) => { 442 | console.log("info:btcsetting"); 443 | punk.setInit(value) 444 | }) 445 | 446 | ipcMain.on('info:punkimgdownload', async (e, value) => { 447 | console.log("info:punkimgdownload"); 448 | punk.punkimgdownload() 449 | }) 450 | 451 | ipcMain.on('info:punkselectblockinfo', async (e, value) => { 452 | console.log("info:punkselectblockinfo"); 453 | punk.punkselectblockinfo() 454 | }) 455 | 456 | ipcMain.on('info:punkidselect', async (e, value) => { 457 | console.log("info:punkidselect"); 458 | var info = punk.punkidselect(value.punkid) 459 | mainWindow.webContents.send("info:getbtccookiepath", { info }); 460 | 461 | }) 462 | 463 | 464 | } 465 | function clearModuleCache(modulePath) { 466 | try { 467 | const resolvedPath = require.resolve(modulePath); 468 | delete require.cache[resolvedPath]; 469 | } catch (error) { 470 | console.error(`Error clearing module cache for: ${modulePath}`, error); 471 | } 472 | } 473 | 474 | eventListener(); 475 | 476 | 477 | function formatDate(date) { 478 | const year = date.getFullYear(); 479 | const month = String(date.getMonth() + 1).padStart(2, '0'); 480 | const day = String(date.getDate()).padStart(2, '0'); 481 | const hours = String(date.getHours()).padStart(2, '0'); 482 | const minutes = String(date.getMinutes()).padStart(2, '0'); 483 | const seconds = String(date.getSeconds()).padStart(2, '0'); 484 | 485 | return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`; 486 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nftqianggou", 3 | "version": "1.0.0", 4 | "description": "A minimal Electron application", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron ." 8 | }, 9 | "repository": "https://github.com/electron/electron-quick-start", 10 | "keywords": [ 11 | "Electron", 12 | "quick", 13 | "start", 14 | "tutorial", 15 | "demo" 16 | ], 17 | "author": "GitHub", 18 | "license": "CC0-1.0", 19 | "devDependencies": { 20 | "electron": "^18.1.0", 21 | "electron-builder": "^23.0.3" 22 | }, 23 | "dependencies": { 24 | "@ethereumjs/common": "^3.0.0", 25 | "@ethereumjs/tx": "^4.0.0", 26 | "@ethersproject/hash": "^5.7.0", 27 | "axios": "^0.27.1", 28 | "cheerio": "*", 29 | "dotenv": "^9.0.2", 30 | "electron-proxy-agent": "^1.2.1", 31 | "ethereumjs-abi": "^0.6.8", 32 | "ethereumjs-tx": "^1.3.7", 33 | "ethers": "^5.3.0", 34 | "ethers-eip712": "^0.2.0", 35 | "ethjs-contract": "^0.2.3", 36 | "ethjs-query": "^0.3.8", 37 | "fs": "0.0.1-security", 38 | "got": "^11.8.2", 39 | "image-hash": "^5.3.1", 40 | "kafka-node": "^5.0.0", 41 | "line-reader": "^0.4.0", 42 | "moment": "^2.29.4", 43 | "node-schedule": "^2.0.0", 44 | "request": "^2.87.0", 45 | "session": "^0.1.0", 46 | "silly-datetime": "^0.1.2", 47 | "web3": "^1.3.4", 48 | "web3-eth-abi": "^1.3.4" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /preload.js: -------------------------------------------------------------------------------- 1 | // All of the Node.js APIs are available in the preload process. 2 | // It has the same sandbox as a Chrome extension. 3 | window.addEventListener('DOMContentLoaded', () => { 4 | const replaceText = (selector, text) => { 5 | const element = document.getElementById(selector) 6 | if (element) element.innerText = text 7 | } 8 | 9 | for (const type of ['chrome', 'node', 'electron']) { 10 | replaceText(`${type}-version`, process.versions[type]) 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /renderer.js: -------------------------------------------------------------------------------- 1 | // This file is required by the index.html file and will 2 | // be executed in the renderer process for that window. 3 | // No Node.js APIs are available in this process because 4 | // `nodeIntegration` is turned off. Use `preload.js` to 5 | // selectively enable features needed in the rendering 6 | // process. 7 | var fs = require('fs'); 8 | 9 | var js = fs.readFileSync("./config.json"); 10 | var evmnetworks = JSON.parse(js); -------------------------------------------------------------------------------- /startblock.txt: -------------------------------------------------------------------------------- 1 | 780282 -------------------------------------------------------------------------------- /taskconfig.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "2", 4 | "taskname": "HOPE自动脚本2", 5 | "scriptpath": "D:\\docker\\github\\nftqianggou\\swap_v1.js", 6 | "exectime": 60000, 7 | "rematimes": 0, 8 | "exectype": "delay", 9 | "execwallet": "./prikey.prikey", 10 | "lastExecTime": "2023/04/27 16:14:00" 11 | }, 12 | { 13 | "id": "1", 14 | "taskname": "HOPE自动脚本", 15 | "scriptpath": "./swap.js", 16 | "exectime": 86400000, 17 | "rematimes": "9999", 18 | "exectype": "now", 19 | "execwallet": "./prikey.prikey", 20 | "lastExecTime": "1970-01-01" 21 | } 22 | ] -------------------------------------------------------------------------------- /web/abi/test.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": true, 12 | "internalType": "address", 13 | "name": "owner", 14 | "type": "address" 15 | }, 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "approved", 20 | "type": "address" 21 | }, 22 | { 23 | "indexed": true, 24 | "internalType": "uint256", 25 | "name": "tokenId", 26 | "type": "uint256" 27 | } 28 | ], 29 | "name": "Approval", 30 | "type": "event" 31 | }, 32 | { 33 | "anonymous": false, 34 | "inputs": [ 35 | { 36 | "indexed": true, 37 | "internalType": "address", 38 | "name": "owner", 39 | "type": "address" 40 | }, 41 | { 42 | "indexed": true, 43 | "internalType": "address", 44 | "name": "operator", 45 | "type": "address" 46 | }, 47 | { 48 | "indexed": false, 49 | "internalType": "bool", 50 | "name": "approved", 51 | "type": "bool" 52 | } 53 | ], 54 | "name": "ApprovalForAll", 55 | "type": "event" 56 | }, 57 | { 58 | "anonymous": false, 59 | "inputs": [ 60 | { 61 | "indexed": true, 62 | "internalType": "address", 63 | "name": "previousOwner", 64 | "type": "address" 65 | }, 66 | { 67 | "indexed": true, 68 | "internalType": "address", 69 | "name": "newOwner", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "OwnershipTransferred", 74 | "type": "event" 75 | }, 76 | { 77 | "anonymous": false, 78 | "inputs": [ 79 | { 80 | "indexed": true, 81 | "internalType": "address", 82 | "name": "from", 83 | "type": "address" 84 | }, 85 | { 86 | "indexed": true, 87 | "internalType": "address", 88 | "name": "to", 89 | "type": "address" 90 | }, 91 | { 92 | "indexed": true, 93 | "internalType": "uint256", 94 | "name": "tokenId", 95 | "type": "uint256" 96 | } 97 | ], 98 | "name": "Transfer", 99 | "type": "event" 100 | }, 101 | { 102 | "anonymous": false, 103 | "inputs": [ 104 | { 105 | "indexed": true, 106 | "internalType": "uint256", 107 | "name": "tokenId", 108 | "type": "uint256" 109 | }, 110 | { 111 | "indexed": true, 112 | "internalType": "address", 113 | "name": "user", 114 | "type": "address" 115 | }, 116 | { 117 | "indexed": false, 118 | "internalType": "uint64", 119 | "name": "expires", 120 | "type": "uint64" 121 | } 122 | ], 123 | "name": "UpdateUser", 124 | "type": "event" 125 | }, 126 | { 127 | "inputs": [ 128 | { 129 | "internalType": "address", 130 | "name": "to", 131 | "type": "address" 132 | }, 133 | { 134 | "internalType": "uint256", 135 | "name": "tokenId", 136 | "type": "uint256" 137 | } 138 | ], 139 | "name": "approve", 140 | "outputs": [], 141 | "stateMutability": "nonpayable", 142 | "type": "function" 143 | }, 144 | { 145 | "inputs": [ 146 | { 147 | "internalType": "address", 148 | "name": "owner", 149 | "type": "address" 150 | } 151 | ], 152 | "name": "balanceOf", 153 | "outputs": [ 154 | { 155 | "internalType": "uint256", 156 | "name": "", 157 | "type": "uint256" 158 | } 159 | ], 160 | "stateMutability": "view", 161 | "type": "function" 162 | }, 163 | { 164 | "inputs": [ 165 | { 166 | "internalType": "uint256", 167 | "name": "tokenId", 168 | "type": "uint256" 169 | } 170 | ], 171 | "name": "getApproved", 172 | "outputs": [ 173 | { 174 | "internalType": "address", 175 | "name": "", 176 | "type": "address" 177 | } 178 | ], 179 | "stateMutability": "view", 180 | "type": "function" 181 | }, 182 | { 183 | "inputs": [], 184 | "name": "getmintCount", 185 | "outputs": [ 186 | { 187 | "internalType": "uint256", 188 | "name": "", 189 | "type": "uint256" 190 | } 191 | ], 192 | "stateMutability": "view", 193 | "type": "function" 194 | }, 195 | { 196 | "inputs": [ 197 | { 198 | "internalType": "address", 199 | "name": "owner", 200 | "type": "address" 201 | }, 202 | { 203 | "internalType": "address", 204 | "name": "operator", 205 | "type": "address" 206 | } 207 | ], 208 | "name": "isApprovedForAll", 209 | "outputs": [ 210 | { 211 | "internalType": "bool", 212 | "name": "", 213 | "type": "bool" 214 | } 215 | ], 216 | "stateMutability": "view", 217 | "type": "function" 218 | }, 219 | { 220 | "inputs": [], 221 | "name": "maxMintAmountPerTx", 222 | "outputs": [ 223 | { 224 | "internalType": "uint256", 225 | "name": "", 226 | "type": "uint256" 227 | } 228 | ], 229 | "stateMutability": "view", 230 | "type": "function" 231 | }, 232 | { 233 | "inputs": [], 234 | "name": "maxSupply", 235 | "outputs": [ 236 | { 237 | "internalType": "uint256", 238 | "name": "", 239 | "type": "uint256" 240 | } 241 | ], 242 | "stateMutability": "view", 243 | "type": "function" 244 | }, 245 | { 246 | "inputs": [ 247 | { 248 | "internalType": "uint256", 249 | "name": "_mintAmount", 250 | "type": "uint256" 251 | } 252 | ], 253 | "name": "mint", 254 | "outputs": [], 255 | "stateMutability": "payable", 256 | "type": "function" 257 | }, 258 | { 259 | "inputs": [], 260 | "name": "mintCost", 261 | "outputs": [ 262 | { 263 | "internalType": "uint256", 264 | "name": "", 265 | "type": "uint256" 266 | } 267 | ], 268 | "stateMutability": "view", 269 | "type": "function" 270 | }, 271 | { 272 | "inputs": [ 273 | { 274 | "internalType": "address", 275 | "name": "", 276 | "type": "address" 277 | } 278 | ], 279 | "name": "mintCount", 280 | "outputs": [ 281 | { 282 | "internalType": "uint256", 283 | "name": "", 284 | "type": "uint256" 285 | } 286 | ], 287 | "stateMutability": "view", 288 | "type": "function" 289 | }, 290 | { 291 | "inputs": [], 292 | "name": "name", 293 | "outputs": [ 294 | { 295 | "internalType": "string", 296 | "name": "", 297 | "type": "string" 298 | } 299 | ], 300 | "stateMutability": "view", 301 | "type": "function" 302 | }, 303 | { 304 | "inputs": [], 305 | "name": "owner", 306 | "outputs": [ 307 | { 308 | "internalType": "address", 309 | "name": "", 310 | "type": "address" 311 | } 312 | ], 313 | "stateMutability": "view", 314 | "type": "function" 315 | }, 316 | { 317 | "inputs": [ 318 | { 319 | "internalType": "uint256", 320 | "name": "tokenId", 321 | "type": "uint256" 322 | } 323 | ], 324 | "name": "ownerOf", 325 | "outputs": [ 326 | { 327 | "internalType": "address", 328 | "name": "", 329 | "type": "address" 330 | } 331 | ], 332 | "stateMutability": "view", 333 | "type": "function" 334 | }, 335 | { 336 | "inputs": [], 337 | "name": "renounceOwnership", 338 | "outputs": [], 339 | "stateMutability": "nonpayable", 340 | "type": "function" 341 | }, 342 | { 343 | "inputs": [ 344 | { 345 | "internalType": "address", 346 | "name": "from", 347 | "type": "address" 348 | }, 349 | { 350 | "internalType": "address", 351 | "name": "to", 352 | "type": "address" 353 | }, 354 | { 355 | "internalType": "uint256", 356 | "name": "tokenId", 357 | "type": "uint256" 358 | } 359 | ], 360 | "name": "safeTransferFrom", 361 | "outputs": [], 362 | "stateMutability": "nonpayable", 363 | "type": "function" 364 | }, 365 | { 366 | "inputs": [ 367 | { 368 | "internalType": "address", 369 | "name": "from", 370 | "type": "address" 371 | }, 372 | { 373 | "internalType": "address", 374 | "name": "to", 375 | "type": "address" 376 | }, 377 | { 378 | "internalType": "uint256", 379 | "name": "tokenId", 380 | "type": "uint256" 381 | }, 382 | { 383 | "internalType": "bytes", 384 | "name": "data", 385 | "type": "bytes" 386 | } 387 | ], 388 | "name": "safeTransferFrom", 389 | "outputs": [], 390 | "stateMutability": "nonpayable", 391 | "type": "function" 392 | }, 393 | { 394 | "inputs": [ 395 | { 396 | "internalType": "address", 397 | "name": "operator", 398 | "type": "address" 399 | }, 400 | { 401 | "internalType": "bool", 402 | "name": "approved", 403 | "type": "bool" 404 | } 405 | ], 406 | "name": "setApprovalForAll", 407 | "outputs": [], 408 | "stateMutability": "nonpayable", 409 | "type": "function" 410 | }, 411 | { 412 | "inputs": [ 413 | { 414 | "internalType": "uint256", 415 | "name": "tokenId", 416 | "type": "uint256" 417 | }, 418 | { 419 | "internalType": "address", 420 | "name": "user", 421 | "type": "address" 422 | }, 423 | { 424 | "internalType": "uint64", 425 | "name": "expires", 426 | "type": "uint64" 427 | } 428 | ], 429 | "name": "setUser", 430 | "outputs": [], 431 | "stateMutability": "nonpayable", 432 | "type": "function" 433 | }, 434 | { 435 | "inputs": [ 436 | { 437 | "internalType": "bytes4", 438 | "name": "interfaceId", 439 | "type": "bytes4" 440 | } 441 | ], 442 | "name": "supportsInterface", 443 | "outputs": [ 444 | { 445 | "internalType": "bool", 446 | "name": "", 447 | "type": "bool" 448 | } 449 | ], 450 | "stateMutability": "view", 451 | "type": "function" 452 | }, 453 | { 454 | "inputs": [], 455 | "name": "symbol", 456 | "outputs": [ 457 | { 458 | "internalType": "string", 459 | "name": "", 460 | "type": "string" 461 | } 462 | ], 463 | "stateMutability": "view", 464 | "type": "function" 465 | }, 466 | { 467 | "inputs": [ 468 | { 469 | "internalType": "uint256", 470 | "name": "_tokenId", 471 | "type": "uint256" 472 | } 473 | ], 474 | "name": "tokenURI", 475 | "outputs": [ 476 | { 477 | "internalType": "string", 478 | "name": "", 479 | "type": "string" 480 | } 481 | ], 482 | "stateMutability": "view", 483 | "type": "function" 484 | }, 485 | { 486 | "inputs": [], 487 | "name": "totalSupply", 488 | "outputs": [ 489 | { 490 | "internalType": "uint256", 491 | "name": "", 492 | "type": "uint256" 493 | } 494 | ], 495 | "stateMutability": "view", 496 | "type": "function" 497 | }, 498 | { 499 | "inputs": [ 500 | { 501 | "internalType": "address", 502 | "name": "from", 503 | "type": "address" 504 | }, 505 | { 506 | "internalType": "address", 507 | "name": "to", 508 | "type": "address" 509 | }, 510 | { 511 | "internalType": "uint256", 512 | "name": "tokenId", 513 | "type": "uint256" 514 | } 515 | ], 516 | "name": "transferFrom", 517 | "outputs": [], 518 | "stateMutability": "nonpayable", 519 | "type": "function" 520 | }, 521 | { 522 | "inputs": [ 523 | { 524 | "internalType": "address", 525 | "name": "newOwner", 526 | "type": "address" 527 | } 528 | ], 529 | "name": "transferOwnership", 530 | "outputs": [], 531 | "stateMutability": "nonpayable", 532 | "type": "function" 533 | }, 534 | { 535 | "inputs": [], 536 | "name": "uriPrefix", 537 | "outputs": [ 538 | { 539 | "internalType": "string", 540 | "name": "", 541 | "type": "string" 542 | } 543 | ], 544 | "stateMutability": "view", 545 | "type": "function" 546 | }, 547 | { 548 | "inputs": [], 549 | "name": "uriSuffix", 550 | "outputs": [ 551 | { 552 | "internalType": "string", 553 | "name": "", 554 | "type": "string" 555 | } 556 | ], 557 | "stateMutability": "view", 558 | "type": "function" 559 | }, 560 | { 561 | "inputs": [ 562 | { 563 | "internalType": "uint256", 564 | "name": "tokenId", 565 | "type": "uint256" 566 | } 567 | ], 568 | "name": "userExpires", 569 | "outputs": [ 570 | { 571 | "internalType": "uint256", 572 | "name": "", 573 | "type": "uint256" 574 | } 575 | ], 576 | "stateMutability": "view", 577 | "type": "function" 578 | }, 579 | { 580 | "inputs": [ 581 | { 582 | "internalType": "uint256", 583 | "name": "tokenId", 584 | "type": "uint256" 585 | } 586 | ], 587 | "name": "userOf", 588 | "outputs": [ 589 | { 590 | "internalType": "address", 591 | "name": "", 592 | "type": "address" 593 | } 594 | ], 595 | "stateMutability": "view", 596 | "type": "function" 597 | }, 598 | { 599 | "inputs": [ 600 | { 601 | "internalType": "address", 602 | "name": "_owner", 603 | "type": "address" 604 | } 605 | ], 606 | "name": "walletOfOwner", 607 | "outputs": [ 608 | { 609 | "internalType": "uint256[]", 610 | "name": "", 611 | "type": "uint256[]" 612 | } 613 | ], 614 | "stateMutability": "view", 615 | "type": "function" 616 | }, 617 | { 618 | "inputs": [], 619 | "name": "withdraw", 620 | "outputs": [], 621 | "stateMutability": "nonpayable", 622 | "type": "function" 623 | } 624 | ] -------------------------------------------------------------------------------- /web/abi/token.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "owner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "spender", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "value", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Approval", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": false, 32 | "internalType": "uint8", 33 | "name": "version", 34 | "type": "uint8" 35 | } 36 | ], 37 | "name": "Initialized", 38 | "type": "event" 39 | }, 40 | { 41 | "anonymous": false, 42 | "inputs": [ 43 | { 44 | "indexed": true, 45 | "internalType": "address", 46 | "name": "previousOwner", 47 | "type": "address" 48 | }, 49 | { 50 | "indexed": true, 51 | "internalType": "address", 52 | "name": "newOwner", 53 | "type": "address" 54 | } 55 | ], 56 | "name": "OwnershipTransferStarted", 57 | "type": "event" 58 | }, 59 | { 60 | "anonymous": false, 61 | "inputs": [ 62 | { 63 | "indexed": true, 64 | "internalType": "address", 65 | "name": "previousOwner", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": true, 70 | "internalType": "address", 71 | "name": "newOwner", 72 | "type": "address" 73 | } 74 | ], 75 | "name": "OwnershipTransferred", 76 | "type": "event" 77 | }, 78 | { 79 | "anonymous": false, 80 | "inputs": [ 81 | { 82 | "indexed": true, 83 | "internalType": "address", 84 | "name": "from", 85 | "type": "address" 86 | }, 87 | { 88 | "indexed": true, 89 | "internalType": "address", 90 | "name": "to", 91 | "type": "address" 92 | }, 93 | { 94 | "indexed": false, 95 | "internalType": "uint256", 96 | "name": "value", 97 | "type": "uint256" 98 | } 99 | ], 100 | "name": "Transfer", 101 | "type": "event" 102 | }, 103 | { 104 | "inputs": [], 105 | "name": "acceptOwnership", 106 | "outputs": [], 107 | "stateMutability": "nonpayable", 108 | "type": "function" 109 | }, 110 | { 111 | "inputs": [ 112 | { 113 | "internalType": "address", 114 | "name": "owner", 115 | "type": "address" 116 | }, 117 | { 118 | "internalType": "address", 119 | "name": "spender", 120 | "type": "address" 121 | } 122 | ], 123 | "name": "allowance", 124 | "outputs": [ 125 | { 126 | "internalType": "uint256", 127 | "name": "", 128 | "type": "uint256" 129 | } 130 | ], 131 | "stateMutability": "view", 132 | "type": "function" 133 | }, 134 | { 135 | "inputs": [ 136 | { 137 | "internalType": "address", 138 | "name": "spender", 139 | "type": "address" 140 | }, 141 | { 142 | "internalType": "uint256", 143 | "name": "amount", 144 | "type": "uint256" 145 | } 146 | ], 147 | "name": "approve", 148 | "outputs": [ 149 | { 150 | "internalType": "bool", 151 | "name": "", 152 | "type": "bool" 153 | } 154 | ], 155 | "stateMutability": "nonpayable", 156 | "type": "function" 157 | }, 158 | { 159 | "inputs": [ 160 | { 161 | "internalType": "address", 162 | "name": "account", 163 | "type": "address" 164 | } 165 | ], 166 | "name": "balanceOf", 167 | "outputs": [ 168 | { 169 | "internalType": "uint256", 170 | "name": "", 171 | "type": "uint256" 172 | } 173 | ], 174 | "stateMutability": "view", 175 | "type": "function" 176 | }, 177 | { 178 | "inputs": [], 179 | "name": "decimals", 180 | "outputs": [ 181 | { 182 | "internalType": "uint8", 183 | "name": "", 184 | "type": "uint8" 185 | } 186 | ], 187 | "stateMutability": "view", 188 | "type": "function" 189 | }, 190 | { 191 | "inputs": [ 192 | { 193 | "internalType": "address", 194 | "name": "spender", 195 | "type": "address" 196 | }, 197 | { 198 | "internalType": "uint256", 199 | "name": "subtractedValue", 200 | "type": "uint256" 201 | } 202 | ], 203 | "name": "decreaseAllowance", 204 | "outputs": [ 205 | { 206 | "internalType": "bool", 207 | "name": "", 208 | "type": "bool" 209 | } 210 | ], 211 | "stateMutability": "nonpayable", 212 | "type": "function" 213 | }, 214 | { 215 | "inputs": [ 216 | { 217 | "internalType": "address", 218 | "name": "spender", 219 | "type": "address" 220 | }, 221 | { 222 | "internalType": "uint256", 223 | "name": "addedValue", 224 | "type": "uint256" 225 | } 226 | ], 227 | "name": "increaseAllowance", 228 | "outputs": [ 229 | { 230 | "internalType": "bool", 231 | "name": "", 232 | "type": "bool" 233 | } 234 | ], 235 | "stateMutability": "nonpayable", 236 | "type": "function" 237 | }, 238 | { 239 | "inputs": [ 240 | { 241 | "internalType": "string", 242 | "name": "_name", 243 | "type": "string" 244 | }, 245 | { 246 | "internalType": "string", 247 | "name": "_symbol", 248 | "type": "string" 249 | }, 250 | { 251 | "internalType": "uint256", 252 | "name": "initialSupply", 253 | "type": "uint256" 254 | }, 255 | { 256 | "internalType": "uint8", 257 | "name": "_decimals", 258 | "type": "uint8" 259 | } 260 | ], 261 | "name": "initialize", 262 | "outputs": [], 263 | "stateMutability": "nonpayable", 264 | "type": "function" 265 | }, 266 | { 267 | "inputs": [], 268 | "name": "name", 269 | "outputs": [ 270 | { 271 | "internalType": "string", 272 | "name": "", 273 | "type": "string" 274 | } 275 | ], 276 | "stateMutability": "view", 277 | "type": "function" 278 | }, 279 | { 280 | "inputs": [], 281 | "name": "owner", 282 | "outputs": [ 283 | { 284 | "internalType": "address", 285 | "name": "", 286 | "type": "address" 287 | } 288 | ], 289 | "stateMutability": "view", 290 | "type": "function" 291 | }, 292 | { 293 | "inputs": [], 294 | "name": "pendingOwner", 295 | "outputs": [ 296 | { 297 | "internalType": "address", 298 | "name": "", 299 | "type": "address" 300 | } 301 | ], 302 | "stateMutability": "view", 303 | "type": "function" 304 | }, 305 | { 306 | "inputs": [], 307 | "name": "renounceOwnership", 308 | "outputs": [], 309 | "stateMutability": "nonpayable", 310 | "type": "function" 311 | }, 312 | { 313 | "inputs": [], 314 | "name": "symbol", 315 | "outputs": [ 316 | { 317 | "internalType": "string", 318 | "name": "", 319 | "type": "string" 320 | } 321 | ], 322 | "stateMutability": "view", 323 | "type": "function" 324 | }, 325 | { 326 | "inputs": [], 327 | "name": "totalSupply", 328 | "outputs": [ 329 | { 330 | "internalType": "uint256", 331 | "name": "", 332 | "type": "uint256" 333 | } 334 | ], 335 | "stateMutability": "view", 336 | "type": "function" 337 | }, 338 | { 339 | "inputs": [ 340 | { 341 | "internalType": "address", 342 | "name": "to", 343 | "type": "address" 344 | }, 345 | { 346 | "internalType": "uint256", 347 | "name": "amount", 348 | "type": "uint256" 349 | } 350 | ], 351 | "name": "transfer", 352 | "outputs": [ 353 | { 354 | "internalType": "bool", 355 | "name": "", 356 | "type": "bool" 357 | } 358 | ], 359 | "stateMutability": "nonpayable", 360 | "type": "function" 361 | }, 362 | { 363 | "inputs": [ 364 | { 365 | "internalType": "address", 366 | "name": "from", 367 | "type": "address" 368 | }, 369 | { 370 | "internalType": "address", 371 | "name": "to", 372 | "type": "address" 373 | }, 374 | { 375 | "internalType": "uint256", 376 | "name": "amount", 377 | "type": "uint256" 378 | } 379 | ], 380 | "name": "transferFrom", 381 | "outputs": [ 382 | { 383 | "internalType": "bool", 384 | "name": "", 385 | "type": "bool" 386 | } 387 | ], 388 | "stateMutability": "nonpayable", 389 | "type": "function" 390 | }, 391 | { 392 | "inputs": [ 393 | { 394 | "internalType": "address", 395 | "name": "newOwner", 396 | "type": "address" 397 | } 398 | ], 399 | "name": "transferOwnership", 400 | "outputs": [], 401 | "stateMutability": "nonpayable", 402 | "type": "function" 403 | } 404 | ] -------------------------------------------------------------------------------- /web/abi/uniswap.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "_factory", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_WETH", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "inputs": [], 20 | "name": "WETH", 21 | "outputs": [ 22 | { 23 | "internalType": "address", 24 | "name": "", 25 | "type": "address" 26 | } 27 | ], 28 | "stateMutability": "view", 29 | "type": "function" 30 | }, 31 | { 32 | "inputs": [ 33 | { 34 | "internalType": "address", 35 | "name": "tokenA", 36 | "type": "address" 37 | }, 38 | { 39 | "internalType": "address", 40 | "name": "tokenB", 41 | "type": "address" 42 | }, 43 | { 44 | "internalType": "uint256", 45 | "name": "amountADesired", 46 | "type": "uint256" 47 | }, 48 | { 49 | "internalType": "uint256", 50 | "name": "amountBDesired", 51 | "type": "uint256" 52 | }, 53 | { 54 | "internalType": "uint256", 55 | "name": "amountAMin", 56 | "type": "uint256" 57 | }, 58 | { 59 | "internalType": "uint256", 60 | "name": "amountBMin", 61 | "type": "uint256" 62 | }, 63 | { 64 | "internalType": "address", 65 | "name": "to", 66 | "type": "address" 67 | }, 68 | { 69 | "internalType": "uint256", 70 | "name": "deadline", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "addLiquidity", 75 | "outputs": [ 76 | { 77 | "internalType": "uint256", 78 | "name": "amountA", 79 | "type": "uint256" 80 | }, 81 | { 82 | "internalType": "uint256", 83 | "name": "amountB", 84 | "type": "uint256" 85 | }, 86 | { 87 | "internalType": "uint256", 88 | "name": "liquidity", 89 | "type": "uint256" 90 | } 91 | ], 92 | "stateMutability": "nonpayable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "address", 99 | "name": "token", 100 | "type": "address" 101 | }, 102 | { 103 | "internalType": "uint256", 104 | "name": "amountTokenDesired", 105 | "type": "uint256" 106 | }, 107 | { 108 | "internalType": "uint256", 109 | "name": "amountTokenMin", 110 | "type": "uint256" 111 | }, 112 | { 113 | "internalType": "uint256", 114 | "name": "amountETHMin", 115 | "type": "uint256" 116 | }, 117 | { 118 | "internalType": "address", 119 | "name": "to", 120 | "type": "address" 121 | }, 122 | { 123 | "internalType": "uint256", 124 | "name": "deadline", 125 | "type": "uint256" 126 | } 127 | ], 128 | "name": "addLiquidityETH", 129 | "outputs": [ 130 | { 131 | "internalType": "uint256", 132 | "name": "amountToken", 133 | "type": "uint256" 134 | }, 135 | { 136 | "internalType": "uint256", 137 | "name": "amountETH", 138 | "type": "uint256" 139 | }, 140 | { 141 | "internalType": "uint256", 142 | "name": "liquidity", 143 | "type": "uint256" 144 | } 145 | ], 146 | "stateMutability": "payable", 147 | "type": "function" 148 | }, 149 | { 150 | "inputs": [], 151 | "name": "factory", 152 | "outputs": [ 153 | { 154 | "internalType": "address", 155 | "name": "", 156 | "type": "address" 157 | } 158 | ], 159 | "stateMutability": "view", 160 | "type": "function" 161 | }, 162 | { 163 | "inputs": [ 164 | { 165 | "internalType": "uint256", 166 | "name": "amountOut", 167 | "type": "uint256" 168 | }, 169 | { 170 | "internalType": "uint256", 171 | "name": "reserveIn", 172 | "type": "uint256" 173 | }, 174 | { 175 | "internalType": "uint256", 176 | "name": "reserveOut", 177 | "type": "uint256" 178 | }, 179 | { 180 | "internalType": "uint32", 181 | "name": "feeRateNumerator", 182 | "type": "uint32" 183 | } 184 | ], 185 | "name": "getAmountIn", 186 | "outputs": [ 187 | { 188 | "internalType": "uint256", 189 | "name": "amountIn", 190 | "type": "uint256" 191 | } 192 | ], 193 | "stateMutability": "pure", 194 | "type": "function" 195 | }, 196 | { 197 | "inputs": [ 198 | { 199 | "internalType": "uint256", 200 | "name": "amountIn", 201 | "type": "uint256" 202 | }, 203 | { 204 | "internalType": "uint256", 205 | "name": "reserveIn", 206 | "type": "uint256" 207 | }, 208 | { 209 | "internalType": "uint256", 210 | "name": "reserveOut", 211 | "type": "uint256" 212 | }, 213 | { 214 | "internalType": "uint32", 215 | "name": "feeRateNumerator", 216 | "type": "uint32" 217 | } 218 | ], 219 | "name": "getAmountOut", 220 | "outputs": [ 221 | { 222 | "internalType": "uint256", 223 | "name": "amountOut", 224 | "type": "uint256" 225 | } 226 | ], 227 | "stateMutability": "pure", 228 | "type": "function" 229 | }, 230 | { 231 | "inputs": [ 232 | { 233 | "internalType": "uint256", 234 | "name": "amountOut", 235 | "type": "uint256" 236 | }, 237 | { 238 | "internalType": "address[]", 239 | "name": "path", 240 | "type": "address[]" 241 | } 242 | ], 243 | "name": "getAmountsIn", 244 | "outputs": [ 245 | { 246 | "internalType": "uint256[]", 247 | "name": "amounts", 248 | "type": "uint256[]" 249 | } 250 | ], 251 | "stateMutability": "view", 252 | "type": "function" 253 | }, 254 | { 255 | "inputs": [ 256 | { 257 | "internalType": "uint256", 258 | "name": "amountIn", 259 | "type": "uint256" 260 | }, 261 | { 262 | "internalType": "address[]", 263 | "name": "path", 264 | "type": "address[]" 265 | } 266 | ], 267 | "name": "getAmountsOut", 268 | "outputs": [ 269 | { 270 | "internalType": "uint256[]", 271 | "name": "amounts", 272 | "type": "uint256[]" 273 | } 274 | ], 275 | "stateMutability": "view", 276 | "type": "function" 277 | }, 278 | { 279 | "inputs": [ 280 | { 281 | "internalType": "uint256", 282 | "name": "amountA", 283 | "type": "uint256" 284 | }, 285 | { 286 | "internalType": "uint256", 287 | "name": "reserveA", 288 | "type": "uint256" 289 | }, 290 | { 291 | "internalType": "uint256", 292 | "name": "reserveB", 293 | "type": "uint256" 294 | } 295 | ], 296 | "name": "quote", 297 | "outputs": [ 298 | { 299 | "internalType": "uint256", 300 | "name": "amountB", 301 | "type": "uint256" 302 | } 303 | ], 304 | "stateMutability": "pure", 305 | "type": "function" 306 | }, 307 | { 308 | "inputs": [ 309 | { 310 | "internalType": "address", 311 | "name": "tokenA", 312 | "type": "address" 313 | }, 314 | { 315 | "internalType": "address", 316 | "name": "tokenB", 317 | "type": "address" 318 | }, 319 | { 320 | "internalType": "uint256", 321 | "name": "liquidity", 322 | "type": "uint256" 323 | }, 324 | { 325 | "internalType": "uint256", 326 | "name": "amountAMin", 327 | "type": "uint256" 328 | }, 329 | { 330 | "internalType": "uint256", 331 | "name": "amountBMin", 332 | "type": "uint256" 333 | }, 334 | { 335 | "internalType": "address", 336 | "name": "to", 337 | "type": "address" 338 | }, 339 | { 340 | "internalType": "uint256", 341 | "name": "deadline", 342 | "type": "uint256" 343 | } 344 | ], 345 | "name": "removeLiquidity", 346 | "outputs": [ 347 | { 348 | "internalType": "uint256", 349 | "name": "amountA", 350 | "type": "uint256" 351 | }, 352 | { 353 | "internalType": "uint256", 354 | "name": "amountB", 355 | "type": "uint256" 356 | } 357 | ], 358 | "stateMutability": "nonpayable", 359 | "type": "function" 360 | }, 361 | { 362 | "inputs": [ 363 | { 364 | "internalType": "address", 365 | "name": "token", 366 | "type": "address" 367 | }, 368 | { 369 | "internalType": "uint256", 370 | "name": "liquidity", 371 | "type": "uint256" 372 | }, 373 | { 374 | "internalType": "uint256", 375 | "name": "amountTokenMin", 376 | "type": "uint256" 377 | }, 378 | { 379 | "internalType": "uint256", 380 | "name": "amountETHMin", 381 | "type": "uint256" 382 | }, 383 | { 384 | "internalType": "address", 385 | "name": "to", 386 | "type": "address" 387 | }, 388 | { 389 | "internalType": "uint256", 390 | "name": "deadline", 391 | "type": "uint256" 392 | } 393 | ], 394 | "name": "removeLiquidityETH", 395 | "outputs": [ 396 | { 397 | "internalType": "uint256", 398 | "name": "amountToken", 399 | "type": "uint256" 400 | }, 401 | { 402 | "internalType": "uint256", 403 | "name": "amountETH", 404 | "type": "uint256" 405 | } 406 | ], 407 | "stateMutability": "nonpayable", 408 | "type": "function" 409 | }, 410 | { 411 | "inputs": [ 412 | { 413 | "internalType": "address", 414 | "name": "token", 415 | "type": "address" 416 | }, 417 | { 418 | "internalType": "uint256", 419 | "name": "liquidity", 420 | "type": "uint256" 421 | }, 422 | { 423 | "internalType": "uint256", 424 | "name": "amountTokenMin", 425 | "type": "uint256" 426 | }, 427 | { 428 | "internalType": "uint256", 429 | "name": "amountETHMin", 430 | "type": "uint256" 431 | }, 432 | { 433 | "internalType": "address", 434 | "name": "to", 435 | "type": "address" 436 | }, 437 | { 438 | "internalType": "uint256", 439 | "name": "deadline", 440 | "type": "uint256" 441 | } 442 | ], 443 | "name": "removeLiquidityETHSupportingFeeOnTransferTokens", 444 | "outputs": [ 445 | { 446 | "internalType": "uint256", 447 | "name": "amountETH", 448 | "type": "uint256" 449 | } 450 | ], 451 | "stateMutability": "nonpayable", 452 | "type": "function" 453 | }, 454 | { 455 | "inputs": [ 456 | { 457 | "internalType": "address", 458 | "name": "token", 459 | "type": "address" 460 | }, 461 | { 462 | "internalType": "uint256", 463 | "name": "liquidity", 464 | "type": "uint256" 465 | }, 466 | { 467 | "internalType": "uint256", 468 | "name": "amountTokenMin", 469 | "type": "uint256" 470 | }, 471 | { 472 | "internalType": "uint256", 473 | "name": "amountETHMin", 474 | "type": "uint256" 475 | }, 476 | { 477 | "internalType": "address", 478 | "name": "to", 479 | "type": "address" 480 | }, 481 | { 482 | "internalType": "uint256", 483 | "name": "deadline", 484 | "type": "uint256" 485 | }, 486 | { 487 | "internalType": "bool", 488 | "name": "approveMax", 489 | "type": "bool" 490 | }, 491 | { 492 | "internalType": "uint8", 493 | "name": "v", 494 | "type": "uint8" 495 | }, 496 | { 497 | "internalType": "bytes32", 498 | "name": "r", 499 | "type": "bytes32" 500 | }, 501 | { 502 | "internalType": "bytes32", 503 | "name": "s", 504 | "type": "bytes32" 505 | } 506 | ], 507 | "name": "removeLiquidityETHWithPermit", 508 | "outputs": [ 509 | { 510 | "internalType": "uint256", 511 | "name": "amountToken", 512 | "type": "uint256" 513 | }, 514 | { 515 | "internalType": "uint256", 516 | "name": "amountETH", 517 | "type": "uint256" 518 | } 519 | ], 520 | "stateMutability": "nonpayable", 521 | "type": "function" 522 | }, 523 | { 524 | "inputs": [ 525 | { 526 | "internalType": "address", 527 | "name": "token", 528 | "type": "address" 529 | }, 530 | { 531 | "internalType": "uint256", 532 | "name": "liquidity", 533 | "type": "uint256" 534 | }, 535 | { 536 | "internalType": "uint256", 537 | "name": "amountTokenMin", 538 | "type": "uint256" 539 | }, 540 | { 541 | "internalType": "uint256", 542 | "name": "amountETHMin", 543 | "type": "uint256" 544 | }, 545 | { 546 | "internalType": "address", 547 | "name": "to", 548 | "type": "address" 549 | }, 550 | { 551 | "internalType": "uint256", 552 | "name": "deadline", 553 | "type": "uint256" 554 | }, 555 | { 556 | "internalType": "bool", 557 | "name": "approveMax", 558 | "type": "bool" 559 | }, 560 | { 561 | "internalType": "uint8", 562 | "name": "v", 563 | "type": "uint8" 564 | }, 565 | { 566 | "internalType": "bytes32", 567 | "name": "r", 568 | "type": "bytes32" 569 | }, 570 | { 571 | "internalType": "bytes32", 572 | "name": "s", 573 | "type": "bytes32" 574 | } 575 | ], 576 | "name": "removeLiquidityETHWithPermitSupportingFeeOnTransferTokens", 577 | "outputs": [ 578 | { 579 | "internalType": "uint256", 580 | "name": "amountETH", 581 | "type": "uint256" 582 | } 583 | ], 584 | "stateMutability": "nonpayable", 585 | "type": "function" 586 | }, 587 | { 588 | "inputs": [ 589 | { 590 | "internalType": "address", 591 | "name": "tokenA", 592 | "type": "address" 593 | }, 594 | { 595 | "internalType": "address", 596 | "name": "tokenB", 597 | "type": "address" 598 | }, 599 | { 600 | "internalType": "uint256", 601 | "name": "liquidity", 602 | "type": "uint256" 603 | }, 604 | { 605 | "internalType": "uint256", 606 | "name": "amountAMin", 607 | "type": "uint256" 608 | }, 609 | { 610 | "internalType": "uint256", 611 | "name": "amountBMin", 612 | "type": "uint256" 613 | }, 614 | { 615 | "internalType": "address", 616 | "name": "to", 617 | "type": "address" 618 | }, 619 | { 620 | "internalType": "uint256", 621 | "name": "deadline", 622 | "type": "uint256" 623 | }, 624 | { 625 | "internalType": "bool", 626 | "name": "approveMax", 627 | "type": "bool" 628 | }, 629 | { 630 | "internalType": "uint8", 631 | "name": "v", 632 | "type": "uint8" 633 | }, 634 | { 635 | "internalType": "bytes32", 636 | "name": "r", 637 | "type": "bytes32" 638 | }, 639 | { 640 | "internalType": "bytes32", 641 | "name": "s", 642 | "type": "bytes32" 643 | } 644 | ], 645 | "name": "removeLiquidityWithPermit", 646 | "outputs": [ 647 | { 648 | "internalType": "uint256", 649 | "name": "amountA", 650 | "type": "uint256" 651 | }, 652 | { 653 | "internalType": "uint256", 654 | "name": "amountB", 655 | "type": "uint256" 656 | } 657 | ], 658 | "stateMutability": "nonpayable", 659 | "type": "function" 660 | }, 661 | { 662 | "inputs": [ 663 | { 664 | "internalType": "uint256", 665 | "name": "amountOut", 666 | "type": "uint256" 667 | }, 668 | { 669 | "internalType": "address[]", 670 | "name": "path", 671 | "type": "address[]" 672 | }, 673 | { 674 | "internalType": "address", 675 | "name": "to", 676 | "type": "address" 677 | }, 678 | { 679 | "internalType": "uint256", 680 | "name": "deadline", 681 | "type": "uint256" 682 | } 683 | ], 684 | "name": "swapETHForExactTokens", 685 | "outputs": [ 686 | { 687 | "internalType": "uint256[]", 688 | "name": "amounts", 689 | "type": "uint256[]" 690 | } 691 | ], 692 | "stateMutability": "payable", 693 | "type": "function" 694 | }, 695 | { 696 | "inputs": [ 697 | { 698 | "internalType": "uint256", 699 | "name": "amountOutMin", 700 | "type": "uint256" 701 | }, 702 | { 703 | "internalType": "address[]", 704 | "name": "path", 705 | "type": "address[]" 706 | }, 707 | { 708 | "internalType": "address", 709 | "name": "to", 710 | "type": "address" 711 | }, 712 | { 713 | "internalType": "uint256", 714 | "name": "deadline", 715 | "type": "uint256" 716 | } 717 | ], 718 | "name": "swapExactETHForTokens", 719 | "outputs": [ 720 | { 721 | "internalType": "uint256[]", 722 | "name": "amounts", 723 | "type": "uint256[]" 724 | } 725 | ], 726 | "stateMutability": "payable", 727 | "type": "function" 728 | }, 729 | { 730 | "inputs": [ 731 | { 732 | "internalType": "uint256", 733 | "name": "amountOutMin", 734 | "type": "uint256" 735 | }, 736 | { 737 | "internalType": "address[]", 738 | "name": "path", 739 | "type": "address[]" 740 | }, 741 | { 742 | "internalType": "address", 743 | "name": "to", 744 | "type": "address" 745 | }, 746 | { 747 | "internalType": "uint256", 748 | "name": "deadline", 749 | "type": "uint256" 750 | } 751 | ], 752 | "name": "swapExactETHForTokensSupportingFeeOnTransferTokens", 753 | "outputs": [], 754 | "stateMutability": "payable", 755 | "type": "function" 756 | }, 757 | { 758 | "inputs": [ 759 | { 760 | "internalType": "uint256", 761 | "name": "amountIn", 762 | "type": "uint256" 763 | }, 764 | { 765 | "internalType": "uint256", 766 | "name": "amountOutMin", 767 | "type": "uint256" 768 | }, 769 | { 770 | "internalType": "address[]", 771 | "name": "path", 772 | "type": "address[]" 773 | }, 774 | { 775 | "internalType": "address", 776 | "name": "to", 777 | "type": "address" 778 | }, 779 | { 780 | "internalType": "uint256", 781 | "name": "deadline", 782 | "type": "uint256" 783 | } 784 | ], 785 | "name": "swapExactTokensForETH", 786 | "outputs": [ 787 | { 788 | "internalType": "uint256[]", 789 | "name": "amounts", 790 | "type": "uint256[]" 791 | } 792 | ], 793 | "stateMutability": "nonpayable", 794 | "type": "function" 795 | }, 796 | { 797 | "inputs": [ 798 | { 799 | "internalType": "uint256", 800 | "name": "amountIn", 801 | "type": "uint256" 802 | }, 803 | { 804 | "internalType": "uint256", 805 | "name": "amountOutMin", 806 | "type": "uint256" 807 | }, 808 | { 809 | "internalType": "address[]", 810 | "name": "path", 811 | "type": "address[]" 812 | }, 813 | { 814 | "internalType": "address", 815 | "name": "to", 816 | "type": "address" 817 | }, 818 | { 819 | "internalType": "uint256", 820 | "name": "deadline", 821 | "type": "uint256" 822 | } 823 | ], 824 | "name": "swapExactTokensForETHSupportingFeeOnTransferTokens", 825 | "outputs": [], 826 | "stateMutability": "nonpayable", 827 | "type": "function" 828 | }, 829 | { 830 | "inputs": [ 831 | { 832 | "internalType": "uint256", 833 | "name": "amountIn", 834 | "type": "uint256" 835 | }, 836 | { 837 | "internalType": "uint256", 838 | "name": "amountOutMin", 839 | "type": "uint256" 840 | }, 841 | { 842 | "internalType": "address[]", 843 | "name": "path", 844 | "type": "address[]" 845 | }, 846 | { 847 | "internalType": "address", 848 | "name": "to", 849 | "type": "address" 850 | }, 851 | { 852 | "internalType": "uint256", 853 | "name": "deadline", 854 | "type": "uint256" 855 | } 856 | ], 857 | "name": "swapExactTokensForTokens", 858 | "outputs": [ 859 | { 860 | "internalType": "uint256[]", 861 | "name": "amounts", 862 | "type": "uint256[]" 863 | } 864 | ], 865 | "stateMutability": "nonpayable", 866 | "type": "function" 867 | }, 868 | { 869 | "inputs": [ 870 | { 871 | "internalType": "uint256", 872 | "name": "amountIn", 873 | "type": "uint256" 874 | }, 875 | { 876 | "internalType": "uint256", 877 | "name": "amountOutMin", 878 | "type": "uint256" 879 | }, 880 | { 881 | "internalType": "address[]", 882 | "name": "path", 883 | "type": "address[]" 884 | }, 885 | { 886 | "internalType": "address", 887 | "name": "to", 888 | "type": "address" 889 | }, 890 | { 891 | "internalType": "uint256", 892 | "name": "deadline", 893 | "type": "uint256" 894 | } 895 | ], 896 | "name": "swapExactTokensForTokensSupportingFeeOnTransferTokens", 897 | "outputs": [], 898 | "stateMutability": "nonpayable", 899 | "type": "function" 900 | }, 901 | { 902 | "inputs": [ 903 | { 904 | "internalType": "uint256", 905 | "name": "amountOut", 906 | "type": "uint256" 907 | }, 908 | { 909 | "internalType": "uint256", 910 | "name": "amountInMax", 911 | "type": "uint256" 912 | }, 913 | { 914 | "internalType": "address[]", 915 | "name": "path", 916 | "type": "address[]" 917 | }, 918 | { 919 | "internalType": "address", 920 | "name": "to", 921 | "type": "address" 922 | }, 923 | { 924 | "internalType": "uint256", 925 | "name": "deadline", 926 | "type": "uint256" 927 | } 928 | ], 929 | "name": "swapTokensForExactETH", 930 | "outputs": [ 931 | { 932 | "internalType": "uint256[]", 933 | "name": "amounts", 934 | "type": "uint256[]" 935 | } 936 | ], 937 | "stateMutability": "nonpayable", 938 | "type": "function" 939 | }, 940 | { 941 | "inputs": [ 942 | { 943 | "internalType": "uint256", 944 | "name": "amountOut", 945 | "type": "uint256" 946 | }, 947 | { 948 | "internalType": "uint256", 949 | "name": "amountInMax", 950 | "type": "uint256" 951 | }, 952 | { 953 | "internalType": "address[]", 954 | "name": "path", 955 | "type": "address[]" 956 | }, 957 | { 958 | "internalType": "address", 959 | "name": "to", 960 | "type": "address" 961 | }, 962 | { 963 | "internalType": "uint256", 964 | "name": "deadline", 965 | "type": "uint256" 966 | } 967 | ], 968 | "name": "swapTokensForExactTokens", 969 | "outputs": [ 970 | { 971 | "internalType": "uint256[]", 972 | "name": "amounts", 973 | "type": "uint256[]" 974 | } 975 | ], 976 | "stateMutability": "nonpayable", 977 | "type": "function" 978 | }, 979 | { 980 | "stateMutability": "payable", 981 | "type": "receive" 982 | } 983 | ] -------------------------------------------------------------------------------- /web/abi/xen.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": true, 12 | "internalType": "address", 13 | "name": "owner", 14 | "type": "address" 15 | }, 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "spender", 20 | "type": "address" 21 | }, 22 | { 23 | "indexed": false, 24 | "internalType": "uint256", 25 | "name": "value", 26 | "type": "uint256" 27 | } 28 | ], 29 | "name": "Approval", 30 | "type": "event" 31 | }, 32 | { 33 | "anonymous": false, 34 | "inputs": [ 35 | { 36 | "indexed": true, 37 | "internalType": "address", 38 | "name": "user", 39 | "type": "address" 40 | }, 41 | { 42 | "indexed": false, 43 | "internalType": "uint256", 44 | "name": "rewardAmount", 45 | "type": "uint256" 46 | } 47 | ], 48 | "name": "MintClaimed", 49 | "type": "event" 50 | }, 51 | { 52 | "anonymous": false, 53 | "inputs": [ 54 | { 55 | "indexed": true, 56 | "internalType": "address", 57 | "name": "user", 58 | "type": "address" 59 | }, 60 | { 61 | "indexed": false, 62 | "internalType": "uint256", 63 | "name": "term", 64 | "type": "uint256" 65 | }, 66 | { 67 | "indexed": false, 68 | "internalType": "uint256", 69 | "name": "rank", 70 | "type": "uint256" 71 | } 72 | ], 73 | "name": "RankClaimed", 74 | "type": "event" 75 | }, 76 | { 77 | "anonymous": false, 78 | "inputs": [ 79 | { 80 | "indexed": true, 81 | "internalType": "address", 82 | "name": "user", 83 | "type": "address" 84 | }, 85 | { 86 | "indexed": false, 87 | "internalType": "uint256", 88 | "name": "amount", 89 | "type": "uint256" 90 | }, 91 | { 92 | "indexed": false, 93 | "internalType": "uint256", 94 | "name": "term", 95 | "type": "uint256" 96 | } 97 | ], 98 | "name": "Staked", 99 | "type": "event" 100 | }, 101 | { 102 | "anonymous": false, 103 | "inputs": [ 104 | { 105 | "indexed": true, 106 | "internalType": "address", 107 | "name": "from", 108 | "type": "address" 109 | }, 110 | { 111 | "indexed": true, 112 | "internalType": "address", 113 | "name": "to", 114 | "type": "address" 115 | }, 116 | { 117 | "indexed": false, 118 | "internalType": "uint256", 119 | "name": "value", 120 | "type": "uint256" 121 | } 122 | ], 123 | "name": "Transfer", 124 | "type": "event" 125 | }, 126 | { 127 | "anonymous": false, 128 | "inputs": [ 129 | { 130 | "indexed": true, 131 | "internalType": "address", 132 | "name": "user", 133 | "type": "address" 134 | }, 135 | { 136 | "indexed": false, 137 | "internalType": "uint256", 138 | "name": "amount", 139 | "type": "uint256" 140 | }, 141 | { 142 | "indexed": false, 143 | "internalType": "uint256", 144 | "name": "reward", 145 | "type": "uint256" 146 | } 147 | ], 148 | "name": "Withdrawn", 149 | "type": "event" 150 | }, 151 | { 152 | "inputs": [], 153 | "name": "AUTHORS", 154 | "outputs": [ 155 | { 156 | "internalType": "string", 157 | "name": "", 158 | "type": "string" 159 | } 160 | ], 161 | "stateMutability": "view", 162 | "type": "function" 163 | }, 164 | { 165 | "inputs": [], 166 | "name": "DAYS_IN_YEAR", 167 | "outputs": [ 168 | { 169 | "internalType": "uint256", 170 | "name": "", 171 | "type": "uint256" 172 | } 173 | ], 174 | "stateMutability": "view", 175 | "type": "function" 176 | }, 177 | { 178 | "inputs": [], 179 | "name": "EAA_PM_START", 180 | "outputs": [ 181 | { 182 | "internalType": "uint256", 183 | "name": "", 184 | "type": "uint256" 185 | } 186 | ], 187 | "stateMutability": "view", 188 | "type": "function" 189 | }, 190 | { 191 | "inputs": [], 192 | "name": "EAA_PM_STEP", 193 | "outputs": [ 194 | { 195 | "internalType": "uint256", 196 | "name": "", 197 | "type": "uint256" 198 | } 199 | ], 200 | "stateMutability": "view", 201 | "type": "function" 202 | }, 203 | { 204 | "inputs": [], 205 | "name": "EAA_RANK_STEP", 206 | "outputs": [ 207 | { 208 | "internalType": "uint256", 209 | "name": "", 210 | "type": "uint256" 211 | } 212 | ], 213 | "stateMutability": "view", 214 | "type": "function" 215 | }, 216 | { 217 | "inputs": [], 218 | "name": "GENESIS_RANK", 219 | "outputs": [ 220 | { 221 | "internalType": "uint256", 222 | "name": "", 223 | "type": "uint256" 224 | } 225 | ], 226 | "stateMutability": "view", 227 | "type": "function" 228 | }, 229 | { 230 | "inputs": [], 231 | "name": "MAX_PENALTY_PCT", 232 | "outputs": [ 233 | { 234 | "internalType": "uint256", 235 | "name": "", 236 | "type": "uint256" 237 | } 238 | ], 239 | "stateMutability": "view", 240 | "type": "function" 241 | }, 242 | { 243 | "inputs": [], 244 | "name": "MAX_TERM_END", 245 | "outputs": [ 246 | { 247 | "internalType": "uint256", 248 | "name": "", 249 | "type": "uint256" 250 | } 251 | ], 252 | "stateMutability": "view", 253 | "type": "function" 254 | }, 255 | { 256 | "inputs": [], 257 | "name": "MAX_TERM_START", 258 | "outputs": [ 259 | { 260 | "internalType": "uint256", 261 | "name": "", 262 | "type": "uint256" 263 | } 264 | ], 265 | "stateMutability": "view", 266 | "type": "function" 267 | }, 268 | { 269 | "inputs": [], 270 | "name": "MIN_TERM", 271 | "outputs": [ 272 | { 273 | "internalType": "uint256", 274 | "name": "", 275 | "type": "uint256" 276 | } 277 | ], 278 | "stateMutability": "view", 279 | "type": "function" 280 | }, 281 | { 282 | "inputs": [], 283 | "name": "REWARD_AMPLIFIER_END", 284 | "outputs": [ 285 | { 286 | "internalType": "uint256", 287 | "name": "", 288 | "type": "uint256" 289 | } 290 | ], 291 | "stateMutability": "view", 292 | "type": "function" 293 | }, 294 | { 295 | "inputs": [], 296 | "name": "REWARD_AMPLIFIER_START", 297 | "outputs": [ 298 | { 299 | "internalType": "uint256", 300 | "name": "", 301 | "type": "uint256" 302 | } 303 | ], 304 | "stateMutability": "view", 305 | "type": "function" 306 | }, 307 | { 308 | "inputs": [], 309 | "name": "SECONDS_IN_DAY", 310 | "outputs": [ 311 | { 312 | "internalType": "uint256", 313 | "name": "", 314 | "type": "uint256" 315 | } 316 | ], 317 | "stateMutability": "view", 318 | "type": "function" 319 | }, 320 | { 321 | "inputs": [], 322 | "name": "TERM_AMPLIFIER", 323 | "outputs": [ 324 | { 325 | "internalType": "uint256", 326 | "name": "", 327 | "type": "uint256" 328 | } 329 | ], 330 | "stateMutability": "view", 331 | "type": "function" 332 | }, 333 | { 334 | "inputs": [], 335 | "name": "TERM_AMPLIFIER_THRESHOLD", 336 | "outputs": [ 337 | { 338 | "internalType": "uint256", 339 | "name": "", 340 | "type": "uint256" 341 | } 342 | ], 343 | "stateMutability": "view", 344 | "type": "function" 345 | }, 346 | { 347 | "inputs": [], 348 | "name": "WITHDRAWAL_WINDOW_DAYS", 349 | "outputs": [ 350 | { 351 | "internalType": "uint256", 352 | "name": "", 353 | "type": "uint256" 354 | } 355 | ], 356 | "stateMutability": "view", 357 | "type": "function" 358 | }, 359 | { 360 | "inputs": [], 361 | "name": "XEN_APY_DAYS_STEP", 362 | "outputs": [ 363 | { 364 | "internalType": "uint256", 365 | "name": "", 366 | "type": "uint256" 367 | } 368 | ], 369 | "stateMutability": "view", 370 | "type": "function" 371 | }, 372 | { 373 | "inputs": [], 374 | "name": "XEN_APY_END", 375 | "outputs": [ 376 | { 377 | "internalType": "uint256", 378 | "name": "", 379 | "type": "uint256" 380 | } 381 | ], 382 | "stateMutability": "view", 383 | "type": "function" 384 | }, 385 | { 386 | "inputs": [], 387 | "name": "XEN_APY_START", 388 | "outputs": [ 389 | { 390 | "internalType": "uint256", 391 | "name": "", 392 | "type": "uint256" 393 | } 394 | ], 395 | "stateMutability": "view", 396 | "type": "function" 397 | }, 398 | { 399 | "inputs": [], 400 | "name": "XEN_MIN_BURN", 401 | "outputs": [ 402 | { 403 | "internalType": "uint256", 404 | "name": "", 405 | "type": "uint256" 406 | } 407 | ], 408 | "stateMutability": "view", 409 | "type": "function" 410 | }, 411 | { 412 | "inputs": [], 413 | "name": "XEN_MIN_STAKE", 414 | "outputs": [ 415 | { 416 | "internalType": "uint256", 417 | "name": "", 418 | "type": "uint256" 419 | } 420 | ], 421 | "stateMutability": "view", 422 | "type": "function" 423 | }, 424 | { 425 | "inputs": [], 426 | "name": "activeMinters", 427 | "outputs": [ 428 | { 429 | "internalType": "uint256", 430 | "name": "", 431 | "type": "uint256" 432 | } 433 | ], 434 | "stateMutability": "view", 435 | "type": "function" 436 | }, 437 | { 438 | "inputs": [], 439 | "name": "activeStakes", 440 | "outputs": [ 441 | { 442 | "internalType": "uint256", 443 | "name": "", 444 | "type": "uint256" 445 | } 446 | ], 447 | "stateMutability": "view", 448 | "type": "function" 449 | }, 450 | { 451 | "inputs": [ 452 | { 453 | "internalType": "address", 454 | "name": "owner", 455 | "type": "address" 456 | }, 457 | { 458 | "internalType": "address", 459 | "name": "spender", 460 | "type": "address" 461 | } 462 | ], 463 | "name": "allowance", 464 | "outputs": [ 465 | { 466 | "internalType": "uint256", 467 | "name": "", 468 | "type": "uint256" 469 | } 470 | ], 471 | "stateMutability": "view", 472 | "type": "function" 473 | }, 474 | { 475 | "inputs": [ 476 | { 477 | "internalType": "address", 478 | "name": "spender", 479 | "type": "address" 480 | }, 481 | { 482 | "internalType": "uint256", 483 | "name": "amount", 484 | "type": "uint256" 485 | } 486 | ], 487 | "name": "approve", 488 | "outputs": [ 489 | { 490 | "internalType": "bool", 491 | "name": "", 492 | "type": "bool" 493 | } 494 | ], 495 | "stateMutability": "nonpayable", 496 | "type": "function" 497 | }, 498 | { 499 | "inputs": [ 500 | { 501 | "internalType": "address", 502 | "name": "account", 503 | "type": "address" 504 | } 505 | ], 506 | "name": "balanceOf", 507 | "outputs": [ 508 | { 509 | "internalType": "uint256", 510 | "name": "", 511 | "type": "uint256" 512 | } 513 | ], 514 | "stateMutability": "view", 515 | "type": "function" 516 | }, 517 | { 518 | "inputs": [ 519 | { 520 | "internalType": "address", 521 | "name": "user", 522 | "type": "address" 523 | }, 524 | { 525 | "internalType": "uint256", 526 | "name": "amount", 527 | "type": "uint256" 528 | } 529 | ], 530 | "name": "burn", 531 | "outputs": [], 532 | "stateMutability": "nonpayable", 533 | "type": "function" 534 | }, 535 | { 536 | "inputs": [], 537 | "name": "claimMintReward", 538 | "outputs": [], 539 | "stateMutability": "nonpayable", 540 | "type": "function" 541 | }, 542 | { 543 | "inputs": [ 544 | { 545 | "internalType": "address", 546 | "name": "other", 547 | "type": "address" 548 | }, 549 | { 550 | "internalType": "uint256", 551 | "name": "pct", 552 | "type": "uint256" 553 | } 554 | ], 555 | "name": "claimMintRewardAndShare", 556 | "outputs": [], 557 | "stateMutability": "nonpayable", 558 | "type": "function" 559 | }, 560 | { 561 | "inputs": [ 562 | { 563 | "internalType": "uint256", 564 | "name": "pct", 565 | "type": "uint256" 566 | }, 567 | { 568 | "internalType": "uint256", 569 | "name": "term", 570 | "type": "uint256" 571 | } 572 | ], 573 | "name": "claimMintRewardAndStake", 574 | "outputs": [], 575 | "stateMutability": "nonpayable", 576 | "type": "function" 577 | }, 578 | { 579 | "inputs": [ 580 | { 581 | "internalType": "uint256", 582 | "name": "term", 583 | "type": "uint256" 584 | } 585 | ], 586 | "name": "claimRank", 587 | "outputs": [], 588 | "stateMutability": "nonpayable", 589 | "type": "function" 590 | }, 591 | { 592 | "inputs": [], 593 | "name": "decimals", 594 | "outputs": [ 595 | { 596 | "internalType": "uint8", 597 | "name": "", 598 | "type": "uint8" 599 | } 600 | ], 601 | "stateMutability": "view", 602 | "type": "function" 603 | }, 604 | { 605 | "inputs": [ 606 | { 607 | "internalType": "address", 608 | "name": "spender", 609 | "type": "address" 610 | }, 611 | { 612 | "internalType": "uint256", 613 | "name": "subtractedValue", 614 | "type": "uint256" 615 | } 616 | ], 617 | "name": "decreaseAllowance", 618 | "outputs": [ 619 | { 620 | "internalType": "bool", 621 | "name": "", 622 | "type": "bool" 623 | } 624 | ], 625 | "stateMutability": "nonpayable", 626 | "type": "function" 627 | }, 628 | { 629 | "inputs": [], 630 | "name": "genesisTs", 631 | "outputs": [ 632 | { 633 | "internalType": "uint256", 634 | "name": "", 635 | "type": "uint256" 636 | } 637 | ], 638 | "stateMutability": "view", 639 | "type": "function" 640 | }, 641 | { 642 | "inputs": [], 643 | "name": "getCurrentAMP", 644 | "outputs": [ 645 | { 646 | "internalType": "uint256", 647 | "name": "", 648 | "type": "uint256" 649 | } 650 | ], 651 | "stateMutability": "view", 652 | "type": "function" 653 | }, 654 | { 655 | "inputs": [], 656 | "name": "getCurrentAPY", 657 | "outputs": [ 658 | { 659 | "internalType": "uint256", 660 | "name": "", 661 | "type": "uint256" 662 | } 663 | ], 664 | "stateMutability": "view", 665 | "type": "function" 666 | }, 667 | { 668 | "inputs": [], 669 | "name": "getCurrentEAAR", 670 | "outputs": [ 671 | { 672 | "internalType": "uint256", 673 | "name": "", 674 | "type": "uint256" 675 | } 676 | ], 677 | "stateMutability": "view", 678 | "type": "function" 679 | }, 680 | { 681 | "inputs": [], 682 | "name": "getCurrentMaxTerm", 683 | "outputs": [ 684 | { 685 | "internalType": "uint256", 686 | "name": "", 687 | "type": "uint256" 688 | } 689 | ], 690 | "stateMutability": "view", 691 | "type": "function" 692 | }, 693 | { 694 | "inputs": [ 695 | { 696 | "internalType": "uint256", 697 | "name": "rankDelta", 698 | "type": "uint256" 699 | }, 700 | { 701 | "internalType": "uint256", 702 | "name": "amplifier", 703 | "type": "uint256" 704 | }, 705 | { 706 | "internalType": "uint256", 707 | "name": "term", 708 | "type": "uint256" 709 | }, 710 | { 711 | "internalType": "uint256", 712 | "name": "eaa", 713 | "type": "uint256" 714 | } 715 | ], 716 | "name": "getGrossReward", 717 | "outputs": [ 718 | { 719 | "internalType": "uint256", 720 | "name": "", 721 | "type": "uint256" 722 | } 723 | ], 724 | "stateMutability": "pure", 725 | "type": "function" 726 | }, 727 | { 728 | "inputs": [], 729 | "name": "getUserMint", 730 | "outputs": [ 731 | { 732 | "components": [ 733 | { 734 | "internalType": "address", 735 | "name": "user", 736 | "type": "address" 737 | }, 738 | { 739 | "internalType": "uint256", 740 | "name": "term", 741 | "type": "uint256" 742 | }, 743 | { 744 | "internalType": "uint256", 745 | "name": "maturityTs", 746 | "type": "uint256" 747 | }, 748 | { 749 | "internalType": "uint256", 750 | "name": "rank", 751 | "type": "uint256" 752 | }, 753 | { 754 | "internalType": "uint256", 755 | "name": "amplifier", 756 | "type": "uint256" 757 | }, 758 | { 759 | "internalType": "uint256", 760 | "name": "eaaRate", 761 | "type": "uint256" 762 | } 763 | ], 764 | "internalType": "struct XENCrypto.MintInfo", 765 | "name": "", 766 | "type": "tuple" 767 | } 768 | ], 769 | "stateMutability": "view", 770 | "type": "function" 771 | }, 772 | { 773 | "inputs": [], 774 | "name": "getUserStake", 775 | "outputs": [ 776 | { 777 | "components": [ 778 | { 779 | "internalType": "uint256", 780 | "name": "term", 781 | "type": "uint256" 782 | }, 783 | { 784 | "internalType": "uint256", 785 | "name": "maturityTs", 786 | "type": "uint256" 787 | }, 788 | { 789 | "internalType": "uint256", 790 | "name": "amount", 791 | "type": "uint256" 792 | }, 793 | { 794 | "internalType": "uint256", 795 | "name": "apy", 796 | "type": "uint256" 797 | } 798 | ], 799 | "internalType": "struct XENCrypto.StakeInfo", 800 | "name": "", 801 | "type": "tuple" 802 | } 803 | ], 804 | "stateMutability": "view", 805 | "type": "function" 806 | }, 807 | { 808 | "inputs": [], 809 | "name": "globalRank", 810 | "outputs": [ 811 | { 812 | "internalType": "uint256", 813 | "name": "", 814 | "type": "uint256" 815 | } 816 | ], 817 | "stateMutability": "view", 818 | "type": "function" 819 | }, 820 | { 821 | "inputs": [ 822 | { 823 | "internalType": "address", 824 | "name": "spender", 825 | "type": "address" 826 | }, 827 | { 828 | "internalType": "uint256", 829 | "name": "addedValue", 830 | "type": "uint256" 831 | } 832 | ], 833 | "name": "increaseAllowance", 834 | "outputs": [ 835 | { 836 | "internalType": "bool", 837 | "name": "", 838 | "type": "bool" 839 | } 840 | ], 841 | "stateMutability": "nonpayable", 842 | "type": "function" 843 | }, 844 | { 845 | "inputs": [], 846 | "name": "name", 847 | "outputs": [ 848 | { 849 | "internalType": "string", 850 | "name": "", 851 | "type": "string" 852 | } 853 | ], 854 | "stateMutability": "view", 855 | "type": "function" 856 | }, 857 | { 858 | "inputs": [ 859 | { 860 | "internalType": "uint256", 861 | "name": "amount", 862 | "type": "uint256" 863 | }, 864 | { 865 | "internalType": "uint256", 866 | "name": "term", 867 | "type": "uint256" 868 | } 869 | ], 870 | "name": "stake", 871 | "outputs": [], 872 | "stateMutability": "nonpayable", 873 | "type": "function" 874 | }, 875 | { 876 | "inputs": [], 877 | "name": "symbol", 878 | "outputs": [ 879 | { 880 | "internalType": "string", 881 | "name": "", 882 | "type": "string" 883 | } 884 | ], 885 | "stateMutability": "view", 886 | "type": "function" 887 | }, 888 | { 889 | "inputs": [], 890 | "name": "totalSupply", 891 | "outputs": [ 892 | { 893 | "internalType": "uint256", 894 | "name": "", 895 | "type": "uint256" 896 | } 897 | ], 898 | "stateMutability": "view", 899 | "type": "function" 900 | }, 901 | { 902 | "inputs": [], 903 | "name": "totalXenStaked", 904 | "outputs": [ 905 | { 906 | "internalType": "uint256", 907 | "name": "", 908 | "type": "uint256" 909 | } 910 | ], 911 | "stateMutability": "view", 912 | "type": "function" 913 | }, 914 | { 915 | "inputs": [ 916 | { 917 | "internalType": "address", 918 | "name": "to", 919 | "type": "address" 920 | }, 921 | { 922 | "internalType": "uint256", 923 | "name": "amount", 924 | "type": "uint256" 925 | } 926 | ], 927 | "name": "transfer", 928 | "outputs": [ 929 | { 930 | "internalType": "bool", 931 | "name": "", 932 | "type": "bool" 933 | } 934 | ], 935 | "stateMutability": "nonpayable", 936 | "type": "function" 937 | }, 938 | { 939 | "inputs": [ 940 | { 941 | "internalType": "address", 942 | "name": "from", 943 | "type": "address" 944 | }, 945 | { 946 | "internalType": "address", 947 | "name": "to", 948 | "type": "address" 949 | }, 950 | { 951 | "internalType": "uint256", 952 | "name": "amount", 953 | "type": "uint256" 954 | } 955 | ], 956 | "name": "transferFrom", 957 | "outputs": [ 958 | { 959 | "internalType": "bool", 960 | "name": "", 961 | "type": "bool" 962 | } 963 | ], 964 | "stateMutability": "nonpayable", 965 | "type": "function" 966 | }, 967 | { 968 | "inputs": [ 969 | { 970 | "internalType": "address", 971 | "name": "", 972 | "type": "address" 973 | } 974 | ], 975 | "name": "userBurns", 976 | "outputs": [ 977 | { 978 | "internalType": "uint256", 979 | "name": "", 980 | "type": "uint256" 981 | } 982 | ], 983 | "stateMutability": "view", 984 | "type": "function" 985 | }, 986 | { 987 | "inputs": [ 988 | { 989 | "internalType": "address", 990 | "name": "", 991 | "type": "address" 992 | } 993 | ], 994 | "name": "userMints", 995 | "outputs": [ 996 | { 997 | "internalType": "address", 998 | "name": "user", 999 | "type": "address" 1000 | }, 1001 | { 1002 | "internalType": "uint256", 1003 | "name": "term", 1004 | "type": "uint256" 1005 | }, 1006 | { 1007 | "internalType": "uint256", 1008 | "name": "maturityTs", 1009 | "type": "uint256" 1010 | }, 1011 | { 1012 | "internalType": "uint256", 1013 | "name": "rank", 1014 | "type": "uint256" 1015 | }, 1016 | { 1017 | "internalType": "uint256", 1018 | "name": "amplifier", 1019 | "type": "uint256" 1020 | }, 1021 | { 1022 | "internalType": "uint256", 1023 | "name": "eaaRate", 1024 | "type": "uint256" 1025 | } 1026 | ], 1027 | "stateMutability": "view", 1028 | "type": "function" 1029 | }, 1030 | { 1031 | "inputs": [ 1032 | { 1033 | "internalType": "address", 1034 | "name": "", 1035 | "type": "address" 1036 | } 1037 | ], 1038 | "name": "userStakes", 1039 | "outputs": [ 1040 | { 1041 | "internalType": "uint256", 1042 | "name": "term", 1043 | "type": "uint256" 1044 | }, 1045 | { 1046 | "internalType": "uint256", 1047 | "name": "maturityTs", 1048 | "type": "uint256" 1049 | }, 1050 | { 1051 | "internalType": "uint256", 1052 | "name": "amount", 1053 | "type": "uint256" 1054 | }, 1055 | { 1056 | "internalType": "uint256", 1057 | "name": "apy", 1058 | "type": "uint256" 1059 | } 1060 | ], 1061 | "stateMutability": "view", 1062 | "type": "function" 1063 | }, 1064 | { 1065 | "inputs": [], 1066 | "name": "withdraw", 1067 | "outputs": [], 1068 | "stateMutability": "nonpayable", 1069 | "type": "function" 1070 | } 1071 | ] -------------------------------------------------------------------------------- /web/css/styles.css: -------------------------------------------------------------------------------- 1 | /* styles.css */ 2 | 3 | .form-check-input:not(:last-child) { 4 | margin-right: 2px; 5 | } 6 | /* Add styles here to customize the appearance of your app */ -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 14 | Hello Crypto! 15 | 16 | 17 | 18 | 19 |
20 |

21 | 科学家小工具 22 |

23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 |
34 |
35 |
36 |

1. 网络设置

37 | 38 |
39 | 40 |
41 |
42 | http地址 44 |
45 |
46 | wss地址 48 |
49 |
50 |
51 | 52 | 54 |
55 | 56 | 57 |
58 |
59 |
60 | 61 |
62 |
63 |

2. 交易设置

64 | 65 |
66 |
67 | 正常模式 69 |
70 |
71 | EIP1559 73 |
74 |
75 |
76 | 77 | 78 |
79 |
80 | 81 | 82 |
83 | 84 |
85 | 86 | 87 |
88 | 89 |
90 | 91 |
92 | 93 | 95 |
96 |
97 | 98 | 99 |
100 |
101 | 102 | 103 |
104 |
105 |
106 |
107 |
108 |
109 |

交互模式

110 |
111 |
112 | 跟单模式 114 |
115 |
116 | 智能合约模式 118 |
119 |
120 | 121 |
122 |
123 |
124 |
125 |
126 |

3. 跟单模式

127 |
128 | 129 | 130 |
131 | 132 |
133 |
134 |
135 |
136 | 137 |
138 |
139 |

4. 按照合约信息交互

140 |
141 | 142 | 143 |
144 | 145 | 146 |
147 | 148 |
149 |
只读方法
151 |
不消耗主币方法
153 |
消耗主币方法
155 |
156 |
157 | 159 |
160 |
161 | 162 |
163 |
164 | 使用2的地址交互 166 |
167 |
168 | 使用4的地址交互 170 |
171 |
172 | 173 |
174 |
175 |
176 |
177 | 202 | 203 | 243 | 244 | 277 | 278 | 279 | 300 | 301 | 339 | 340 |
341 |
342 |
343 |

导入账户

344 |
345 |
347 |
348 |
349 |
350 |
351 |
352 |

日志

353 |
354 |
355 |
356 | 357 |
358 |
359 |
360 |
361 |
362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 374 | 375 | -------------------------------------------------------------------------------- /web/js/btcpunk.js: -------------------------------------------------------------------------------- 1 | function punkimgdownload() 2 | { 3 | ipcRenderer.send('info:punkimgdownload', null) 4 | } 5 | 6 | function punkselectblockinfo() 7 | { 8 | 9 | ipcRenderer.send('info:punkselectblockinfo', null) 10 | } 11 | 12 | function punkidselect() 13 | { 14 | var punkid = document.querySelector('#punkid').value; 15 | ipcRenderer.send('info:punkidselect', {punkid}) 16 | } 17 | 18 | function getbtccookiepath() 19 | { 20 | ipcRenderer.send('info:getbtccookiepath', null) 21 | } 22 | 23 | ipcRenderer.on('info:getbtccookiepath', (e, value) => { 24 | var filename = value.filename 25 | document.querySelector('#btccookiepath').value = filename; 26 | }); 27 | 28 | ipcRenderer.on('info:punkidselect', (e, value) => { 29 | var info = value.info 30 | console.log(info) 31 | }); 32 | 33 | 34 | function btcsetting() 35 | { 36 | var btcordrpc = document.querySelector('#btcordrpc').value 37 | var btcrpc = document.querySelector('#btcrpc').value 38 | var cookiefilename = document.querySelector('#btccookiepath').value 39 | ipcRenderer.send('info:btcsetting', {btcordrpc,btcrpc,cookiefilename}) 40 | } -------------------------------------------------------------------------------- /web/js/privatemanage.js: -------------------------------------------------------------------------------- 1 | //const { ipcRenderer } = require("electron"); 2 | 3 | 4 | //查询智能合约功能 5 | function btcreatpriatenumber() { 6 | const createnumber = document.querySelector('#creatpriatenumber').value; 7 | 8 | var value = { createnumber }; 9 | ipcRenderer.send('info:creatpriatenumber', value) 10 | 11 | } 12 | 13 | function reloadaddress() { 14 | ipcRenderer.send('info:accounts', null) 15 | } 16 | 17 | function changepage(pagename) { 18 | 19 | var pagenamelist = ['jiaohu','manageprikey','highfunction','melody','btcpunk','taskmanagement'] 20 | var pagenameele = ['#tabjiaohu','#tabmanageprikey','#highfunction','#melodycheck','#btcordnft','#taskmanagement'] 21 | 22 | var pageindex = 0; 23 | for(var i=0;i { 29 | const opt = document.createElement('option'); 30 | opt.textContent = option.label; 31 | opt.value = option.value; 32 | if (item[key] == option.value) { 33 | opt.selected = true; 34 | } 35 | select.appendChild(opt); 36 | }); 37 | 38 | select.setAttribute('data-key', key); 39 | select.disabled = true; 40 | cell.appendChild(select); 41 | } else if ((key !== 'id') || (key !== 'lastExecTime')) { 42 | const input = document.createElement('input'); 43 | input.value = item[key]; 44 | input.setAttribute('data-key', key); 45 | input.disabled = true; 46 | cell.appendChild(input); 47 | } else { 48 | cell.textContent = item[key]; 49 | } 50 | row.appendChild(cell); 51 | } 52 | const editCell = document.createElement('td'); 53 | const editButton = document.createElement('button'); 54 | editButton.textContent = '编辑'; 55 | editButton.classList.add('edit'); 56 | editButton.addEventListener('click', () => enableEditing(row)); 57 | editCell.appendChild(editButton); 58 | row.appendChild(editCell); 59 | 60 | const saveCell = document.createElement('td'); 61 | const saveButton = document.createElement('button'); 62 | saveButton.textContent = '保存'; 63 | saveButton.addEventListener('click', () => saveRow(row)); 64 | saveCell.appendChild(saveButton); 65 | row.appendChild(saveCell); 66 | 67 | const deleteCell = document.createElement('td'); 68 | const deleteButton = document.createElement('button'); 69 | deleteButton.textContent = '删除'; 70 | deleteButton.addEventListener('click', () => deleteRow(row)); 71 | deleteCell.appendChild(deleteButton); 72 | row.appendChild(deleteCell); 73 | 74 | tableBody.appendChild(row); 75 | } 76 | } 77 | 78 | function enableEditing(row) { 79 | 80 | const editButton = row.querySelector('button.edit'); 81 | editButton.disabled = true; 82 | const inputs = row.querySelectorAll('input ,select'); 83 | var id = null; 84 | 85 | inputs.forEach((input, index) => { 86 | input.disabled = false; 87 | if (input.getAttribute('data-key') === 'id') { 88 | id = input.value; 89 | } 90 | 91 | if ((input.getAttribute('data-key') === 'scriptpath') || (input.getAttribute('data-key') === 'execwallet')) { 92 | const browseButton = document.createElement('button'); 93 | browseButton.textContent = '浏览'; 94 | browseButton.setAttribute('data-input-id', index); 95 | browseButton.onclick = async () => { 96 | onSelectPath(id, input.getAttribute('data-key')); 97 | }; 98 | input.parentNode.appendChild(browseButton); 99 | 100 | } 101 | }); 102 | 103 | 104 | 105 | } 106 | 107 | async function onSelectPath(id, type) { 108 | ipcRenderer.send('info:selectpath', { id, type }) 109 | } 110 | 111 | ipcRenderer.on('info:selectpath', (e, value) => { 112 | 113 | id = Number(value.id); 114 | type = value.type; 115 | row = findRowById(id); 116 | if (row != null) { 117 | const inputs = row.querySelectorAll('input'); 118 | 119 | inputs.forEach(input => { 120 | input.disabled = false; 121 | if (input.getAttribute('data-key') === type) { 122 | input.value = value.filepath; 123 | } 124 | 125 | }); 126 | } 127 | 128 | 129 | }); 130 | 131 | function findRowById(id) { 132 | debugger 133 | const rows = tableBody.querySelectorAll('tr'); 134 | for (const row of rows) { 135 | const rowId = parseInt(row.getAttribute('data-id')); 136 | if (rowId === id) { 137 | return row; 138 | } 139 | } 140 | return null; 141 | } 142 | 143 | 144 | function saveRow(row) { 145 | 146 | 147 | const inputs = row.querySelectorAll('input, select'); 148 | const rowIndex = Array.from(tableBody.children).indexOf(row); 149 | inputs.forEach(input => { 150 | const key = input.getAttribute('data-key'); 151 | if(key == "exectime") 152 | { 153 | configData[rowIndex][key] = Number(input.value); 154 | } 155 | else 156 | { 157 | configData[rowIndex][key] = input.value; 158 | } 159 | 160 | input.disabled = true; 161 | }); 162 | 163 | // 查找所有文本内容为"浏览"的按钮并删除它们 164 | const browseButtons = row.querySelectorAll('button[data-input-id]'); 165 | for (const button of browseButtons) { 166 | button.parentNode.removeChild(button); 167 | } 168 | 169 | 170 | 171 | const editButton = row.querySelector('button.edit'); 172 | editButton.disabled = false; 173 | 174 | configedit(configData[rowIndex]); 175 | //将修改完的提交到后台 176 | 177 | //console.log(configData); // 输出更新后的configData,实际应用中请根据需要保存到文件或服务器 178 | } 179 | 180 | function configedit(editdata) { 181 | ipcRenderer.send('info:taskedit', { "editdata": editdata }) 182 | } 183 | 184 | function taskInit() { 185 | ipcRenderer.send('info:taskInit', {}) 186 | } 187 | 188 | function deleteRow(row) { 189 | id = row.getAttribute('data-id'); 190 | ipcRenderer.send('info:taskdelete', { id }) 191 | 192 | 193 | 194 | if (row) { 195 | 196 | row.parentNode.removeChild(row); 197 | // Call the function to delete the task from the config file. 198 | // deleteTaskById(configData, taskId); 199 | const taskIndex = configData.findIndex(item => item.id === id); 200 | 201 | if (taskIndex !== -1) { 202 | configData.splice(taskIndex, 1); 203 | } else { 204 | // console.log(`Task with ID ${taskId} not found.`); 205 | } 206 | //displayConfigData(); 207 | } 208 | 209 | } 210 | 211 | ipcRenderer.on('info:taskInit', (e, value) => { 212 | 213 | 214 | configData = value.configData; 215 | displayConfigData(); 216 | 217 | }); 218 | 219 | function addRow() { 220 | const newRowData = { 221 | id: (configData.length + 1), 222 | taskname: "", 223 | scriptpath: "", 224 | exectime: 0, 225 | rematimes: 0, 226 | exectype: "", 227 | execwallet: "", 228 | lastExecTime: "1970-01-01" 229 | }; 230 | configData.push(newRowData); 231 | displayConfigData(); 232 | } -------------------------------------------------------------------------------- /web/js/webmain.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const electron = require('electron'); 4 | const { ipcRenderer, dialog } = electron; 5 | 6 | var nownetwork = 'eth'; 7 | var chainid = 1; 8 | var nowgastype = "eip1599"; 9 | function init() { 10 | document.querySelector("#rpc").checked = true; 11 | //debugger 12 | document.querySelector("#eip1559").checked = true; 13 | changewebgastype(nowgastype); 14 | 15 | document.querySelector("#contractmodel").checked = true; 16 | changejiaohutype("contractmodel"); 17 | document.querySelector("#webjiaohuaddress2").checked = true; 18 | 19 | 20 | } 21 | init(); 22 | 23 | 24 | //初始化web3 25 | function initweb3() { 26 | var webtype = "rpc"; 27 | const wschecked = document.querySelector('#ws').checked 28 | if (wschecked) { 29 | webtype = "ws"; 30 | } 31 | 32 | const weburl = document.querySelector('#weburl').value; 33 | var value = { webtype, weburl, chainid, nownetwork }; 34 | //console.log(value); 35 | ipcRenderer.send('info:initweb3', value) 36 | } 37 | 38 | //查询智能合约功能 39 | function queryContarct() { 40 | const contractaddress = document.querySelector('#Contractaddress').value; 41 | evmnetwork = getNetworkInfo(nownetwork); 42 | if (evmnetwork[0]) { 43 | var apiurl = evmnetwork[1].apiurl; 44 | var value = { contractaddress, apiurl }; 45 | ipcRenderer.send('info:queryabi', value) 46 | } 47 | } 48 | 49 | 50 | 51 | //抢购开始函数 52 | function qianggou() { 53 | const nftaddress = document.querySelector('#nftaddress').value; 54 | const inputdata = document.querySelector('#inputdata').value; 55 | const gas = document.querySelector('#qianggougas').value; 56 | 57 | const gaslimit = document.querySelector('#qianggougaslimit').value; 58 | const neth = document.querySelector('#neth').value; 59 | 60 | const maxPriorityFeePerGas = document.querySelector('#qianggoumaxPriorityFeePerGas').value; 61 | const maxFeePerGas = document.querySelector('#qianggoumaxFeePerGas').value; 62 | 63 | value = { nftaddress, inputdata, gas, gaslimit, neth, maxPriorityFeePerGas, maxFeePerGas, nowgastype }; 64 | console.log("开始抢购,请稍等,或者去区块链网络查看:"); 65 | ipcRenderer.send('info:qianggou', value) 66 | } 67 | 68 | function ceshi() { 69 | 70 | 71 | ipcRenderer.send('info:test', {}) 72 | } 73 | 74 | function init1() { 75 | 76 | //debugger; 77 | var network = document.querySelector('#network'); 78 | var i = 0; 79 | for (evmnetwork in evmnetworks) { 80 | //console.log(evmnetwork); 81 | var radioWrapper = document.createElement('div'); 82 | radioWrapper.className = 'form-check form-check-inline'; 83 | var radio = document.createElement("input"); 84 | radio.type = "radio"; 85 | radio.name = "evmnetwork"; 86 | radio.className = 'form-check-input' 87 | console.log(radio); 88 | radio.value = evmnetworks[evmnetwork].network; 89 | radio.id = evmnetworks[evmnetwork].network; 90 | if (i == 0) { 91 | radio.checked = true; 92 | nownetwork = evmnetworks[evmnetwork].network; 93 | chainid = evmnetworks[evmnetwork].chainid; 94 | } 95 | i++; 96 | //radio.innerHTML = '"' + evmnetworks[evmnetwork].network + '"'; 97 | radio.onclick = function () { changenetwork(this.value) }; 98 | // network.appendChild(radio); 99 | radioWrapper.appendChild(radio); 100 | var label = document.createElement("label"); 101 | label.className = 'form-check-label'; 102 | label.innerHTML = evmnetworks[evmnetwork].network; 103 | // network.appendChild(label); 104 | radioWrapper.appendChild(label); 105 | network.appendChild(radioWrapper) 106 | } 107 | 108 | } 109 | 110 | 111 | 112 | function changejiaohutype(jiaohutype) { 113 | //debugger 114 | if (jiaohutype == "contractmodel") { 115 | document.querySelector('#followmodelcard').style.display = 'none'; 116 | document.querySelector('#contractmodelcard').style.display = 'block'; 117 | } 118 | else { 119 | document.querySelector('#followmodelcard').style.display = 'block'; 120 | document.querySelector('#contractmodelcard').style.display = 'none'; 121 | } 122 | 123 | } 124 | 125 | function changewebgastype(gastype) { 126 | //alert(webtype); 127 | //debugger 128 | if (gastype == "default") { 129 | //正常模式 130 | nowgastype = "default"; 131 | /* 132 | document.querySelector('#divdefalutgas').style.visibility = 'visible'; 133 | document.querySelector('#divmaxPriorityFeePerGas').style.visibility = 'hidden'; 134 | document.querySelector('#divmaxFeePerGas').style.visibility = 'hidden';*/ 135 | document.querySelector('#divdefalutgas').style.display = 'block'; 136 | document.querySelector('#divmaxPriorityFeePerGas').style.display = 'none'; 137 | document.querySelector('#divmaxFeePerGas').style.display = 'none'; 138 | 139 | } 140 | else { 141 | //EIP1559 142 | nowgastype = "eip1559"; 143 | document.querySelector('#divdefalutgas').style.display = 'none'; 144 | document.querySelector('#divmaxPriorityFeePerGas').style.display = 'block'; 145 | document.querySelector('#divmaxFeePerGas').style.display = 'block'; 146 | 147 | } 148 | } 149 | 150 | function changewebnetwork(webtype) { 151 | //alert(webtype); 152 | changenetwork(nownetwork); 153 | } 154 | 155 | function changenetwork(network) { 156 | var result = getNetworkInfo(network); 157 | if (result[0]) { 158 | nownetwork = result[1].network; 159 | chainid = result[1].chainid; 160 | var webtype = "rpc"; 161 | const wschecked = document.querySelector('#ws').checked 162 | if (wschecked) { 163 | webtype = "ws"; 164 | } 165 | if (webtype == "rpc") { 166 | document.querySelector('#weburl').value = result[1].rpc; 167 | } 168 | else { 169 | document.querySelector('#weburl').value = result[1].ws; 170 | } 171 | 172 | } 173 | 174 | } 175 | 176 | function getNetworkInfo(network) { 177 | for (evmnetwork of evmnetworks) { 178 | //console.log(evmnetwork); 179 | if (network == evmnetwork.network) { 180 | return [true, evmnetwork]; 181 | 182 | } 183 | } 184 | return [false, "false"]; 185 | } 186 | 187 | init1(); 188 | 189 | 190 | 191 | ipcRenderer.on('info:initweb3', (e, value) => { 192 | //console.log(value) 193 | if (value.result) { 194 | console.log("initweb3成功"); 195 | } 196 | else { 197 | console.log("initweb3失败"); 198 | } 199 | 200 | }); 201 | 202 | var abi = null; 203 | ipcRenderer.on('info:queryabi', (e, value) => { 204 | console.log(value) 205 | if (value.result[0] == true) { 206 | console.log("智能合约查询成功") 207 | abi = value.result; 208 | } 209 | else { 210 | abi = null; 211 | } 212 | }); 213 | 214 | function cleanall() { 215 | var selecthtml = document.querySelector('#log'); 216 | cleanchild(selecthtml) 217 | } 218 | 219 | function cleanchild(selecthtml) { 220 | while (true) { 221 | try { 222 | selecthtml.removeChild(selecthtml.childNodes[0]); 223 | } 224 | catch (e) { 225 | break; 226 | } 227 | } 228 | } 229 | 230 | function readfunction(value) { 231 | //debugger; 232 | var selecthtml = document.querySelector('#fangfa'); 233 | if (selecthtml != null) { 234 | 235 | cleanchild(selecthtml) 236 | } 237 | else { 238 | return; 239 | } 240 | 241 | if (abi == null) { 242 | return; 243 | } 244 | var viewmap = null; 245 | var typename = "view" 246 | if (value == "view") { 247 | viewmap = abi[1]; 248 | typename = "view"; 249 | 250 | } 251 | else if (value == "nonpayable") { 252 | viewmap = abi[2]; 253 | typename = "nonpayable"; 254 | } 255 | else if (value == "payable") { 256 | viewmap = abi[3]; 257 | typename = "payable"; 258 | } 259 | viewmap.forEach(element => { 260 | //debugger; 261 | var fname = element.name 262 | var option = document.createElement("option"); 263 | option.value = typename; 264 | option.id = fname + ":" + element.id; 265 | option.innerHTML = fname; 266 | option.selected = true; 267 | //option.onclick = function () { changefunction(this.value,this.id) }; 268 | selecthtml.appendChild(option); 269 | }); 270 | changefunction(selecthtml); 271 | } 272 | 273 | function changefunction(selecthtml) { 274 | //debugger; 275 | var option = selecthtml.options[selecthtml.selectedIndex]; 276 | console.log(option.value) 277 | changefunctionEX(option.value, option.id); 278 | } 279 | 280 | function transpara(input) { 281 | type = input.name; 282 | value = input.value; 283 | id = input.id; 284 | debugger 285 | if (type == "bool") { 286 | if (value.toLowerCase() == "ture" || value == "1") { 287 | return true; 288 | } 289 | else if (value.toLowerCase() == "false" || value == "0") { 290 | return false; 291 | } 292 | else { 293 | console.log("错误:" + id + "输入的参数不匹配"); 294 | return "error"; 295 | } 296 | } 297 | else if(type.indexOf("[]")!=-1) 298 | { 299 | value = JSON.parse(value); 300 | return value; 301 | } 302 | else if (type == "address") { 303 | if (value.indexOf("0x") == -1) { 304 | if (value == "myaddress") { 305 | return value; 306 | } 307 | if (value == "我的地址") { 308 | return value; 309 | } 310 | if (value == "地址") { 311 | return value; 312 | } 313 | console.log("错误:" + id + "输入的参数不匹配"); 314 | return "error"; 315 | } 316 | else { 317 | return value; 318 | } 319 | } 320 | else { 321 | return value; 322 | } 323 | 324 | } 325 | 326 | function exce() { 327 | var paralist = document.querySelector('#paralist').getElementsByTagName("input") 328 | var okvalue = []; 329 | var tijiao = true; 330 | for (i = 0; i < paralist.length; i++) { 331 | var result = transpara(paralist[i]) 332 | if (result != "error") 333 | okvalue.push(result) 334 | else 335 | tijiao = false; 336 | } 337 | if (tijiao) { 338 | 339 | 340 | 341 | //给后台提交数组 342 | if (useabi != null) { 343 | 344 | 345 | var nftaddress = document.querySelector('#nftaddress').value; 346 | const address2 = document.querySelector("#webjiaohuaddress2").checked; 347 | if (address2 == false) { 348 | nftaddress = document.querySelector('#Contractaddress').value; 349 | } 350 | const gas = document.querySelector('#qianggougas').value; 351 | const gaslimit = document.querySelector('#qianggougaslimit').value; 352 | const neth = document.querySelector('#neth').value; 353 | const maxPriorityFeePerGas = document.querySelector('#qianggoumaxPriorityFeePerGas').value; 354 | const maxFeePerGas = document.querySelector('#qianggoumaxFeePerGas').value; 355 | //debugger; 356 | value = { useabi, okvalue, nftaddress, gas, gaslimit, neth, maxPriorityFeePerGas, maxFeePerGas, nowgastype }; 357 | ipcRenderer.send('info:abishiyong', value) 358 | } 359 | } 360 | } 361 | 362 | var useabi = null; 363 | function changefunctionEX(name, value) { 364 | 365 | var viewmap = null; 366 | if (name == "view") { 367 | viewmap = abi[1]; 368 | 369 | 370 | } 371 | else if (name == "nonpayable") { 372 | viewmap = abi[2]; 373 | 374 | } 375 | else if (name == "payable") { 376 | viewmap = abi[3]; 377 | 378 | } 379 | if (viewmap != null) { 380 | var valueabi = viewmap.get(value); 381 | if (valueabi != null) { 382 | console.log(valueabi); 383 | var inputs = valueabi.inputs; 384 | useabi = valueabi; 385 | var selecthtml = document.querySelector('#paralist'); 386 | if (selecthtml != null) { 387 | 388 | cleanchild(selecthtml) 389 | } 390 | else { 391 | return; 392 | } 393 | 394 | inputs.forEach(element => { 395 | var dom = document.createElement('div'); 396 | dom.className = 'mb-1'; 397 | var label = document.createElement('label'); 398 | label.innerHTML = element.name + "(" + element.type + ")"; 399 | dom.appendChild(label) 400 | var input = document.createElement('input'); 401 | input.name = element.type; 402 | input.id = element.name; 403 | input.className = 'form-control' 404 | if (element.type == "address") { 405 | input.value = "myaddress"; 406 | } 407 | dom.appendChild(input); 408 | selecthtml.appendChild(dom); 409 | }); 410 | 411 | 412 | } 413 | else { 414 | useabi = null; 415 | } 416 | 417 | } 418 | } 419 | 420 | ipcRenderer.on('info:msg', (e, value) => { 421 | 422 | console.log(value.msg) 423 | 424 | 425 | }); 426 | 427 | ipcRenderer.on('info:setnowgasprice', (e, value) => { 428 | //debugger; 429 | if(bautogetgas) 430 | { 431 | var xiaofei =Number(value.maxgasprice) + Number(document.querySelector('#qianggoumaxPriorityFeePerGas').value); 432 | document.querySelector('#qianggoumaxFeePerGas').value = Number(xiaofei); 433 | } 434 | 435 | 436 | 437 | }); 438 | 439 | 440 | 441 | var accountHolder = document.getElementById('priAccounts'); 442 | ipcRenderer.on('info:accounts', (e, value) => { 443 | cleanchild(accountHolder) 444 | for (let acct of value['result']) { 445 | accountHolder.append(acct); 446 | accountHolder.append(document.createElement('br')) 447 | } 448 | }); 449 | 450 | (function () { 451 | var old = console.log; 452 | var logger = document.getElementById('log'); 453 | console.log = function (message) { 454 | if (typeof message == 'object') { 455 | logger.innerHTML += (JSON && JSON.stringify ? JSON.stringify(message) : message) + '
'; 456 | } else { 457 | logger.innerHTML += message + '
'; 458 | } 459 | } 460 | })(); 461 | 462 | setTimeout(() => { 463 | ipcRenderer.send('info:accounts', null) 464 | }, 300); 465 | 466 | 467 | var bautogetgas = false 468 | function autogetgas() 469 | { 470 | var mybutton = document.querySelector('#autogetgas'); 471 | if(bautogetgas) 472 | { 473 | //关闭自动获取 474 | bautogetgas = false; 475 | mybutton.innerHTML = "启动自动获取gas" 476 | } 477 | else 478 | { 479 | //启动自动获取 480 | bautogetgas = true; 481 | mybutton.innerHTML = "关闭自动获取gas" 482 | ipcRenderer.send('info:startgetmaxgasprice', null) 483 | } 484 | } 485 | 486 | function LoadlocalABI() 487 | { 488 | ipcRenderer.send('info:loadlocalABI', null) 489 | } 490 | 491 | --------------------------------------------------------------------------------