Skip to content

Conversation

@paulgnz
Copy link

@paulgnz paulgnz commented Jan 18, 2026

Summary

This PR improves the developer experience based on real-world usage feedback from building Proton.Link and related smart contracts.

Addresses feedback from #30

Changes

1. Enhanced Error Parsing (src/utils/detailsError.ts)

  • Added helpful hints for common blockchain errors:
    • Insufficient RAM → suggests proton ram:buy command
    • CPU/NET exceeded → explains allocation reset
    • Unknown key → suggests proton key:add
    • Insufficient balance, missing authority, etc.

2. WebAuthn Key Error Message (src/apis/uri/parseUri.ts)

  • Before: Generic "Request cancelled from WebAuth.com Wallet"
  • After: Clear message explaining WebAuthn keys (PUB_WA_*) cannot sign from CLI, with suggestion to add K1 key

3. Contract Deployment Output (src/commands/contract/set.ts)

  • Added progress indicators ("Deploying WASM to account...")
  • Better success formatting with checkmarks
  • Shows WASM file size
  • Handles "contract unchanged" gracefully as a warning instead of error

4. RAM Buy Command (src/commands/ram/buy.ts)

  • Fixed class name (was incorrectly named ClaimFaucet)
  • Added usage examples to help text
  • Improved flag descriptions
  • Added proper error handling with parseDetailsError

Before/After Examples

Error Messages

# Before
Error: unknown key

# After
Error: unknown key
Hint: The signing key is not available. Make sure you have added the correct private key: proton key:add

Contract Deployment

# Before
WASM Successfully Deployed:
View TX (link)

# After
Deploying WASM to mycontract...
✓ WASM Successfully Deployed
  Account: mycontract
  Size: 127.45 KB
  TX: abc123...
  View on Explorer (link)

Test Plan

  • npm run build passes
  • Test proton ram:buy with new error handling
  • Test proton contract:set deployment messages
  • Test error hints appear for common failures

Changes:
- Enhanced error parsing with helpful hints for common issues
  (insufficient RAM, CPU exceeded, unknown key, etc.)
- Improved WebAuthn key error message - now clearly explains that
  PUB_WA_* keys cannot sign from CLI and suggests adding K1 key
- Better contract deployment output with progress indicators,
  file sizes, and cleaner success/error formatting
- Fixed ram:buy command class name and added examples to help text
- Handle "contract unchanged" scenario gracefully instead of error

Addresses feedback from issue XPRNetwork#30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants