forked from wusimpl/atommical-js-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.js
56 lines (54 loc) · 1.59 KB
/
generate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var generateAtommap = async () => {
var check = async (number) => {
try {
const res = await fetch(`https://geniidata.com/api/dashboard/chart/public/data?chartId=165760&pageSize=20&page=1&searchKey=atommapID&searchValue=` + number)
const json = await res.json()
const list = json['data']['list']
return list.length === 0
} catch (error) {
console.log(error)
return false
}
}
function getRandom(n, m) {
var num = Math.floor(Math.random() * (m - n + 1) + n)
return num
}
const result = getRandom(999,9999)
const isAvailable = await check(result)
if(isAvailable) {
console.log(`%c ${result}.atommap is OK to mint`,'color:green;')
}else {
console.log(`%c ${result}.atommap has been minted, please try again.`,'color:red;')
}
return isAvailable
}
var check = async (number) => {
try {
const res = await fetch(`https://geniidata.com/api/dashboard/chart/public/data?chartId=165760&pageSize=20&page=1&searchKey=atommapID&searchValue=` + number)
const json = await res.json()
const list = json['data']['list']
return list.length === 0
} catch (error) {
console.log(error)
return false
}
}
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()
generateAtommap()