Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Check Command

The check command allows you to verify if a contract class is already verified on Voyager.

Basic Usage

voyager check --network mainnet --class-hash 0x044dc2b3239382230d8b1e943df23b96f52eebcac93efe6e8bde92f9a2f1da18

Options

OptionShortDescription
--networkNetwork to check (mainnet, sepolia, dev)
--urlCustom API endpoint URL
--class-hashClass hash to check (0x-prefixed hex)
--json-jOutput result as JSON
--verbose-vShow detailed error messages

Examples

Check on Mainnet

voyager check --network mainnet \
  --class-hash 0x044dc2b3239382230d8b1e943df23b96f52eebcac93efe6e8bde92f9a2f1da18

Output (Verified):

✓ Class 0x044dc2b3... is verified
  Name: MyContract
  Version: 0.1.0
  License: MIT
  Contract file: src/lib.cairo
  Verified: 2025-01-15 10:30:45 UTC

Output (Not Verified):

✗ Class 0x044dc2b3... is not verified

Output (Not Found):

! Class 0x044dc2b3... not found on-chain

Check on Sepolia

voyager check --network sepolia \
  --class-hash 0x044dc2b3239382230d8b1e943df23b96f52eebcac93efe6e8bde92f9a2f1da18

JSON Output

For programmatic use, output as JSON:

voyager check --network mainnet \
  --class-hash 0x044dc2b3... \
  --json

Output:

{
  "verified": true,
  "class_hash": "0x044dc2b3...",
  "name": "MyContract",
  "version": "0.1.0",
  "license": "MIT",
  "verified_timestamp": 1705315845.0,
  "contract_file": "src/lib.cairo"
}

Using Custom URL

voyager check --url https://custom-api.example.com/beta \
  --class-hash 0x044dc2b3...

Use Cases

Pre-verification Check

Before submitting a verification request, check if the class is already verified:

# Check first
voyager check --network mainnet --class-hash 0x044dc2b3...

# If not verified, submit verification
voyager verify --network mainnet \
  --class-hash 0x044dc2b3... \
  --contract-name MyContract

CI/CD Integration

Use in scripts to conditionally verify:

#!/bin/bash

CLASS_HASH="0x044dc2b3..."

# Check if already verified
if voyager check --network mainnet --class-hash $CLASS_HASH --json | jq -e '.verified' > /dev/null 2>&1; then
  echo "Contract already verified"
else
  echo "Submitting for verification..."
  voyager verify --network mainnet \
    --class-hash $CLASS_HASH \
    --contract-name MyContract \
    --watch
fi

Batch Verification Status

Check multiple classes:

#!/bin/bash

CLASS_HASHES=(
  "0x044dc2b3..."
  "0x123abc..."
  "0x456def..."
)

for hash in "${CLASS_HASHES[@]}"; do
  echo "Checking $hash..."
  voyager check --network mainnet --class-hash $hash
done

Response Fields

When a class is verified, the following information is returned:

FieldDescription
verifiedWhether the class is verified (true/false)
class_hashThe class hash that was checked
nameContract name (if verified)
versionPackage version (if verified)
licenseSPDX license identifier (if verified)
verified_timestampUnix timestamp of verification (if verified)
contract_fileMain contract file path (if verified)

Exit Codes

CodeMeaning
0Success (class found, verified or not)
1Class not found on-chain
Non-zeroOther error (network failure, etc.)

Configuration File

The check command supports configuration via .voyager.toml:

[voyager]
network = "mainnet"
verbose = true

Then simply run:

voyager check --class-hash 0x044dc2b3...

See Also