v1.0 Release
Migration Guide: Beta to v1.0
Complete guide for migrating from Swig TypeScript SDK beta versions to v1.0
This guide helps you migrate from the beta versions of the Swig TypeScript SDK to the completely refactored v1.0 release.
Overview of Changes
The v1.0 release represents an overhaul with some breaking changes.
Key Changes
- Modular Architecture: Core logic moved to
@swig-wallet/lib
- Instruction-Based API: Functions return
TransactionInstruction[]
instead of single instructions - Simplified Package Structure:
@swig-wallet/classic
now acts as a thin wrapper - Updated Dependencies: Moved from
@solana/spl-token
to@solana-program/token
Package Changes
Before (Beta)
After (v1.0)
For Web3.js 1.x applications:
For Web3.js 2.0 applications:
After (v1.0)
Function Migrations
Creating a Swig
Before (Beta)
After (v1.0)
Adding Authorities
Before (Beta)
After (v1.0)
Signing Instructions
Before (Beta)
After (v1.0)
PDA Derivation
Before (Beta)
After (v1.0)
Authority Creation Changes
Before (Beta)
After (v1.0)
Import Changes
Core Classes
Actions
class is now imported from@swig-wallet/lib
(re-exported by@swig-wallet/classic
)Swig
class is now imported from@swig-wallet/lib
(re-exported by@swig-wallet/classic
)- Authority classes have been replaced with info creation functions
Function Naming
createSwig()
→getCreateSwigInstruction()
addAuthorityInstruction()
→getAddAuthorityInstructions()
signInstruction()
→getSignInstructions()
removeAuthorityInstruction()
→getRemoveAuthorityInstructions()
Dependency Updates
For Web3.js 1.x applications:
For Web3.js 2.0 applications:
Remove old dependencies:
Remove old dependencies:
Migration Checklist
- Update package dependencies
- Replace single instruction functions with instruction array functions
- Update authority creation from classes to info functions
- Update PDA derivation calls
- Replace
Ed25519Authority.fromPublicKey()
withcreateEd25519AuthorityInfo()
- Update transaction building to spread instruction arrays
- Test all functionality with the new API
- Update error handling for new function signatures
Common Migration Issues
Issue: Functions returning arrays instead of single instructions
Solution: Use the spread operator when adding to transactions:
Issue: Authority class methods no longer available
Solution: Use the Swig instance methods instead:
Issue: Import errors for removed classes
Solution: Replace with new function-based API:
Getting Help
If you encounter issues during migration:
- Check the API documentation
- Review the updated tutorials
- Examine the example code
- Open an issue on the GitHub repository
The v1.0 release is designed to be more consistent and composable, making it easier to build complex Swig applications once you’ve completed the migration.