Skip to content

Seamlessly migrate Solana Anchor projects to SOON Network with automated configuration updates and oracle detection

License

Notifications You must be signed in to change notification settings

akshatcoder-hash/soon-migrate

Repository files navigation

soon-migrate

Rust Report Card Crates.io Downloads License Documentation

🚀 soon-migrate is a CLI tool that helps developers migrate their Solana Anchor projects to the SOON Network. It modifies the Anchor.toml configuration file, updates the cluster RPC URL, and provides oracle detection and migration guidance. This tool simplifies the process of upgrading and migrating existing Solana Anchor projects to the SOON ecosystem.

Features

  • 🛠 Automatic Migration: Updates the Anchor.toml file to migrate from standard Solana clusters to SOON Network.
  • 🔍 Oracle Detection: Automatically detects and provides migration guidance for various oracle providers (Pyth, Switchboard, Chainlink, etc.).
  • 📦 APRO Integration: Generates comprehensive guides for integrating with APRO (SOON's oracle solution).
  • 📊 Configuration Management: Handles cluster and program configurations seamlessly.
  • 📦 Backup & Restore: Automatically backs up the existing Anchor.toml to ensure you can restore it if needed.
  • 🔍 Dry Run Option: Preview changes before applying them.
  • 🗑 Verbose Logging: Detailed output to help you understand the migration process.

Installation

You can install soon-migrate using Cargo:

cargo install soon-migrate

Usage

Basic Usage

Navigate to the root directory of your Anchor project and run:

soon-migrate

This will migrate your project by modifying Anchor.toml and updating the cluster RPC URL to the SOON Network. The tool will also create a backup (Anchor.toml.bak) before making any changes.

Running with a Specific Path

You can specify the path to your Anchor project explicitly:

soon-migrate /path/to/your/anchor-project

Dry Run Mode (Recommended First Step)

If you want to preview the changes that will be made without modifying the actual files, use the --dry-run flag:

soon-migrate --dry-run

This will print out the changes that would be made to Anchor.toml without making any modifications.

Verbose Mode

For more detailed logging about the migration process, use the --verbose flag:

soon-migrate --verbose

Restore from Backup

If you need to revert the changes made by soon-migrate, you can restore the backup using the --restore flag:

soon-migrate --restore

Full Command Reference

  • Basic Migration:
    soon-migrate
  • Specify Path:
    soon-migrate /path/to/project
  • Dry Run:
    soon-migrate --dry-run
  • Verbose Logging:
    soon-migrate --verbose
  • Restore Backup:
    soon-migrate --restore

Example Workflow

  1. Run a Dry Run to see what changes will be made:

    soon-migrate --dry-run
  2. Run the Actual Migration after reviewing the dry run output:

    soon-migrate
  3. For Oracle Migration, review the generated guide:

    soon-migrate --oracle
  4. Verify the updated Anchor.toml and run your project's tests.

  5. If something went wrong, restore from the backup:

    soon-migrate --restore

How it Works

soon-migrate performs the following tasks:

  1. Project Validation: Ensures the directory is a valid Anchor project with Anchor.toml and Cargo.toml.
  2. Backup Creation: Creates a backup of Anchor.toml before making any changes.
  3. Network Migration: Updates the RPC URL in Anchor.toml to point to the SOON Network.
  4. Oracle Detection: Scans your project for oracle usage and provides migration guidance.
  5. Configuration Updates: Handles program IDs and cluster configurations specific to SOON Network.
  6. Documentation: Generates detailed migration guides for detected oracles.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an Issue for suggestions, improvements, or bug reports.

Development Setup

  1. Clone the Repository:

    git clone https://github.com/akshatcoder-hash/soon-migrate.git
    cd soon-migrate
  2. Build the Project:

    cargo build
  3. Run Tests:

    cargo test
  4. Run Linting:

    cargo clippy -- -D warnings
    cargo fmt --check
  5. Generate Documentation:

    cargo doc --no-deps --open

License

Licensed under the MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT).

Contact

If you have any questions or suggestions, feel free to reach out!


Give soon-migrate a ⭐ on GitHub if you find it useful!

About

Seamlessly migrate Solana Anchor projects to SOON Network with automated configuration updates and oracle detection

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages