@lightprotocol/zk-compression-cli 0.10.0 → 0.15.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.
Files changed (65) hide show
  1. package/README.md +6 -6
  2. package/bin/account_compression.so +0 -0
  3. package/bin/{forester → cargo-generate} +0 -0
  4. package/bin/light_compressed_token.so +0 -0
  5. package/bin/light_registry.so +0 -0
  6. package/bin/light_system_program.so +0 -0
  7. package/bin/prover-darwin-arm64 +0 -0
  8. package/bin/prover-darwin-x64 +0 -0
  9. package/bin/prover-linux-arm64 +0 -0
  10. package/bin/prover-linux-x64 +0 -0
  11. package/bin/prover-windows-arm64.exe +0 -0
  12. package/bin/prover-windows-x64.exe +0 -0
  13. package/bin/proving-keys/combined_26_1_1.key +0 -0
  14. package/bin/proving-keys/combined_26_1_1.vkey +1 -1
  15. package/bin/proving-keys/combined_26_1_2.key +0 -0
  16. package/bin/proving-keys/combined_26_1_2.vkey +1 -1
  17. package/bin/proving-keys/combined_26_2_1.key +0 -0
  18. package/bin/proving-keys/combined_26_2_1.vkey +1 -1
  19. package/bin/proving-keys/combined_26_2_2.key +0 -0
  20. package/bin/proving-keys/combined_26_2_2.vkey +1 -1
  21. package/bin/proving-keys/combined_26_3_1.key +0 -0
  22. package/bin/proving-keys/combined_26_3_1.vkey +1 -1
  23. package/bin/proving-keys/combined_26_3_2.key +0 -0
  24. package/bin/proving-keys/combined_26_3_2.vkey +1 -1
  25. package/bin/proving-keys/combined_26_4_1.key +0 -0
  26. package/bin/proving-keys/combined_26_4_1.vkey +1 -1
  27. package/bin/proving-keys/combined_26_4_2.key +0 -0
  28. package/bin/proving-keys/combined_26_4_2.vkey +1 -1
  29. package/bin/proving-keys/inclusion_26_1.key +0 -0
  30. package/bin/proving-keys/inclusion_26_1.vkey +1 -1
  31. package/bin/proving-keys/inclusion_26_2.key +0 -0
  32. package/bin/proving-keys/inclusion_26_2.vkey +1 -1
  33. package/bin/proving-keys/inclusion_26_3.key +0 -0
  34. package/bin/proving-keys/inclusion_26_3.vkey +1 -1
  35. package/bin/proving-keys/inclusion_26_4.key +0 -0
  36. package/bin/proving-keys/inclusion_26_4.vkey +1 -1
  37. package/bin/proving-keys/inclusion_26_8.key +0 -0
  38. package/bin/proving-keys/inclusion_26_8.vkey +1 -1
  39. package/bin/proving-keys/non-inclusion_26_1.key +0 -0
  40. package/bin/proving-keys/non-inclusion_26_1.vkey +1 -1
  41. package/bin/proving-keys/non-inclusion_26_2.key +0 -0
  42. package/bin/proving-keys/non-inclusion_26_2.vkey +1 -1
  43. package/dist/commands/{register-mint → create-token-pool}/index.js +4 -4
  44. package/dist/commands/init/index.d.ts +26 -0
  45. package/dist/commands/init/index.js +180 -0
  46. package/dist/commands/merge-token-accounts/index.d.ts +11 -0
  47. package/dist/commands/merge-token-accounts/index.js +41 -0
  48. package/dist/commands/test-validator/index.d.ts +1 -1
  49. package/dist/commands/test-validator/index.js +29 -20
  50. package/dist/utils/constants.d.ts +20 -7
  51. package/dist/utils/constants.js +21 -8
  52. package/dist/utils/initTestEnv.d.ts +8 -4
  53. package/dist/utils/initTestEnv.js +31 -8
  54. package/dist/utils/process.d.ts +1 -1
  55. package/dist/utils/process.js +26 -13
  56. package/dist/utils/processPhotonIndexer.d.ts +1 -0
  57. package/dist/utils/processPhotonIndexer.js +1 -0
  58. package/dist/utils/processProverServer.d.ts +1 -0
  59. package/dist/utils/processProverServer.js +6 -1
  60. package/oclif.manifest.json +242 -173
  61. package/package.json +9 -9
  62. package/bin/forester.toml +0 -8
  63. package/dist/utils/processForester.d.ts +0 -3
  64. package/dist/utils/processForester.js +0 -24
  65. /package/dist/commands/{register-mint → create-token-pool}/index.d.ts +0 -0
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stopTestEnv = stopTestEnv;
3
4
  exports.initTestEnv = initTestEnv;
4
5
  exports.initTestEnvIfNeeded = initTestEnvIfNeeded;
6
+ exports.programsDirPath = programsDirPath;
7
+ exports.programFilePath = programFilePath;
5
8
  exports.getSolanaArgs = getSolanaArgs;
6
9
  exports.startTestValidator = startTestValidator;
7
10
  exports.killTestValidator = killTestValidator;
@@ -14,9 +17,33 @@ const psp_utils_1 = require("../psp-utils");
14
17
  const process_1 = require("./process");
15
18
  const processProverServer_1 = require("./processProverServer");
16
19
  const processPhotonIndexer_1 = require("./processPhotonIndexer");
17
- const processForester_1 = require("./processForester");
18
- async function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer = true, prover = true, forester = true, rpcPort = 8899, indexerPort = 8784, proverPort = 3001, gossipHost = "127.0.0.1", proveCompressedAccounts = true, proveNewAddresses = false, checkPhotonVersion = true, photonDatabaseUrl, limitLedgerSize, }) {
19
- console.log("Performing setup tasks...\n");
20
+ async function stopTestEnv(options) {
21
+ const processesToKill = [
22
+ { name: "photon", condition: options.indexer, killFunction: processPhotonIndexer_1.killIndexer },
23
+ { name: "prover", condition: options.prover, killFunction: processProverServer_1.killProver },
24
+ {
25
+ name: "test-validator",
26
+ condition: true,
27
+ killFunction: killTestValidator,
28
+ },
29
+ ];
30
+ const killPromises = processesToKill
31
+ .filter((process) => process.condition)
32
+ .map(async (process) => {
33
+ try {
34
+ if (process.killFunction) {
35
+ await process.killFunction();
36
+ }
37
+ console.log(`${process.name} stopped successfully.`);
38
+ }
39
+ catch (error) {
40
+ console.error(`Failed to stop ${process.name}:`, error);
41
+ }
42
+ });
43
+ await Promise.all(killPromises);
44
+ console.log("All specified processes and validator stopped.");
45
+ }
46
+ async function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer = true, prover = true, rpcPort = 8899, indexerPort = 8784, proverPort = 3001, gossipHost = "127.0.0.1", proveCompressedAccounts = true, proveNewAddresses = false, checkPhotonVersion = true, photonDatabaseUrl, limitLedgerSize, }) {
20
47
  const initAccounts = async () => {
21
48
  const anchorProvider = await (0, utils_1.setAnchorProvider)();
22
49
  const payer = await (0, utils_1.getPayer)();
@@ -49,11 +76,8 @@ async function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer = t
49
76
  (0, utils_1.setConfig)(config);
50
77
  await (0, processProverServer_1.startProver)(proverPort, proveCompressedAccounts, proveNewAddresses);
51
78
  }
52
- if (forester) {
53
- await (0, processForester_1.startForester)();
54
- }
55
79
  }
56
- async function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, indexer = false, prover = false, forester = false, } = {}) {
80
+ async function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, indexer = false, prover = false, } = {}) {
57
81
  try {
58
82
  const anchorProvider = await (0, utils_1.setAnchorProvider)();
59
83
  // this request will fail if there is no local test validator running
@@ -67,7 +91,6 @@ async function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, ind
67
91
  skipSystemAccounts,
68
92
  indexer,
69
93
  prover,
70
- forester,
71
94
  });
72
95
  }
73
96
  }
@@ -22,7 +22,7 @@ export declare function executeCommand({ command, args, additionalPath, logFile,
22
22
  * @example const output = await execute("ls -alh");
23
23
  */
24
24
  export declare function execute(command: string): Promise<string>;
25
- export declare function spawnBinary(command: string, args?: string[]): void;
25
+ export declare function spawnBinary(command: string, args?: string[]): import("child_process").ChildProcess;
26
26
  export declare function waitForServers(servers: {
27
27
  port: number;
28
28
  path: string;
@@ -111,20 +111,33 @@ async function execute(command) {
111
111
  function spawnBinary(command, args = []) {
112
112
  const logDir = "test-ledger";
113
113
  const binaryName = path_1.default.basename(command);
114
- const dir = path_1.default.join(__dirname, logDir);
115
- if (!fs_1.default.existsSync(dir)) {
116
- fs_1.default.mkdirSync(dir);
114
+ const dir = path_1.default.join(__dirname, "../..", logDir);
115
+ try {
116
+ if (!fs_1.default.existsSync(dir)) {
117
+ fs_1.default.mkdirSync(dir, { recursive: true });
118
+ }
119
+ const logPath = path_1.default.join(dir, `${binaryName}.log`);
120
+ const out = fs_1.default.openSync(logPath, "a");
121
+ const err = fs_1.default.openSync(logPath, "a");
122
+ const spawnedProcess = (0, child_process_1.spawn)(command, args, {
123
+ stdio: ["ignore", out, err],
124
+ shell: false,
125
+ detached: true,
126
+ });
127
+ spawnedProcess.on("close", (code) => {
128
+ console.log(`${binaryName} process exited with code ${code}`);
129
+ });
130
+ return spawnedProcess;
131
+ }
132
+ catch (error) {
133
+ if (error instanceof Error) {
134
+ console.error(`Error spawning binary: ${error.message}`);
135
+ }
136
+ else {
137
+ console.error(`An unknown error occurred while spawning binary`);
138
+ }
139
+ throw error;
117
140
  }
118
- const out = fs_1.default.openSync(`${logDir}/${binaryName}.log`, "a");
119
- const err = fs_1.default.openSync(`${logDir}/${binaryName}.log`, "a");
120
- const spawnedProcess = (0, child_process_1.spawn)(command, args, {
121
- stdio: ["ignore", out, err],
122
- shell: false,
123
- detached: true,
124
- });
125
- spawnedProcess.on("close", (code) => {
126
- console.log(`${binaryName} process exited with code ${code}`);
127
- });
128
141
  }
129
142
  async function waitForServers(servers) {
130
143
  const opts = {
@@ -1 +1,2 @@
1
1
  export declare function startIndexer(rpcUrl: string, indexerPort: number, checkPhotonVersion?: boolean, photonDatabaseUrl?: string): Promise<void>;
2
+ export declare function killIndexer(): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.startIndexer = startIndexer;
4
+ exports.killIndexer = killIndexer;
4
5
  const tslib_1 = require("tslib");
5
6
  const which_1 = tslib_1.__importDefault(require("which"));
6
7
  const process_1 = require("./process");
@@ -1,3 +1,4 @@
1
1
  export declare function killProver(): Promise<void>;
2
2
  export declare function startProver(proverPort: number, proveCompressedAccounts: boolean, proveNewAddresses: boolean): Promise<void>;
3
3
  export declare function getProverNameByArch(): string;
4
+ export declare function getProverPathByArch(): string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.killProver = killProver;
4
4
  exports.startProver = startProver;
5
5
  exports.getProverNameByArch = getProverNameByArch;
6
+ exports.getProverPathByArch = getProverPathByArch;
6
7
  const tslib_1 = require("tslib");
7
8
  const path_1 = tslib_1.__importDefault(require("path"));
8
9
  const process_1 = require("./process");
@@ -28,7 +29,7 @@ async function startProver(proverPort, proveCompressedAccounts, proveNewAddresse
28
29
  args.push("--keys-dir", keysDir);
29
30
  args.push("--prover-address", `0.0.0.0:${proverPort}`);
30
31
  console.log("Starting prover...");
31
- (0, process_1.spawnBinary)(getProverNameByArch(), args);
32
+ (0, process_1.spawnBinary)(getProverPathByArch(), args);
32
33
  await (0, process_1.waitForServers)([{ port: proverPort, path: "/" }]);
33
34
  console.log("Prover started successfully!");
34
35
  }
@@ -42,6 +43,10 @@ function getProverNameByArch() {
42
43
  if (platform.toString() === "windows") {
43
44
  binaryName += ".exe";
44
45
  }
46
+ return binaryName;
47
+ }
48
+ function getProverPathByArch() {
49
+ let binaryName = getProverNameByArch();
45
50
  // We need to provide the full path to the binary because it's not in the PATH.
46
51
  const binDir = path_1.default.join(__dirname, "../..", "bin");
47
52
  binaryName = path_1.default.join(binDir, binaryName);