OpenViSTAI · Agents · Blockchain · Crypto
Menu
Exchanges & Trading

Raydium SDK Swap Example

A TypeScript command-line example using Raydium SDK v2 to build, simulate and optionally submit Solana token-swap transactions through Raydium AMM pools.

Independent OpenViST project profile, based on linked sources.

Raydium SDK Swap Example — OpenViST project profile in Exchanges & Trading.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when a developer needs a compact, configurable command-line reference for Raydium AMM swaps on Solana, especially before adapting the transaction flow into another service.

Who it is for

  • Solana developers
  • TypeScript developers exploring Raydium SDK v2
  • Engineers testing swap parameters and transaction settings
  • Teams evaluating a backend or self-hosted swap integration

Documented uses

  • Configure a Raydium pool and input token for a swap
  • Fetch pool data through Raydium API/RPC access
  • Build and simulate a versioned Solana swap transaction
  • Optionally submit the transaction with a configured wallet
  • Adjust slippage, priority fees and retry settings
Before you choose

Requirements & limits

The repository is publicly accessible and open source under the MIT license. The documented setup requires local Node.js and Yarn, an RPC endpoint, and wallet private-key configuration.

  • Simulation is controlled by executeSwap, allowing the documented default to avoid submission.
  • The example builds versioned (v0) transactions and supports a configurable priority fee.
  • Pool, mint, amount, slippage, retry and execution settings are edited in a dedicated configuration file.
  • Execution requires a funded Solana wallet and valid RPC and private-key configuration.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Set up and run a simulated Raydium swap

Install the example, configure a Solana RPC endpoint and wallet, then simulate a configured swap.

Before you start

  • Node.js v18 or above recommended
  • Yarn
  • A Solana wallet with some SOL for testing
  • An RPC URL and wallet private key
  • A local clone of the repository

Steps

  1. Clone the repository, enter its directory and install dependencies with yarn.

  2. Add RPC_URL and WALLET_PRIVATE_KEY to a .env file.

  3. In src/swapConfig.ts, set the pool ID, input mint, amount, slippage and priority fee, leaving executeSwap set to false for simulation.

  4. Run yarn swap.

Expected outcome

The configured swap is simulated rather than submitted.

Guide limitations

  • The documented example uses a Raydium AMM v4 pool and defaults to SOL-USDC.
  • The setup requires private-key configuration and a suitable RPC endpoint.
  • The README documents simulation and submission settings but does not provide a user-interface workflow.
COMPARE OPTIONS

Compare options for DEX swap integration

These projects document a common task and share a project role. This is a source-based comparison, not an execution benchmark or a guarantee of interchangeability.

ProjectDocumented purposePlatformAccess and requirements
Raydium SDK Swap ExampleConfigure a Raydium pool and input token for a swapCLI, Self-hosted, ServerThe repository is publicly accessible and open source under the MIT license. The documented setup requires local Node.js and Yarn, an RPC endpoint, and wallet private-key configuration.
VIA SDKFind swap or bridge routes using source and destination chains, token addresses, and an amount.WebThe package is installed through npm and the documented client uses an API key. The README says the default key is limited to one request per second per IP and directs developers seeking higher limits to contact VIA.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
1 October 2026
Original website title
chainstacklabs/raydium-sdk-swap-example-typescript · Official homepage title · retained in its source language