|
| 1 | +# Proto-Kit CLI |
| 2 | + |
| 3 | +A comprehensive command-line interface for managing Proto-Kit applications, environments, and blockchain interactions. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +```bash |
| 8 | +npm install @proto-kit/cli |
| 9 | +``` |
| 10 | + |
| 11 | +Or use with npx: |
| 12 | + |
| 13 | +```bash |
| 14 | +npx @proto-kit/cli <command> |
| 15 | +``` |
| 16 | + |
| 17 | +## Commands Overview |
| 18 | + |
| 19 | +### Environment Management |
| 20 | + |
| 21 | +Creates a new environment configuration with an interactive guided wizard. |
| 22 | + |
| 23 | +```bash |
| 24 | +npm protokit wizard |
| 25 | +``` |
| 26 | + |
| 27 | +This command walks you through setting up: |
| 28 | +- Network configuration |
| 29 | +- Key management |
| 30 | +- Environment variables |
| 31 | +- Deployment settings |
| 32 | + |
| 33 | +### Bridge Operations |
| 34 | + |
| 35 | +#### `bridge deposit <tokenId> <fromKey> <toKey> <amount>` |
| 36 | +Deposits tokens to the bridge contract. |
| 37 | + |
| 38 | +**Parameters:** |
| 39 | +- `tokenId` - Token identifier |
| 40 | +- `fromKey` - Sender's private key (or environment variable name) |
| 41 | +- `toKey` - Recipient's public key (or environment variable name) |
| 42 | +- `amount` - Amount to deposit |
| 43 | + |
| 44 | +**Example:** |
| 45 | +```bash |
| 46 | +npm protokit bridge deposit 1 SENDER_KEY RECIPIENT_KEY 100 |
| 47 | +``` |
| 48 | + |
| 49 | +#### `bridge redeem <tokenId> <toKey> <amount>` |
| 50 | +Redeems tokens from the bridge contract. |
| 51 | + |
| 52 | +**Parameters:** |
| 53 | +- `tokenId` - Token identifier |
| 54 | +- `toKey` - Recipient's public key (or environment variable name) |
| 55 | +- `amount` - Amount to redeem |
| 56 | + |
| 57 | +**Example:** |
| 58 | +```bash |
| 59 | +npm protokit bridge redeem 1 RECIPIENT_KEY 100 |
| 60 | +``` |
| 61 | + |
| 62 | +#### `bridge withdraw <tokenId> <senderKey> <amount>` |
| 63 | +Withdraws tokens from the bridge. |
| 64 | + |
| 65 | +**Parameters:** |
| 66 | +- `tokenId` - Token identifier |
| 67 | +- `senderKey` - Sender's private key (or environment variable name) |
| 68 | +- `amount` - Amount to withdraw |
| 69 | + |
| 70 | +**Example:** |
| 71 | +```bash |
| 72 | +npm protokit bridge withdraw 1 SENDER_KEY 100 |
| 73 | +``` |
| 74 | + |
| 75 | +### Settlement Deployment |
| 76 | + |
| 77 | +#### `settlement deploy` |
| 78 | +Deploys settlement contracts to the network. |
| 79 | + |
| 80 | +```bash |
| 81 | +npm protokit settlement deploy |
| 82 | +``` |
| 83 | + |
| 84 | +#### `settlement token-deploy <tokenSymbol> <feepayerKey> <receiverPublicKey> [mintAmount]` |
| 85 | +Deploys custom fungible tokens for settlement operations. |
| 86 | + |
| 87 | +**Parameters:** |
| 88 | +- `tokenSymbol` - Symbol for the token |
| 89 | +- `feepayerKey` - Private key for paying deployment fees |
| 90 | +- `receiverPublicKey` - Public key to receive initially minted tokens |
| 91 | +- `[mintAmount]` - Initial amount to mint (default: 0) |
| 92 | + |
| 93 | +**Example:** |
| 94 | +```bash |
| 95 | +npm protokit settlement token-deploy USDC FEEPAYER_KEY RECEIVER_KEY 1000 |
| 96 | +``` |
| 97 | + |
| 98 | +### Lightnet Utilities |
| 99 | + |
| 100 | +#### `lightnet:wait-for-network` |
| 101 | +Waits for the lightnet network to be ready before proceeding with other operations. |
| 102 | + |
| 103 | +```bash |
| 104 | +npm protokit lightnet wait |
| 105 | +``` |
| 106 | + |
| 107 | +#### `lightnet:faucet <publicKey>` |
| 108 | +Sends MINA from the lightnet faucet to the specified account. |
| 109 | + |
| 110 | +**Parameters:** |
| 111 | +- `publicKey` - Destination public key (or environment variable name) |
| 112 | + |
| 113 | +**Example:** |
| 114 | +```bash |
| 115 | +npm protokit lightnet:faucet B62qnzbXQcUoQFnjvF4Kog6KfNsuuSoo7LSLvomPeak2CLvEYiUqT |
| 116 | +``` |
| 117 | + |
| 118 | +#### `lightnet:initialize` |
| 119 | +Complete lightnet setup that performs: |
| 120 | +1. Waits for network readiness |
| 121 | +2. Funds test accounts from faucet |
| 122 | +3. Deploys settlement contracts |
| 123 | + |
| 124 | +```bash |
| 125 | +npm protokit lightnet initialize |
| 126 | +``` |
| 127 | + |
| 128 | +### Developer Tools |
| 129 | + |
| 130 | +#### `generate-keys [count]` |
| 131 | +Generates private/public key pairs for development and testing. |
| 132 | + |
| 133 | +**Parameters:** |
| 134 | +- `[count]` - Number of key pairs to generate (default: 1) |
| 135 | + |
| 136 | +**Example:** |
| 137 | +```bash |
| 138 | +# Generate 1 key pair |
| 139 | +npm protokit generate-keys |
| 140 | + |
| 141 | +# Generate 5 key pairs |
| 142 | +npm protokit generate-keys 5 |
| 143 | +``` |
| 144 | + |
| 145 | +**Output format:** |
| 146 | +``` |
| 147 | +Key Pair 1: |
| 148 | +Private Key: EKE8... |
| 149 | +Public Key: B62q... |
| 150 | +
|
| 151 | +Key Pair 2: |
| 152 | +Private Key: EKF9... |
| 153 | +Public Key: B62r... |
| 154 | +``` |
| 155 | + |
| 156 | +#### `explorer:start` |
| 157 | +Starts the Proto-Kit explorer web interface. |
| 158 | + |
| 159 | +**Options:** |
| 160 | +- `-p, --port` - Port to run on (default: 5003) |
| 161 | +- `--indexer-url` - GraphQL endpoint URL for the indexer |
| 162 | + |
| 163 | +**Examples:** |
| 164 | +```bash |
| 165 | +# Start on default port 5003 |
| 166 | +npm protokit explorer start |
| 167 | + |
| 168 | +# Start on custom port with indexer URL |
| 169 | +npm protokit explorer start -p 3000 --indexer-url http://localhost:8081/graphql |
| 170 | +``` |
| 171 | + |
| 172 | +## Environment Variable Configuration |
| 173 | + |
| 174 | +The CLI supports three methods for passing environment variables and configuration: |
| 175 | + |
| 176 | +### Option 1: `--env-path` (File-based) |
| 177 | +Load environment variables from a `.env` file: |
| 178 | + |
| 179 | +```bash |
| 180 | +npm protokit settlement deploy --env-path ./my-config/.env |
| 181 | +``` |
| 182 | + |
| 183 | +### Option 2: `--set KEY=value` (Inline) |
| 184 | +Pass environment variables directly as command-line arguments. Can be used multiple times: |
| 185 | + |
| 186 | +```bash |
| 187 | +npm protokit settlement deploy \ |
| 188 | + --set PROTOKIT_SETTLEMENT_CONTRACT_PRIVATE_KEY=EK... \ |
| 189 | + MINA_NETWORK_URL=https://lightnet.lokinet.dev/graphql |
| 190 | +``` |
| 191 | + |
| 192 | +### Option 3: `--env {envName}` (Named Environment) |
| 193 | +Use a pre-configured environment by name: |
| 194 | + |
| 195 | +```bash |
| 196 | +npm protokit settlement deploy --env sovereign |
| 197 | +``` |
0 commit comments