@lightprotocol/zk-compression-cli 0.14.0 → 0.15.1

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -7,7 +7,7 @@ const compressed_token_1 = require("@lightprotocol/compressed-token");
7
7
  class RegisterMintCommand extends core_1.Command {
8
8
  async run() {
9
9
  const { flags } = await this.parse(RegisterMintCommand);
10
- const loader = new utils_1.CustomLoader(`Performing register-mint...\n`);
10
+ const loader = new utils_1.CustomLoader(`Performing create-token-pool...\n`);
11
11
  loader.start();
12
12
  try {
13
13
  const payer = (0, utils_1.defaultSolanaWalletKeypair)();
@@ -16,15 +16,15 @@ class RegisterMintCommand extends core_1.Command {
16
16
  loader.stop(false);
17
17
  console.log("\x1b[1mMint public key:\x1b[0m ", mintAddress.toBase58());
18
18
  console.log("\x1b[1mMint tx:\x1b[0m ", (0, utils_1.generateSolanaTransactionURL)("tx", txId, "custom"));
19
- console.log("register-mint successful");
19
+ console.log("create-token-pool successful");
20
20
  }
21
21
  catch (error) {
22
- this.error(`Failed to register-mint!\n${error}`);
22
+ this.error(`Failed to create-token-pool!\n${error}`);
23
23
  }
24
24
  }
25
25
  }
26
26
  RegisterMintCommand.summary = "Register an existing mint with the CompressedToken program";
27
- RegisterMintCommand.examples = ["$ light register-mint --mint-decimals 5"];
27
+ RegisterMintCommand.examples = ["$ light create-token-pool --mint-decimals 5"];
28
28
  RegisterMintCommand.flags = {
29
29
  mint: core_1.Flags.string({
30
30
  description: "Provide a base58 encoded mint address to register",
@@ -0,0 +1,26 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class InitCommand extends Command {
3
+ static description: string;
4
+ static args: {
5
+ name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
9
+ export declare const initRepo: (name: string, flags: any) => Promise<void>;
10
+ export declare const initFlags: {
11
+ path: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ git: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ tag: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ branch: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ };
16
+ export declare function downloadCargoGenerateIfNotExists({ localFilePath, dirPath, }: {
17
+ localFilePath: string;
18
+ dirPath: string;
19
+ }): Promise<void>;
20
+ export declare enum System {
21
+ MacOsAmd64 = 0,
22
+ MacOsArm64 = 1,
23
+ LinuxAmd64 = 2,
24
+ LinuxArm64 = 3
25
+ }
26
+ export declare function getSystem(): System;
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.System = exports.initFlags = exports.initRepo = void 0;
4
+ exports.downloadCargoGenerateIfNotExists = downloadCargoGenerateIfNotExists;
5
+ exports.getSystem = getSystem;
6
+ const tslib_1 = require("tslib");
7
+ const stateless_js_1 = require("@lightprotocol/stateless.js");
8
+ const core_1 = require("@oclif/core");
9
+ const process_1 = require("../../utils/process");
10
+ const psp_utils_1 = require("../../psp-utils");
11
+ const constants_1 = require("../../utils/constants");
12
+ const utils_1 = require("../../utils");
13
+ const case_anything_1 = require("case-anything");
14
+ class InitCommand extends core_1.Command {
15
+ async run() {
16
+ const { args, flags } = await this.parse(InitCommand);
17
+ const { name } = args;
18
+ this.log("Initializing project...");
19
+ await (0, exports.initRepo)(name, flags);
20
+ this.log("✅ Project initialized successfully");
21
+ }
22
+ }
23
+ InitCommand.description = "Initialize a compressed account project.";
24
+ InitCommand.args = {
25
+ name: core_1.Args.string({
26
+ name: "NAME",
27
+ description: "The name of the project",
28
+ required: true,
29
+ }),
30
+ };
31
+ exports.default = InitCommand;
32
+ const initRepo = async (name, flags) => {
33
+ const localFilePath = (0, utils_1.programFilePath)("cargo-generate");
34
+ const dirPath = (0, utils_1.programsDirPath)();
35
+ await downloadCargoGenerateIfNotExists({
36
+ localFilePath,
37
+ dirPath,
38
+ });
39
+ const kebabCaseName = (0, case_anything_1.kebabCase)(name);
40
+ const snakeCaseName = (0, case_anything_1.snakeCase)(name);
41
+ const camelCaseName = (0, case_anything_1.pascalCase)(name);
42
+ await (0, process_1.executeCommand)({
43
+ command: localFilePath,
44
+ args: [
45
+ "generate",
46
+ "--name",
47
+ kebabCaseName,
48
+ "--git",
49
+ "https://github.com/Lightprotocol/compressed-program-template",
50
+ "--tag",
51
+ constants_1.COMPRESSED_PROGRAM_TEMPLATE_TAG,
52
+ "--define",
53
+ `rust-name=${kebabCaseName}`,
54
+ "--define",
55
+ `rust-name-snake-case=${snakeCaseName}`,
56
+ "--define",
57
+ `rust-name-camel-case=${camelCaseName}`,
58
+ "--define",
59
+ `program-id=${constants_1.PROGRAM_ID}`,
60
+ "--define",
61
+ `anchor-version=${constants_1.ANCHOR_VERSION}`,
62
+ "--define",
63
+ `borsh-version=${constants_1.BORSH_VERSION}`,
64
+ "--define",
65
+ `light-hasher-version=${constants_1.LIGHT_HASHER_VERSION}`,
66
+ "--define",
67
+ `light-macros-version=${constants_1.LIGHT_MACROS_VERSION}`,
68
+ "--define",
69
+ `light-sdk-version=${constants_1.LIGHT_SDK_VERSION}`,
70
+ "--define",
71
+ `light-sdk-macros-version=${constants_1.LIGHT_SDK_MACROS_VERSION}`,
72
+ "--define",
73
+ `light-utils-version=${constants_1.LIGHT_UTILS_VERSION}`,
74
+ "--define",
75
+ `light-verifier-version=${constants_1.LIGHT_VERIFIER_VERSION}`,
76
+ "--define",
77
+ `solana-sdk-version=${constants_1.SOLANA_SDK_VERSION}`,
78
+ "--define",
79
+ `light-client-version=${constants_1.LIGHT_CLIENT_VERSION}`,
80
+ "--define",
81
+ `light-test-utils-version=${constants_1.LIGHT_TEST_UTILS_VERSION}`,
82
+ "--define",
83
+ `solana-program-test-version=${constants_1.SOLANA_PROGRAM_TEST_VERSION}`,
84
+ "--define",
85
+ `tokio-version=${constants_1.TOKIO_VERSION}`,
86
+ ],
87
+ logFile: true,
88
+ });
89
+ await (0, stateless_js_1.sleep)(1000);
90
+ };
91
+ exports.initRepo = initRepo;
92
+ exports.initFlags = {
93
+ path: core_1.Flags.string({
94
+ aliases: ["p"],
95
+ description: "Path of the template repo.",
96
+ required: false,
97
+ }),
98
+ git: core_1.Flags.string({
99
+ aliases: ["g"],
100
+ description: "Github url of the template repo",
101
+ default: "https://github.com/Lightprotocol/psp-template",
102
+ required: false,
103
+ }),
104
+ tag: core_1.Flags.string({
105
+ aliases: ["t"],
106
+ description: "Tag must be used in conjuction with --git",
107
+ required: false,
108
+ }),
109
+ branch: core_1.Flags.string({
110
+ aliases: ["b"],
111
+ description: "Branch must be used in conjuction with --git",
112
+ default: "main",
113
+ required: false,
114
+ }),
115
+ };
116
+ async function downloadCargoGenerateIfNotExists({ localFilePath, dirPath, }) {
117
+ let remoteFileName;
118
+ const tag = utils_1.CARGO_GENERATE_TAG;
119
+ switch (getSystem()) {
120
+ case System.LinuxAmd64:
121
+ remoteFileName = `cargo-generate-${tag}-x86_64-unknown-linux-musl.tar.gz`;
122
+ break;
123
+ case System.LinuxArm64:
124
+ remoteFileName = `cargo-generate-${tag}-aarch64-unknown-linux-musl.tar.gz`;
125
+ break;
126
+ case System.MacOsAmd64:
127
+ remoteFileName = `cargo-generate-${tag}-x86_64-apple-darwin.tar.gz`;
128
+ break;
129
+ case System.MacOsArm64:
130
+ remoteFileName = `cargo-generate-${tag}-aarch64-apple-darwin.tar.gz`;
131
+ break;
132
+ default:
133
+ throw new Error(`Unsupported system: ${getSystem()}`);
134
+ }
135
+ await (0, psp_utils_1.downloadBinIfNotExists)({
136
+ localFilePath,
137
+ dirPath,
138
+ owner: "cargo-generate",
139
+ repoName: "cargo-generate",
140
+ remoteFileName,
141
+ tag,
142
+ });
143
+ }
144
+ var System;
145
+ (function (System) {
146
+ System[System["MacOsAmd64"] = 0] = "MacOsAmd64";
147
+ System[System["MacOsArm64"] = 1] = "MacOsArm64";
148
+ System[System["LinuxAmd64"] = 2] = "LinuxAmd64";
149
+ System[System["LinuxArm64"] = 3] = "LinuxArm64";
150
+ })(System || (exports.System = System = {}));
151
+ const os = tslib_1.__importStar(require("os"));
152
+ function getSystem() {
153
+ const arch = os.arch();
154
+ const platform = os.platform();
155
+ switch (platform) {
156
+ case "darwin":
157
+ switch (arch) {
158
+ case "x64":
159
+ return System.MacOsAmd64;
160
+ case "arm":
161
+ // fallthrough
162
+ case "arm64":
163
+ return System.MacOsArm64;
164
+ default:
165
+ throw new stateless_js_1.UtilsError(stateless_js_1.UtilsErrorCode.UNSUPPORTED_ARCHITECTURE, "getSystem", `Architecture ${arch} is not supported.`);
166
+ }
167
+ case "linux":
168
+ switch (arch) {
169
+ case "x64":
170
+ return System.LinuxAmd64;
171
+ case "arm":
172
+ // fallthrough
173
+ case "arm64":
174
+ return System.LinuxArm64;
175
+ default:
176
+ throw new stateless_js_1.UtilsError(stateless_js_1.UtilsErrorCode.UNSUPPORTED_ARCHITECTURE, "getSystem", `Architecture ${arch} is not supported.`);
177
+ }
178
+ }
179
+ throw new stateless_js_1.UtilsError(stateless_js_1.UtilsErrorCode.UNSUPPORTED_PLATFORM, "getSystem", `Platform ${platform} is not supported.`);
180
+ }
@@ -0,0 +1,11 @@
1
+ import { Command } from "@oclif/core";
2
+ declare class MergeTokenAccountsCommand extends Command {
3
+ static summary: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ mint: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ "fee-payer": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
11
+ export default MergeTokenAccountsCommand;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const utils_1 = require("../../utils/utils");
5
+ const compressed_token_1 = require("@lightprotocol/compressed-token");
6
+ const web3_js_1 = require("@solana/web3.js");
7
+ const helpers_1 = require("@solana-developers/helpers");
8
+ class MergeTokenAccountsCommand extends core_1.Command {
9
+ async run() {
10
+ const { flags } = await this.parse(MergeTokenAccountsCommand);
11
+ const loader = new utils_1.CustomLoader(`Merging token accounts...\n`);
12
+ loader.start();
13
+ try {
14
+ const mint = new web3_js_1.PublicKey(flags.mint);
15
+ let payer = (0, utils_1.defaultSolanaWalletKeypair)();
16
+ if (flags["fee-payer"]) {
17
+ payer = await (0, helpers_1.getKeypairFromFile)(flags["fee-payer"]);
18
+ }
19
+ const txId = await (0, compressed_token_1.mergeTokenAccounts)((0, utils_1.rpc)(), payer, mint, payer);
20
+ loader.stop(false);
21
+ console.log(`\x1b[1mMerge tx:\x1b[0m `, (0, utils_1.generateSolanaTransactionURL)("tx", txId, "custom"));
22
+ console.log("Token accounts merged successfully");
23
+ }
24
+ catch (error) {
25
+ this.error(`Failed to merge token accounts!\n${error}`);
26
+ }
27
+ }
28
+ }
29
+ MergeTokenAccountsCommand.summary = "Merge all token accounts for a specific mint.";
30
+ MergeTokenAccountsCommand.examples = ["$ light merge-token-accounts --mint PublicKey"];
31
+ MergeTokenAccountsCommand.flags = {
32
+ mint: core_1.Flags.string({
33
+ description: "Mint to merge accounts for",
34
+ required: true,
35
+ }),
36
+ "fee-payer": core_1.Flags.string({
37
+ description: "Specify the fee-payer account. Defaults to the client keypair.",
38
+ required: false,
39
+ }),
40
+ };
41
+ exports.default = MergeTokenAccountsCommand;
@@ -5,7 +5,6 @@ declare class SetupCommand extends Command {
5
5
  static flags: {
6
6
  "skip-indexer": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
7
  "skip-prover": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
- "skip-forester": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
8
  "skip-system-accounts": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
9
  "prove-compressed-accounts": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
10
  "prove-new-addresses": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -13,7 +13,6 @@ class SetupCommand extends core_1.Command {
13
13
  loader.start();
14
14
  if (flags["stop"] === true) {
15
15
  await (0, initTestEnv_1.stopTestEnv)({
16
- forester: !flags["skip-forester"],
17
16
  indexer: !flags["skip-indexer"],
18
17
  prover: !flags["skip-prover"],
19
18
  });
@@ -22,7 +21,6 @@ class SetupCommand extends core_1.Command {
22
21
  else {
23
22
  await (0, initTestEnv_1.initTestEnv)({
24
23
  checkPhotonVersion: !flags["relax-indexer-version-constraint"],
25
- forester: !flags["skip-forester"],
26
24
  indexer: !flags["skip-indexer"],
27
25
  limitLedgerSize: flags["limit-ledger-size"],
28
26
  photonDatabaseUrl: flags["indexer-db-url"],
@@ -49,10 +47,6 @@ SetupCommand.flags = {
49
47
  description: "Runs a test validator without starting a new prover service.",
50
48
  default: false,
51
49
  }),
52
- "skip-forester": core_1.Flags.boolean({
53
- description: "Runs a test validator without starting a new forester service.",
54
- default: false,
55
- }),
56
50
  "skip-system-accounts": core_1.Flags.boolean({
57
51
  description: "Runs a test validator without initialized light system accounts.",
58
52
  default: false,
@@ -105,7 +99,7 @@ SetupCommand.flags = {
105
99
  default: "127.0.0.1",
106
100
  }),
107
101
  stop: core_1.Flags.boolean({
108
- description: "Stops the test validator and dependent processes. Use with --skip-indexer, --skip-prover, --skip-forester to keep specific services running.",
102
+ description: "Stops the test validator and dependent processes. Use with --skip-indexer, --skip-prover to keep specific services running.",
109
103
  required: false,
110
104
  default: false,
111
105
  }),
@@ -1,9 +1,8 @@
1
1
  export declare const SPL_NOOP_PROGRAM_TAG = "spl-noop-v0.2.0";
2
- export declare const LIGHT_MERKLE_TREE_PROGRAM_TAG = "light-merkle-tree-program-v0.3.1";
3
- export declare const LIGHT_ACCOUNT_COMPRESSION_TAG = "account-compression-v0.3.5";
4
- export declare const LIGHT_SYSTEM_PROGRAM_TAG = "light-system-program-v0.3.4";
5
- export declare const LIGHT_REGISTRY_TAG = "light-registry-v0.3.4";
6
- export declare const LIGHT_COMPRESSED_TOKEN_TAG = "light-compressed-token-v0.3.4";
2
+ export declare const LIGHT_ACCOUNT_COMPRESSION_TAG = "account-compression-v1.0.0";
3
+ export declare const LIGHT_SYSTEM_PROGRAM_TAG = "light-system-program-v1.0.0";
4
+ export declare const LIGHT_REGISTRY_TAG = "light-registry-v1.0.0";
5
+ export declare const LIGHT_COMPRESSED_TOKEN_TAG = "light-compressed-token-v1.0.0";
7
6
  export declare const CONFIG_PATH = "/.config/light/";
8
7
  export declare const CONFIG_FILE_NAME = "config.json";
9
8
  export declare const DEFAULT_CONFIG: {
@@ -13,7 +12,21 @@ export declare const CARGO_GENERATE_TAG = "v0.18.4";
13
12
  export declare const SOLANA_VALIDATOR_PROCESS_NAME = "solana-test-validator";
14
13
  export declare const LIGHT_PROVER_PROCESS_NAME = "light-prover";
15
14
  export declare const INDEXER_PROCESS_NAME = "photon";
16
- export declare const FORESTER_PROCESS_NAME = "forester";
17
15
  export declare const PHOTON_VERSION = "0.45.0";
18
16
  export declare const LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = "LIGHT_PROTOCOL_PROGRAMS_DIR";
19
17
  export declare const BASE_PATH = "../../bin/";
18
+ export declare const PROGRAM_ID = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS";
19
+ export declare const ANCHOR_VERSION = "0.29.0";
20
+ export declare const BORSH_VERSION = "0.9.2";
21
+ export declare const LIGHT_HASHER_VERSION = "1.1.0";
22
+ export declare const LIGHT_MACROS_VERSION = "1.1.0";
23
+ export declare const LIGHT_SDK_VERSION = "0.10.0";
24
+ export declare const LIGHT_SDK_MACROS_VERSION = "0.3.0";
25
+ export declare const LIGHT_UTILS_VERSION = "1.1.0";
26
+ export declare const LIGHT_VERIFIER_VERSION = "1.1.0";
27
+ export declare const SOLANA_SDK_VERSION = "1.18.22";
28
+ export declare const LIGHT_CLIENT_VERSION = "0.9.1";
29
+ export declare const LIGHT_TEST_UTILS_VERSION = "1.2.1";
30
+ export declare const SOLANA_PROGRAM_TEST_VERSION = "1.18.22";
31
+ export declare const TOKIO_VERSION = "1.36.0";
32
+ export declare const COMPRESSED_PROGRAM_TEMPLATE_TAG = "v0.1.1";
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BASE_PATH = exports.LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = exports.PHOTON_VERSION = exports.FORESTER_PROCESS_NAME = exports.INDEXER_PROCESS_NAME = exports.LIGHT_PROVER_PROCESS_NAME = exports.SOLANA_VALIDATOR_PROCESS_NAME = exports.CARGO_GENERATE_TAG = exports.DEFAULT_CONFIG = exports.CONFIG_FILE_NAME = exports.CONFIG_PATH = exports.LIGHT_COMPRESSED_TOKEN_TAG = exports.LIGHT_REGISTRY_TAG = exports.LIGHT_SYSTEM_PROGRAM_TAG = exports.LIGHT_ACCOUNT_COMPRESSION_TAG = exports.LIGHT_MERKLE_TREE_PROGRAM_TAG = exports.SPL_NOOP_PROGRAM_TAG = void 0;
3
+ exports.COMPRESSED_PROGRAM_TEMPLATE_TAG = exports.TOKIO_VERSION = exports.SOLANA_PROGRAM_TEST_VERSION = exports.LIGHT_TEST_UTILS_VERSION = exports.LIGHT_CLIENT_VERSION = exports.SOLANA_SDK_VERSION = exports.LIGHT_VERIFIER_VERSION = exports.LIGHT_UTILS_VERSION = exports.LIGHT_SDK_MACROS_VERSION = exports.LIGHT_SDK_VERSION = exports.LIGHT_MACROS_VERSION = exports.LIGHT_HASHER_VERSION = exports.BORSH_VERSION = exports.ANCHOR_VERSION = exports.PROGRAM_ID = exports.BASE_PATH = exports.LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = exports.PHOTON_VERSION = exports.INDEXER_PROCESS_NAME = exports.LIGHT_PROVER_PROCESS_NAME = exports.SOLANA_VALIDATOR_PROCESS_NAME = exports.CARGO_GENERATE_TAG = exports.DEFAULT_CONFIG = exports.CONFIG_FILE_NAME = exports.CONFIG_PATH = exports.LIGHT_COMPRESSED_TOKEN_TAG = exports.LIGHT_REGISTRY_TAG = exports.LIGHT_SYSTEM_PROGRAM_TAG = exports.LIGHT_ACCOUNT_COMPRESSION_TAG = exports.SPL_NOOP_PROGRAM_TAG = void 0;
4
4
  exports.SPL_NOOP_PROGRAM_TAG = "spl-noop-v0.2.0";
5
- exports.LIGHT_MERKLE_TREE_PROGRAM_TAG = "light-merkle-tree-program-v0.3.1";
6
- exports.LIGHT_ACCOUNT_COMPRESSION_TAG = "account-compression-v0.3.5";
7
- exports.LIGHT_SYSTEM_PROGRAM_TAG = "light-system-program-v0.3.4";
8
- exports.LIGHT_REGISTRY_TAG = "light-registry-v0.3.4";
9
- exports.LIGHT_COMPRESSED_TOKEN_TAG = "light-compressed-token-v0.3.4";
5
+ exports.LIGHT_ACCOUNT_COMPRESSION_TAG = "account-compression-v1.0.0";
6
+ exports.LIGHT_SYSTEM_PROGRAM_TAG = "light-system-program-v1.0.0";
7
+ exports.LIGHT_REGISTRY_TAG = "light-registry-v1.0.0";
8
+ exports.LIGHT_COMPRESSED_TOKEN_TAG = "light-compressed-token-v1.0.0";
10
9
  exports.CONFIG_PATH = "/.config/light/";
11
10
  exports.CONFIG_FILE_NAME = "config.json";
12
11
  exports.DEFAULT_CONFIG = {
@@ -18,7 +17,21 @@ exports.CARGO_GENERATE_TAG = "v0.18.4";
18
17
  exports.SOLANA_VALIDATOR_PROCESS_NAME = "solana-test-validator";
19
18
  exports.LIGHT_PROVER_PROCESS_NAME = "light-prover";
20
19
  exports.INDEXER_PROCESS_NAME = "photon";
21
- exports.FORESTER_PROCESS_NAME = "forester";
22
20
  exports.PHOTON_VERSION = "0.45.0";
23
21
  exports.LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = "LIGHT_PROTOCOL_PROGRAMS_DIR";
24
22
  exports.BASE_PATH = "../../bin/";
23
+ exports.PROGRAM_ID = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS";
24
+ exports.ANCHOR_VERSION = "0.29.0";
25
+ exports.BORSH_VERSION = "0.9.2";
26
+ exports.LIGHT_HASHER_VERSION = "1.1.0";
27
+ exports.LIGHT_MACROS_VERSION = "1.1.0";
28
+ exports.LIGHT_SDK_VERSION = "0.10.0";
29
+ exports.LIGHT_SDK_MACROS_VERSION = "0.3.0";
30
+ exports.LIGHT_UTILS_VERSION = "1.1.0";
31
+ exports.LIGHT_VERIFIER_VERSION = "1.1.0";
32
+ exports.SOLANA_SDK_VERSION = "1.18.22";
33
+ exports.LIGHT_CLIENT_VERSION = "0.9.1";
34
+ exports.LIGHT_TEST_UTILS_VERSION = "1.2.1";
35
+ exports.SOLANA_PROGRAM_TEST_VERSION = "1.18.22";
36
+ exports.TOKIO_VERSION = "1.36.0";
37
+ exports.COMPRESSED_PROGRAM_TEMPLATE_TAG = "v0.1.1";
@@ -1,9 +1,8 @@
1
1
  export declare function stopTestEnv(options: {
2
- forester: boolean;
3
2
  indexer: boolean;
4
3
  prover: boolean;
5
4
  }): Promise<void>;
6
- export declare function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer, prover, forester, rpcPort, indexerPort, proverPort, gossipHost, proveCompressedAccounts, proveNewAddresses, checkPhotonVersion, photonDatabaseUrl, limitLedgerSize, }: {
5
+ export declare function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer, prover, rpcPort, indexerPort, proverPort, gossipHost, proveCompressedAccounts, proveNewAddresses, checkPhotonVersion, photonDatabaseUrl, limitLedgerSize, }: {
7
6
  additionalPrograms?: {
8
7
  address: string;
9
8
  path: string;
@@ -11,7 +10,6 @@ export declare function initTestEnv({ additionalPrograms, skipSystemAccounts, in
11
10
  skipSystemAccounts?: boolean;
12
11
  indexer: boolean;
13
12
  prover: boolean;
14
- forester: boolean;
15
13
  rpcPort?: number;
16
14
  indexerPort?: number;
17
15
  proverPort?: number;
@@ -22,7 +20,7 @@ export declare function initTestEnv({ additionalPrograms, skipSystemAccounts, in
22
20
  photonDatabaseUrl?: string;
23
21
  limitLedgerSize?: number;
24
22
  }): Promise<void>;
25
- export declare function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, indexer, prover, forester, }?: {
23
+ export declare function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, indexer, prover, }?: {
26
24
  additionalPrograms?: {
27
25
  address: string;
28
26
  path: string;
@@ -30,8 +28,9 @@ export declare function initTestEnvIfNeeded({ additionalPrograms, skipSystemAcco
30
28
  skipSystemAccounts?: boolean;
31
29
  indexer?: boolean;
32
30
  prover?: boolean;
33
- forester?: boolean;
34
31
  }): Promise<void>;
32
+ export declare function programsDirPath(): string;
33
+ export declare function programFilePath(programName: string): string;
35
34
  export declare function getSolanaArgs({ additionalPrograms, skipSystemAccounts, limitLedgerSize, rpcPort, gossipHost, downloadBinaries, }: {
36
35
  additionalPrograms?: {
37
36
  address: string;
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stopTestEnv = stopTestEnv;
4
4
  exports.initTestEnv = initTestEnv;
5
5
  exports.initTestEnvIfNeeded = initTestEnvIfNeeded;
6
+ exports.programsDirPath = programsDirPath;
7
+ exports.programFilePath = programFilePath;
6
8
  exports.getSolanaArgs = getSolanaArgs;
7
9
  exports.startTestValidator = startTestValidator;
8
10
  exports.killTestValidator = killTestValidator;
@@ -15,16 +17,10 @@ const psp_utils_1 = require("../psp-utils");
15
17
  const process_1 = require("./process");
16
18
  const processProverServer_1 = require("./processProverServer");
17
19
  const processPhotonIndexer_1 = require("./processPhotonIndexer");
18
- const processForester_1 = require("./processForester");
19
20
  async function stopTestEnv(options) {
20
21
  const processesToKill = [
21
22
  { name: "photon", condition: options.indexer, killFunction: processPhotonIndexer_1.killIndexer },
22
23
  { name: "prover", condition: options.prover, killFunction: processProverServer_1.killProver },
23
- {
24
- name: "forester",
25
- condition: options.forester,
26
- killFunction: processForester_1.killForester,
27
- },
28
24
  {
29
25
  name: "test-validator",
30
26
  condition: true,
@@ -47,7 +43,7 @@ async function stopTestEnv(options) {
47
43
  await Promise.all(killPromises);
48
44
  console.log("All specified processes and validator stopped.");
49
45
  }
50
- 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, }) {
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, }) {
51
47
  const initAccounts = async () => {
52
48
  const anchorProvider = await (0, utils_1.setAnchorProvider)();
53
49
  const payer = await (0, utils_1.getPayer)();
@@ -80,11 +76,8 @@ async function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer = t
80
76
  (0, utils_1.setConfig)(config);
81
77
  await (0, processProverServer_1.startProver)(proverPort, proveCompressedAccounts, proveNewAddresses);
82
78
  }
83
- if (forester) {
84
- await (0, processForester_1.startForester)();
85
- }
86
79
  }
87
- async function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, indexer = false, prover = false, forester = false, } = {}) {
80
+ async function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, indexer = false, prover = false, } = {}) {
88
81
  try {
89
82
  const anchorProvider = await (0, utils_1.setAnchorProvider)();
90
83
  // this request will fail if there is no local test validator running
@@ -98,7 +91,6 @@ async function initTestEnvIfNeeded({ additionalPrograms, skipSystemAccounts, ind
98
91
  skipSystemAccounts,
99
92
  indexer,
100
93
  prover,
101
- forester,
102
94
  });
103
95
  }
104
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,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);