Upgrade to the newer MEE contracts
Complete guide to migrate to the newer version of MEE stack.
This guide explains how to upgrade to the latest MEE contracts suite. This involves upgrading your Nexus smart accounts from older versions to the latest implementation. The migration process preserves your account’s address, balance, and history while providing access to new features, security fixes, and performance improvements.
Why Upgrade?
Benefits of Upgrading
Upgrading your Nexus smart account is recommended for several important reasons:
1
Security Improvements
The latest implementation includes critical security enhancements.
2
New Features
Access to the newest MEE capabilities.
3
Performance Improvements
Enhanced gas efficiency and transaction processing.
4
Compatibility
Ensure you can leverage all the latest features of AbstractJS SDK and MEE infra.
Migration Process Overview
Migration Steps
The migration consists of these key steps:
1
Update AbstractJS Package
Install the latest SDK version
2
Connect to Existing Account
Use your existing account address
3
Upgrade Implementation
Call
upgradeToAndCall() via Supertransaction4
Verify Upgrade
Test the account by executing a simple Supertransaction
5
Update Application
Adjust your application to use the latest features
Important Notes for Migration
CRITICAL: After migration, you must store your account address and use it with the
accountAddress parameter in toNexusAccount() or toMultichainNexusAccount() for all future interactions. This is how you’ll maintain access to your upgraded account and its balances.Step 1: Update AbstractJS Package
SDK Update
First, update to the latest version of the AbstractJS SDK:
Step 2: Connect to Your Existing Account
Account Connection
When connecting to an account created with an older SDK version, you’ll need your existing account address:
Note: After upgrading, use your existing
accountAddress for all SDK operations.accountAddressis optional on your first upgrade.- After any previous upgrade, always provide
accountAddressto avoid errors or wrong account access.
Step 3: Upgrade the Smart Account
Account Upgrade
Call the
upgradeToAndCall() method to upgrade your account to the latest implementation.- Different MEE K1 Validator is used
- Same MEE K1 is used
In most cases, your account is going to use newer MEE K1 Validator, so you’ll have to re-initialize it while upgrading the account.
Step 4: Verify the Upgrade
Upgrade Verification
After upgrading, verify that your account works correctly by performing a test supertransaction:
Step 5: Store Your Account Address
Address Storage
After successful migration, you MUST store your account address for future use:
Post-Migration: Future Account Access
Example Code
A minimal working migration script is available on GitHub: Click hereTroubleshooting
Common Issues and Solutions
If you encounter issues during the migration:
- Upgrade Transaction Fails
- Cannot Access Account After Upgrade
1
Check Funds
Make sure you’re re-initializing or not re-initializing the validator module depending on the version you are migrating from and to. See two tabs on the Step 3.
2
Check Funds
Ensure the account has sufficient funds for gas or use sponsorship mode for gasless upgrades
3
Verify Deployment
Verify the account is properly deployed on-chain
4
Check SDK Version
Check that your application is using the latest SDK version
Next Steps
After successfully migrating your Nexus account:
Post-Migration Actions
1
Store Account Address
STORE YOUR ACCOUNT ADDRESS in your application’s persistent storage
2
Update Application Code
Update your application code to use the
accountAddress parameter in all future interactions3
Test Thoroughly
Test thoroughly with real transactions to ensure everything works as expected
By following this migration guide and properly storing your account address, you’ve successfully upgraded your Nexus account to the latest implementation while preserving its address, balance, and history.