@lightprotocol/zk-compression-cli 0.24.0 → 0.26.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/README.md +1 -1
- package/accounts/address_merkle_tree_amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2.json +1 -1
- package/accounts/batch_address_merkle_tree_EzKE84aVTkCUhDHLELqyJaq1Y7UVVmqxXqZjVHwHY3rK.json +1 -0
- package/accounts/batch_state_merkle_tree_HLKs5NJ8FXkJg8BrzJt56adFYYuwg5etzDtBbQYTsixu.json +1 -0
- package/accounts/batched_output_queue_6L7SzhYB3anwEQ9cphpJ1U7Scwj57bx2xueReg7R9cKU.json +1 -0
- package/accounts/cpi_context_2_cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK.json +1 -0
- package/accounts/cpi_context_cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK.json +1 -0
- package/accounts/group_pda_32tgQWfaASE7SfTQvMaSJDrqe728tJQ2SGzxtDDrpDwS.json +1 -0
- package/accounts/merkle_tree_pubkey_2_smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho.json +1 -0
- package/accounts/merkle_tree_pubkey_smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho.json +1 -0
- package/accounts/nullifier_queue_pubkey_2_nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X.json +1 -0
- package/accounts/nullifier_queue_pubkey_nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X.json +1 -0
- package/accounts/registered_program_pda_35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh.json +1 -1
- package/accounts/registered_registry_program_pda_DumMsyvkaGJG4QnQ1BhTgvoRMXsgGxfpKDUCr22Xqu4w.json +1 -1
- package/bin/account_compression.so +0 -0
- package/bin/light_compressed_token.so +0 -0
- package/bin/light_registry.so +0 -0
- package/bin/light_system_program_pinocchio.so +0 -0
- package/bin/prover-darwin-arm64 +0 -0
- package/bin/prover-darwin-x64 +0 -0
- package/bin/prover-linux-arm64 +0 -0
- package/bin/prover-linux-x64 +0 -0
- package/bin/prover-windows-arm64.exe +0 -0
- package/bin/prover-windows-x64.exe +0 -0
- package/bin/proving-keys/combined_32_40_1_1.key +0 -0
- package/bin/proving-keys/{combined_26_3_2.key → combined_32_40_1_2.key} +0 -0
- package/bin/proving-keys/{combined_26_2_2.key → combined_32_40_2_1.key} +0 -0
- package/bin/proving-keys/inclusion_32_1.key +0 -0
- package/bin/proving-keys/inclusion_32_2.key +0 -0
- package/bin/proving-keys/{combined_26_3_1.key → inclusion_32_3.key} +0 -0
- package/bin/proving-keys/{combined_26_4_1.key → inclusion_32_4.key} +0 -0
- package/bin/proving-keys/{inclusion_26_2.key → mainnet_inclusion_26_2.key} +0 -0
- package/bin/proving-keys/non-inclusion_40_1.key +0 -0
- package/bin/proving-keys/non-inclusion_40_2.key +0 -0
- package/dist/commands/balance/index.d.ts +0 -1
- package/dist/commands/balance/index.js +10 -17
- package/dist/commands/compress-spl/index.js +3 -1
- package/dist/commands/decompress-spl/index.js +3 -1
- package/dist/commands/init/index.js +33 -3
- package/dist/commands/start-prover/index.d.ts +2 -0
- package/dist/commands/start-prover/index.js +38 -6
- package/dist/commands/test-validator/index.d.ts +2 -2
- package/dist/commands/test-validator/index.js +36 -31
- package/dist/commands/token-balance/index.d.ts +12 -0
- package/dist/commands/token-balance/index.js +55 -0
- package/dist/utils/constants.d.ts +20 -12
- package/dist/utils/constants.js +24 -13
- package/dist/utils/initTestEnv.d.ts +9 -1
- package/dist/utils/initTestEnv.js +38 -28
- package/dist/utils/process.d.ts +4 -0
- package/dist/utils/process.js +41 -2
- package/dist/utils/processPhotonIndexer.d.ts +1 -1
- package/dist/utils/processPhotonIndexer.js +33 -24
- package/dist/utils/processProverServer.d.ts +3 -1
- package/dist/utils/processProverServer.js +83 -2
- package/oclif.manifest.json +142 -93
- package/package.json +29 -51
- package/bin/proving-keys/CHECKSUM +0 -127
- package/bin/proving-keys/combined_26_1_1.vkey +0 -1
- package/bin/proving-keys/combined_26_1_2.vkey +0 -1
- package/bin/proving-keys/combined_26_2_1.vkey +0 -1
- package/bin/proving-keys/combined_26_2_2.vkey +0 -1
- package/bin/proving-keys/combined_26_3_1.vkey +0 -1
- package/bin/proving-keys/combined_26_3_2.vkey +0 -1
- package/bin/proving-keys/combined_26_4_1.vkey +0 -1
- package/bin/proving-keys/combined_26_4_2.key +0 -0
- package/bin/proving-keys/combined_26_4_2.vkey +0 -1
- package/bin/proving-keys/inclusion_26_1.vkey +0 -1
- package/bin/proving-keys/inclusion_26_2.vkey +0 -1
- package/bin/proving-keys/inclusion_26_3.vkey +0 -1
- package/bin/proving-keys/inclusion_26_4.vkey +0 -1
- package/bin/proving-keys/inclusion_26_8.key +0 -0
- package/bin/proving-keys/inclusion_26_8.vkey +0 -1
- package/bin/proving-keys/non-inclusion_26_1.vkey +0 -1
- package/bin/proving-keys/non-inclusion_26_2.vkey +0 -1
- /package/bin/proving-keys/{inclusion_26_1.key → mainnet_inclusion_26_1.key} +0 -0
- /package/bin/proving-keys/{inclusion_26_3.key → mainnet_inclusion_26_3.key} +0 -0
- /package/bin/proving-keys/{inclusion_26_4.key → mainnet_inclusion_26_4.key} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"pubkey":"35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh","account":{"lamports":
|
|
1
|
+
{"pubkey":"35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh","account":{"lamports":1614720,"data":["H/u06wN0MgQGp1X4ITkFTUQksVrwxDDPL0t/mHk62hJS1I82ZsbLzg/Y1EfToz5VLJjxHxd2rjLiDsKHFAg5RA9dMMbnV0jY+7ModRBcroW1tER2B+2/4UUnv7QjkRykBCO/0VJ6JnU=","base64"],"owner":"compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq","executable":false,"rentEpoch":18446744073709551615,"space":104}}
|
package/accounts/registered_registry_program_pda_DumMsyvkaGJG4QnQ1BhTgvoRMXsgGxfpKDUCr22Xqu4w.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"pubkey":"DumMsyvkaGJG4QnQ1BhTgvoRMXsgGxfpKDUCr22Xqu4w","account":{"lamports":
|
|
1
|
+
{"pubkey":"DumMsyvkaGJG4QnQ1BhTgvoRMXsgGxfpKDUCr22Xqu4w","account":{"lamports":1614720,"data":["H/u06wN0MgQFDSsTeVE2hc8C8rX9UpG9lZsrBgqlJepbNIE7Hbm3bg/Y1EfToz5VLJjxHxd2rjLiDsKHFAg5RA9dMMbnV0jYEKZefdY5BPg4OtA83uB4uRTYcxiAOxU1gHDXkuBc/ec=","base64"],"owner":"compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq","executable":false,"rentEpoch":18446744073709551615,"space":104}}
|
|
Binary file
|
|
Binary file
|
package/bin/light_registry.so
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/prover-darwin-arm64
CHANGED
|
Binary file
|
package/bin/prover-darwin-x64
CHANGED
|
Binary file
|
package/bin/prover-linux-arm64
CHANGED
|
Binary file
|
package/bin/prover-linux-x64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,7 +4,6 @@ declare class BalanceCommand extends Command {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
owner: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
-
mint: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
7
|
};
|
|
9
8
|
static args: {};
|
|
10
9
|
run(): Promise<void>;
|
|
@@ -9,36 +9,29 @@ class BalanceCommand extends core_1.Command {
|
|
|
9
9
|
const loader = new utils_1.CustomLoader(`Performing balance...\n`);
|
|
10
10
|
loader.start();
|
|
11
11
|
try {
|
|
12
|
-
const refMint = new web3_js_1.PublicKey(flags["mint"]);
|
|
13
12
|
const refOwner = new web3_js_1.PublicKey(flags["owner"]);
|
|
14
|
-
const
|
|
13
|
+
const accounts = await (0, utils_1.rpc)().getCompressedAccountsByOwner(refOwner);
|
|
15
14
|
loader.stop(false);
|
|
16
|
-
if (
|
|
17
|
-
console.log("No
|
|
15
|
+
if (accounts.items.length === 0) {
|
|
16
|
+
console.log("No accounts found");
|
|
18
17
|
return;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return;
|
|
19
|
+
let totalAmount = 0;
|
|
20
|
+
for (const account of accounts.items) {
|
|
21
|
+
totalAmount += account.lamports.toNumber();
|
|
24
22
|
}
|
|
25
|
-
console.log("\x1b[
|
|
26
|
-
console.log("balance successful");
|
|
23
|
+
console.log("\x1b[1mCompressed SOL balance:\x1b[0m ", totalAmount.toString());
|
|
27
24
|
}
|
|
28
25
|
catch (error) {
|
|
29
26
|
this.error(`Failed to get balance!\n${error}`);
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
BalanceCommand.summary = "Get balance";
|
|
34
|
-
BalanceCommand.examples = ["$ light balance --
|
|
30
|
+
BalanceCommand.summary = "Get compressed SOL balance";
|
|
31
|
+
BalanceCommand.examples = ["$ light balance --owner=<ADDRESS>"];
|
|
35
32
|
BalanceCommand.flags = {
|
|
36
33
|
owner: core_1.Flags.string({
|
|
37
|
-
description: "Address of the
|
|
38
|
-
required: true,
|
|
39
|
-
}),
|
|
40
|
-
mint: core_1.Flags.string({
|
|
41
|
-
description: "Mint address of the compressed token account.",
|
|
34
|
+
description: "Address of the owner.",
|
|
42
35
|
required: true,
|
|
43
36
|
}),
|
|
44
37
|
};
|
|
@@ -5,6 +5,7 @@ const utils_1 = require("../../utils/utils");
|
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const compressed_token_1 = require("@lightprotocol/compressed-token");
|
|
7
7
|
const spl_token_1 = require("@solana/spl-token");
|
|
8
|
+
const compressed_token_2 = require("@lightprotocol/compressed-token");
|
|
8
9
|
/// TODO: add ability to compress from non-fee payer
|
|
9
10
|
class CompressSplCommand extends core_1.Command {
|
|
10
11
|
async run() {
|
|
@@ -22,8 +23,9 @@ class CompressSplCommand extends core_1.Command {
|
|
|
22
23
|
const toPublicKey = new web3_js_1.PublicKey(to);
|
|
23
24
|
const mintPublicKey = new web3_js_1.PublicKey(mint);
|
|
24
25
|
const payer = (0, utils_1.defaultSolanaWalletKeypair)();
|
|
26
|
+
const tokenProgramId = await compressed_token_2.CompressedTokenProgram.getMintProgramId(mintPublicKey, (0, utils_1.rpc)());
|
|
25
27
|
/// TODO: add explicit check that the ata is valid
|
|
26
|
-
const sourceAta = (0, spl_token_1.getAssociatedTokenAddressSync)(mintPublicKey, payer.publicKey);
|
|
28
|
+
const sourceAta = (0, spl_token_1.getAssociatedTokenAddressSync)(mintPublicKey, payer.publicKey, undefined, tokenProgramId);
|
|
27
29
|
txId = await (0, compressed_token_1.compress)((0, utils_1.rpc)(), payer, mintPublicKey, amount, payer, sourceAta, toPublicKey);
|
|
28
30
|
loader.stop(false);
|
|
29
31
|
console.log("\x1b[32mtxId:\x1b[0m ", (0, utils_1.generateSolanaTransactionURL)("tx", txId, "custom"));
|
|
@@ -5,6 +5,7 @@ const utils_1 = require("../../utils/utils");
|
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const compressed_token_1 = require("@lightprotocol/compressed-token");
|
|
7
7
|
const spl_token_1 = require("@solana/spl-token");
|
|
8
|
+
const compressed_token_2 = require("@lightprotocol/compressed-token");
|
|
8
9
|
/// TODO: add ability to decompress from non-fee payer
|
|
9
10
|
class DecompressSplCommand extends core_1.Command {
|
|
10
11
|
async run() {
|
|
@@ -22,7 +23,8 @@ class DecompressSplCommand extends core_1.Command {
|
|
|
22
23
|
const toPublicKey = new web3_js_1.PublicKey(to);
|
|
23
24
|
const mintPublicKey = new web3_js_1.PublicKey(mint);
|
|
24
25
|
const payer = (0, utils_1.defaultSolanaWalletKeypair)();
|
|
25
|
-
const
|
|
26
|
+
const tokenProgramId = await compressed_token_2.CompressedTokenProgram.getMintProgramId(mintPublicKey, (0, utils_1.rpc)());
|
|
27
|
+
const recipientAta = await (0, spl_token_1.getOrCreateAssociatedTokenAccount)((0, utils_1.rpc)(), payer, mintPublicKey, toPublicKey, undefined, undefined, undefined, tokenProgramId);
|
|
26
28
|
txId = await (0, compressed_token_1.decompress)((0, utils_1.rpc)(), payer, mintPublicKey, amount, payer, recipientAta.address);
|
|
27
29
|
loader.stop(false);
|
|
28
30
|
console.log("\x1b[32mtxId:\x1b[0m ", (0, utils_1.generateSolanaTransactionURL)("tx", txId, "custom"));
|
|
@@ -61,13 +61,43 @@ const initRepo = async (name, flags) => {
|
|
|
61
61
|
"--define",
|
|
62
62
|
`anchor-version=${constants_1.ANCHOR_VERSION}`,
|
|
63
63
|
"--define",
|
|
64
|
+
`borsh-version=${constants_1.BORSH_VERSION}`,
|
|
65
|
+
"--define",
|
|
64
66
|
`light-hasher-version=${constants_1.LIGHT_HASHER_VERSION}`,
|
|
65
67
|
"--define",
|
|
68
|
+
`light-macros-version=${constants_1.LIGHT_MACROS_VERSION}`,
|
|
69
|
+
"--define",
|
|
70
|
+
`light-account-checks-version=${constants_1.LIGHT_ACCOUNT_CHECKS}`,
|
|
71
|
+
"--define",
|
|
66
72
|
`light-sdk-version=${constants_1.LIGHT_SDK_VERSION}`,
|
|
67
73
|
"--define",
|
|
68
|
-
`
|
|
74
|
+
`light-sdk-macros-version=${constants_1.LIGHT_SDK_MACROS_VERSION}`,
|
|
75
|
+
"--define",
|
|
76
|
+
`light-utils-version=${constants_1.LIGHT_UTILS_VERSION}`,
|
|
77
|
+
"--define",
|
|
78
|
+
`light-compressed-account-version=${constants_1.LIGHT_COMPRESSED_ACCOUNT_VERSION}`,
|
|
79
|
+
"--define",
|
|
80
|
+
`light-verifier-version=${constants_1.LIGHT_VERIFIER_VERSION}`, // TODO: remove
|
|
81
|
+
"--define",
|
|
82
|
+
`solana-sdk-version=${constants_1.SOLANA_SDK_VERSION}`,
|
|
83
|
+
"--define",
|
|
84
|
+
`light-client-version=${constants_1.LIGHT_CLIENT_VERSION}`,
|
|
85
|
+
"--define",
|
|
86
|
+
`light-test-utils-version=${constants_1.LIGHT_TEST_UTILS_VERSION}`,
|
|
87
|
+
"--define",
|
|
88
|
+
`light-program-test-version=${constants_1.SOLANA_PROGRAM_TEST_VERSION}`,
|
|
89
|
+
"--define",
|
|
90
|
+
`solana-program-test-version=${constants_1.SOLANA_PROGRAM_TEST_VERSION}`, // TODO: remove
|
|
91
|
+
"--define",
|
|
92
|
+
`tokio-version=${constants_1.TOKIO_VERSION}`,
|
|
69
93
|
"--define",
|
|
70
94
|
`stateless-js-version=${constants_1.STATELESS_JS_VERSION}`,
|
|
95
|
+
"--define",
|
|
96
|
+
`anchor-js-version=${constants_1.ANCHOR_VERSION}`,
|
|
97
|
+
"--define",
|
|
98
|
+
`light-cli-version=${constants_1.LIGHT_CLI_VERSION}`,
|
|
99
|
+
"--define",
|
|
100
|
+
`solana-cli-version=${constants_1.SOLANA_CLI_VERSION}`,
|
|
71
101
|
],
|
|
72
102
|
logFile: true,
|
|
73
103
|
env: env,
|
|
@@ -102,12 +132,12 @@ exports.initFlags = {
|
|
|
102
132
|
}),
|
|
103
133
|
tag: core_1.Flags.string({
|
|
104
134
|
aliases: ["t"],
|
|
105
|
-
description: "Tag must be used in
|
|
135
|
+
description: "Tag must be used in conjunction with --git",
|
|
106
136
|
required: false,
|
|
107
137
|
}),
|
|
108
138
|
branch: core_1.Flags.string({
|
|
109
139
|
aliases: ["b"],
|
|
110
|
-
description: "Branch must be used in
|
|
140
|
+
description: "Branch must be used in conjunction with --git",
|
|
111
141
|
default: "main",
|
|
112
142
|
required: false,
|
|
113
143
|
}),
|
|
@@ -6,6 +6,8 @@ declare class StartProver extends Command {
|
|
|
6
6
|
"prover-port": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
7
|
"run-mode": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
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
|
+
redisUrl: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
11
|
};
|
|
10
12
|
run(): Promise<void>;
|
|
11
13
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const index_1 = require("../../utils/index");
|
|
5
|
+
const processProverServer_1 = require("../../utils/processProverServer");
|
|
5
6
|
class StartProver extends core_1.Command {
|
|
6
7
|
finally(_) {
|
|
7
8
|
process.exit();
|
|
@@ -14,8 +15,25 @@ class StartProver extends core_1.Command {
|
|
|
14
15
|
this.log("Please specify --run-mode or --circuit.");
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const proverPort = flags["prover-port"] || 3001;
|
|
19
|
+
const force = flags["force"] || false;
|
|
20
|
+
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);
|
|
29
|
+
const healthy = await (0, processProverServer_1.healthCheck)(proverPort, 10, 1000);
|
|
30
|
+
loader.stop();
|
|
31
|
+
if (healthy) {
|
|
32
|
+
this.log("\nProver started and passed health check \x1b[32m✔\x1b[0m");
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.log("\nProver started but health check failed");
|
|
36
|
+
}
|
|
19
37
|
}
|
|
20
38
|
}
|
|
21
39
|
StartProver.description = "Start gnark prover";
|
|
@@ -26,8 +44,15 @@ StartProver.flags = {
|
|
|
26
44
|
default: 3001,
|
|
27
45
|
}),
|
|
28
46
|
"run-mode": core_1.Flags.string({
|
|
29
|
-
description: "Specify the running mode (forester, forester-test, rpc, full
|
|
30
|
-
options: [
|
|
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
|
+
],
|
|
31
56
|
required: false,
|
|
32
57
|
}),
|
|
33
58
|
circuit: core_1.Flags.string({
|
|
@@ -37,16 +62,23 @@ StartProver.flags = {
|
|
|
37
62
|
"non-inclusion",
|
|
38
63
|
"combined",
|
|
39
64
|
"append-with-proofs",
|
|
40
|
-
"append-with-subtrees",
|
|
41
65
|
"update",
|
|
42
66
|
"address-append",
|
|
43
67
|
"append-with-proofs-test",
|
|
44
|
-
"append-with-subtrees-test",
|
|
45
68
|
"update-test",
|
|
46
69
|
"address-append-test",
|
|
47
70
|
],
|
|
48
71
|
multiple: true,
|
|
49
72
|
required: false,
|
|
50
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
|
+
}),
|
|
51
83
|
};
|
|
52
84
|
exports.default = StartProver;
|
|
@@ -2,7 +2,7 @@ import { Command } from "@oclif/core";
|
|
|
2
2
|
declare class SetupCommand extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
-
protected finally(
|
|
5
|
+
protected finally(err: Error | undefined): Promise<any>;
|
|
6
6
|
static flags: {
|
|
7
7
|
"skip-indexer": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
"skip-prover": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -21,11 +21,11 @@ declare class SetupCommand extends Command {
|
|
|
21
21
|
"validator-args": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
22
22
|
"sbf-program": import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
23
23
|
};
|
|
24
|
-
run(): Promise<void>;
|
|
25
24
|
validatePrograms(programs: {
|
|
26
25
|
address: string;
|
|
27
26
|
path: string;
|
|
28
27
|
}[]): void;
|
|
28
|
+
run(): Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
export default SetupCommand;
|
|
31
31
|
export declare const SYSTEM_PROGRAMS: {
|
|
@@ -8,9 +8,40 @@ 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
|
-
finally(
|
|
11
|
+
finally(err) {
|
|
12
|
+
if (err) {
|
|
13
|
+
console.error(err);
|
|
14
|
+
}
|
|
12
15
|
process.exit();
|
|
13
16
|
}
|
|
17
|
+
validatePrograms(programs) {
|
|
18
|
+
// Check for duplicate addresses among provided programs
|
|
19
|
+
const addresses = new Set();
|
|
20
|
+
for (const program of programs) {
|
|
21
|
+
if (addresses.has(program.address)) {
|
|
22
|
+
this.error(`Duplicate program address detected: ${program.address}`);
|
|
23
|
+
}
|
|
24
|
+
addresses.add(program.address);
|
|
25
|
+
// Get the program filename from the path
|
|
26
|
+
const programFileName = path_1.default.basename(program.path);
|
|
27
|
+
// Check for collisions with system programs (both address and filename)
|
|
28
|
+
const systemProgramCollision = exports.SYSTEM_PROGRAMS.find((sysProg) => sysProg.id === program.address ||
|
|
29
|
+
(sysProg.name && programFileName === sysProg.name));
|
|
30
|
+
if (systemProgramCollision) {
|
|
31
|
+
const collisionType = systemProgramCollision.id === program.address
|
|
32
|
+
? `address (${program.address})`
|
|
33
|
+
: `filename (${programFileName})`;
|
|
34
|
+
this.error(`Program ${collisionType} collides with system program ` +
|
|
35
|
+
`"${systemProgramCollision.name || systemProgramCollision.id}". ` +
|
|
36
|
+
`System programs cannot be overwritten.`);
|
|
37
|
+
}
|
|
38
|
+
// Validate program file exists
|
|
39
|
+
const programPath = path_1.default.resolve(program.path);
|
|
40
|
+
if (!fs_1.default.existsSync(programPath)) {
|
|
41
|
+
this.error(`Program file not found: ${programPath}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
14
45
|
async run() {
|
|
15
46
|
const { flags } = await this.parse(SetupCommand);
|
|
16
47
|
const loader = new index_1.CustomLoader("Performing setup tasks...\n");
|
|
@@ -42,6 +73,7 @@ class SetupCommand extends core_1.Command {
|
|
|
42
73
|
}
|
|
43
74
|
this.validatePrograms(programs);
|
|
44
75
|
await (0, initTestEnv_1.initTestEnv)({
|
|
76
|
+
additionalPrograms: programs,
|
|
45
77
|
checkPhotonVersion: !flags["relax-indexer-version-constraint"],
|
|
46
78
|
indexer: !flags["skip-indexer"],
|
|
47
79
|
limitLedgerSize: flags["limit-ledger-size"],
|
|
@@ -56,39 +88,10 @@ class SetupCommand extends core_1.Command {
|
|
|
56
88
|
circuits: flags["circuit"],
|
|
57
89
|
geyserConfig: flags["geyser-config"],
|
|
58
90
|
validatorArgs: flags["validator-args"],
|
|
59
|
-
additionalPrograms: programs,
|
|
60
91
|
});
|
|
61
92
|
this.log("\nSetup tasks completed successfully \x1b[32m✔\x1b[0m");
|
|
62
93
|
}
|
|
63
94
|
}
|
|
64
|
-
validatePrograms(programs) {
|
|
65
|
-
// Check for duplicate addresses among provided programs
|
|
66
|
-
const addresses = new Set();
|
|
67
|
-
for (const program of programs) {
|
|
68
|
-
if (addresses.has(program.address)) {
|
|
69
|
-
this.error(`Duplicate program address detected: ${program.address}`);
|
|
70
|
-
}
|
|
71
|
-
addresses.add(program.address);
|
|
72
|
-
// Get the program filename from the path
|
|
73
|
-
const programFileName = path_1.default.basename(program.path);
|
|
74
|
-
// Check for collisions with system programs (both address and filename)
|
|
75
|
-
const systemProgramCollision = exports.SYSTEM_PROGRAMS.find((sysProg) => sysProg.id === program.address ||
|
|
76
|
-
(sysProg.name && programFileName === sysProg.name));
|
|
77
|
-
if (systemProgramCollision) {
|
|
78
|
-
const collisionType = systemProgramCollision.id === program.address
|
|
79
|
-
? `address (${program.address})`
|
|
80
|
-
: `filename (${programFileName})`;
|
|
81
|
-
this.error(`Program ${collisionType} collides with system program ` +
|
|
82
|
-
`"${systemProgramCollision.name || systemProgramCollision.id}". ` +
|
|
83
|
-
`System programs cannot be overwritten.`);
|
|
84
|
-
}
|
|
85
|
-
// Validate program file exists
|
|
86
|
-
const programPath = path_1.default.resolve(program.path);
|
|
87
|
-
if (!fs_1.default.existsSync(programPath)) {
|
|
88
|
-
this.error(`Program file not found: ${programPath}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
95
|
}
|
|
93
96
|
SetupCommand.description = "Start a local test setup with: Solana test validator, Photon indexer, and Light prover";
|
|
94
97
|
SetupCommand.examples = [
|
|
@@ -96,6 +99,7 @@ SetupCommand.examples = [
|
|
|
96
99
|
"$ light test-validator --skip-indexer",
|
|
97
100
|
"$ light test-validator --geyser-config ./config.json",
|
|
98
101
|
'$ light test-validator --validator-args "--limit-ledger-size 50000000"',
|
|
102
|
+
"$ light test-validator --sbf-program <address> <path/program>",
|
|
99
103
|
];
|
|
100
104
|
SetupCommand.flags = {
|
|
101
105
|
"skip-indexer": core_1.Flags.boolean({
|
|
@@ -138,8 +142,9 @@ SetupCommand.flags = {
|
|
|
138
142
|
exclusive: ["skip-prover"],
|
|
139
143
|
}),
|
|
140
144
|
"prover-run-mode": core_1.Flags.string({
|
|
141
|
-
description: "Specify the running mode for the prover (forester, forester-test, rpc, or full)",
|
|
145
|
+
description: "Specify the running mode for the prover (local-rpc, forester, forester-test, rpc, or full). Default: local-rpc",
|
|
142
146
|
options: [
|
|
147
|
+
"local-rpc",
|
|
143
148
|
"rpc",
|
|
144
149
|
"forester",
|
|
145
150
|
"forester-test",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
declare class TokenBalanceCommand extends Command {
|
|
3
|
+
static summary: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
owner: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
mint: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
static args: {};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export default TokenBalanceCommand;
|
|
@@ -0,0 +1,55 @@
|
|
|
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 web3_js_1 = require("@solana/web3.js");
|
|
6
|
+
class TokenBalanceCommand extends core_1.Command {
|
|
7
|
+
async run() {
|
|
8
|
+
const { flags } = await this.parse(TokenBalanceCommand);
|
|
9
|
+
const loader = new utils_1.CustomLoader(`Performing balance...\n`);
|
|
10
|
+
loader.start();
|
|
11
|
+
try {
|
|
12
|
+
const refMint = new web3_js_1.PublicKey(flags["mint"]);
|
|
13
|
+
const refOwner = new web3_js_1.PublicKey(flags["owner"]);
|
|
14
|
+
const tokenAccounts = await (0, utils_1.rpc)().getCompressedTokenAccountsByOwner(refOwner, { mint: refMint });
|
|
15
|
+
loader.stop(false);
|
|
16
|
+
// Handle case when no token accounts are found
|
|
17
|
+
if (tokenAccounts.items.length === 0) {
|
|
18
|
+
console.log("\x1b[1mBalance:\x1b[0m 0");
|
|
19
|
+
console.log("No token accounts found");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const compressedTokenAccounts = tokenAccounts.items.filter((acc) => acc.parsed.mint.equals(refMint));
|
|
23
|
+
if (compressedTokenAccounts.length === 0) {
|
|
24
|
+
console.log("\x1b[1mBalance:\x1b[0m 0");
|
|
25
|
+
console.log("No token accounts found for this mint");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let totalBalance = BigInt(0);
|
|
29
|
+
compressedTokenAccounts.forEach((account) => {
|
|
30
|
+
const amount = account.parsed.amount;
|
|
31
|
+
totalBalance += BigInt(amount.toString());
|
|
32
|
+
});
|
|
33
|
+
console.log(`\x1b[1mBalance:\x1b[0m ${totalBalance.toString()}`);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
this.error(`Failed to get balance!\n${error}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
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
|
+
exports.default = TokenBalanceCommand;
|
|
@@ -12,21 +12,29 @@ 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.50.
|
|
15
|
+
export declare const PHOTON_VERSION = "0.50.1";
|
|
16
|
+
export declare const USE_PHOTON_FROM_GIT = true;
|
|
17
|
+
export declare const PHOTON_GIT_REPO = "https://github.com/lightprotocol/photon.git";
|
|
18
|
+
export declare const PHOTON_GIT_COMMIT = "49b7e7f0d668babbc4d65fe8a0a7236df76f75a8";
|
|
16
19
|
export declare const LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = "LIGHT_PROTOCOL_PROGRAMS_DIR";
|
|
17
20
|
export declare const BASE_PATH = "../../bin/";
|
|
18
21
|
export declare const PROGRAM_ID = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS";
|
|
22
|
+
export declare const SOLANA_SDK_VERSION = "2.2";
|
|
19
23
|
export declare const ANCHOR_VERSION = "0.31.1";
|
|
20
|
-
export declare const BORSH_VERSION = "0.
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const SOLANA_SDK_VERSION = "1.18.22";
|
|
24
|
+
export declare const BORSH_VERSION = "0.10.4";
|
|
25
|
+
export declare const COMPRESSED_PROGRAM_TEMPLATE_TAG = "v0.3.0";
|
|
23
26
|
export declare const TOKIO_VERSION = "1.36.0";
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
27
|
+
export declare const SOLANA_PROGRAM_TEST_VERSION = "2.2";
|
|
28
|
+
export declare const SOLANA_CLI_VERSION = "2.2.15";
|
|
29
|
+
export declare const LIGHT_HASHER_VERSION = "3.1.0";
|
|
30
|
+
export declare const LIGHT_MACROS_VERSION = "2.1.0";
|
|
31
|
+
export declare const LIGHT_SDK_VERSION = "0.13.0";
|
|
32
|
+
export declare const LIGHT_SDK_MACROS_VERSION = "0.13.0";
|
|
33
|
+
export declare const LIGHT_UTILS_VERSION = "0.13.0";
|
|
34
|
+
export declare const LIGHT_COMPRESSED_ACCOUNT_VERSION = "0.3.0";
|
|
35
|
+
export declare const LIGHT_VERIFIER_VERSION = "2.0.0";
|
|
26
36
|
export declare const LIGHT_CLIENT_VERSION = "0.9.1";
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const LIGHT_ACCOUNT_CHECKS = "0.
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const ANCHOR_JS_VERSION = "0.31.1";
|
|
32
|
-
export declare const STATELESS_JS_VERSION = "0.21.0";
|
|
37
|
+
export declare const LIGHT_TEST_UTILS_VERSION = "1.2.1";
|
|
38
|
+
export declare const LIGHT_ACCOUNT_CHECKS = "0.3.0";
|
|
39
|
+
export declare const STATELESS_JS_VERSION = "0.22.0";
|
|
40
|
+
export declare const LIGHT_CLI_VERSION = "0.26.0";
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STATELESS_JS_VERSION = exports.
|
|
3
|
+
exports.LIGHT_CLI_VERSION = exports.STATELESS_JS_VERSION = exports.LIGHT_ACCOUNT_CHECKS = exports.LIGHT_TEST_UTILS_VERSION = exports.LIGHT_CLIENT_VERSION = exports.LIGHT_VERIFIER_VERSION = exports.LIGHT_COMPRESSED_ACCOUNT_VERSION = exports.LIGHT_UTILS_VERSION = exports.LIGHT_SDK_MACROS_VERSION = exports.LIGHT_SDK_VERSION = exports.LIGHT_MACROS_VERSION = exports.LIGHT_HASHER_VERSION = exports.SOLANA_CLI_VERSION = exports.SOLANA_PROGRAM_TEST_VERSION = exports.TOKIO_VERSION = exports.COMPRESSED_PROGRAM_TEMPLATE_TAG = exports.BORSH_VERSION = exports.ANCHOR_VERSION = exports.SOLANA_SDK_VERSION = exports.PROGRAM_ID = exports.BASE_PATH = exports.LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = exports.PHOTON_GIT_COMMIT = exports.PHOTON_GIT_REPO = exports.USE_PHOTON_FROM_GIT = 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
5
|
exports.LIGHT_ACCOUNT_COMPRESSION_TAG = "account-compression-v1.0.0";
|
|
6
6
|
exports.LIGHT_SYSTEM_PROGRAM_TAG = "light-system-program-v1.0.0";
|
|
@@ -17,21 +17,32 @@ 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.50.
|
|
20
|
+
exports.PHOTON_VERSION = "0.50.1";
|
|
21
|
+
// Set these to override Photon requirements with a specific git commit:
|
|
22
|
+
exports.USE_PHOTON_FROM_GIT = true; // If true, will show git install command instead of crates.io.
|
|
23
|
+
exports.PHOTON_GIT_REPO = "https://github.com/lightprotocol/photon.git";
|
|
24
|
+
exports.PHOTON_GIT_COMMIT = "49b7e7f0d668babbc4d65fe8a0a7236df76f75a8"; // If empty, will use main branch.
|
|
21
25
|
exports.LIGHT_PROTOCOL_PROGRAMS_DIR_ENV = "LIGHT_PROTOCOL_PROGRAMS_DIR";
|
|
22
26
|
exports.BASE_PATH = "../../bin/";
|
|
23
27
|
exports.PROGRAM_ID = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS";
|
|
28
|
+
exports.SOLANA_SDK_VERSION = "2.2";
|
|
24
29
|
exports.ANCHOR_VERSION = "0.31.1";
|
|
25
|
-
exports.BORSH_VERSION = "0.
|
|
26
|
-
exports.
|
|
27
|
-
exports.SOLANA_SDK_VERSION = "1.18.22";
|
|
30
|
+
exports.BORSH_VERSION = "0.10.4";
|
|
31
|
+
exports.COMPRESSED_PROGRAM_TEMPLATE_TAG = "v0.3.0";
|
|
28
32
|
exports.TOKIO_VERSION = "1.36.0";
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
33
|
+
exports.SOLANA_PROGRAM_TEST_VERSION = "2.2";
|
|
34
|
+
exports.SOLANA_CLI_VERSION = "2.2.15";
|
|
35
|
+
exports.LIGHT_HASHER_VERSION = "3.1.0";
|
|
36
|
+
exports.LIGHT_MACROS_VERSION = "2.1.0";
|
|
37
|
+
exports.LIGHT_SDK_VERSION = "0.13.0";
|
|
38
|
+
exports.LIGHT_SDK_MACROS_VERSION = "0.13.0";
|
|
39
|
+
exports.LIGHT_UTILS_VERSION = "0.13.0";
|
|
40
|
+
exports.LIGHT_COMPRESSED_ACCOUNT_VERSION = "0.3.0";
|
|
41
|
+
exports.LIGHT_VERIFIER_VERSION = "2.0.0";
|
|
31
42
|
exports.LIGHT_CLIENT_VERSION = "0.9.1";
|
|
32
|
-
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
43
|
+
// TODO: replace with light program test
|
|
44
|
+
exports.LIGHT_TEST_UTILS_VERSION = "1.2.1";
|
|
45
|
+
exports.LIGHT_ACCOUNT_CHECKS = "0.3.0";
|
|
46
|
+
// js packages
|
|
47
|
+
exports.STATELESS_JS_VERSION = "0.22.0";
|
|
48
|
+
exports.LIGHT_CLI_VERSION = "0.26.0";
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
type Program = {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
tag?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const SYSTEM_PROGRAMS: Program[];
|
|
1
8
|
export declare function stopTestEnv(options: {
|
|
2
9
|
indexer: boolean;
|
|
3
10
|
prover: boolean;
|
|
@@ -17,7 +24,7 @@ export declare function initTestEnv({ additionalPrograms, skipSystemAccounts, in
|
|
|
17
24
|
checkPhotonVersion?: boolean;
|
|
18
25
|
photonDatabaseUrl?: string;
|
|
19
26
|
limitLedgerSize?: number;
|
|
20
|
-
proverRunMode?: "inclusion" | "non-inclusion" | "forester" | "forester-test" | "rpc" | "full" | "full-test";
|
|
27
|
+
proverRunMode?: "local-rpc" | "inclusion" | "non-inclusion" | "forester" | "forester-test" | "rpc" | "full" | "full-test";
|
|
21
28
|
circuits?: string[];
|
|
22
29
|
validatorArgs?: string;
|
|
23
30
|
geyserConfig?: string;
|
|
@@ -59,3 +66,4 @@ export declare function startTestValidator({ additionalPrograms, skipSystemAccou
|
|
|
59
66
|
geyserConfig?: string;
|
|
60
67
|
}): Promise<void>;
|
|
61
68
|
export declare function killTestValidator(): Promise<void>;
|
|
69
|
+
export {};
|