@lightprotocol/zk-compression-cli 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cargo-generate +0 -0
- package/dist/commands/init/index.js +22 -6
- package/dist/utils/process.js +10 -8
- package/oclif.manifest.json +100 -100
- package/package.json +1 -1
|
Binary file
|
|
@@ -11,7 +11,6 @@ const psp_utils_1 = require("../../psp-utils");
|
|
|
11
11
|
const constants_1 = require("../../utils/constants");
|
|
12
12
|
const utils_1 = require("../../utils");
|
|
13
13
|
const case_anything_1 = require("case-anything");
|
|
14
|
-
const child_process_1 = require("child_process");
|
|
15
14
|
class InitCommand extends core_1.Command {
|
|
16
15
|
async run() {
|
|
17
16
|
const { args, flags } = await this.parse(InitCommand);
|
|
@@ -40,13 +39,14 @@ const initRepo = async (name, flags) => {
|
|
|
40
39
|
const kebabCaseName = (0, case_anything_1.kebabCase)(name);
|
|
41
40
|
const snakeCaseName = (0, case_anything_1.snakeCase)(name);
|
|
42
41
|
const camelCaseName = (0, case_anything_1.pascalCase)(name);
|
|
43
|
-
|
|
42
|
+
let command = localFilePath;
|
|
43
|
+
let env = { ...process.env };
|
|
44
44
|
if (os.platform() === "darwin") {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const cpathExport = 'export CPATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include:$CPATH"';
|
|
46
|
+
command = `${cpathExport} && ${command}`;
|
|
47
47
|
}
|
|
48
48
|
await (0, process_1.executeCommand)({
|
|
49
|
-
command
|
|
49
|
+
command,
|
|
50
50
|
args: [
|
|
51
51
|
"generate",
|
|
52
52
|
"--name",
|
|
@@ -91,8 +91,24 @@ const initRepo = async (name, flags) => {
|
|
|
91
91
|
`tokio-version=${constants_1.TOKIO_VERSION}`,
|
|
92
92
|
],
|
|
93
93
|
logFile: true,
|
|
94
|
-
env:
|
|
94
|
+
env: env,
|
|
95
95
|
});
|
|
96
|
+
if (os.platform() === "darwin") {
|
|
97
|
+
console.log(`
|
|
98
|
+
🧢 Important for macOS users 🧢
|
|
99
|
+
---------------------------
|
|
100
|
+
1. Run this command in your terminal:
|
|
101
|
+
export CPATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include:$CPATH"
|
|
102
|
+
|
|
103
|
+
2. To persist this change:
|
|
104
|
+
• Zsh users (default): Add the line to ~/.zshrc
|
|
105
|
+
• Bash users: Add the line to ~/.bash_profile
|
|
106
|
+
|
|
107
|
+
3. Apply changes:
|
|
108
|
+
• Zsh: Run 'source ~/.zshrc'
|
|
109
|
+
• Bash: Run 'source ~/.bash_profile'
|
|
110
|
+
`.trim());
|
|
111
|
+
}
|
|
96
112
|
await (0, stateless_js_1.sleep)(1000);
|
|
97
113
|
};
|
|
98
114
|
exports.initRepo = initRepo;
|
package/dist/utils/process.js
CHANGED
|
@@ -35,14 +35,18 @@ async function killProcessByPort(port) {
|
|
|
35
35
|
*/
|
|
36
36
|
async function executeCommand({ command, args, additionalPath, logFile = true, env, }) {
|
|
37
37
|
return new Promise((resolve, reject) => {
|
|
38
|
-
const
|
|
38
|
+
const commandParts = command.split(' && ');
|
|
39
|
+
const finalCommand = commandParts.pop() || '';
|
|
40
|
+
const preCommands = commandParts.join(' && ');
|
|
41
|
+
const fullCommand = preCommands ? `${preCommands} && ${finalCommand} ${args.join(' ')}` : `${finalCommand} ${args.join(' ')}`;
|
|
42
|
+
const commandBase = path_1.default.basename(finalCommand);
|
|
39
43
|
let stdoutData = "";
|
|
40
44
|
const childPathEnv = additionalPath
|
|
41
45
|
? process.env.PATH + path_1.default.delimiter + additionalPath
|
|
42
46
|
: process.env.PATH;
|
|
43
47
|
const options = {
|
|
44
|
-
env: env ||
|
|
45
|
-
|
|
48
|
+
env: env || (childPathEnv ? { ...process.env, PATH: childPathEnv } : process.env),
|
|
49
|
+
shell: true,
|
|
46
50
|
detached: true,
|
|
47
51
|
};
|
|
48
52
|
let logStream = null;
|
|
@@ -52,14 +56,12 @@ async function executeCommand({ command, args, additionalPath, logFile = true, e
|
|
|
52
56
|
if (!fs_1.default.existsSync(folderName)) {
|
|
53
57
|
fs_1.default.mkdirSync(folderName);
|
|
54
58
|
}
|
|
55
|
-
logStream = fs_1.default.createWriteStream(file, {
|
|
56
|
-
flags: "a",
|
|
57
|
-
});
|
|
59
|
+
logStream = fs_1.default.createWriteStream(file, { flags: "a" });
|
|
58
60
|
}
|
|
59
|
-
console.log(`Executing command ${
|
|
61
|
+
console.log(`Executing command: ${fullCommand}`);
|
|
60
62
|
let childProcess;
|
|
61
63
|
try {
|
|
62
|
-
childProcess = (0, child_process_1.spawn)(
|
|
64
|
+
childProcess = (0, child_process_1.spawn)(fullCommand, [], options);
|
|
63
65
|
}
|
|
64
66
|
catch (e) {
|
|
65
67
|
throw new Error(`Failed to execute command ${commandBase}: ${e}`);
|
package/oclif.manifest.json
CHANGED
|
@@ -1,46 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
-
"balance": {
|
|
4
|
-
"aliases": [],
|
|
5
|
-
"args": {},
|
|
6
|
-
"examples": [
|
|
7
|
-
"$ light balance --mint=<ADDRESS> --owner=<ADDRESS>"
|
|
8
|
-
],
|
|
9
|
-
"flags": {
|
|
10
|
-
"owner": {
|
|
11
|
-
"description": "Address of the compressed token owner.",
|
|
12
|
-
"name": "owner",
|
|
13
|
-
"required": true,
|
|
14
|
-
"hasDynamicHelp": false,
|
|
15
|
-
"multiple": false,
|
|
16
|
-
"type": "option"
|
|
17
|
-
},
|
|
18
|
-
"mint": {
|
|
19
|
-
"description": "Mint address of the compressed token account.",
|
|
20
|
-
"name": "mint",
|
|
21
|
-
"required": true,
|
|
22
|
-
"hasDynamicHelp": false,
|
|
23
|
-
"multiple": false,
|
|
24
|
-
"type": "option"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"hasDynamicHelp": false,
|
|
28
|
-
"hiddenAliases": [],
|
|
29
|
-
"id": "balance",
|
|
30
|
-
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
31
|
-
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
32
|
-
"pluginType": "core",
|
|
33
|
-
"strict": true,
|
|
34
|
-
"summary": "Get balance",
|
|
35
|
-
"enableJsonFlag": false,
|
|
36
|
-
"isESM": false,
|
|
37
|
-
"relativePath": [
|
|
38
|
-
"dist",
|
|
39
|
-
"commands",
|
|
40
|
-
"balance",
|
|
41
|
-
"index.js"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
3
|
"approve-and-mint-to": {
|
|
45
4
|
"aliases": [],
|
|
46
5
|
"args": {},
|
|
@@ -98,93 +57,44 @@
|
|
|
98
57
|
"index.js"
|
|
99
58
|
]
|
|
100
59
|
},
|
|
101
|
-
"
|
|
60
|
+
"balance": {
|
|
102
61
|
"aliases": [],
|
|
103
62
|
"args": {},
|
|
104
63
|
"examples": [
|
|
105
|
-
"$ light
|
|
64
|
+
"$ light balance --mint=<ADDRESS> --owner=<ADDRESS>"
|
|
106
65
|
],
|
|
107
66
|
"flags": {
|
|
108
|
-
"
|
|
109
|
-
"description": "
|
|
110
|
-
"name": "
|
|
67
|
+
"owner": {
|
|
68
|
+
"description": "Address of the compressed token owner.",
|
|
69
|
+
"name": "owner",
|
|
111
70
|
"required": true,
|
|
112
71
|
"hasDynamicHelp": false,
|
|
113
72
|
"multiple": false,
|
|
114
73
|
"type": "option"
|
|
115
74
|
},
|
|
116
|
-
"amount": {
|
|
117
|
-
"description": "Amount to compress, in lamports.",
|
|
118
|
-
"name": "amount",
|
|
119
|
-
"required": true,
|
|
120
|
-
"hasDynamicHelp": false,
|
|
121
|
-
"multiple": false,
|
|
122
|
-
"type": "option"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"hasDynamicHelp": false,
|
|
126
|
-
"hiddenAliases": [],
|
|
127
|
-
"id": "compress-sol",
|
|
128
|
-
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
129
|
-
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
130
|
-
"pluginType": "core",
|
|
131
|
-
"strict": true,
|
|
132
|
-
"summary": "Compress SOL.",
|
|
133
|
-
"enableJsonFlag": false,
|
|
134
|
-
"isESM": false,
|
|
135
|
-
"relativePath": [
|
|
136
|
-
"dist",
|
|
137
|
-
"commands",
|
|
138
|
-
"compress-sol",
|
|
139
|
-
"index.js"
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
|
-
"compress-spl": {
|
|
143
|
-
"aliases": [],
|
|
144
|
-
"args": {},
|
|
145
|
-
"examples": [
|
|
146
|
-
"$ light compress-spl --mint PublicKey --to PublicKey --amount 10"
|
|
147
|
-
],
|
|
148
|
-
"flags": {
|
|
149
75
|
"mint": {
|
|
150
|
-
"description": "
|
|
76
|
+
"description": "Mint address of the compressed token account.",
|
|
151
77
|
"name": "mint",
|
|
152
78
|
"required": true,
|
|
153
79
|
"hasDynamicHelp": false,
|
|
154
80
|
"multiple": false,
|
|
155
81
|
"type": "option"
|
|
156
|
-
},
|
|
157
|
-
"to": {
|
|
158
|
-
"description": "Specify the recipient address (owner of destination compressed token account).",
|
|
159
|
-
"name": "to",
|
|
160
|
-
"required": true,
|
|
161
|
-
"hasDynamicHelp": false,
|
|
162
|
-
"multiple": false,
|
|
163
|
-
"type": "option"
|
|
164
|
-
},
|
|
165
|
-
"amount": {
|
|
166
|
-
"description": "Amount to compress, in tokens.",
|
|
167
|
-
"name": "amount",
|
|
168
|
-
"required": true,
|
|
169
|
-
"hasDynamicHelp": false,
|
|
170
|
-
"multiple": false,
|
|
171
|
-
"type": "option"
|
|
172
82
|
}
|
|
173
83
|
},
|
|
174
84
|
"hasDynamicHelp": false,
|
|
175
85
|
"hiddenAliases": [],
|
|
176
|
-
"id": "
|
|
86
|
+
"id": "balance",
|
|
177
87
|
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
178
88
|
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
179
89
|
"pluginType": "core",
|
|
180
90
|
"strict": true,
|
|
181
|
-
"summary": "
|
|
91
|
+
"summary": "Get balance",
|
|
182
92
|
"enableJsonFlag": false,
|
|
183
93
|
"isESM": false,
|
|
184
94
|
"relativePath": [
|
|
185
95
|
"dist",
|
|
186
96
|
"commands",
|
|
187
|
-
"
|
|
97
|
+
"balance",
|
|
188
98
|
"index.js"
|
|
189
99
|
]
|
|
190
100
|
},
|
|
@@ -377,6 +287,96 @@
|
|
|
377
287
|
"index.js"
|
|
378
288
|
]
|
|
379
289
|
},
|
|
290
|
+
"compress-spl": {
|
|
291
|
+
"aliases": [],
|
|
292
|
+
"args": {},
|
|
293
|
+
"examples": [
|
|
294
|
+
"$ light compress-spl --mint PublicKey --to PublicKey --amount 10"
|
|
295
|
+
],
|
|
296
|
+
"flags": {
|
|
297
|
+
"mint": {
|
|
298
|
+
"description": "Specify the mint address.",
|
|
299
|
+
"name": "mint",
|
|
300
|
+
"required": true,
|
|
301
|
+
"hasDynamicHelp": false,
|
|
302
|
+
"multiple": false,
|
|
303
|
+
"type": "option"
|
|
304
|
+
},
|
|
305
|
+
"to": {
|
|
306
|
+
"description": "Specify the recipient address (owner of destination compressed token account).",
|
|
307
|
+
"name": "to",
|
|
308
|
+
"required": true,
|
|
309
|
+
"hasDynamicHelp": false,
|
|
310
|
+
"multiple": false,
|
|
311
|
+
"type": "option"
|
|
312
|
+
},
|
|
313
|
+
"amount": {
|
|
314
|
+
"description": "Amount to compress, in tokens.",
|
|
315
|
+
"name": "amount",
|
|
316
|
+
"required": true,
|
|
317
|
+
"hasDynamicHelp": false,
|
|
318
|
+
"multiple": false,
|
|
319
|
+
"type": "option"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"hasDynamicHelp": false,
|
|
323
|
+
"hiddenAliases": [],
|
|
324
|
+
"id": "compress-spl",
|
|
325
|
+
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
326
|
+
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
327
|
+
"pluginType": "core",
|
|
328
|
+
"strict": true,
|
|
329
|
+
"summary": "Compress SPL tokens.",
|
|
330
|
+
"enableJsonFlag": false,
|
|
331
|
+
"isESM": false,
|
|
332
|
+
"relativePath": [
|
|
333
|
+
"dist",
|
|
334
|
+
"commands",
|
|
335
|
+
"compress-spl",
|
|
336
|
+
"index.js"
|
|
337
|
+
]
|
|
338
|
+
},
|
|
339
|
+
"compress-sol": {
|
|
340
|
+
"aliases": [],
|
|
341
|
+
"args": {},
|
|
342
|
+
"examples": [
|
|
343
|
+
"$ light compress-sol --to PublicKey --amount 10"
|
|
344
|
+
],
|
|
345
|
+
"flags": {
|
|
346
|
+
"to": {
|
|
347
|
+
"description": "Specify the recipient address.",
|
|
348
|
+
"name": "to",
|
|
349
|
+
"required": true,
|
|
350
|
+
"hasDynamicHelp": false,
|
|
351
|
+
"multiple": false,
|
|
352
|
+
"type": "option"
|
|
353
|
+
},
|
|
354
|
+
"amount": {
|
|
355
|
+
"description": "Amount to compress, in lamports.",
|
|
356
|
+
"name": "amount",
|
|
357
|
+
"required": true,
|
|
358
|
+
"hasDynamicHelp": false,
|
|
359
|
+
"multiple": false,
|
|
360
|
+
"type": "option"
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"hasDynamicHelp": false,
|
|
364
|
+
"hiddenAliases": [],
|
|
365
|
+
"id": "compress-sol",
|
|
366
|
+
"pluginAlias": "@lightprotocol/zk-compression-cli",
|
|
367
|
+
"pluginName": "@lightprotocol/zk-compression-cli",
|
|
368
|
+
"pluginType": "core",
|
|
369
|
+
"strict": true,
|
|
370
|
+
"summary": "Compress SOL.",
|
|
371
|
+
"enableJsonFlag": false,
|
|
372
|
+
"isESM": false,
|
|
373
|
+
"relativePath": [
|
|
374
|
+
"dist",
|
|
375
|
+
"commands",
|
|
376
|
+
"compress-sol",
|
|
377
|
+
"index.js"
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
380
|
"decompress-sol": {
|
|
381
381
|
"aliases": [],
|
|
382
382
|
"args": {},
|
|
@@ -831,5 +831,5 @@
|
|
|
831
831
|
]
|
|
832
832
|
}
|
|
833
833
|
},
|
|
834
|
-
"version": "0.
|
|
834
|
+
"version": "0.17.0"
|
|
835
835
|
}
|