npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lightprotocol/zk-compression-cli

v0.19.0

Published

ZK Compression: Secure Scaling on Solana

Downloads

590

Readme

ZK Compression CLI

CLI to interact with ZK compression.

Requirements

  • Ensure you have Node >= v20.9.0 installed on your machine.

  • You will need a valid Solana filesystem wallet set up at ~/.config/solana/id.json. If you don't have one yet, visit the Solana documentation for details. The CLI will use this wallet as the default fee payer and mint authority.

Installation

Using npm

npm install -g @lightprotocol/zk-compression-cli

Building from source

If you prefer to build the CLI from source, follow the steps below to install the necessary prerequesites.

1. Activate the Development Environment

Ensure you are at the root of the monorepo.

. ./scripts/devenv

2. Install and build the monorepo from source. This also builds the CLI.

./scripts/install.sh
./scripts/build.sh

3. Make your CLI available globally

pnpm link --global
# Verify the CLI was correctly installed
which light

Usage

1. Once globally installed, start the Light test validator

light test-validator

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.

# Pass --skip-indexer to start without the indexer
light test-validator --skip-indexer

# Pass --skip-prover to start without the prover
light test-validator --skip-prover

Note: The CLI currently runs the photon indexer and light-prover as background processes at port: 8784 and 3001 respectively.

2. Ensure you have sufficient localnet funds

# Airdrop 1 SOL
solana airdrop 1

# Print your address
solana address

# Print your balance
solana balance

Now you're all set up to run CLI commands :)

Using Devnet

By default, the CLI interacts with localnet. You can view the current config by running:

light config --get

To switch to Devnet, point the URLs to an RPC supporting ZK Compression. For example, run:

  light config --indexerUrl "https://devnet.helius-rpc.com/?api-key=<api-key>" \
    --proverUrl "https://devnet.helius-rpc.com/?api-key=<api-key>" \
    --solanaRpcUrl "https://devnet.helius-rpc.com/?api-key=<api-key>"

Also adjust your solana config:

# Set config
solana config set --url "https://devnet.helius-rpc.com/?api-key=<api-key>"

# Airdrop 1 SOL
solana airdrop 1

# Print your address
solana address

Commands

Create a compressed token mint

light create-mint
USAGE
  $ light create-mint [--mint-keypair <value>] [--mint-authority <value>]
    [--mint-decimals <value>]

FLAGS
  --mint-authority=<value>  Path to the mint authority keypair file.
                            Defaults to default local Solana wallet file
                            path.
  --mint-decimals=<value>   Number of base 10 digits to the right
                            of the decimal place [default: 9].
  --mint-keypair=<value>    Path to a mint keypair file. Defaults to a
                            random keypair.

Mint compressed tokens to a Solana wallet

light mint-to --mint "YOUR_MINT_ADDRESS" --to "YOUR_WALLET_ADDRESS" --amount 4200000000
USAGE
  $ light mint-to --mint <value> --to <value> --amount <value>
    [--mint-authority <value>]

FLAGS
  --amount=<value>          (required) Amount to mint.
  --mint=<value>            (required) Mint address.
  --mint-authority=<value>  File path of the mint authority keypair.
                            Defaults to local Solana wallet.
  --to=<value>              (required) Recipient address.

Transfer compressed tokens from one wallet to another

light transfer --mint "YOUR_MINT_ADDRESS" --to "RECIPIENT_WALLET_ADDRESS" --amount 4200000000
USAGE
  $ light transfer --mint <value> --to <value> --amount <value>
    [--fee-payer <value>]

FLAGS
  --amount=<value>     (required) Amount to send.
  --fee-payer=<value>  Fee payer account. Defaults to the client
                       keypair.
  --mint=<value>       (required) Mint to transfer
  --to=<value>         (required) Recipient address

Compress native SOL

Note: Ensure the SOL omnibus account of the Light system program is already initialized by running: light init-sol-pool

light compress-sol --amount 1000 --to "YOUR_WALLET_ADDRESS_BASE58"
USAGE
  $ light compress-sol --to <value> --amount <value>

FLAGS
  --amount=<value>  (required) Amount to compress in lamports.
  --to=<value>      (required) Specify the recipient address.

Decompress into native SOL

light decompress-sol --amount 42 --to "YOUR_WALLET_ADDRESS_BASE58"
USAGE
  $ light decompress-sol --to <value> --amount <value>

FLAGS
  --amount=<value>  (required) Amount to decompress in lamports.
  --to=<value>      (required) Specify the recipient address.

Support

  • Always feel free to join the Developer Discord for help!
  • For more info about the canonical indexer implementation built and maintained by Helius Labs, refer to the Photon codebase.
  • For more info about Light, refer to the documentation.