Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ before:
- go vet ./...

builds:
- id: platform
binary: platform
- id: platform-cli
binary: platform-cli
main: .
env:
- CGO_ENABLED=1
Expand All @@ -26,9 +26,9 @@ builds:
- CC=aarch64-linux-gnu-gcc

archives:
- id: platform
- id: platform-cli
builds:
- platform
- platform-cli
format: tar.gz
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"

Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ e2e/ - End-to-end tests (run against real networks)

```bash
# Build
go build -o platform .
go build -o platform-cli .

# Lint & vet (run before committing)
go vet ./...
Expand Down Expand Up @@ -140,7 +140,7 @@ if err != nil {
## Transaction Flow Example

```
User runs: platform subnet create --network fuji
User runs: platform-cli subnet create --network fuji

1. cmd/subnet.go: Parse flags, load key
2. pkg/wallet/wallet.go: Create wallet from private key
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# platform
# platform-cli

Minimal CLI for Avalanche P-Chain operations.

Expand All @@ -8,34 +8,34 @@ Requirements:
- Go 1.24.13+

```bash
go install github.com/ava-labs/platform-cli@latest
go install github.com/ava-labs/platform-cli@main
```

Or build from source:

```bash
git clone https://github.com/ava-labs/platform-cli.git
cd platform-cli
go build -o platform .
go build -o platform-cli .
```

For Ledger support, build with:

```bash
go build -tags ledger -o platform .
go build -tags ledger -o platform-cli .
```

## Quick Start

```bash
# Generate a key
platform keys generate --name mykey
platform-cli keys generate --name mykey

# Check your address
platform wallet address --key-name mykey
platform-cli wallet address --key-name mykey

# Check balance on Fuji
platform wallet balance --network fuji --key-name mykey
platform-cli wallet balance --network fuji --key-name mykey
```

## Documentation
Expand All @@ -50,6 +50,6 @@ Detailed docs live in [`docs/`](docs/README.md):
## CLI Help

```bash
platform --help
platform <command> --help
platform-cli --help
platform-cli <command> --help
```
32 changes: 16 additions & 16 deletions cmd/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ When encryption is enabled, set PLATFORM_CLI_KEY_PASSWORD for non-interactive us
or follow the password prompt.

Examples:
platform keys import --name mykey --private-key "PrivateKey-..."
platform keys import --name mykey
platform keys import --name mykey --encrypt=false`,
platform-cli keys import --name mykey --private-key "PrivateKey-..."
platform-cli keys import --name mykey
platform-cli keys import --name mykey --encrypt=false`,
RunE: func(cmd *cobra.Command, args []string) error {
if keyName == "" {
return fmt.Errorf("--name is required")
Expand Down Expand Up @@ -155,8 +155,8 @@ When encryption is enabled, set PLATFORM_CLI_KEY_PASSWORD for non-interactive us
or follow the password prompt.

Examples:
platform keys generate --name mykey
platform keys generate --name mykey --encrypt=false`,
platform-cli keys generate --name mykey
platform-cli keys generate --name mykey --encrypt=false`,
RunE: func(cmd *cobra.Command, args []string) error {
if keyName == "" {
return fmt.Errorf("--name is required")
Expand Down Expand Up @@ -217,7 +217,7 @@ Examples:
}

fmt.Println()
fmt.Println("WARNING: Back up your key! Use 'platform keys export' to view the private key.")
fmt.Println("WARNING: Back up your key! Use 'platform-cli keys export' to view the private key.")

return nil
},
Expand All @@ -231,8 +231,8 @@ var keysListCmd = &cobra.Command{
Use --show-addresses to display P-Chain and EVM addresses.

Examples:
platform keys list
platform keys list --show-addresses`,
platform-cli keys list
platform-cli keys list --show-addresses`,
RunE: func(cmd *cobra.Command, args []string) error {
ks, err := keystore.Load()
if err != nil {
Expand All @@ -241,7 +241,7 @@ Examples:

entries := ks.ListKeys()
if len(entries) == 0 {
fmt.Println("No keys found. Use 'platform keys import' or 'platform keys generate' to add a key.")
fmt.Println("No keys found. Use 'platform-cli keys import' or 'platform-cli keys generate' to add a key.")
return nil
}

Expand Down Expand Up @@ -302,9 +302,9 @@ If you really need stdout output, you must pass --unsafe-stdout.
If the key is encrypted, you will be prompted for the password.

Examples:
platform keys export --name mykey --output-file ./mykey.txt
platform keys export --name mykey --format hex --output-file ./mykey.hex
platform keys export --name mykey --unsafe-stdout`,
platform-cli keys export --name mykey --output-file ./mykey.txt
platform-cli keys export --name mykey --format hex --output-file ./mykey.hex
platform-cli keys export --name mykey --unsafe-stdout`,
RunE: func(cmd *cobra.Command, args []string) error {
if keyName == "" {
return fmt.Errorf("--name is required")
Expand Down Expand Up @@ -371,8 +371,8 @@ var keysDeleteCmd = &cobra.Command{
This action is irreversible! Make sure you have a backup of your key.

Examples:
platform keys delete --name mykey
platform keys delete --name mykey --force`,
platform-cli keys delete --name mykey
platform-cli keys delete --name mykey --force`,
RunE: func(cmd *cobra.Command, args []string) error {
if keyName == "" {
return fmt.Errorf("--name is required")
Expand Down Expand Up @@ -425,8 +425,8 @@ When no --name is provided, shows the current default key.
When --name is provided, sets that key as the default.

Examples:
platform keys default
platform keys default --name mykey`,
platform-cli keys default
platform-cli keys default --name mykey`,
RunE: func(cmd *cobra.Command, args []string) error {
ks, err := keystore.Load()
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ var (

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "platform",
Use: "platform-cli",
Short: "Avalanche P-Chain CLI",
SilenceErrors: true,
SilenceUsage: true,
Long: `Avalanche P-Chain operations: staking, subnets, transfers, and L1 validators.

Example usage:
platform wallet balance --key-name mykey
platform validator add --node-id NodeID-... --stake 2000
platform transfer p-to-c --amount 10 --key-name mykey
platform subnet create --network fuji --key-name mykey
platform-cli wallet balance --key-name mykey
platform-cli validator add --node-id NodeID-... --stake 2000
platform-cli transfer p-to-c --amount 10 --key-name mykey
platform-cli subnet create --network fuji --key-name mykey

Environment Variables:
AVALANCHE_PRIVATE_KEY Private key fallback (prefer --key-name or --ledger)
Expand Down Expand Up @@ -76,7 +76,7 @@ func init() {
Use: "version",
Short: "Print the CLI version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("platform " + version)
fmt.Println("platform-cli " + version)
},
})
}
Expand Down
12 changes: 6 additions & 6 deletions docs/networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ For local networks, devnets, or custom RPC endpoints, use `--rpc-url`:

```bash
# Local network (e.g. avalanche-network-runner)
platform wallet balance --rpc-url http://127.0.0.1:9650 --key-name ewoq
platform-cli wallet balance --rpc-url http://127.0.0.1:9650 --key-name ewoq

# Custom devnet (auto-detects network ID)
platform wallet balance --rpc-url https://my-devnet:9650 --key-name mykey
platform-cli wallet balance --rpc-url https://my-devnet:9650 --key-name mykey

# Explicit network ID if auto-detection fails
platform wallet balance --rpc-url https://my-devnet:9650 --network-id 12345 --key-name mykey
platform-cli wallet balance --rpc-url https://my-devnet:9650 --network-id 12345 --key-name mykey

# Works across commands
platform subnet create --rpc-url https://my-devnet:9650 --key-name mykey
platform transfer send --rpc-url https://my-devnet:9650 --to <address> --amount 1.0
platform-cli subnet create --rpc-url https://my-devnet:9650 --key-name mykey
platform-cli transfer send --rpc-url https://my-devnet:9650 --to <address> --amount 1.0

# Non-local HTTP is blocked by default; enable only on trusted networks
platform wallet balance --rpc-url http://my-devnet:9650 --allow-insecure-http --key-name mykey
platform-cli wallet balance --rpc-url http://my-devnet:9650 --allow-insecure-http --key-name mykey
```

When using `--rpc-url`:
Expand Down
4 changes: 2 additions & 2 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ go test -tags=clie2e -v ./e2e/... -run "Help|Params|MissingArgs"

# Ledger-tag compile/unit checks
go test -tags=ledger ./...
go build -tags ledger -o platform-ledger .
go build -tags ledger -o platform-cli-ledger .
```

## End-to-End Tests

```bash
# Build first
go build -o platform .
go build -o platform-cli .

# Network e2e tests are opt-in to avoid accidental live transactions
# Set RUN_E2E_NETWORK_TESTS=1 when you intentionally want to run them
Expand Down
Loading
Loading