@lightprotocol/zk-compression-cli 0.27.1-alpha.0 → 0.27.1-alpha.2

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 (96) hide show
  1. package/accounts/address_merkle_tree_amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2.json +1 -1
  2. package/accounts/address_merkle_tree_queue_aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F.json +1 -1
  3. package/accounts/batch_address_merkle_tree_EzKE84aVTkCUhDHLELqyJaq1Y7UVVmqxXqZjVHwHY3rK.json +14 -1
  4. package/accounts/{batch_state_merkle_tree_2_2Yb3fGo2E9aWLjY8KuESaqurYpGGhEeJr7eynKrSgXwS.json → batch_address_merkle_tree_amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx.json} +1 -1
  5. package/accounts/{batch_state_merkle_tree_HLKs5NJ8FXkJg8BrzJt56adFYYuwg5etzDtBbQYTsixu.json → batch_state_merkle_tree_bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU.json} +1 -1
  6. package/accounts/batch_state_merkle_tree_bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi.json +1 -0
  7. package/accounts/batch_state_merkle_tree_bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb.json +1 -0
  8. package/accounts/batch_state_merkle_tree_bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8.json +1 -0
  9. package/accounts/batch_state_merkle_tree_bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2.json +1 -0
  10. package/accounts/{batched_output_queue_2_12wJT3xYd46rtjeqDU6CrtT8unqLjPiheggzqhN9YsyB.json → batched_output_queue_oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto.json} +1 -1
  11. package/accounts/{batched_output_queue_6L7SzhYB3anwEQ9cphpJ1U7Scwj57bx2xueReg7R9cKU.json → batched_output_queue_oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg.json} +1 -1
  12. package/accounts/batched_output_queue_oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ.json +1 -0
  13. package/accounts/batched_output_queue_oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq.json +1 -0
  14. package/accounts/batched_output_queue_oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P.json +1 -0
  15. package/accounts/{test_batched_cpi_context_7Hp52chxaew8bW1ApR4fck2bh6Y8qA1pu3qwH6N9zaLj.json → cpi_context_cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y.json} +1 -1
  16. package/accounts/cpi_context_cpi1uHzrEhBG733DoEJNgHCyRS3XmmyVNZx5fonubE4.json +1 -1
  17. package/accounts/cpi_context_cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK.json +1 -1
  18. package/accounts/{cpi_context_batched_2_HwtjxDvFEXiWnzeMeWkMBzpQN45A95rTJNZmz1Z3pe8R.json → cpi_context_cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B.json} +1 -14
  19. package/accounts/cpi_context_cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf.json +1 -0
  20. package/accounts/cpi_context_cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc.json +1 -0
  21. package/accounts/cpi_context_cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6.json +1 -0
  22. package/accounts/epoch_pda_34w7KcLBXabMkHuXE2fY368vFe6kP3v5EJn8nPvQ8SKn.json +1 -1
  23. package/accounts/forester_epoch_pda_3FBt1BPQHCQkS8k3wrUXMfB6JBhtMhEqQXueHRw2ojZV.json +1 -1
  24. package/accounts/governance_authority_pda_CuEtcKkkbTn6qy2qxqDswq5U2ADsqoipYDAYfRvxPjcp.json +1 -1
  25. package/accounts/group_pda_24rt4RgeyjUCWGS2eF7L7gyNMuz6JWdqYpAvb1KRoHxs.json +1 -1
  26. package/accounts/merkle_tree_pubkey_smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT.json +1 -1
  27. package/accounts/merkle_tree_pubkey_smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho.json +1 -1
  28. package/accounts/nullifier_queue_pubkey_nfq1NvQDJ2GEgnS8zt9prAe8rjjpAW1zFkrvZoBR148.json +1 -1
  29. package/accounts/nullifier_queue_pubkey_nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X.json +1 -1
  30. package/accounts/registered_forester_pda_2KNqEh23Se8AHecuzR1UkxL26euq2qXSpQPTH1jH7VqU.json +1 -1
  31. package/bin/account_compression.so +0 -0
  32. package/bin/light_compressed_token.so +0 -0
  33. package/bin/light_registry.so +0 -0
  34. package/bin/light_system_program_pinocchio.so +0 -0
  35. package/dist/commands/approve-and-mint-to/index.js +26 -29
  36. package/dist/commands/balance/index.js +12 -11
  37. package/dist/commands/compress-sol/index.js +13 -13
  38. package/dist/commands/compress-spl/index.js +19 -19
  39. package/dist/commands/config/config.js +67 -33
  40. package/dist/commands/create-mint/index.js +19 -20
  41. package/dist/commands/create-token-pool/index.js +9 -9
  42. package/dist/commands/decompress-sol/index.js +13 -13
  43. package/dist/commands/decompress-spl/index.js +19 -19
  44. package/dist/commands/init/index.js +8 -8
  45. package/dist/commands/merge-token-accounts/index.js +13 -14
  46. package/dist/commands/mint-to/index.js +24 -25
  47. package/dist/commands/start-prover/index.d.ts +0 -3
  48. package/dist/commands/start-prover/index.js +13 -58
  49. package/dist/commands/test-validator/index.d.ts +0 -2
  50. package/dist/commands/test-validator/index.js +79 -109
  51. package/dist/commands/token-balance/index.js +15 -15
  52. package/dist/commands/transfer/index.js +23 -24
  53. package/dist/psp-utils/download.js +1 -1
  54. package/dist/utils/constants.d.ts +2 -2
  55. package/dist/utils/constants.js +2 -3
  56. package/dist/utils/downloadProverBinary.d.ts +7 -0
  57. package/dist/utils/downloadProverBinary.js +107 -0
  58. package/dist/utils/initTestEnv.d.ts +1 -3
  59. package/dist/utils/initTestEnv.js +2 -2
  60. package/dist/utils/process.js +4 -6
  61. package/dist/utils/processProverServer.d.ts +1 -2
  62. package/dist/utils/processProverServer.js +63 -81
  63. package/dist/utils/utils.d.ts +4 -0
  64. package/dist/utils/utils.js +44 -3
  65. package/oclif.manifest.json +129 -210
  66. package/package.json +61 -60
  67. package/test_bin/dev +4 -7
  68. package/test_bin/run +2 -2
  69. package/bin/forester +0 -0
  70. package/bin/forester.toml +0 -15
  71. package/bin/light_system_program.so +0 -0
  72. package/bin/prover-darwin-arm64 +0 -0
  73. package/bin/prover-darwin-x64 +0 -0
  74. package/bin/prover-linux-arm64 +0 -0
  75. package/bin/prover-linux-x64 +0 -0
  76. package/bin/prover-windows-arm64.exe +0 -0
  77. package/bin/prover-windows-x64.exe +0 -0
  78. package/bin/proving-keys/combined_26_1_1.key +0 -0
  79. package/bin/proving-keys/combined_26_1_2.key +0 -0
  80. package/bin/proving-keys/combined_26_2_1.key +0 -0
  81. package/bin/proving-keys/combined_32_40_1_1.key +0 -0
  82. package/bin/proving-keys/combined_32_40_1_2.key +0 -0
  83. package/bin/proving-keys/combined_32_40_2_1.key +0 -0
  84. package/bin/proving-keys/inclusion_32_1.key +0 -0
  85. package/bin/proving-keys/inclusion_32_2.key +0 -0
  86. package/bin/proving-keys/inclusion_32_3.key +0 -0
  87. package/bin/proving-keys/inclusion_32_4.key +0 -0
  88. package/bin/proving-keys/mainnet_inclusion_26_1.key +0 -0
  89. package/bin/proving-keys/mainnet_inclusion_26_2.key +0 -0
  90. package/bin/proving-keys/mainnet_inclusion_26_3.key +0 -0
  91. package/bin/proving-keys/mainnet_inclusion_26_4.key +0 -0
  92. package/bin/proving-keys/non-inclusion_26_1.key +0 -0
  93. package/bin/proving-keys/non-inclusion_26_2.key +0 -0
  94. package/bin/proving-keys/non-inclusion_40_1.key +0 -0
  95. package/bin/proving-keys/non-inclusion_40_2.key +0 -0
  96. package/test_bin/lut.json +0 -1
@@ -2,10 +2,32 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const utils_1 = require("../../utils/utils");
5
- const helpers_1 = require("@solana-developers/helpers");
6
5
  const web3_js_1 = require("@solana/web3.js");
7
6
  const compressed_token_1 = require("@lightprotocol/compressed-token");
8
7
  class MintToCommand extends core_1.Command {
8
+ static summary = "Mint tokens to an account.";
9
+ static examples = [
10
+ "$ light mint-to --mint PublicKey --to PublicKey --amount 1000",
11
+ ];
12
+ static flags = {
13
+ "mint-authority": core_1.Flags.string({
14
+ description: "Specify the filepath of the mint authority keypair. Defaults to your local solana wallet.",
15
+ required: false,
16
+ }),
17
+ mint: core_1.Flags.string({
18
+ description: "Specify the mint address.",
19
+ required: true,
20
+ }),
21
+ to: core_1.Flags.string({
22
+ description: "Specify the recipient address.",
23
+ required: true,
24
+ }),
25
+ amount: core_1.Flags.integer({
26
+ description: "Amount to mint, in tokens.",
27
+ required: true,
28
+ }),
29
+ };
30
+ static args = {};
9
31
  async run() {
10
32
  const { flags } = await this.parse(MintToCommand);
11
33
  const mint = flags["mint"];
@@ -22,7 +44,7 @@ class MintToCommand extends core_1.Command {
22
44
  const payer = (0, utils_1.defaultSolanaWalletKeypair)();
23
45
  let mintAuthority = payer;
24
46
  if (flags["mint-authority"] !== undefined) {
25
- mintAuthority = await (0, helpers_1.getKeypairFromFile)(flags["mint-authority"]);
47
+ mintAuthority = await (0, utils_1.getKeypairFromFile)(flags["mint-authority"]);
26
48
  }
27
49
  const txId = await (0, compressed_token_1.mintTo)((0, utils_1.rpc)(), payer, mintPublicKey, toPublicKey, mintAuthority, amount);
28
50
  loader.stop(false);
@@ -34,27 +56,4 @@ class MintToCommand extends core_1.Command {
34
56
  }
35
57
  }
36
58
  }
37
- MintToCommand.summary = "Mint tokens to an account.";
38
- MintToCommand.examples = [
39
- "$ light mint-to --mint PublicKey --to PublicKey --amount 1000",
40
- ];
41
- MintToCommand.flags = {
42
- "mint-authority": core_1.Flags.string({
43
- description: "Specify the filepath of the mint authority keypair. Defaults to your local solana wallet.",
44
- required: false,
45
- }),
46
- mint: core_1.Flags.string({
47
- description: "Specify the mint address.",
48
- required: true,
49
- }),
50
- to: core_1.Flags.string({
51
- description: "Specify the recipient address.",
52
- required: true,
53
- }),
54
- amount: core_1.Flags.integer({
55
- description: "Amount to mint, in tokens.",
56
- required: true,
57
- }),
58
- };
59
- MintToCommand.args = {};
60
59
  exports.default = MintToCommand;
@@ -4,9 +4,6 @@ declare class StartProver extends Command {
4
4
  protected finally(_: Error | undefined): Promise<any>;
5
5
  static flags: {
6
6
  "prover-port": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- "run-mode": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- circuit: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
- force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
7
  redisUrl: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
8
  };
12
9
  run(): Promise<void>;
@@ -4,28 +4,28 @@ const core_1 = require("@oclif/core");
4
4
  const index_1 = require("../../utils/index");
5
5
  const processProverServer_1 = require("../../utils/processProverServer");
6
6
  class StartProver extends core_1.Command {
7
+ static description = "Start gnark prover";
7
8
  finally(_) {
8
9
  process.exit();
9
10
  }
11
+ static flags = {
12
+ "prover-port": core_1.Flags.integer({
13
+ description: "Enable Light Prover server on this port.",
14
+ required: false,
15
+ default: 3001,
16
+ }),
17
+ redisUrl: core_1.Flags.string({
18
+ description: "Redis URL to use for the prover (e.g. redis://localhost:6379)",
19
+ required: false,
20
+ }),
21
+ };
10
22
  async run() {
11
23
  const { flags } = await this.parse(StartProver);
12
24
  const loader = new index_1.CustomLoader("Performing setup tasks...\n");
13
25
  loader.start();
14
- if (!flags["run-mode"] && !flags["circuit"]) {
15
- this.log("Please specify --run-mode or --circuit.");
16
- return;
17
- }
18
26
  const proverPort = flags["prover-port"] || 3001;
19
- const force = flags["force"] || false;
20
27
  const redisUrl = flags["redisUrl"] || process.env.REDIS_URL || undefined;
21
- // TODO: remove this workaround.
22
- // Force local-rpc mode when rpc is specified
23
- let runMode = flags["run-mode"];
24
- if (runMode === "rpc") {
25
- runMode = "local-rpc";
26
- this.log("Note: Running in local-rpc mode instead of rpc mode");
27
- }
28
- await (0, processProverServer_1.startProver)(proverPort, runMode, flags["circuit"], force, redisUrl);
28
+ await (0, processProverServer_1.startProver)(proverPort, redisUrl);
29
29
  const healthy = await (0, processProverServer_1.healthCheck)(proverPort, 10, 1000);
30
30
  loader.stop();
31
31
  if (healthy) {
@@ -36,49 +36,4 @@ class StartProver extends core_1.Command {
36
36
  }
37
37
  }
38
38
  }
39
- StartProver.description = "Start gnark prover";
40
- StartProver.flags = {
41
- "prover-port": core_1.Flags.integer({
42
- description: "Enable Light Prover server on this port.",
43
- required: false,
44
- default: 3001,
45
- }),
46
- "run-mode": core_1.Flags.string({
47
- description: "Specify the running mode (local-rpc, forester, forester-test, rpc, or full). Default: local-rpc",
48
- options: [
49
- "local-rpc",
50
- "rpc",
51
- "forester",
52
- "forester-test",
53
- "full",
54
- "full-test",
55
- ],
56
- required: false,
57
- }),
58
- circuit: core_1.Flags.string({
59
- description: "Specify individual circuits to enable.",
60
- options: [
61
- "inclusion",
62
- "non-inclusion",
63
- "combined",
64
- "append",
65
- "update",
66
- "address-append",
67
- "append-test",
68
- "update-test",
69
- "address-append-test",
70
- ],
71
- multiple: true,
72
- required: false,
73
- }),
74
- force: core_1.Flags.boolean({
75
- description: "Force restart the prover even if one is already running with the same flags.",
76
- required: false,
77
- default: false,
78
- }),
79
- redisUrl: core_1.Flags.string({
80
- description: "Redis URL to use for the prover (e.g. redis://localhost:6379)",
81
- required: false,
82
- }),
83
- };
84
39
  exports.default = StartProver;
@@ -12,8 +12,6 @@ declare class SetupCommand extends Command {
12
12
  "rpc-port": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
13
13
  "indexer-port": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
14
14
  "prover-port": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
15
- "prover-run-mode": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
16
- circuit: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
17
15
  "limit-ledger-size": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
18
16
  "gossip-host": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
19
17
  stop: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -8,12 +8,91 @@ const index_1 = require("../../utils/index");
8
8
  const path_1 = tslib_1.__importDefault(require("path"));
9
9
  const fs_1 = tslib_1.__importDefault(require("fs"));
10
10
  class SetupCommand extends core_1.Command {
11
+ static description = "Start a local test setup with: Solana test validator, Photon indexer, and Light prover";
12
+ static examples = [
13
+ "$ light test-validator",
14
+ "$ light test-validator --skip-indexer",
15
+ "$ light test-validator --geyser-config ./config.json",
16
+ '$ light test-validator --validator-args "--limit-ledger-size 50000000"',
17
+ "$ light test-validator --sbf-program <address> <path/program>",
18
+ ];
11
19
  finally(err) {
12
20
  if (err) {
13
21
  console.error(err);
14
22
  }
15
23
  process.exit();
16
24
  }
25
+ static flags = {
26
+ "skip-indexer": core_1.Flags.boolean({
27
+ description: "Runs a test validator without starting a new indexer.",
28
+ default: false,
29
+ }),
30
+ "skip-prover": core_1.Flags.boolean({
31
+ description: "Runs a test validator without starting a new prover service.",
32
+ default: false,
33
+ }),
34
+ "skip-system-accounts": core_1.Flags.boolean({
35
+ description: "Runs a test validator without initialized light system accounts.",
36
+ default: false,
37
+ }),
38
+ "relax-indexer-version-constraint": core_1.Flags.boolean({
39
+ description: "Disables indexer version check. Only use if you know what you are doing.",
40
+ default: false,
41
+ exclusive: ["skip-indexer"],
42
+ }),
43
+ "indexer-db-url": core_1.Flags.string({
44
+ description: "Custom indexer database URL to store indexing data. By default we use an in-memory SQLite database.",
45
+ required: false,
46
+ exclusive: ["skip-indexer"],
47
+ }),
48
+ "rpc-port": core_1.Flags.integer({
49
+ description: "Enable JSON RPC on this port, and the next port for the RPC websocket.",
50
+ required: false,
51
+ default: 8899,
52
+ }),
53
+ "indexer-port": core_1.Flags.integer({
54
+ description: "Enable Photon indexer on this port.",
55
+ required: false,
56
+ default: 8784,
57
+ exclusive: ["skip-indexer"],
58
+ }),
59
+ "prover-port": core_1.Flags.integer({
60
+ description: "Enable Light Prover server on this port.",
61
+ required: false,
62
+ default: 3001,
63
+ exclusive: ["skip-prover"],
64
+ }),
65
+ "limit-ledger-size": core_1.Flags.integer({
66
+ description: "Keep this amount of shreds in root slots.",
67
+ required: false,
68
+ default: 10000,
69
+ }),
70
+ "gossip-host": core_1.Flags.string({
71
+ description: "Gossip DNS name or IP address for the validator to advertise in gossip.",
72
+ required: false,
73
+ default: "127.0.0.1",
74
+ }),
75
+ stop: core_1.Flags.boolean({
76
+ description: "Stops the test validator and dependent processes. Use with --skip-indexer, --skip-prover to keep specific services running.",
77
+ required: false,
78
+ default: false,
79
+ }),
80
+ "geyser-config": core_1.Flags.string({
81
+ description: "Path to Geyser plugin config.",
82
+ required: false,
83
+ }),
84
+ "validator-args": core_1.Flags.string({
85
+ description: "Additional arguments to pass directly to solana-test-validator. Only use if you know what you are doing.",
86
+ required: false,
87
+ exclusive: ["geyser-config"],
88
+ }),
89
+ "sbf-program": core_1.Flags.string({
90
+ description: "Add a SBF program to the genesis configuration with upgrades disabled. If the ledger already exists then this parameter is silently ignored. First argument can be a pubkey string or path to a keypair",
91
+ required: false,
92
+ multiple: true,
93
+ summary: "Usage: --sbf-program <address> <path/program_name.so>",
94
+ }),
95
+ };
17
96
  validatePrograms(programs) {
18
97
  // Check for duplicate addresses among provided programs
19
98
  const addresses = new Set();
@@ -84,8 +163,6 @@ class SetupCommand extends core_1.Command {
84
163
  proverPort: flags["prover-port"],
85
164
  prover: !flags["skip-prover"],
86
165
  skipSystemAccounts: flags["skip-system-accounts"],
87
- proverRunMode: flags["prover-run-mode"],
88
- circuits: flags["circuit"],
89
166
  geyserConfig: flags["geyser-config"],
90
167
  validatorArgs: flags["validator-args"],
91
168
  });
@@ -93,113 +170,6 @@ class SetupCommand extends core_1.Command {
93
170
  }
94
171
  }
95
172
  }
96
- SetupCommand.description = "Start a local test setup with: Solana test validator, Photon indexer, and Light prover";
97
- SetupCommand.examples = [
98
- "$ light test-validator",
99
- "$ light test-validator --skip-indexer",
100
- "$ light test-validator --geyser-config ./config.json",
101
- '$ light test-validator --validator-args "--limit-ledger-size 50000000"',
102
- "$ light test-validator --sbf-program <address> <path/program>",
103
- ];
104
- SetupCommand.flags = {
105
- "skip-indexer": core_1.Flags.boolean({
106
- description: "Runs a test validator without starting a new indexer.",
107
- default: false,
108
- }),
109
- "skip-prover": core_1.Flags.boolean({
110
- description: "Runs a test validator without starting a new prover service.",
111
- default: false,
112
- }),
113
- "skip-system-accounts": core_1.Flags.boolean({
114
- description: "Runs a test validator without initialized light system accounts.",
115
- default: false,
116
- }),
117
- "relax-indexer-version-constraint": core_1.Flags.boolean({
118
- description: "Disables indexer version check. Only use if you know what you are doing.",
119
- default: false,
120
- exclusive: ["skip-indexer"],
121
- }),
122
- "indexer-db-url": core_1.Flags.string({
123
- description: "Custom indexer database URL to store indexing data. By default we use an in-memory SQLite database.",
124
- required: false,
125
- exclusive: ["skip-indexer"],
126
- }),
127
- "rpc-port": core_1.Flags.integer({
128
- description: "Enable JSON RPC on this port, and the next port for the RPC websocket.",
129
- required: false,
130
- default: 8899,
131
- }),
132
- "indexer-port": core_1.Flags.integer({
133
- description: "Enable Photon indexer on this port.",
134
- required: false,
135
- default: 8784,
136
- exclusive: ["skip-indexer"],
137
- }),
138
- "prover-port": core_1.Flags.integer({
139
- description: "Enable Light Prover server on this port.",
140
- required: false,
141
- default: 3001,
142
- exclusive: ["skip-prover"],
143
- }),
144
- "prover-run-mode": core_1.Flags.string({
145
- description: "Specify the running mode for the prover (local-rpc, forester, forester-test, rpc, or full). Default: local-rpc",
146
- options: [
147
- "local-rpc",
148
- "rpc",
149
- "forester",
150
- "forester-test",
151
- "full",
152
- "full-test",
153
- ],
154
- required: false,
155
- exclusive: ["skip-prover"],
156
- }),
157
- circuit: core_1.Flags.string({
158
- description: "Specify individual circuits to enable.",
159
- options: [
160
- "inclusion",
161
- "non-inclusion",
162
- "combined",
163
- "append",
164
- "update",
165
- "append-test",
166
- "update-test",
167
- ],
168
- multiple: true,
169
- required: false,
170
- exclusive: ["skip-prover"],
171
- }),
172
- "limit-ledger-size": core_1.Flags.integer({
173
- description: "Keep this amount of shreds in root slots.",
174
- required: false,
175
- default: 10000,
176
- }),
177
- "gossip-host": core_1.Flags.string({
178
- description: "Gossip DNS name or IP address for the validator to advertise in gossip.",
179
- required: false,
180
- default: "127.0.0.1",
181
- }),
182
- stop: core_1.Flags.boolean({
183
- description: "Stops the test validator and dependent processes. Use with --skip-indexer, --skip-prover to keep specific services running.",
184
- required: false,
185
- default: false,
186
- }),
187
- "geyser-config": core_1.Flags.string({
188
- description: "Path to Geyser plugin config.",
189
- required: false,
190
- }),
191
- "validator-args": core_1.Flags.string({
192
- description: "Additional arguments to pass directly to solana-test-validator. Only use if you know what you are doing.",
193
- required: false,
194
- exclusive: ["geyser-config"],
195
- }),
196
- "sbf-program": core_1.Flags.string({
197
- description: "Add a SBF program to the genesis configuration with upgrades disabled. If the ledger already exists then this parameter is silently ignored. First argument can be a pubkey string or path to a keypair",
198
- required: false,
199
- multiple: true,
200
- summary: "Usage: --sbf-program <address> <path/program_name.so>",
201
- }),
202
- };
203
173
  exports.default = SetupCommand;
204
174
  exports.SYSTEM_PROGRAMS = [
205
175
  {
@@ -4,6 +4,21 @@ const core_1 = require("@oclif/core");
4
4
  const utils_1 = require("../../utils/utils");
5
5
  const web3_js_1 = require("@solana/web3.js");
6
6
  class TokenBalanceCommand extends core_1.Command {
7
+ static summary = "Get balance";
8
+ static examples = [
9
+ "$ light token-balance --mint=<ADDRESS> --owner=<ADDRESS>",
10
+ ];
11
+ static flags = {
12
+ owner: core_1.Flags.string({
13
+ description: "Address of the compressed token owner.",
14
+ required: true,
15
+ }),
16
+ mint: core_1.Flags.string({
17
+ description: "Mint address of the compressed token account.",
18
+ required: true,
19
+ }),
20
+ };
21
+ static args = {};
7
22
  async run() {
8
23
  const { flags } = await this.parse(TokenBalanceCommand);
9
24
  const loader = new utils_1.CustomLoader(`Performing balance...\n`);
@@ -37,19 +52,4 @@ class TokenBalanceCommand extends core_1.Command {
37
52
  }
38
53
  }
39
54
  }
40
- TokenBalanceCommand.summary = "Get balance";
41
- TokenBalanceCommand.examples = [
42
- "$ light token-balance --mint=<ADDRESS> --owner=<ADDRESS>",
43
- ];
44
- TokenBalanceCommand.flags = {
45
- owner: core_1.Flags.string({
46
- description: "Address of the compressed token owner.",
47
- required: true,
48
- }),
49
- mint: core_1.Flags.string({
50
- description: "Mint address of the compressed token account.",
51
- required: true,
52
- }),
53
- };
54
- TokenBalanceCommand.args = {};
55
55
  exports.default = TokenBalanceCommand;
@@ -4,8 +4,29 @@ const core_1 = require("@oclif/core");
4
4
  const utils_1 = require("../../utils/utils");
5
5
  const compressed_token_1 = require("@lightprotocol/compressed-token");
6
6
  const web3_js_1 = require("@solana/web3.js");
7
- const helpers_1 = require("@solana-developers/helpers");
8
7
  class TransferCommand extends core_1.Command {
8
+ static summary = "Transfer tokens from one account to another.";
9
+ static examples = [
10
+ "$ light transfer --mint PublicKey --to PublicKey --amount 1000",
11
+ ];
12
+ static flags = {
13
+ mint: core_1.Flags.string({
14
+ description: "Mint to transfer",
15
+ required: true,
16
+ }),
17
+ to: core_1.Flags.string({
18
+ description: "Recipient address",
19
+ required: true,
20
+ }),
21
+ amount: core_1.Flags.integer({
22
+ description: "Amount to send, in tokens",
23
+ required: true,
24
+ }),
25
+ "fee-payer": core_1.Flags.string({
26
+ description: "Specify the fee-payer account. Defaults to the client keypair.",
27
+ required: false,
28
+ }),
29
+ };
9
30
  async run() {
10
31
  const { flags } = await this.parse(TransferCommand);
11
32
  const loader = new utils_1.CustomLoader(`Performing transfer...\n`);
@@ -21,7 +42,7 @@ class TransferCommand extends core_1.Command {
21
42
  const toPublicKey = new web3_js_1.PublicKey(to);
22
43
  let payer = (0, utils_1.defaultSolanaWalletKeypair)();
23
44
  if (flags["fee-payer"] !== undefined) {
24
- payer = await (0, helpers_1.getKeypairFromFile)(flags["fee-payer"]);
45
+ payer = await (0, utils_1.getKeypairFromFile)(flags["fee-payer"]);
25
46
  }
26
47
  const txId = await (0, compressed_token_1.transfer)((0, utils_1.rpc)(), payer, mintPublicKey, amount, payer, toPublicKey);
27
48
  loader.stop(false);
@@ -33,26 +54,4 @@ class TransferCommand extends core_1.Command {
33
54
  }
34
55
  }
35
56
  }
36
- TransferCommand.summary = "Transfer tokens from one account to another.";
37
- TransferCommand.examples = [
38
- "$ light transfer --mint PublicKey --to PublicKey --amount 1000",
39
- ];
40
- TransferCommand.flags = {
41
- mint: core_1.Flags.string({
42
- description: "Mint to transfer",
43
- required: true,
44
- }),
45
- to: core_1.Flags.string({
46
- description: "Recipient address",
47
- required: true,
48
- }),
49
- amount: core_1.Flags.integer({
50
- description: "Amount to send, in tokens",
51
- required: true,
52
- }),
53
- "fee-payer": core_1.Flags.string({
54
- description: "Specify the fee-payer account. Defaults to the client keypair.",
55
- required: false,
56
- }),
57
- };
58
57
  exports.default = TransferCommand;
@@ -58,7 +58,7 @@ async function makeExecutableInDir(dirPath) {
58
58
  * @returns {Promise<void>}
59
59
  */
60
60
  function handleTarFile({ decompressor, data, localFilePath, dirPath, }) {
61
- const parser = new tar.Parse();
61
+ const parser = new tar.Parser();
62
62
  data.pipe(decompressor).pipe(parser);
63
63
  parser.on("entry", (entry) => {
64
64
  const baseName = path.parse(entry.path).base;
@@ -12,10 +12,10 @@ export declare const CARGO_GENERATE_TAG = "v0.18.4";
12
12
  export declare const SOLANA_VALIDATOR_PROCESS_NAME = "solana-test-validator";
13
13
  export declare const LIGHT_PROVER_PROCESS_NAME = "light-prover";
14
14
  export declare const INDEXER_PROCESS_NAME = "photon";
15
- export declare const PHOTON_VERSION = "0.52.3";
15
+ export declare const PHOTON_VERSION = "0.51.0";
16
16
  export declare const USE_PHOTON_FROM_GIT = true;
17
17
  export declare const PHOTON_GIT_REPO = "https://github.com/lightprotocol/photon.git";
18
- export declare const PHOTON_GIT_COMMIT = "6ba6813";
18
+ export declare const PHOTON_GIT_COMMIT = "1a785036de52896b68d06413e3b0231122d6aa4a";
19
19
  export declare const LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = "LIGHT_PROTOCOL_PROGRAMS_DIR";
20
20
  export declare const BASE_PATH = "../../bin/";
21
21
  export declare const PROGRAM_ID = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS";
@@ -17,12 +17,11 @@ exports.CARGO_GENERATE_TAG = "v0.18.4";
17
17
  exports.SOLANA_VALIDATOR_PROCESS_NAME = "solana-test-validator";
18
18
  exports.LIGHT_PROVER_PROCESS_NAME = "light-prover";
19
19
  exports.INDEXER_PROCESS_NAME = "photon";
20
- exports.PHOTON_VERSION = "0.52.3";
20
+ exports.PHOTON_VERSION = "0.51.0";
21
21
  // Set these to override Photon requirements with a specific git commit:
22
22
  exports.USE_PHOTON_FROM_GIT = true; // If true, will show git install command instead of crates.io.
23
23
  exports.PHOTON_GIT_REPO = "https://github.com/lightprotocol/photon.git";
24
- // added new v2 tree.
25
- exports.PHOTON_GIT_COMMIT = "6ba6813"; // If empty, will use main branch.
24
+ exports.PHOTON_GIT_COMMIT = "1a785036de52896b68d06413e3b0231122d6aa4a"; // If empty, will use main branch.
26
25
  exports.LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = "LIGHT_PROTOCOL_PROGRAMS_DIR";
27
26
  exports.BASE_PATH = "../../bin/";
28
27
  exports.PROGRAM_ID = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS";
@@ -0,0 +1,7 @@
1
+ interface DownloadOptions {
2
+ maxRetries?: number;
3
+ retryDelay?: number;
4
+ }
5
+ export declare function downloadProverBinary(binaryPath: string, binaryName: string, options?: DownloadOptions): Promise<void>;
6
+ export declare function getProverVersion(): string;
7
+ export {};
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.downloadProverBinary = downloadProverBinary;
4
+ exports.getProverVersion = getProverVersion;
5
+ const tslib_1 = require("tslib");
6
+ const fs_1 = tslib_1.__importDefault(require("fs"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const https_1 = tslib_1.__importDefault(require("https"));
9
+ const http_1 = tslib_1.__importDefault(require("http"));
10
+ const promises_1 = require("stream/promises");
11
+ const PROVER_VERSION = "2.0.0";
12
+ const GITHUB_RELEASES_BASE_URL = `https://github.com/Lightprotocol/light-protocol/releases/download/light-prover-v${PROVER_VERSION}`;
13
+ const MAX_REDIRECTS = 10;
14
+ async function downloadProverBinary(binaryPath, binaryName, options = {}) {
15
+ const { maxRetries = 3, retryDelay = 2000 } = options;
16
+ const url = `${GITHUB_RELEASES_BASE_URL}/${binaryName}`;
17
+ console.log(`\nDownloading prover binary: ${binaryName}`);
18
+ console.log(` From: ${url}`);
19
+ console.log(` To: ${binaryPath}\n`);
20
+ const dir = path_1.default.dirname(binaryPath);
21
+ if (!fs_1.default.existsSync(dir)) {
22
+ fs_1.default.mkdirSync(dir, { recursive: true });
23
+ }
24
+ let lastError = null;
25
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
26
+ try {
27
+ await downloadFile(url, binaryPath);
28
+ if (process.platform !== "win32") {
29
+ fs_1.default.chmodSync(binaryPath, 0o755);
30
+ }
31
+ console.log("\nProver binary downloaded.\n");
32
+ return;
33
+ }
34
+ catch (error) {
35
+ lastError = error;
36
+ console.error(`\nDownload attempt ${attempt}/${maxRetries} failed: ${lastError.message}`);
37
+ if (attempt < maxRetries) {
38
+ console.log(` Retrying in ${retryDelay / 1000}s...\n`);
39
+ await new Promise((resolve) => setTimeout(resolve, retryDelay));
40
+ }
41
+ }
42
+ }
43
+ throw new Error(`Failed to download prover binary after ${maxRetries} attempts: ${lastError?.message}`);
44
+ }
45
+ async function downloadFile(url, outputPath, redirectDepth = 0) {
46
+ return new Promise((resolve, reject) => {
47
+ const protocol = url.startsWith("https") ? https_1.default : http_1.default;
48
+ const request = protocol.get(url, (response) => {
49
+ if (response.statusCode === 301 ||
50
+ response.statusCode === 302 ||
51
+ response.statusCode === 307 ||
52
+ response.statusCode === 308) {
53
+ const redirectUrl = response.headers.location;
54
+ if (!redirectUrl) {
55
+ return reject(new Error("Redirect without location header"));
56
+ }
57
+ if (redirectDepth >= MAX_REDIRECTS) {
58
+ return reject(new Error(`Too many redirects: exceeded maximum of ${MAX_REDIRECTS} redirects`));
59
+ }
60
+ return downloadFile(redirectUrl, outputPath, redirectDepth + 1).then(resolve, reject);
61
+ }
62
+ if (response.statusCode !== 200) {
63
+ return reject(new Error(`HTTP ${response.statusCode}: ${response.statusMessage}`));
64
+ }
65
+ const totalBytes = parseInt(response.headers["content-length"] || "0", 10);
66
+ let downloadedBytes = 0;
67
+ let lastProgress = 0;
68
+ const fileStream = fs_1.default.createWriteStream(outputPath);
69
+ response.on("data", (chunk) => {
70
+ downloadedBytes += chunk.length;
71
+ if (totalBytes > 0) {
72
+ const progress = Math.floor((downloadedBytes / totalBytes) * 100);
73
+ if (progress >= lastProgress + 5) {
74
+ lastProgress = progress;
75
+ const mb = (downloadedBytes / 1024 / 1024).toFixed(1);
76
+ const totalMb = (totalBytes / 1024 / 1024).toFixed(1);
77
+ process.stdout.write(`\r Progress: ${progress}% (${mb}MB / ${totalMb}MB)`);
78
+ }
79
+ }
80
+ });
81
+ (0, promises_1.pipeline)(response, fileStream)
82
+ .then(() => {
83
+ if (totalBytes > 0) {
84
+ process.stdout.write("\r Progress: 100% - Download complete\n");
85
+ }
86
+ resolve();
87
+ })
88
+ .catch((error) => {
89
+ fs_1.default.unlinkSync(outputPath);
90
+ reject(error);
91
+ });
92
+ });
93
+ request.on("error", (error) => {
94
+ if (fs_1.default.existsSync(outputPath)) {
95
+ fs_1.default.unlinkSync(outputPath);
96
+ }
97
+ reject(error);
98
+ });
99
+ request.setTimeout(60000, () => {
100
+ request.destroy();
101
+ reject(new Error("Download timeout"));
102
+ });
103
+ });
104
+ }
105
+ function getProverVersion() {
106
+ return PROVER_VERSION;
107
+ }