Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions typescript/agentkit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# AgentKit Changelog

## Unreleased

### Features

- Added Raydium Action Provider for Solana DEX interactions with COMPLETE on-chain execution
- `get_pools`: Fetches live pool data from Raydium API
- `get_price`: Queries actual on-chain pool reserves for real-time prices
- `get_pool_info`: Decodes actual pool state from blockchain
- `swap`: **Executes REAL swaps on-chain** - fetches complete pool keys from Raydium API, builds swap transactions using Raydium SDK, and executes on Solana mainnet
- All actions use real data and execute actual blockchain transactions
- Production-ready for Raydium-specific trading strategies

## 0.10.3

### Patch Changes
Expand Down
2 changes: 2 additions & 0 deletions typescript/agentkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@coinbase/coinbase-sdk": "^0.20.0",
"@coinbase/x402": "^0.6.3",
"@jup-ag/api": "^6.0.39",
"@raydium-io/raydium-sdk": "^1.3.1-beta.58",
"@privy-io/public-api": "2.18.5",
"@privy-io/server-auth": "1.18.4",
"@solana/kit": "^2.1.1",
Expand All @@ -56,6 +57,7 @@
"@zerodev/sdk": "^5.4.28",
"@zoralabs/coins-sdk": "^0.2.8",
"axios": "^1.9.0",
"bn.js": "^5.2.1",
"bs58": "^4.0.1",
"canonicalize": "^2.1.0",
"clanker-sdk": "^4.1.18",
Expand Down
1 change: 1 addition & 0 deletions typescript/agentkit/src/action-providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export * from "./farcaster";
export * from "./jupiter";
export * from "./messari";
export * from "./pyth";
export * from "./raydium";
export * from "./moonwell";
export * from "./morpho";
export * from "./opensea";
Expand Down
142 changes: 142 additions & 0 deletions typescript/agentkit/src/action-providers/raydium/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Raydium Action Provider for CDP AgentKit

![Raydium](./raydium.jpg)

*submitted by teddynix as part of the Solana Cypherpunk Hackathon, Oct 2025*

This directory contains the **RaydiumActionProvider** implementation, which provides actions for AI agents to interact with **Raydium**, a leading automated market maker (AMM) and DEX on Solana.

## overview

Raydium is one of the largest and most liquid DEXs on Solana, offering things like:
- Fast and cheap token swaps
- Deep liquidity through its AMM protocol
- Integration with Serum's order book
- Over $1B in total value locked (TVL)

## directory structure

```
raydium/
├── raydiumActionProvider.ts # Main provider with Raydium DEX functionality
├── raydiumActionProvider.test.ts # Test file for Raydium provider
├── schemas.ts # Action schemas for all Raydium operations
├── index.ts # Main exports
└── README.md # This file
```

## actions

### `get_pools`
Get a list of available Raydium liquidity pools.

**Returns:**
- Pool pairs (e.g., SOL-USDC, RAY-USDC)
- Liquidity depth
- 24-hour volume
- APR (Annual Percentage Rate)

**Example Usage:**
```typescript
const pools = await agent.run("raydium_get_pools", { limit: 5 });
```

### `get_price`
Get the current price for a token pair on Raydium.

**Parameters:**
- `tokenAMint`: Mint address of the first token
- `tokenBMint`: Mint address of the second token

**Common Token Mints:**
- SOL: `So11111111111111111111111111111111111111112`
- USDC: `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`
- RAY: `4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R`

**Example Usage:**
```typescript
const price = await agent.run("raydium_get_price", {
tokenAMint: "So11111111111111111111111111111111111111112", // SOL
tokenBMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" // USDC
});
```

### `swap`
Swap tokens using Raydium's AMM.

**Parameters:**
- `inputMint`: Mint address of the token to swap from
- `outputMint`: Mint address of the token to swap to
- `amount`: Amount of input tokens to swap
- `slippageBps`: Slippage tolerance in basis points (default: 50 = 0.5%)

**Example Usage:**
```typescript
const result = await agent.run("raydium_swap", {
inputMint: "So11111111111111111111111111111111111111112", // SOL
outputMint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
amount: 1.0,
slippageBps: 50 // 0.5% slippage
});
```

### `get_pool_info`
Get detailed information about a specific Raydium pool.

**Parameters:**
- `poolId`: The Raydium pool ID (public key)

**Returns:**
- Token reserves
- Trading fees (typically 0.25%)
- APR
- 24-hour volume and trade count
- Total Value Locked (TVL)

**Example Usage:**
```typescript
const poolInfo = await agent.run("raydium_get_pool_info", {
poolId: "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2" // SOL-USDC pool
});
```

## network support

The Raydium provider supports **Solana mainnet only**.

For development and testing, consider:
- Using devnet testing (when Raydium devnet pools are available)
- Starting with small amounts on mainnet
- Using Jupiter for broader DEX aggregation

## adding new actions

To add new Raydium actions:

1. Define your action schema in `schemas.ts`
2. Implement the action method in `raydiumActionProvider.ts`
3. Add the `@CreateAction` decorator with proper description
4. Add tests in `raydiumActionProvider.test.ts`
5. Update this README

Potential future actions:
- Add/remove liquidity
- Stake LP tokens for farming
- Query user's pool positions
- Get historical price data
- Query pool APY/APR calculations

## dependencies

This action provider uses:
- `@solana/web3.js` - Solana blockchain interaction
- `@solana/spl-token` - SPL token operations
- `@raydium-io/raydium-sdk` - (planned) Full Raydium integration
- `zod` - Schema validation

## resources

- **Raydium Website**: https://raydium.io/
- **Raydium Docs**: https://docs.raydium.io/
- **Raydium SDK**: https://github.com/raydium-io/raydium-sdk
- **Raydium API**: https://api.raydium.io/v2/main/pairs
8 changes: 8 additions & 0 deletions typescript/agentkit/src/action-providers/raydium/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { RaydiumActionProvider, raydiumActionProvider } from "./raydiumActionProvider";
export {
GetPoolsSchema,
GetPriceSchema,
SwapTokenSchema,
GetPoolInfoSchema,
} from "./schemas";

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading