-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: non-inclusion gnark circuits (#559) feat: sol decompression (#567) * feat: sol de compression * feat: JS compress and decompress lamports (#572) --------- Co-authored-by: Swen Schäferjohann <[email protected]> ci: add github ci syntax linter (#574) chore: Remove patched arkworks crates (#575) We are using only upstream 0.4.0 arkworks crates now, there is no need to point to patched 0.3.0 crates. feat: gnark circuits inclusion + non-inclusion 2-in-1 (#569) * feat: inclusion + non-inclusion gnark circuits * Refactor gnark server spawning and killing process. add actions for initSolOmnibusAccount, compressLamports, decompressLamports + happy path tests (#578) refactor: rename gnark proof inputs to plural form (#579) * refactor: rename gnark proof inputs to plural form * formatting feat: add SOL compression and decompression cli commands (#580) * Add SOL compression and decompression commands * Use getTestRpc instead of Connection in decompress and compress cli cmds. sync interface rpc-interface coerce from photon response. open: tests all endpoints except token wip: debug delay in photon indexing wip: RPC tests working. debug: merkleproof, notest: token wip: add sleep wip: fix cli build fresh install changes gnark-prover merkleproof confirmed for 2 consecutive leaves wip wip: built rm compress test dupe * cli, stateless.js, ctoken working with photon * lint * stdout * cleanup logs * initTestEnvIfNeeded with prover and indexer * cli cmds: create-mint and mint-to working (happy path) * transfer cli command works * cli tests working: createmint, mint-to, transfer, balance * compress, decompress, initsolpool working. * linted * cleanup * disable vitest:browser for prover.js * update readme: add usage instructions * upd cli readme * fix typo * Update key loading logic and add test-validator options * fix cli tests + update oclif * Replace Connection with getTestRpc in cli command * fix create-mint * new cli + photon rpc * remove manual prover.sh invocation in compressed-token/package.json * clean up * Add CLI test to light-sdk-tests.yml workflow * Update cli/README.md Co-authored-by: Michal Rostecki <[email protected]> * fix cli prove test * add "build @lightprotocol/programs" step to setup-and-build action * Update cli/test/commands/config/index.test.ts Co-authored-by: Swen Schäferjohann <[email protected]> * Update test script in package.json The `test` script in the package.json file was updated to include `test-prove` and `test-init-sol-pool`. * Enable in-browser tests for prover.js package * Update test command in cli/package.json * rm commented code, address review --------- Co-authored-by: Swen <[email protected]> Co-authored-by: Michal Rostecki <[email protected]> Co-authored-by: Swen Schäferjohann <[email protected]>
- Loading branch information
1 parent
2b79a37
commit 72c4439
Showing
56 changed files
with
3,988 additions
and
3,385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
|
||
/cli/bin | ||
|
||
**/photon.log | ||
|
||
# Yarn | ||
**/.yarn | ||
**/.pnpm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,62 @@ | ||
# Light CLI | ||
|
||
Official CLI to interact with Light Protocol v3 and build Private Solana Programs (https://github.com/Lightprotocol/light-protocol) | ||
CLI to interact with Light Protocol and use generalized ZK compression. | ||
|
||
## Installation | ||
|
||
To use Light CLI, you need to have Node.js (version 12 or later) and npm (Node Package Manager) installed on your machine. Follow the steps below to install [Your CLI Name] globally: | ||
To use Light CLI, you need to have Node.js (version 12 or later) and npm (Node Package Manager) installed on your machine. | ||
|
||
1. Open your terminal or command prompt. | ||
2. Run the following command: | ||
Please compile the CLI from source. | ||
|
||
```shell | ||
npm install -g @lightprotocol/cli | ||
``` | ||
`. ./scripts/devenv` | ||
|
||
3. After the installation is complete, you can verify the installation by running: | ||
`./scripts/install.sh` | ||
|
||
```shell | ||
light --version | ||
``` | ||
`./scripts/build.sh` | ||
|
||
## Usage | ||
|
||
The CLI lets you initialize a PSP scaffold project and customize, build, and test it. (`light psp:...` subcommand) | ||
Note: currently, you have to start the light-test-validator, gnark-prover, and photon indexer outside the CLI binary: | ||
|
||
It also provides utilities for local development, such as running a local Solana-test-validator with all necessary Light accounts and pre-loaded programs. (`light test-validator`). | ||
`cd js/stateless.js` | ||
|
||
You can also execute common user actions such as compressing and sending private transfers. (`light compress`, `light transfer`, `light decompress`). | ||
`pnpm run pretest:e2e` | ||
|
||
For the full list of available commands, see below: | ||
This will reset and start the validator, prover, and indexer on a clean ledger. | ||
|
||
### Commands | ||
Alternatively, to start only the light-test-validator and the gnark-prover, run: | ||
|
||
- `help`: Display help information. | ||
- `account`: Get the current account details | ||
- `airdrop`: Perform a native Solana or SPL airdrop to a user. | ||
- `balance`: Retrieve the balance, inbox balance, or utxos for the user. | ||
- `config`: Update the configuration values. | ||
- `history`: Retrieve transaction history for the user. | ||
- `accept-utxos`: Merge multiple utxos into a single UTXO. | ||
- `compress`: Compress tokens for a user. | ||
- `compress:sol`: Compress sol for a user. | ||
- `compress:spl`: Compress spl tokens for a user. | ||
- `transfer`: Transfer tokens to a recipient. | ||
- `decompress`: Decompress tokens for a user. | ||
`./cli/test_bin/run test-validator -p -i && pnpm gnark-prover` | ||
|
||
- `decompress:sol`: Decompress sol for a user. | ||
- `decompress:spl`: Decompress spl tokens for a user. | ||
Note: the CLI currently expects the photon indexer to run at port: 8784, and the gnark-prover at port: 3001 | ||
|
||
- `test-validator`: Starts a solana-test-validator and with an initialized light environment. Use in a separate terminal instead of solana-test-validator. | ||
Once you've started all services, in the same or a separate terminal window, go to the cli directory: | ||
|
||
- merkleTree: | ||
`cd cli` | ||
|
||
- `mt:authority`: Initialize, set, or get the Merkle Tree Authority. | ||
- `mt:configuration`: Update the configuration of the Merkle Tree NFTs, permissionless SPL tokens, and lock duration. | ||
- `mt:initialize`: Initialize the Merkle Tree. | ||
- `mt:pool`: Register a new pool type [default, spl, sol]. | ||
- `mt:verifier`: Register a new verifier for a Merkle Tree. | ||
Ensure that the CLI is built. | ||
Also ensure that you have a local solana wallet set up at ~/.config/solana/id.json. (see solana documentation for how to create one). This wallet will be used by the CLI as default feePayer and mintAuthority. | ||
|
||
- psp: | ||
- `psp:init`: Initialize, set, or get the Merkle Tree Authority | ||
- `psp:build`: Update the configuration of the Merkle Tree NFTs, permissionless SPL tokens, and lock duration. | ||
- `psp:test`: Perform the PSP tests. | ||
Run `solana address` using the solana-cli to print your id.json/wallet address. | ||
To ensure you have enough localnet funds: run `solana aidrop 10000000` | ||
|
||
## PSP Guide | ||
You can now create test-data against the test-ledger and photon with the following commands: | ||
|
||
You can find a comprehensive tutorial for building a custom Private Solana Program [here](https://docs.lightprotocol.com/getting-started/creating-a-custom-psp). | ||
`./test_bin/run create-mint` | ||
|
||
## License | ||
This will create a random mint and print its mint address. | ||
You can then mint some tokens to your wallet. | ||
|
||
@lightprotocol/cli is released under the GNU General Public License v3.0. See the LICENSE file for more details. | ||
`./test_bin/run mint-to --mint "YOUR_MINT_ADDRESS_BASE58" --amount 4242 --to "YOUR_WALLET_ADDRESS_BASE58"` | ||
|
||
## Contact | ||
Next, you can transfer some of your compressed tokens to another solana wallet: | ||
|
||
If you have questions, suggestions, or feedback, join the developer community on [Discord](https://discord.gg/J3KvDfZpyp), or reach out at hello[at]lightprotocol[dot]com. | ||
`./test_bin/run transfer --mint "YOUR_MINT_ADDRESS_BASE58" --amount 3 --to "5bdFnXU47QjzGpzHfXnxcEi5WXyxzEAZzd1vrE39bf1W"` | ||
|
||
Other commands include: | ||
|
||
`./test_bin/run init-sol-pool` (must be run once before compressing lamports) | ||
|
||
`./test_bin/run compress-sol --amount 1000 --to "YOUR_WALLET_ADDRESS_BASE58"` | ||
|
||
`./test_bin/run decompress-sol --amount 42 --to "YOUR_WALLET_ADDRESS_BASE58"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.