-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.ts
159 lines (146 loc) · 5.6 KB
/
index.ts
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env node
import { program } from "commander";
import path from "path";
import { createLogger } from "./src/lib/logger.js";
import {
AnimationInput,
createUploaderCommand,
ImageInput,
} from "./src/commands/upload.js";
import { createShuffleCommand } from "./src/commands/shuffle.js";
import { createFixMissingPostMintCommand } from "./src/commands/fixMissingPostMint.js";
import { createDonateCommand } from "./src/commands/donate.js";
import { createDropToHoldersCommand } from "./src/commands/dropToHolders.js";
import { createBuildLayersJSONCommand } from "./src/commands/buildLayersJSON.js";
import { createGenerateArtCommand } from "./src/commands/generateArt.js";
import { createBuildSpecificArtCommand } from "./src/commands/createSpecificArt.js";
const __dirname = path.resolve();
const logger = createLogger(path.join(__dirname, "journal.log"));
const pseudoCachePath = path.join(__dirname, "pseudo-cache.json");
program.version("0.0.1");
program
.command("donate")
.description(
"Donate to the developer (FeikG7Kui7zw8srzShhrPv2TJgwAn61GU7m8xmaK9GnW), devnet tokens accepted too."
)
.requiredOption("-s, --solana-keypair <solanaKeypair>", "Solana Keypair")
.requiredOption(
"-a, --amount <amount>",
"Amount of sol to donate (Not in lamports)"
)
.option("-r, --rpc <rpc>", "RPC to use.", "https://api.devnet.solana.com")
.action(createDonateCommand());
program
.command("shuffle")
.description("Little helper to shuffle Candy Machine pair files.")
.requiredOption("-p, --path <filesPath>", "Files Path")
.action(createShuffleCommand());
program
.command("upload")
.description(
"Uploads the pair files (Candy-machine style) in the files path into Arweave using parallelization."
)
.requiredOption("-k, --key <jwk>", "JWK For Arweave")
.requiredOption("-p, --path <filesPath>", "Files Path")
.option(
"-i, --imageFormat <imageFormat>",
"Specify the image format (Defaults to .png)",
"png" as ImageInput
)
.option(
"-a, --animatedFormat <animatedFormat>",
"If animated, uploads an animation for each file. (Defaults to none)",
"none" as AnimationInput
)
.option("-s, --sequential <sequential>", "Sequential")
.option("-r, --retries <retries>", "Retries", "5")
.option("-t, --threads <threads>", "Threads to use (Parallelization)", "10")
.action(createUploaderCommand(logger, pseudoCachePath));
/**
* TODO: Check candy machine mints instead of checking pseudo-cache.json
*/
program
.command("fix_missing_post_mint")
.description(
"Takes files in a pseudo-cache and checks they're good on Arweave. If anything is broken(404) it will fix it."
)
.requiredOption("-p, --path <filesPath>", "Files Path")
.requiredOption("-k, --key <jwk>", "JWK For Arweave")
.requiredOption("-s, --solana-keypair <solanaKeypair>", "Solana Keypair")
.requiredOption("-i, --id <candyMachineId>", "Candy machine identifier")
.requiredOption("-c, --cache <cache>", "PseudoCache file")
.option(
"-r, --rpc <rpc>",
"Solana RPC To Use",
"https://api.devnet.solana.com"
)
.option("-t, --threads <threads>", "Threads to use (Parallelization)", "10")
.action(createFixMissingPostMintCommand(logger));
program
.command("drop_to_holders")
.description(
"Similar to a Candy-Machine drop, but instead of creating a candy machine, it mints and airdrops directly to a Candy Machine set of Holders over the air."
)
.requiredOption("-p, --path <filesPath>", "Files Path")
.requiredOption("-k, --key <jwk>", "JWK For Arweave")
.requiredOption("-s, --solana-keypair <solanaKeypair>", "Solana Keypair")
.requiredOption("-i, --id <candyMachineId>", "Candy machine identifier")
.requiredOption(
"-f, --snapshotFile <snapshotFile>",
"Candy machine holder snapshot file path"
)
.option("-c, --cache <cache>", "Cache file to use", "drop-cache.json")
.option(
"-r, --rpc <rpc>",
"Solana RPC To Use",
"https://api.devnet.solana.com"
)
.option("-t, --threads <threads>", "Threads to use (Parallelization)", "10")
.option("-k, --retries <retries>", "Retries", "5")
.action(createDropToHoldersCommand(logger));
program
.command("build_layers_json")
.requiredOption("-p, --path <path>", "Input layers folders path")
.requiredOption(
"-o, --output <output>",
"Output file to write",
"layers.json"
)
.action(createBuildLayersJSONCommand(logger));
program
.command("generate_art")
.requiredOption(
"-j, --json-template-path <jsonTemplatePath>",
"JSON Template Input Path"
)
.requiredOption(
"-l, --layers-config-path <layersConfigPath>",
"Layers configuration path"
)
.requiredOption("-p, --layers-path <layersPath>", "Path of the layers folder")
.requiredOption("-o, --output-path <outputPath>", "Path to write files into")
.requiredOption("-a, --amount <amount>", "Amount of entries to generate")
.requiredOption(
"-f, --output-format <outputFormat>",
"Output format (jpeg, png, webp)"
)
.action(createGenerateArtCommand(logger));
program
.command("create_specific_art")
.requiredOption(
"-j, --json-template-path <jsonTemplatePath>",
"JSON Template Input Path"
)
.requiredOption(
"-l, --picked-layers-path <pickedLayersPath>",
"Picked layers json Path"
)
.requiredOption("-p, --layers-path <layersPath>", "Path of the layers folder")
.requiredOption("-o, --output-path <outputPath>", "Path to write files into")
.requiredOption("-i, --item-number <itemNumber>", "Element number")
.requiredOption(
"-f, --output-format <outputFormat>",
"Output format (jpeg, png, webp)"
)
.action(createBuildSpecificArtCommand(logger));
program.parse(process.argv);