Migration Guide (v1 → v2)

Complete guide for migrating from Vertigo SDK v1 to v2

This comprehensive guide will help you migrate from Vertigo SDK v1 to v2. The v2 SDK has been completely redesigned for better developer experience, simpler APIs, and powerful new features.

Quick Migration Checklist

Installation

v1

npm install @vertigo-amm/vertigo-sdk

v2

The v2 SDK includes backward compatibility with v1 for gradual migration.

SDK Initialization

v1: Using AnchorProvider

v2: Direct Initialization

Key Changes:

  • No more AnchorProvider setup

  • Async initialization with await

  • Built-in read-only mode

  • Network parameter for proper configuration


Swapping Tokens (Buy/Sell)

v1: Separate Buy and Sell Methods

Buy (v1):

Sell (v1):

v2: Unified Swap Method

Buy (v2):

Sell (v2):

Key Changes:

  • Single swap() method for both directions

  • No more owner, user, userTaA, userTaB parameters

  • No more tokenProgramA, tokenProgramB parameters

  • limit replaced by slippageBps (clearer intent)

  • Automatic token account creation and management

  • Built-in priority fee support

  • Returns more information (inputAmount, outputAmount, signature)


Building Transaction Instructions

v1: Manual Instruction Building

v2: Simplified Transaction Building

Key Changes:

  • Two-step process: get quote, then build transaction

  • No manual instruction array management

  • Built-in compute unit and priority fee handling

  • Can still customize transaction before sending


Pool Creation

v1: Complex Manual Setup

v2: Simple Pool Creation

For existing tokens:

For new token + pool:

Key Changes:

  • No manual mint creation

  • No manual token wallet creation

  • No manual token minting

  • No manual authority management

  • No token program parameters

  • Automatic account funding and setup

  • Single method call


Token Factories

v1: Separate Factory Programs

SPL Token Factory (v1):

Token 2022 Factory (v1):

v2: Unified Factory Client

Launch token only:

Launch token with pool:

Key Changes:

  • No factory initialization required

  • Single FactoryClient for both SPL and Token-2022

  • No nonce management

  • Automatic token program detection via useToken2022 flag

  • Simpler parameter structure

  • No manual mint/authority creation


Claiming Royalty Fees

v1: Manual Account Management

v2: Simplified Claiming

Key Changes:

  • No claimer, mintA, receiverTaA, tokenProgramA parameters

  • No unwrap flag (automatic)

  • Automatic receiver account creation

  • Automatic SOL unwrapping

  • Single method call


Getting Pool Information

v1: Manual Fetching

v2: Built-in Pool Methods

Key Changes:

  • Built-in pool fetching methods

  • Automatic data parsing

  • Pool search by mints

  • Statistics and analytics

  • Batch fetching support


API Integration

v1: No Built-in API

v2: Built-in API Client

Key Changes:

  • Built-in API client with caching

  • Comprehensive market data endpoints

  • Historical data support

  • Transaction history

  • No manual HTTP requests needed


Utility Functions

v1: Limited Utilities

v2: Rich Utility Library

Key Changes:

  • Comprehensive utility library

  • Token amount formatting/parsing

  • ATA management helpers

  • Priority fee estimation

  • Retry logic with backoff

  • Explorer link generation

  • Transaction helpers


Error Handling

v1: Generic Errors

v2: Specific Error Codes

Key Changes:

  • Specific error codes

  • Better error messages

  • Actionable error information


Advanced Features (New in v2)

Simulation

Pool Authority (Advanced)

Relay Client (Permissioned Swaps)


Migration Strategy

The v2 SDK includes backward compatibility:

Option 2: Full Migration

  1. Update imports: Replace all VertigoSDK imports with Vertigo

  2. Update initialization: Replace provider setup with Vertigo.load()

  3. Update swaps: Replace buy/sell with unified swap()

  4. Update pools: Use new createPool() or launchTokenWithPool()

  5. Update factories: Remove initialization, use launchToken()

  6. Update claims: Use simple claimFees()

  7. Test thoroughly: Test all functionality on devnet

  8. Deploy: Roll out to production


Breaking Changes Summary

Feature
v1
v2

Initialization

new VertigoSDK(provider)

await Vertigo.load({ connection, wallet })

Buy

buy()

swap.swap()

Sell

sell()

swap.swap() (same method)

Quote

quoteBuy(), quoteSell()

swap.getQuote()

Pool Creation

launchPool() with manual setup

pools.createPool() or factory.launchTokenWithPool()

Factory Init

SPLTokenFactory.initialize()

Not needed

Factory Launch

SPLTokenFactory.launch()

factory.launchToken()

Claim

claimRoyalties()

pools.claimFees()

Get Pool

Manual program fetch

pools.getPool()


Testing Checklist

After migration, test the following:


Getting Help

If you encounter issues during migration:

  1. Check the API Reference for complete method documentation

  2. Join our Discord #sdk-support channel

  3. Open an issue on GitHub


Benefits of v2

Upgrading to v2 provides:

  • 50% less code on average

  • Simpler APIs - fewer parameters, better defaults

  • Better type safety - full TypeScript support

  • New features - simulation, API client, utilities

  • Better performance - optimized transactions, caching

  • Improved errors - specific codes, actionable messages

  • Future-proof - built for upcoming features

Take the time to migrate - the improved developer experience is worth it!

Last updated