@lightprotocol/zk-compression-cli 0.3.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/LICENSE +674 -0
- package/README.md +189 -0
- package/accounts/address_merkle_tree_C83cpRN6oaafjNgMQJvaYgAz592EP5wunKvbokeTKPLn.json +1 -0
- package/accounts/address_merkle_tree_queue_HNjtNrjt6irUPYEgxhx2Vcs42koK9fxzm3aFLHVaaRWz.json +1 -0
- package/accounts/governance_authority_pda_3MtrKu5Mjgh3JqeE5PeRzw2Ld28XjFgbbph67E6UERSx.json +1 -0
- package/accounts/group_pda_Edo2YjXU5eE17CejPBkupPgFLcYuAX47pGZmM7s2hAkj.json +1 -0
- package/accounts/merkle_tree_pubkey_5bdFnXU47QjzGpzHfXnxcEi5WXyxzEAZzd1vrE39bf1W.json +1 -0
- package/accounts/nullifier_queue_pubkey_44J4oDXpjPAbzHCSc24q7NEiPekss4sAbLd8ka4gd9CZ.json +1 -0
- package/accounts/registered_program_pda_ytwwVWhQUMoTKdirKmvEW5xCRVr4B2dJZnToiHtE2L2.json +1 -0
- package/bin/account_compression.so +0 -0
- package/bin/light_compressed_pda.so +0 -0
- package/bin/light_compressed_token.so +0 -0
- package/bin/light_registry.so +0 -0
- 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/prover-windows-arm64.exe +0 -0
- package/bin/prover-windows-x64.exe +0 -0
- package/bin/proving-keys/combined_26_1_1.key +0 -0
- package/bin/proving-keys/combined_26_1_1.vkey +1 -0
- package/bin/proving-keys/combined_26_1_2.key +0 -0
- package/bin/proving-keys/combined_26_1_2.vkey +1 -0
- package/bin/proving-keys/combined_26_2_1.key +0 -0
- package/bin/proving-keys/combined_26_2_1.vkey +1 -0
- package/bin/proving-keys/combined_26_2_2.key +0 -0
- package/bin/proving-keys/combined_26_2_2.vkey +1 -0
- package/bin/proving-keys/combined_26_3_1.key +0 -0
- package/bin/proving-keys/combined_26_3_1.vkey +1 -0
- package/bin/proving-keys/combined_26_3_2.key +0 -0
- package/bin/proving-keys/combined_26_3_2.vkey +1 -0
- package/bin/proving-keys/combined_26_4_1.key +0 -0
- package/bin/proving-keys/combined_26_4_1.vkey +1 -0
- package/bin/proving-keys/combined_26_4_2.key +0 -0
- package/bin/proving-keys/combined_26_4_2.vkey +1 -0
- package/bin/proving-keys/inclusion_26_1.key +0 -0
- package/bin/proving-keys/inclusion_26_1.vkey +1 -0
- package/bin/proving-keys/inclusion_26_2.key +0 -0
- package/bin/proving-keys/inclusion_26_2.vkey +1 -0
- package/bin/proving-keys/inclusion_26_3.key +0 -0
- package/bin/proving-keys/inclusion_26_3.vkey +1 -0
- package/bin/proving-keys/inclusion_26_4.key +0 -0
- package/bin/proving-keys/inclusion_26_4.vkey +1 -0
- package/bin/proving-keys/inclusion_26_8.key +0 -0
- package/bin/proving-keys/inclusion_26_8.vkey +1 -0
- package/bin/proving-keys/non-inclusion_26_1.key +0 -0
- package/bin/proving-keys/non-inclusion_26_1.vkey +1 -0
- package/bin/proving-keys/non-inclusion_26_2.key +0 -0
- package/bin/proving-keys/non-inclusion_26_2.vkey +1 -0
- package/bin/spl_noop.so +0 -0
- package/config.json +3 -0
- package/dist/commands/approve-and-mint-to/index.d.ts +14 -0
- package/dist/commands/approve-and-mint-to/index.js +64 -0
- package/dist/commands/balance/index.d.ts +12 -0
- package/dist/commands/balance/index.js +50 -0
- package/dist/commands/compress-sol/index.d.ts +12 -0
- package/dist/commands/compress-sol/index.js +48 -0
- package/dist/commands/compress-spl/index.d.ts +13 -0
- package/dist/commands/compress-spl/index.js +61 -0
- package/dist/commands/config/config.d.ts +11 -0
- package/dist/commands/config/config.js +69 -0
- package/dist/commands/config/index.d.ts +2 -0
- package/dist/commands/config/index.js +5 -0
- package/dist/commands/create-mint/index.d.ts +17 -0
- package/dist/commands/create-mint/index.js +67 -0
- package/dist/commands/decompress-sol/index.d.ts +12 -0
- package/dist/commands/decompress-sol/index.js +46 -0
- package/dist/commands/decompress-spl/index.d.ts +13 -0
- package/dist/commands/decompress-spl/index.js +60 -0
- package/dist/commands/mint-to/index.d.ts +14 -0
- package/dist/commands/mint-to/index.js +64 -0
- package/dist/commands/register-mint/index.d.ts +14 -0
- package/dist/commands/register-mint/index.js +50 -0
- package/dist/commands/start-prover/index.d.ts +11 -0
- package/dist/commands/start-prover/index.js +30 -0
- package/dist/commands/test-validator/index.d.ts +16 -0
- package/dist/commands/test-validator/index.js +61 -0
- package/dist/commands/transfer/index.d.ts +13 -0
- package/dist/commands/transfer/index.js +62 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +8 -0
- package/dist/psp-utils/download.d.ts +34 -0
- package/dist/psp-utils/download.js +203 -0
- package/dist/psp-utils/index.d.ts +1 -0
- package/dist/psp-utils/index.js +4 -0
- package/dist/utils/constants.d.ts +14 -0
- package/dist/utils/constants.js +19 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/initTestEnv.d.ts +38 -0
- package/dist/utils/initTestEnv.js +171 -0
- package/dist/utils/process.d.ts +30 -0
- package/dist/utils/process.js +162 -0
- package/dist/utils/processPhotonIndexer.d.ts +1 -0
- package/dist/utils/processPhotonIndexer.js +45 -0
- package/dist/utils/processProverServer.d.ts +3 -0
- package/dist/utils/processProverServer.js +49 -0
- package/dist/utils/standardFlags.d.ts +8 -0
- package/dist/utils/standardFlags.js +36 -0
- package/dist/utils/utils.d.ts +26 -0
- package/dist/utils/utils.js +150 -0
- package/oclif.manifest.json +684 -0
- package/package.json +122 -0
- package/test_bin/dev +17 -0
- package/test_bin/run +5 -0
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# ZK Compression CLI
|
|
2
|
+
|
|
3
|
+
CLI to interact with ZK compression.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Ensure you have Node >= v20.9.0 installed on your machine.
|
|
8
|
+
|
|
9
|
+
- You will need a valid Solana filesystem wallet set up at `~/.config/solana/id.json`.
|
|
10
|
+
If you don't have one yet, visit the [Solana documentation](https://docs.solanalabs.com/cli/wallets/file-system) for details.
|
|
11
|
+
The CLI will use this wallet as the default fee payer and mint authority.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Using npm
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g @lightprotocol/zk-compression-cli
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Building from source
|
|
22
|
+
|
|
23
|
+
If you prefer to build the CLI from source, follow the steps below to install
|
|
24
|
+
the necessary prerequesites.
|
|
25
|
+
|
|
26
|
+
**1. Activate the Development Environment**
|
|
27
|
+
|
|
28
|
+
Ensure you are at the root of the monorepo.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
. ./scripts/devenv
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**2. Install and build the monorepo from source. This also builds the CLI.**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
./scripts/install.sh
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
./scripts/build.sh
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**3. Make your CLI available globally**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pnpm link --global
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Verify the CLI was correctly installed
|
|
52
|
+
which light
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
**1. Once globally installed, start the Light test validator**
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
light test-validator
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This starts a Solana test-validator with the Light system programs and accounts, a prover server, and the Photon indexer as background processes against a clean ledger.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Pass --skip-indexer to start without the indexer
|
|
67
|
+
light test-validator --skip-indexer
|
|
68
|
+
|
|
69
|
+
# Pass --skip-prover to start without the prover
|
|
70
|
+
light test-validator --skip-prover
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> **Note:** The CLI currently runs the photon indexer and gnark-prover as background processes at port: `8784` and `3001` respectively.
|
|
75
|
+
|
|
76
|
+
**2. Ensure you have sufficient localnet funds**
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Airdrop 1 SOL
|
|
80
|
+
solana airdrop 1
|
|
81
|
+
|
|
82
|
+
# Print your address
|
|
83
|
+
solana address
|
|
84
|
+
|
|
85
|
+
# Print your balance
|
|
86
|
+
solana balance
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Now you're all set up to run CLI commands :)
|
|
90
|
+
|
|
91
|
+
### Commands
|
|
92
|
+
|
|
93
|
+
#### Create a compressed token mint
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
light create-mint
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
USAGE
|
|
101
|
+
$ light create-mint [--mint-keypair <value>] [--mint-authority <value>]
|
|
102
|
+
[--mint-decimals <value>]
|
|
103
|
+
|
|
104
|
+
FLAGS
|
|
105
|
+
--mint-authority=<value> Path to the mint authority keypair file.
|
|
106
|
+
Defaults to default local Solana wallet file
|
|
107
|
+
path.
|
|
108
|
+
--mint-decimals=<value> Number of base 10 digits to the right
|
|
109
|
+
of the decimal place [default: 9].
|
|
110
|
+
--mint-keypair=<value> Path to a mint keypair file. Defaults to a
|
|
111
|
+
random keypair.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Mint compressed tokens to a Solana wallet
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
light mint-to --mint "YOUR_MINT_ADDRESS" --to "YOUR_WALLET_ADDRESS" --amount 4200000000
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
USAGE
|
|
122
|
+
$ light mint-to --mint <value> --to <value> --amount <value>
|
|
123
|
+
[--mint-authority <value>]
|
|
124
|
+
|
|
125
|
+
FLAGS
|
|
126
|
+
--amount=<value> (required) Amount to mint.
|
|
127
|
+
--mint=<value> (required) Mint address.
|
|
128
|
+
--mint-authority=<value> File path of the mint authority keypair.
|
|
129
|
+
Defaults to local Solana wallet.
|
|
130
|
+
--to=<value> (required) Recipient address.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Transfer compressed tokens from one wallet to another
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
light transfer --mint "YOUR_MINT_ADDRESS" --to "RECIPIENT_WALLET_ADDRESS" --amount 4200000000
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
USAGE
|
|
141
|
+
$ light transfer --mint <value> --to <value> --amount <value>
|
|
142
|
+
[--fee-payer <value>]
|
|
143
|
+
|
|
144
|
+
FLAGS
|
|
145
|
+
--amount=<value> (required) Amount to send.
|
|
146
|
+
--fee-payer=<value> Fee payer account. Defaults to the client
|
|
147
|
+
keypair.
|
|
148
|
+
--mint=<value> (required) Mint to transfer
|
|
149
|
+
--to=<value> (required) Recipient address
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Compress native SOL
|
|
154
|
+
|
|
155
|
+
> **Note:** Ensure the SOL omnibus account of the Light system program is already initialized by running: `light init-sol-pool`
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
light compress-sol --amount 1000 --to "YOUR_WALLET_ADDRESS_BASE58"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
USAGE
|
|
163
|
+
$ light compress-sol --to <value> --amount <value>
|
|
164
|
+
|
|
165
|
+
FLAGS
|
|
166
|
+
--amount=<value> (required) Amount to compress in lamports.
|
|
167
|
+
--to=<value> (required) Specify the recipient address.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Decompress into native SOL
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
light decompress-sol --amount 42 --to "YOUR_WALLET_ADDRESS_BASE58"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
USAGE
|
|
178
|
+
$ light decompress-sol --to <value> --amount <value>
|
|
179
|
+
|
|
180
|
+
FLAGS
|
|
181
|
+
--amount=<value> (required) Amount to decompress in lamports.
|
|
182
|
+
--to=<value> (required) Specify the recipient address.
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Support
|
|
186
|
+
|
|
187
|
+
- Always feel free to join the [Developer Discord](https://discord.gg/D2cEphnvcY) for help!
|
|
188
|
+
- For more info about the canonical indexer implementation built and maintained by Helius Labs, refer to the [Photon codebase](https://github.com/helius-labs/photon).
|
|
189
|
+
- For more info about Light, refer to the [documentation](https://docs.lightprotocol.com/).
|