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-walletusers)

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-WalletCreate 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/addresswallets)

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 AddressCreate 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-mainnet). v1 (POST /v1/sub-wallet/address):
v2 (POST /v2/wallets):

Step 3: Checking Balances (sub-wallet/assetsusers/balances)

🔄 Action: Get Sub-Wallet AssetsGet 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/createtransactions/withdraw)

🔄 Action: Create Sub-Wallet WithdrawalExecute 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-swapswap)

🔄 Action: Execute Instant SwapCreate Swap Transaction

  • v1: POST /v1/instant-swap
  • v2: POST /v2/swap