-
+
-
+ Get started by editing{" "}
+
+ src/app/page.tsx ++ . +
+ - Save and see your changes instantly. +
Configuration object
+Solana RPC connection
+Wallet keypair for signing transactions
+Public key of the wallet
+Optionalpayer: stringOptionaloptions: PumpFunTokenOptionsOptionalrecipient: PublicKeyAn open-source toolkit for connecting AI agents to Solana protocols. Now, any agent, using any model can autonomously perform 15+ Solana actions:
Anyone - whether an SF-based AI researcher or a crypto-native builder - can bring their AI agents trained with any model and seamlessly integrate with Solana.
-++Replit template created by Arpit Singh
+
Token Operations
Solana Blinks
Non-Financial Actions
+LangChain Integration
npm install solana-agent-kit
+📦 Installation
npm install solana-agent-kit
-Quick Start
import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit";
// Initialize with private key and optional RPC URL
const agent = new SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
);
// Create LangChain tools
const tools = createSolanaTools(agent);
+Quick Start
import { SolanaAgentKit, createSolanaTools } from "solana-agent-kit";
// Initialize with private key and optional RPC URL
const agent = new SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
);
// Create LangChain tools
const tools = createSolanaTools(agent);
-Usage Examples
Deploy a New Token
const result = await agent.deployToken(
"my ai token", // name
"uri", // uri
"token", // symbol
9, // decimals
1000000 // initial supply
);
console.log("Token Mint Address:", result.mint.toString());
+Usage Examples
Deploy a New Token
const result = await agent.deployToken(
"my ai token", // name
"uri", // uri
"token", // symbol
9, // decimals
1000000 // initial supply
);
console.log("Token Mint Address:", result.mint.toString());
-Create NFT Collection
const collection = await agent.deployCollection({
name: "My NFT Collection",
uri: "https://arweave.net/metadata.json",
royaltyBasisPoints: 500, // 5%
creators: [
{
address: "creator-wallet-address",
percentage: 100,
},
],
});
+Create NFT Collection
const collection = await agent.deployCollection({
name: "My NFT Collection",
uri: "https://arweave.net/metadata.json",
royaltyBasisPoints: 500, // 5%
creators: [
{
address: "creator-wallet-address",
percentage: 100,
},
],
});
-Swap Tokens
import { PublicKey } from "@solana/web3.js";
const signature = await agent.trade(
new PublicKey("target-token-mint"),
100, // amount
new PublicKey("source-token-mint"),
300 // 3% slippage
);
+Swap Tokens
import { PublicKey } from "@solana/web3.js";
const signature = await agent.trade(
new PublicKey("target-token-mint"),
100, // amount
new PublicKey("source-token-mint"),
300 // 3% slippage
);
-Lend Tokens
import { PublicKey } from "@solana/web3.js";
const signature = await agent.lendAssets(
100 // amount of USDC to lend
);
+Lend Tokens
import { PublicKey } from "@solana/web3.js";
const signature = await agent.lendAssets(
100 // amount of USDC to lend
);
-Stake SOL
const signature = await agent.stake(
1 // amount in SOL to stake
);
+Stake SOL
const signature = await agent.stake(
1 // amount in SOL to stake
);
-Send an SPL Token Airdrop via ZK Compression
import { PublicKey } from "@solana/web3.js";
(async () => {
console.log(
"~Airdrop cost estimate:",
getAirdropCostEstimate(
1000, // recipients
30_000 // priority fee in lamports
)
);
const signature = await agent.sendCompressedAirdrop(
new PublicKey("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"), // mint
42, // amount per recipient
[
new PublicKey("1nc1nerator11111111111111111111111111111111"),
// ... add more recipients
],
30_000 // priority fee in lamports
);
})();
+Send an SPL Token Airdrop via ZK Compression
import { PublicKey } from "@solana/web3.js";
(async () => {
console.log(
"~Airdrop cost estimate:",
getAirdropCostEstimate(
1000, // recipients
30_000 // priority fee in lamports
)
);
const signature = await agent.sendCompressedAirdrop(
new PublicKey("JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"), // mint
42, // amount per recipient
[
new PublicKey("1nc1nerator11111111111111111111111111111111"),
// ... add more recipients
],
30_000 // priority fee in lamports
);
})();
-Fetch Price Data from Pyth
const price = await agent.pythFetchPrice(
"0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"
);
console.log("Price in BTC/USD:", price);
+Fetch Price Data from Pyth
const price = await agent.pythFetchPrice(
"0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"
);
console.log("Price in BTC/USD:", price);
-Dependencies
The toolkit relies on several key Solana and Metaplex libraries:
+Examples
LangGraph Multi-Agent System
The repository includes an advanced example of building a multi-agent system using LangGraph and Solana Agent Kit. Located in examples/agent-kit-langgraph, this example demonstrates:
+
+- Multi-agent architecture using LangGraph's StateGraph
+- Specialized agents for different tasks:
+
+- General purpose agent for basic queries
+- Transfer/Swap agent for transaction operations
+- Read agent for blockchain data queries
+- Manager agent for routing and orchestration
+
+
+- Fully typed TypeScript implementation
+- Environment-based configuration
+
+Check out the LangGraph example for a complete implementation of an advanced Solana agent system.
+Dependencies
The toolkit relies on several key Solana and Metaplex libraries:
- @solana/web3.js
- @solana/spl-token
@@ -121,8 +152,12 @@
- @lightprotocol/stateless.js
- @pythnetwork/price-service-client
-Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
+
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Refer to CONTRIBUTING.md for detailed guidelines on how to contribute to this project.
-License
MIT License
-Security
This toolkit handles private keys and transactions. Always ensure you're using it in a secure environment and never share your private keys.
-
Apache-2 License
+This toolkit handles private keys and transactions. Always ensure you're using it in a secure environment and never share your private keys.
+Lulo Account Details response format
-Lulo Account Details response format
+app/api/chat/route.ts.
+
+ app/page.tsx.
+
+ What is my wallet address? below!
+
+
+ 🔍 Sources:
+
+
+ {props.sources?.map((source, i) => (
+
+ {i + 1}. "{source.pageContent}"
+ {source.metadata?.loc?.lines !== undefined ? (
+
+
+ Lines {source.metadata?.loc?.lines?.from} to{" "}
+ {source.metadata?.loc?.lines?.to}
+
+ ) : (
+ ""
+ )}
+
+ ))}
+
+ >
+ ) : (
+ ""
+ )}
+
+ 🛠 {action.name}
+
+ 🔽
+ 🔼
+
+ Tool Input:
+
+
+ {JSON.stringify(action.args)}
+
+
+ {observation}
+
+
+ src/app/page.tsx
+
+ .
+
Main class for interacting with Solana blockchain +
- Preparing search index...
- The search index is not available
solana-agent-kitClass SolanaAgentKit
Main class for interacting with Solana blockchain Provides a unified interface for token operations, NFT management, trading and more
SolanaAgentKit
-Index
Constructors
Properties
Index
Constructors
Properties
Methods
Methods
Constructors
constructor
Parameters
Returns SolanaAgentKit
Properties
connection
Solana RPC connection
-openai_ api_ key
wallet
Wallet keypair for signing transactions
-wallet_ address
Public key of the wallet
-Methods
create Orca Single Sided Whirlpool
Parameters
| 0.01
| 0.02
| 0.04
| 0.05
| 0.16
| 0.3
| 0.65
| 1
| 2
Returns Promise<string>
deploy Collection
Parameters
Returns Promise<CollectionDeployment>
deploy Token
mint: PublicKey;
}>
Parameters
OptionalinitialSupply: numberReturns Promise<{
mint: PublicKey;
}>
fetch Token Price
Parameters
Returns Promise<string>
get All DomainsTLDs
Returns Promise<String[]>
get All Registered All Domains
Returns Promise<string[]>
get Balance
Parameters
Optionaltoken_address: PublicKeyReturns Promise<number>
get Main All Domains Domain
Parameters
Returns Promise<null | string>
get Owned All Domains
Parameters
Returns Promise<string[]>
get Owned Domains ForTLD
Parameters
Returns Promise<string[]>
get Primary Domain
Parameters
Returns Promise<string>
get Token Data By Address
Parameters
Returns Promise<undefined | JupiterTokenData>
get Token Data By Ticker
Parameters
Returns Promise<undefined | JupiterTokenData>
getTPS
Returns Promise<number>
launch Pump Fun Token
Parameters
Optionaloptions: PumpFunTokenOptionsReturns Promise<PumpfunLaunchResponse>
lend Assets
Parameters
Returns Promise<string>
mintNFT
Parameters
creators?: {
address: string;
share: number;
}[];
name: string;
sellerFeeBasisPoints?: number;
uri: string;
}
Optionalcreators?: {address: string;
share: number;
}[]
name: string
Optionalselleruri: string
Optionalrecipient: PublicKeyReturns Promise<MintCollectionNFTResponse>
openbook Create Market
Parameters
Returns Promise<string[]>
pyth Fetch Price
Parameters
Returns Promise<string>
raydium Create Amm V4
Parameters
Returns Promise<string>
raydium Create Clmm
Parameters
Returns Promise<string>
raydium Create Cpmm
Parameters
Returns Promise<string>
register Domain
Parameters
OptionalspaceKB: numberReturns Promise<string>
request Faucet Funds
Returns Promise<string>
resolve All Domains
Parameters
Returns Promise<undefined | PublicKey>
resolve Sol Domain
Parameters
Returns Promise<PublicKey>
send Compressed Airdrop
Parameters
Returns Promise<string[]>
stake
Parameters
Returns Promise<string>
trade
Parameters
OptionalinputMint: PublicKeyReturns Promise<string>
transfer
Parameters
Optionalmint: PublicKeyReturns Promise<string>
Settings
On This Page
Constructors
Properties
Methods