-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.js
92 lines (84 loc) · 2.61 KB
/
app.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
const {RPCAgent} = require("chia-agent")
const {get_plots} = require("chia-agent/api/rpc/harvester")
const agent = new RPCAgent({service: "harvester"})
let plots
let plotsPromise
const args = process.argv.slice(2)
function getPlots(){
console.log("Loading plots...")
return new Promise((resolve, reject) => {
get_plots(agent).then((response) => {
plots = response.plots;
console.log("Plots loaded.\n")
resolve();
})
});
}
function showAllPlots(){
for (let plot of plots){
console.log("Name: "+plot.filename)
console.log("Size: "+plot.size)
console.log("Plot ID: "+plot.plot_id)
console.log("Pool public key: "+plot.pool_public_key)
console.log("Pool contract puzzle hash: "+plot.pool_contract_puzzle_hash)
console.log("Plot public key: "+plot.plot_public_key)
console.log("Time created/modified: "+plot.time_modified)
console.log("")
}
}
function showInfo(){
let uniquePc = []
let nftNum = 0;
let ogNum = 0;
for (let plot of plots){
if(plot.pool_contract_puzzle_hash == null){
ogNum = ogNum + 1
}
else{
nftNum = nftNum + 1
if(!uniquePc.includes(plot.pool_contract_puzzle_hash)){
uniquePc.push(plot.pool_contract_puzzle_hash)
}
}
}
console.log(uniquePc.length+" unique pool contract adresses")
console.log(plots.length+" plots total")
console.log(nftNum+" NFT plots ("+(nftNum/plots.length*100).toFixed(2)+"%)")
console.log(ogNum+" OG plots ("+(ogNum/plots.length*100).toFixed(2)+"%)")
}
function showAllOgPlots(){
for (let plot of plots){
if(plot.pool_contract_puzzle_hash == null){
console.log(plot.filename)
}
}
}
console.log("Chia plot checker v.1.0 by mssc@xch.garden (check our pool out!)\n")
switch (args[0]) {
case '-h':
console.log("Usage:")
console.log("node app.js [OPTION]")
console.log("")
console.log("Available options:")
console.log("-h Show help")
console.log("-a Show all plots and all their info")
console.log("-og Show list of all OG plots paths")
break;
case '-a':
plotsPromise = getPlots()
plotsPromise.then(() => {
showAllPlots()
})
break;
case '-og':
plotsPromise = getPlots()
plotsPromise.then(() => {
showAllOgPlots()
})
break;
default:
plotsPromise = getPlots()
plotsPromise.then(() => {
showInfo()
})
}