Skip to main content
This walkthrough guides you step-by-step through migrating your infrastructure from OpenXSwitch v1 to OpenXSwitch v2. v2 introduces an upgraded smart account architecture delivering gasless operations, native testnet execution, auto-sweeping rules, native transaction batching, and isolated account containers.

πŸ— Summary of Changes

Account Architecture Overview

In v1, the architecture relied on a Prime Wallet and Sub-Wallet model (1:N), where a single central Prime Wallet managed liquidity and treasury operations across multiple sub-wallets. In v2, infrastructure hierarchy transitions to an Accounts container model:
  • Account-Based Isolation: You can create an account specifically for your application or business unit. All wallets generated can be attached directly to that account.
  • Fund & Access Control Segregation: This structure ensures complete separation of funds, permissions, policies, and operational controls at both the Account and Wallet levels.
Within this new architecture, accounts typically fall into two categories:
  • Settlement Account: Serves as the primary operational or treasury container for managing enterprise funds, sweeps, and global balances.
  • Users Account: Acts as an isolated container assigned to individual end-users to manage dedicated smart wallet instances and balances.

Base URL Updates

Update your base request URL across all API client configurations:
  • v1 Base URL: [https://api.openxswitch.com/v1]
  • v2 Base URL: [https://api.openxswitch.com/v2]

Step-by-Step Migration Walkthrough

Step 1: User Onboarding (sub-wallet βž” users)

In v1, user identities were represented as sub-wallet records. In v2, this primitive is renamed to users. Existing sub-wallet IDs are maintained throughout the migration.

πŸ”„ Action: Create Sub-Wallet βž” Create User

  • v1 : POST /v1/sub-wallet/create
  • v2: POST /v2/users
Request Changes
Replace clientUserId with refId, rename name to displayName, and drop canTrade. v1 (POST /v1/sub-wallet/create):
v2 (POST /v2/users):
πŸ“˜ Migration Note Existing sub-wallets maintain their original identifiers during migration. To retrieve or update migrated records, replace /v1/sub-wallet?subWalletId={id} with /v2/users?userId={id} in your endpoints.

Step 2: Blockchain Wallets & Addresses (sub-wallet/address βž” wallets)

In v1, distinct addresses had to be generated per token and network. In v2, a single wallet address handles deposits across all supported tokens on a given network protocol.

πŸ”„ Action: Generate Deposit Address βž” Create Smart Wallet

  • v1: POST /v1/sub-wallet/address
  • v2: POST /v2/wallets
Request Changes
Pass userId and accountId directly in the payload, provide an idempotencyKey, and designate the specific target blockchain network string (e.g., ethereum). v1 (POST /v1/sub-wallet/address):
v2 (POST /v2/wallets):

Step 3: Checking Balances (sub-wallet/assets βž” users/balances)

πŸ”„ Action: Get Sub-Wallet Assets βž” Get User Balances

  • v1 : GET /v1/sub-wallet/assets?subWalletId={id}
  • v2 : GET /v2/users/balances?userId={id}
Response Comparison
v2 provides comprehensive token metadata (standards, contract addresses, raw/formatted amounts) instead of single-string outputs.
⚠️ Deprecation Notice: Internal Off-Chain Transfers Off-chain free internal transfers available in v1 are deprecated. In v2, all asset movements are executed transparently on-chain.

Step 4: Outbound Transactions (withdraw/create βž” transactions/withdraw)

πŸ”„ Action: Create Sub-Wallet Withdrawal βž” Execute Withdrawal Transaction

  • v1: POST /v1/withdraw/create
  • v2: POST /v2/transactions/withdraw
Request Changes
Pass walletId instead of subWalletId, supply toAddress instead of withdrawalAddress, and include an idempotencyKey.

πŸ”„ Action: Fetch Transaction History

Transaction lookup endpoints have been unified under a consolidated GET /v2/transactions resource with filtering options:
  • Fetch Deposits:
    • v1: GET /v1/sub-wallet/deposit
    • v2: GET /v2/transactions?txType=incoming
  • Fetch Withdrawals:
    • v1: GET /v1/sub-wallet/withdraw
    • v2: GET /v2/transactions?txType=outgoing

Step 5: Instant Swaps (instant-swap βž” swap)

πŸ”„ Action: Execute Instant Swap βž” Create Swap Transaction

  • v1: POST /v1/instant-swap
  • v2: POST /v2/swap
Here is the revised Migration Guide tailored specifically to your exact platform updates:

πŸ”„ What Does This Mean for Existing Integrations?

If you are migrating your existing integration to the upgraded infrastructure, use this guide to update your endpoints, identifiers, wallet provisioning, and webhook event handlers.

πŸ‘€ 1. Users Infrastructure (Zero-Friction User Migration)

  • No User Re-creation Needed: You do not need to re-create users for your existing customers.
  • Reused Identifiers: All existing sub-wallets created via the API have been migrated automatically. Your previous subWalletId now acts directly as the new userId.
  • What to Change: Update the base URL endpoint in your requestsβ€”your existing sub-wallet IDs continue to work seamlessly without additional mapping.

πŸ‘› 2. Address & Wallet Management

In the updated model, a user utilizes a single wallet container across supported assets, requiring you to provision chain-specific wallet addresses using the updated wallet creation endpoint.
  • Provisioning Wallets: Call the new wallet creation endpoint per supported chain:
JSON
  • accountId: Retrieve your Account ID by completing the workspace setup via the Accounts & Workspace Console.
  • userId: Pass your existing subWalletId directly into this field.
  • EVM Address Consistency: To ensure a user shares the exact same blockchain address across all EVM-compatible chains, pass the same refId string for every EVM chain provisioning request.
  • Wallet-Level Auto-Sweep: Auto-sweep capabilities are now configured directly at the individual wallet level. Set "autoSweep": true if you want automatic fund sweeps enabled for that specific wallet.

πŸ’Έ 3. Transactions

  • Endpoint Updates: Update all payment, deposit, and withdrawal endpoints to the new transaction URL paths.
  • Idempotency Headers/Fields: Pass standard idempotency keys on state-changing transaction endpoints to ensure safe retry logic.

πŸ”” 4. Webhook Event Consumption

Refer to the complete Webhook Event Documentation for the updated topic structure and full payload schema reference.
  • Update Event Names: Update your webhook listeners to match the new topic identifiers (e.g., replace legacy topics with wallets:deposit.success, wallets:withdraw.success, wallets:swap.success).
  • Update Payload Parsing: Modify your application code to handle the updated event payload schema (e.g., parsing params.amount.value, params.amount.rawValue, and structured params.wallet objects).