Prerequisites
Install the required dependencies:Signing Utilities
Here’s the signing function you’ll need for Solana operations:For browser wallets like Phantom or Solflare:
Example 1: SOL → USDC (Same Chain)
The simplest Solana operation - swap SOL to USDC within Solana:Example 2: SOL → USDC (Cross-Chain)
Swap SOL on Solana to USDC on Arbitrum - the most common cross-chain pattern:Example 3: USDC (Solana) → USDC (Arbitrum)
Transfer USDC from Solana to Arbitrum:This operation only requires a Solana account since funds come entirely from Solana. The recipient is specified in
to.account
.Example 4: Aggregated USDC → SOL (Multi-Account)
Use aggregated USDC balance from both EVM and Solana accounts to buy SOL:This example shows OneBalance’s power - using funds from multiple blockchains in a single operation.