@lightprotocol/zk-compression-cli 0.27.1-alpha.1 → 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.
- package/accounts/address_merkle_tree_amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2.json +1 -1
- package/accounts/address_merkle_tree_queue_aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F.json +1 -1
- package/accounts/batch_address_merkle_tree_EzKE84aVTkCUhDHLELqyJaq1Y7UVVmqxXqZjVHwHY3rK.json +14 -1
- package/accounts/{batch_state_merkle_tree_2_2Yb3fGo2E9aWLjY8KuESaqurYpGGhEeJr7eynKrSgXwS.json → batch_address_merkle_tree_amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx.json} +1 -1
- package/accounts/{batch_state_merkle_tree_HLKs5NJ8FXkJg8BrzJt56adFYYuwg5etzDtBbQYTsixu.json → batch_state_merkle_tree_bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU.json} +1 -1
- package/accounts/batch_state_merkle_tree_bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi.json +1 -0
- package/accounts/batch_state_merkle_tree_bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb.json +1 -0
- package/accounts/batch_state_merkle_tree_bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8.json +1 -0
- package/accounts/batch_state_merkle_tree_bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2.json +1 -0
- package/accounts/{batched_output_queue_2_12wJT3xYd46rtjeqDU6CrtT8unqLjPiheggzqhN9YsyB.json → batched_output_queue_oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto.json} +1 -1
- package/accounts/{batched_output_queue_6L7SzhYB3anwEQ9cphpJ1U7Scwj57bx2xueReg7R9cKU.json → batched_output_queue_oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg.json} +1 -1
- package/accounts/batched_output_queue_oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ.json +1 -0
- package/accounts/batched_output_queue_oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq.json +1 -0
- package/accounts/batched_output_queue_oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P.json +1 -0
- package/accounts/{test_batched_cpi_context_7Hp52chxaew8bW1ApR4fck2bh6Y8qA1pu3qwH6N9zaLj.json → cpi_context_cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y.json} +1 -1
- package/accounts/cpi_context_cpi1uHzrEhBG733DoEJNgHCyRS3XmmyVNZx5fonubE4.json +1 -1
- package/accounts/cpi_context_cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK.json +1 -1
- package/accounts/{cpi_context_batched_2_HwtjxDvFEXiWnzeMeWkMBzpQN45A95rTJNZmz1Z3pe8R.json → cpi_context_cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B.json} +1 -14
- package/accounts/cpi_context_cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf.json +1 -0
- package/accounts/cpi_context_cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc.json +1 -0
- package/accounts/cpi_context_cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6.json +1 -0
- package/accounts/epoch_pda_34w7KcLBXabMkHuXE2fY368vFe6kP3v5EJn8nPvQ8SKn.json +1 -1
- package/accounts/forester_epoch_pda_3FBt1BPQHCQkS8k3wrUXMfB6JBhtMhEqQXueHRw2ojZV.json +1 -1
- package/accounts/governance_authority_pda_CuEtcKkkbTn6qy2qxqDswq5U2ADsqoipYDAYfRvxPjcp.json +1 -1
- package/accounts/group_pda_24rt4RgeyjUCWGS2eF7L7gyNMuz6JWdqYpAvb1KRoHxs.json +1 -1
- package/accounts/merkle_tree_pubkey_smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT.json +1 -1
- package/accounts/merkle_tree_pubkey_smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho.json +1 -1
- package/accounts/nullifier_queue_pubkey_nfq1NvQDJ2GEgnS8zt9prAe8rjjpAW1zFkrvZoBR148.json +1 -1
- package/accounts/nullifier_queue_pubkey_nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X.json +1 -1
- package/accounts/registered_forester_pda_2KNqEh23Se8AHecuzR1UkxL26euq2qXSpQPTH1jH7VqU.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/dist/commands/approve-and-mint-to/index.js +26 -29
- package/dist/commands/balance/index.js +12 -11
- package/dist/commands/compress-sol/index.js +13 -13
- package/dist/commands/compress-spl/index.js +19 -19
- package/dist/commands/config/config.js +67 -33
- package/dist/commands/create-mint/index.js +19 -20
- package/dist/commands/create-token-pool/index.js +9 -9
- package/dist/commands/decompress-sol/index.js +13 -13
- package/dist/commands/decompress-spl/index.js +19 -19
- package/dist/commands/init/index.js +8 -8
- package/dist/commands/merge-token-accounts/index.js +13 -14
- package/dist/commands/mint-to/index.js +24 -25
- package/dist/commands/start-prover/index.d.ts +0 -3
- package/dist/commands/start-prover/index.js +13 -58
- package/dist/commands/test-validator/index.d.ts +0 -2
- package/dist/commands/test-validator/index.js +79 -109
- package/dist/commands/token-balance/index.js +15 -15
- package/dist/commands/transfer/index.js +23 -24
- package/dist/psp-utils/download.js +1 -1
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +2 -3
- package/dist/utils/downloadProverBinary.d.ts +7 -0
- package/dist/utils/downloadProverBinary.js +107 -0
- package/dist/utils/initTestEnv.d.ts +1 -3
- package/dist/utils/initTestEnv.js +2 -2
- package/dist/utils/process.js +4 -6
- package/dist/utils/processProverServer.d.ts +1 -2
- package/dist/utils/processProverServer.js +63 -81
- package/dist/utils/utils.d.ts +4 -0
- package/dist/utils/utils.js +44 -3
- package/oclif.manifest.json +161 -242
- package/package.json +61 -63
- package/test_bin/dev +4 -7
- package/test_bin/run +2 -2
- package/bin/forester +0 -0
- package/bin/forester.toml +0 -15
- package/bin/light_system_program.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/proving-keys/combined_26_1_1.key +0 -0
- package/bin/proving-keys/combined_26_1_2.key +0 -0
- package/bin/proving-keys/combined_26_2_1.key +0 -0
- package/bin/proving-keys/combined_32_40_1_1.key +0 -0
- package/bin/proving-keys/combined_32_40_1_2.key +0 -0
- package/bin/proving-keys/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/inclusion_32_3.key +0 -0
- package/bin/proving-keys/inclusion_32_4.key +0 -0
- package/bin/proving-keys/mainnet_inclusion_26_1.key +0 -0
- package/bin/proving-keys/mainnet_inclusion_26_2.key +0 -0
- package/bin/proving-keys/mainnet_inclusion_26_3.key +0 -0
- package/bin/proving-keys/mainnet_inclusion_26_4.key +0 -0
- package/bin/proving-keys/non-inclusion_26_1.key +0 -0
- package/bin/proving-keys/non-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/bin/proving-keys/non-inclusion_40_3.key +0 -0
- package/bin/proving-keys/non-inclusion_40_4.key +0 -0
- package/test_bin/lut.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"pubkey":"2KNqEh23Se8AHecuzR1UkxL26euq2qXSpQPTH1jH7VqU","account":{"lamports":1670400,"data":["My+7VlKZdQXMuMIVdedaPnWzorVHJCIvMcPXWnMDRUrSS6K/PzOqzAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==","base64"],"owner":"Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX","executable":false,"rentEpoch":
|
|
1
|
+
{"pubkey":"2KNqEh23Se8AHecuzR1UkxL26euq2qXSpQPTH1jH7VqU","account":{"lamports":1670400,"data":["My+7VlKZdQXMuMIVdedaPnWzorVHJCIvMcPXWnMDRUrSS6K/PzOqzAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==","base64"],"owner":"Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX","executable":false,"rentEpoch":0,"space":112}}
|
|
Binary file
|
|
Binary file
|
package/bin/light_registry.so
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -2,15 +2,35 @@
|
|
|
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 ApproveAndMintToCommand extends core_1.Command {
|
|
8
|
+
static summary = "Mint tokens to a compressed account via external mint authority";
|
|
9
|
+
static examples = [
|
|
10
|
+
"$ light approve-and-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(ApproveAndMintToCommand);
|
|
11
|
-
const mint = flags
|
|
12
|
-
const to = flags["to"];
|
|
13
|
-
const amount = flags["amount"];
|
|
33
|
+
const { mint, to, amount } = flags;
|
|
14
34
|
if (!mint || !to || !amount) {
|
|
15
35
|
throw new Error("Invalid arguments");
|
|
16
36
|
}
|
|
@@ -22,11 +42,11 @@ class ApproveAndMintToCommand extends core_1.Command {
|
|
|
22
42
|
const payer = (0, utils_1.defaultSolanaWalletKeypair)();
|
|
23
43
|
let mintAuthority = payer;
|
|
24
44
|
if (flags["mint-authority"] !== undefined) {
|
|
25
|
-
mintAuthority = await (0,
|
|
45
|
+
mintAuthority = await (0, utils_1.getKeypairFromFile)(flags["mint-authority"]);
|
|
26
46
|
}
|
|
27
47
|
const txId = await (0, compressed_token_1.approveAndMintTo)((0, utils_1.rpc)(), payer, mintPublicKey, toPublicKey, mintAuthority, amount);
|
|
28
48
|
loader.stop(false);
|
|
29
|
-
console.log("\
|
|
49
|
+
console.log("\u001B[1mMint tx:\u001B[0m", (0, utils_1.generateSolanaTransactionURL)("tx", txId, "custom"));
|
|
30
50
|
console.log("approve-and-mint-to successful");
|
|
31
51
|
}
|
|
32
52
|
catch (error) {
|
|
@@ -34,27 +54,4 @@ class ApproveAndMintToCommand extends core_1.Command {
|
|
|
34
54
|
}
|
|
35
55
|
}
|
|
36
56
|
}
|
|
37
|
-
ApproveAndMintToCommand.summary = "Mint tokens to a compressed account via external mint authority";
|
|
38
|
-
ApproveAndMintToCommand.examples = [
|
|
39
|
-
"$ light approve-and-mint-to --mint PublicKey --to PublicKey --amount 1000",
|
|
40
|
-
];
|
|
41
|
-
ApproveAndMintToCommand.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
|
-
ApproveAndMintToCommand.args = {};
|
|
60
57
|
exports.default = ApproveAndMintToCommand;
|
|
@@ -4,12 +4,22 @@ 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 BalanceCommand extends core_1.Command {
|
|
7
|
+
static summary = "Get compressed SOL balance";
|
|
8
|
+
static examples = ["$ light balance --owner=<ADDRESS>"];
|
|
9
|
+
static flags = {
|
|
10
|
+
owner: core_1.Flags.string({
|
|
11
|
+
description: "Address of the owner.",
|
|
12
|
+
required: true,
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
static args = {};
|
|
7
16
|
async run() {
|
|
8
17
|
const { flags } = await this.parse(BalanceCommand);
|
|
9
18
|
const loader = new utils_1.CustomLoader(`Performing balance...\n`);
|
|
10
19
|
loader.start();
|
|
11
20
|
try {
|
|
12
|
-
const
|
|
21
|
+
const { owner } = flags;
|
|
22
|
+
const refOwner = new web3_js_1.PublicKey(owner);
|
|
13
23
|
const accounts = await (0, utils_1.rpc)().getCompressedAccountsByOwner(refOwner);
|
|
14
24
|
loader.stop(false);
|
|
15
25
|
if (accounts.items.length === 0) {
|
|
@@ -20,20 +30,11 @@ class BalanceCommand extends core_1.Command {
|
|
|
20
30
|
for (const account of accounts.items) {
|
|
21
31
|
totalAmount += account.lamports.toNumber();
|
|
22
32
|
}
|
|
23
|
-
console.log("\
|
|
33
|
+
console.log("\u001B[1mCompressed SOL balance:\u001B[0m", totalAmount.toString());
|
|
24
34
|
}
|
|
25
35
|
catch (error) {
|
|
26
36
|
this.error(`Failed to get balance!\n${error}`);
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
}
|
|
30
|
-
BalanceCommand.summary = "Get compressed SOL balance";
|
|
31
|
-
BalanceCommand.examples = ["$ light balance --owner=<ADDRESS>"];
|
|
32
|
-
BalanceCommand.flags = {
|
|
33
|
-
owner: core_1.Flags.string({
|
|
34
|
-
description: "Address of the owner.",
|
|
35
|
-
required: true,
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
BalanceCommand.args = {};
|
|
39
40
|
exports.default = BalanceCommand;
|
|
@@ -5,6 +5,19 @@ const utils_1 = require("../../utils/utils");
|
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const stateless_js_1 = require("@lightprotocol/stateless.js");
|
|
7
7
|
class CompressSolCommand extends core_1.Command {
|
|
8
|
+
static summary = "Compress SOL.";
|
|
9
|
+
static examples = ["$ light compress-sol --to PublicKey --amount 10"];
|
|
10
|
+
static flags = {
|
|
11
|
+
to: core_1.Flags.string({
|
|
12
|
+
description: "Specify the recipient address.",
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
amount: core_1.Flags.integer({
|
|
16
|
+
description: "Amount to compress, in lamports.",
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static args = {};
|
|
8
21
|
async run() {
|
|
9
22
|
const { flags } = await this.parse(CompressSolCommand);
|
|
10
23
|
const to = flags["to"];
|
|
@@ -29,17 +42,4 @@ class CompressSolCommand extends core_1.Command {
|
|
|
29
42
|
}
|
|
30
43
|
}
|
|
31
44
|
}
|
|
32
|
-
CompressSolCommand.summary = "Compress SOL.";
|
|
33
|
-
CompressSolCommand.examples = ["$ light compress-sol --to PublicKey --amount 10"];
|
|
34
|
-
CompressSolCommand.flags = {
|
|
35
|
-
to: core_1.Flags.string({
|
|
36
|
-
description: "Specify the recipient address.",
|
|
37
|
-
required: true,
|
|
38
|
-
}),
|
|
39
|
-
amount: core_1.Flags.integer({
|
|
40
|
-
description: "Amount to compress, in lamports.",
|
|
41
|
-
required: true,
|
|
42
|
-
}),
|
|
43
|
-
};
|
|
44
|
-
CompressSolCommand.args = {};
|
|
45
45
|
exports.default = CompressSolCommand;
|
|
@@ -8,6 +8,25 @@ const spl_token_1 = require("@solana/spl-token");
|
|
|
8
8
|
const compressed_token_2 = require("@lightprotocol/compressed-token");
|
|
9
9
|
/// TODO: add ability to compress from non-fee payer
|
|
10
10
|
class CompressSplCommand extends core_1.Command {
|
|
11
|
+
static summary = "Compress SPL tokens.";
|
|
12
|
+
static examples = [
|
|
13
|
+
"$ light compress-spl --mint PublicKey --to PublicKey --amount 10",
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
mint: core_1.Flags.string({
|
|
17
|
+
description: "Specify the mint address.",
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
to: core_1.Flags.string({
|
|
21
|
+
description: "Specify the recipient address (owner of destination compressed token account).",
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
amount: core_1.Flags.integer({
|
|
25
|
+
description: "Amount to compress, in tokens.",
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
static args = {};
|
|
11
30
|
async run() {
|
|
12
31
|
const { flags } = await this.parse(CompressSplCommand);
|
|
13
32
|
const to = flags["to"];
|
|
@@ -37,23 +56,4 @@ class CompressSplCommand extends core_1.Command {
|
|
|
37
56
|
}
|
|
38
57
|
}
|
|
39
58
|
}
|
|
40
|
-
CompressSplCommand.summary = "Compress SPL tokens.";
|
|
41
|
-
CompressSplCommand.examples = [
|
|
42
|
-
"$ light compress-spl --mint PublicKey --to PublicKey --amount 10",
|
|
43
|
-
];
|
|
44
|
-
CompressSplCommand.flags = {
|
|
45
|
-
mint: core_1.Flags.string({
|
|
46
|
-
description: "Specify the mint address.",
|
|
47
|
-
required: true,
|
|
48
|
-
}),
|
|
49
|
-
to: core_1.Flags.string({
|
|
50
|
-
description: "Specify the recipient address (owner of destination compressed token account).",
|
|
51
|
-
required: true,
|
|
52
|
-
}),
|
|
53
|
-
amount: core_1.Flags.integer({
|
|
54
|
-
description: "Amount to compress, in tokens.",
|
|
55
|
-
required: true,
|
|
56
|
-
}),
|
|
57
|
-
};
|
|
58
|
-
CompressSplCommand.args = {};
|
|
59
59
|
exports.default = CompressSplCommand;
|
|
@@ -1,15 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
const core_1 = require("@oclif/core");
|
|
4
37
|
const utils_1 = require("../../utils/utils");
|
|
5
38
|
class ConfigCommand extends core_1.Command {
|
|
39
|
+
static description = "Initialize or update the configuration values. The default config path is ~/.config/light/config.json you can set up a custom path with an environment variable export LIGHT_PROTOCOL_CONFIG=path/to/config.json";
|
|
40
|
+
static examples = [
|
|
41
|
+
"$ light config --solanaRpcUrl https://solana-api.example.com",
|
|
42
|
+
];
|
|
43
|
+
static flags = {
|
|
44
|
+
solanaRpcUrl: core_1.Flags.string({
|
|
45
|
+
description: "Solana RPC url",
|
|
46
|
+
}),
|
|
47
|
+
indexerUrl: core_1.Flags.string({
|
|
48
|
+
description: "Indexer url",
|
|
49
|
+
}),
|
|
50
|
+
proverUrl: core_1.Flags.string({
|
|
51
|
+
description: "Prover url",
|
|
52
|
+
}),
|
|
53
|
+
get: core_1.Flags.boolean({
|
|
54
|
+
description: "Gets the current config values",
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
6
58
|
async run() {
|
|
7
59
|
const { flags } = await this.parse(ConfigCommand);
|
|
8
60
|
const { solanaRpcUrl, indexerUrl, proverUrl, get } = flags;
|
|
9
61
|
try {
|
|
10
62
|
const config = (0, utils_1.getConfig)();
|
|
11
63
|
if (get) {
|
|
12
|
-
logConfig(config);
|
|
64
|
+
await logConfig(config);
|
|
13
65
|
return;
|
|
14
66
|
}
|
|
15
67
|
const loader = new utils_1.CustomLoader("Updating configuration...");
|
|
@@ -41,57 +93,39 @@ class ConfigCommand extends core_1.Command {
|
|
|
41
93
|
}
|
|
42
94
|
}
|
|
43
95
|
(0, utils_1.setConfig)(config);
|
|
44
|
-
this.log("\nConfiguration values updated successfully \
|
|
96
|
+
this.log("\nConfiguration values updated successfully \x1B[32m✔\x1B[0m");
|
|
45
97
|
loader.stop(false);
|
|
46
98
|
// logging updated config values
|
|
47
|
-
logConfig(config);
|
|
99
|
+
await logConfig(config);
|
|
48
100
|
}
|
|
49
101
|
catch (error) {
|
|
50
102
|
this.error(`\nFailed to update configuration values\n${error}`);
|
|
51
103
|
}
|
|
52
104
|
}
|
|
53
105
|
}
|
|
54
|
-
|
|
55
|
-
ConfigCommand.examples = [
|
|
56
|
-
"$ light config --solanaRpcUrl https://solana-api.example.com",
|
|
57
|
-
];
|
|
58
|
-
ConfigCommand.flags = {
|
|
59
|
-
solanaRpcUrl: core_1.Flags.string({
|
|
60
|
-
description: "Solana RPC url",
|
|
61
|
-
}),
|
|
62
|
-
indexerUrl: core_1.Flags.string({
|
|
63
|
-
description: "Indexer url",
|
|
64
|
-
}),
|
|
65
|
-
proverUrl: core_1.Flags.string({
|
|
66
|
-
description: "Prover url",
|
|
67
|
-
}),
|
|
68
|
-
get: core_1.Flags.boolean({
|
|
69
|
-
description: "Gets the current config values",
|
|
70
|
-
required: false,
|
|
71
|
-
}),
|
|
72
|
-
};
|
|
73
|
-
function logConfig(config) {
|
|
106
|
+
async function logConfig(config) {
|
|
74
107
|
const tableData = [];
|
|
75
108
|
tableData.push({
|
|
76
109
|
name: "Solana RPC URL",
|
|
77
110
|
value: config.solanaRpcUrl,
|
|
78
|
-
}
|
|
79
|
-
tableData.push({
|
|
111
|
+
}, {
|
|
80
112
|
name: "Indexer URL",
|
|
81
113
|
value: config.indexerUrl,
|
|
82
|
-
}
|
|
83
|
-
tableData.push({
|
|
114
|
+
}, {
|
|
84
115
|
name: "Prover URL",
|
|
85
116
|
value: config.proverUrl,
|
|
86
|
-
}
|
|
87
|
-
// space
|
|
88
|
-
tableData.push({
|
|
117
|
+
}, {
|
|
89
118
|
name: "",
|
|
90
119
|
value: "",
|
|
91
120
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
121
|
+
// Dynamically import @oclif/table since it's ESM-only
|
|
122
|
+
const { printTable } = await Promise.resolve().then(() => __importStar(require("@oclif/table")));
|
|
123
|
+
printTable({
|
|
124
|
+
data: tableData,
|
|
125
|
+
columns: [
|
|
126
|
+
{ key: "name", name: "" },
|
|
127
|
+
{ key: "value", name: "" },
|
|
128
|
+
],
|
|
95
129
|
});
|
|
96
130
|
}
|
|
97
131
|
exports.default = ConfigCommand;
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
|
-
const helpers_1 = require("@solana-developers/helpers");
|
|
5
4
|
const utils_1 = require("../../utils/utils");
|
|
6
5
|
const compressed_token_1 = require("@lightprotocol/compressed-token");
|
|
7
6
|
const web3_js_1 = require("@solana/web3.js");
|
|
8
7
|
const DEFAULT_DECIMAL_COUNT = 9;
|
|
9
8
|
class CreateMintCommand extends core_1.Command {
|
|
9
|
+
static summary = "Create a new compressed token mint";
|
|
10
|
+
static examples = ["$ light create-mint --mint-decimals 5"];
|
|
11
|
+
static flags = {
|
|
12
|
+
"mint-keypair": core_1.Flags.string({
|
|
13
|
+
description: "Provide a path to a mint keypair file. Defaults to a random keypair",
|
|
14
|
+
required: false,
|
|
15
|
+
}),
|
|
16
|
+
"mint-authority": core_1.Flags.string({
|
|
17
|
+
description: "Address of the mint authority. Defaults to the fee payer",
|
|
18
|
+
required: false,
|
|
19
|
+
}),
|
|
20
|
+
"mint-decimals": core_1.Flags.integer({
|
|
21
|
+
description: `Number of base 10 digits to the right of the decimal place [default: ${DEFAULT_DECIMAL_COUNT}]`,
|
|
22
|
+
required: false,
|
|
23
|
+
default: DEFAULT_DECIMAL_COUNT,
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
static args = {};
|
|
10
27
|
async run() {
|
|
11
28
|
const { flags } = await this.parse(CreateMintCommand);
|
|
12
29
|
const loader = new utils_1.CustomLoader(`Performing create-mint...\n`);
|
|
@@ -34,7 +51,7 @@ class CreateMintCommand extends core_1.Command {
|
|
|
34
51
|
if (!mintKeypairFilePath) {
|
|
35
52
|
return undefined;
|
|
36
53
|
}
|
|
37
|
-
return await (0,
|
|
54
|
+
return await (0, utils_1.getKeypairFromFile)(mintKeypairFilePath);
|
|
38
55
|
}
|
|
39
56
|
async getMintAuthority(flags, feePayer) {
|
|
40
57
|
return flags["mint-authority"]
|
|
@@ -42,22 +59,4 @@ class CreateMintCommand extends core_1.Command {
|
|
|
42
59
|
: feePayer;
|
|
43
60
|
}
|
|
44
61
|
}
|
|
45
|
-
CreateMintCommand.summary = "Create a new compressed token mint";
|
|
46
|
-
CreateMintCommand.examples = ["$ light create-mint --mint-decimals 5"];
|
|
47
|
-
CreateMintCommand.flags = {
|
|
48
|
-
"mint-keypair": core_1.Flags.string({
|
|
49
|
-
description: "Provide a path to a mint keypair file. Defaults to a random keypair",
|
|
50
|
-
required: false,
|
|
51
|
-
}),
|
|
52
|
-
"mint-authority": core_1.Flags.string({
|
|
53
|
-
description: "Address of the mint authority. Defaults to the fee payer",
|
|
54
|
-
required: false,
|
|
55
|
-
}),
|
|
56
|
-
"mint-decimals": core_1.Flags.integer({
|
|
57
|
-
description: `Number of base 10 digits to the right of the decimal place [default: ${DEFAULT_DECIMAL_COUNT}]`,
|
|
58
|
-
required: false,
|
|
59
|
-
default: DEFAULT_DECIMAL_COUNT,
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
62
|
-
CreateMintCommand.args = {};
|
|
63
62
|
exports.default = CreateMintCommand;
|
|
@@ -5,6 +5,15 @@ 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
|
class RegisterMintCommand extends core_1.Command {
|
|
8
|
+
static summary = "Register an existing mint with the CompressedToken program";
|
|
9
|
+
static examples = ["$ light create-token-pool --mint-decimals 5"];
|
|
10
|
+
static flags = {
|
|
11
|
+
mint: core_1.Flags.string({
|
|
12
|
+
description: "Provide a base58 encoded mint address to register",
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
static args = {};
|
|
8
17
|
async run() {
|
|
9
18
|
const { flags } = await this.parse(RegisterMintCommand);
|
|
10
19
|
const loader = new utils_1.CustomLoader(`Performing create-token-pool...\n`);
|
|
@@ -23,13 +32,4 @@ class RegisterMintCommand extends core_1.Command {
|
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
|
-
RegisterMintCommand.summary = "Register an existing mint with the CompressedToken program";
|
|
27
|
-
RegisterMintCommand.examples = ["$ light create-token-pool --mint-decimals 5"];
|
|
28
|
-
RegisterMintCommand.flags = {
|
|
29
|
-
mint: core_1.Flags.string({
|
|
30
|
-
description: "Provide a base58 encoded mint address to register",
|
|
31
|
-
required: true,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
RegisterMintCommand.args = {};
|
|
35
35
|
exports.default = RegisterMintCommand;
|
|
@@ -5,6 +5,19 @@ const utils_1 = require("../../utils/utils");
|
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const stateless_js_1 = require("@lightprotocol/stateless.js");
|
|
7
7
|
class DecompressSolCommand extends core_1.Command {
|
|
8
|
+
static summary = "Decompress SOL.";
|
|
9
|
+
static examples = ["$ light decompress-sol --to PublicKey --amount 10"];
|
|
10
|
+
static flags = {
|
|
11
|
+
to: core_1.Flags.string({
|
|
12
|
+
description: "Specify the recipient address.",
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
amount: core_1.Flags.integer({
|
|
16
|
+
description: "Amount to decompress, in lamports.",
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
static args = {};
|
|
8
21
|
async run() {
|
|
9
22
|
const { flags } = await this.parse(DecompressSolCommand);
|
|
10
23
|
const to = flags["to"];
|
|
@@ -27,17 +40,4 @@ class DecompressSolCommand extends core_1.Command {
|
|
|
27
40
|
}
|
|
28
41
|
}
|
|
29
42
|
}
|
|
30
|
-
DecompressSolCommand.summary = "Decompress SOL.";
|
|
31
|
-
DecompressSolCommand.examples = ["$ light decompress-sol --to PublicKey --amount 10"];
|
|
32
|
-
DecompressSolCommand.flags = {
|
|
33
|
-
to: core_1.Flags.string({
|
|
34
|
-
description: "Specify the recipient address.",
|
|
35
|
-
required: true,
|
|
36
|
-
}),
|
|
37
|
-
amount: core_1.Flags.integer({
|
|
38
|
-
description: "Amount to decompress, in lamports.",
|
|
39
|
-
required: true,
|
|
40
|
-
}),
|
|
41
|
-
};
|
|
42
|
-
DecompressSolCommand.args = {};
|
|
43
43
|
exports.default = DecompressSolCommand;
|
|
@@ -8,6 +8,25 @@ const spl_token_1 = require("@solana/spl-token");
|
|
|
8
8
|
const compressed_token_2 = require("@lightprotocol/compressed-token");
|
|
9
9
|
/// TODO: add ability to decompress from non-fee payer
|
|
10
10
|
class DecompressSplCommand extends core_1.Command {
|
|
11
|
+
static summary = "Decompress into SPL tokens.";
|
|
12
|
+
static examples = [
|
|
13
|
+
"$ light decompress-spl --mint PublicKey --to PublicKey --amount 10",
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
mint: core_1.Flags.string({
|
|
17
|
+
description: "Specify the mint address.",
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
to: core_1.Flags.string({
|
|
21
|
+
description: "Specify the recipient address. (owner of destination token account)",
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
amount: core_1.Flags.integer({
|
|
25
|
+
description: "Amount to decompress, in tokens.",
|
|
26
|
+
required: true,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
static args = {};
|
|
11
30
|
async run() {
|
|
12
31
|
const { flags } = await this.parse(DecompressSplCommand);
|
|
13
32
|
const to = flags["to"];
|
|
@@ -36,23 +55,4 @@ class DecompressSplCommand extends core_1.Command {
|
|
|
36
55
|
}
|
|
37
56
|
}
|
|
38
57
|
}
|
|
39
|
-
DecompressSplCommand.summary = "Decompress into SPL tokens.";
|
|
40
|
-
DecompressSplCommand.examples = [
|
|
41
|
-
"$ light decompress-spl --mint PublicKey --to PublicKey --amount 10",
|
|
42
|
-
];
|
|
43
|
-
DecompressSplCommand.flags = {
|
|
44
|
-
mint: core_1.Flags.string({
|
|
45
|
-
description: "Specify the mint address.",
|
|
46
|
-
required: true,
|
|
47
|
-
}),
|
|
48
|
-
to: core_1.Flags.string({
|
|
49
|
-
description: "Specify the recipient address. (owner of destination token account)",
|
|
50
|
-
required: true,
|
|
51
|
-
}),
|
|
52
|
-
amount: core_1.Flags.integer({
|
|
53
|
-
description: "Amount to decompress, in tokens.",
|
|
54
|
-
required: true,
|
|
55
|
-
}),
|
|
56
|
-
};
|
|
57
|
-
DecompressSplCommand.args = {};
|
|
58
58
|
exports.default = DecompressSplCommand;
|
|
@@ -12,6 +12,14 @@ const constants_1 = require("../../utils/constants");
|
|
|
12
12
|
const utils_1 = require("../../utils");
|
|
13
13
|
const case_anything_1 = require("case-anything");
|
|
14
14
|
class InitCommand extends core_1.Command {
|
|
15
|
+
static description = "Initialize a compressed account project.";
|
|
16
|
+
static args = {
|
|
17
|
+
name: core_1.Args.string({
|
|
18
|
+
name: "NAME",
|
|
19
|
+
description: "The name of the project",
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
15
23
|
async run() {
|
|
16
24
|
const { args, flags } = await this.parse(InitCommand);
|
|
17
25
|
const { name } = args;
|
|
@@ -19,14 +27,6 @@ class InitCommand extends core_1.Command {
|
|
|
19
27
|
await (0, exports.initRepo)(name, flags);
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
|
-
InitCommand.description = "Initialize a compressed account project.";
|
|
23
|
-
InitCommand.args = {
|
|
24
|
-
name: core_1.Args.string({
|
|
25
|
-
name: "NAME",
|
|
26
|
-
description: "The name of the project",
|
|
27
|
-
required: true,
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
30
30
|
exports.default = InitCommand;
|
|
31
31
|
const initRepo = async (name, flags) => {
|
|
32
32
|
const localFilePath = (0, utils_1.programFilePath)("cargo-generate");
|
|
@@ -4,8 +4,19 @@ 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 MergeTokenAccountsCommand extends core_1.Command {
|
|
8
|
+
static summary = "Merge all token accounts for a specific mint.";
|
|
9
|
+
static examples = ["$ light merge-token-accounts --mint PublicKey"];
|
|
10
|
+
static flags = {
|
|
11
|
+
mint: core_1.Flags.string({
|
|
12
|
+
description: "Mint to merge accounts for",
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
"fee-payer": core_1.Flags.string({
|
|
16
|
+
description: "Specify the fee-payer account. Defaults to the client keypair.",
|
|
17
|
+
required: false,
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
9
20
|
async run() {
|
|
10
21
|
const { flags } = await this.parse(MergeTokenAccountsCommand);
|
|
11
22
|
const loader = new utils_1.CustomLoader(`Merging token accounts...\n`);
|
|
@@ -14,7 +25,7 @@ class MergeTokenAccountsCommand extends core_1.Command {
|
|
|
14
25
|
const mint = new web3_js_1.PublicKey(flags.mint);
|
|
15
26
|
let payer = (0, utils_1.defaultSolanaWalletKeypair)();
|
|
16
27
|
if (flags["fee-payer"]) {
|
|
17
|
-
payer = await (0,
|
|
28
|
+
payer = await (0, utils_1.getKeypairFromFile)(flags["fee-payer"]);
|
|
18
29
|
}
|
|
19
30
|
const txId = await (0, compressed_token_1.mergeTokenAccounts)((0, utils_1.rpc)(), payer, mint, payer);
|
|
20
31
|
loader.stop(false);
|
|
@@ -26,16 +37,4 @@ class MergeTokenAccountsCommand extends core_1.Command {
|
|
|
26
37
|
}
|
|
27
38
|
}
|
|
28
39
|
}
|
|
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
40
|
exports.default = MergeTokenAccountsCommand;
|