@proto-kit/cli
v0.1.1-develop.2137
Published
A comprehensive command-line interface for managing Proto-Kit applications, environments, and blockchain interactions.
Readme
Proto-Kit CLI
A comprehensive command-line interface for managing Proto-Kit applications, environments, and blockchain interactions.
Installation
npm install @proto-kit/cliOr use with npx:
npx @proto-kit/cli <command>Commands Overview
Environment Management
Creates a new environment configuration with an interactive guided wizard.
npm protokit wizardThis command walks you through setting up:
- Network configuration
- Key management
- Environment variables
- Deployment settings
Bridge Operations
bridge deposit <tokenId> <fromKey> <toKey> <amount>
Deposits tokens to the bridge contract.
Parameters:
tokenId- Token identifierfromKey- Sender's private key (or environment variable name)toKey- Recipient's public key (or environment variable name)amount- Amount to deposit
Example:
npm protokit bridge deposit 1 SENDER_KEY RECIPIENT_KEY 100bridge redeem <tokenId> <toKey> <amount>
Redeems tokens from the bridge contract.
Parameters:
tokenId- Token identifiertoKey- Recipient's public key (or environment variable name)amount- Amount to redeem
Example:
npm protokit bridge redeem 1 RECIPIENT_KEY 100bridge withdraw <tokenId> <senderKey> <amount>
Withdraws tokens from the bridge.
Parameters:
tokenId- Token identifiersenderKey- Sender's private key (or environment variable name)amount- Amount to withdraw
Example:
npm protokit bridge withdraw 1 SENDER_KEY 100Settlement Deployment
settlement deploy
Deploys settlement contracts to the network.
npm protokit settlement deploysettlement token-deploy <tokenSymbol> <feepayerKey> <receiverPublicKey> [mintAmount]
Deploys custom fungible tokens for settlement operations.
Parameters:
tokenSymbol- Symbol for the tokenfeepayerKey- Private key for paying deployment feesreceiverPublicKey- Public key to receive initially minted tokens[mintAmount]- Initial amount to mint (default: 0)
Example:
npm protokit settlement token-deploy USDC FEEPAYER_KEY RECEIVER_KEY 1000Lightnet Utilities
lightnet:wait-for-network
Waits for the lightnet network to be ready before proceeding with other operations.
npm protokit lightnet waitlightnet:faucet <publicKey>
Sends MINA from the lightnet faucet to the specified account.
Parameters:
publicKey- Destination public key (or environment variable name)
Example:
npm protokit lightnet:faucet B62qnzbXQcUoQFnjvF4Kog6KfNsuuSoo7LSLvomPeak2CLvEYiUqTlightnet:initialize
Complete lightnet setup that performs:
- Waits for network readiness
- Funds test accounts from faucet
- Deploys settlement contracts
npm protokit lightnet initializeDeveloper Tools
generate-keys [count]
Generates private/public key pairs for development and testing.
Parameters:
[count]- Number of key pairs to generate (default: 1)
Example:
# Generate 1 key pair
npm protokit generate-keys
# Generate 5 key pairs
npm protokit generate-keys 5Output format:
Key Pair 1:
Private Key: EKE8...
Public Key: B62q...
Key Pair 2:
Private Key: EKF9...
Public Key: B62r...explorer:start
Starts the Proto-Kit explorer web interface.
Options:
-p, --port- Port to run on (default: 5003)--indexer-url- GraphQL endpoint URL for the indexer
Examples:
# Start on default port 5003
npm protokit explorer start
# Start on custom port with indexer URL
npm protokit explorer start -p 3000 --indexer-url http://localhost:8081/graphqlEnvironment Variable Configuration
The CLI supports three methods for passing environment variables and configuration:
Option 1: --env-path (File-based)
Load environment variables from a .env file:
npm protokit settlement deploy --env-path ./my-config/.envOption 2: --set KEY=value (Inline)
Pass environment variables directly as command-line arguments. Can be used multiple times:
npm protokit settlement deploy \
--set PROTOKIT_SETTLEMENT_CONTRACT_PRIVATE_KEY=EK... \
MINA_NETWORK_URL=https://lightnet.lokinet.dev/graphqlOption 3: --env {envName} (Named Environment)
Use a pre-configured environment by name:
npm protokit settlement deploy --env sovereign