Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sendaifun/solana-agent-kit
a toolkit for building agentfi
https://github.com/sendaifun/solana-agent-kit
ai langchain langchain-js solana solana-langchain web3js
Last synced: about 1 month ago
JSON representation
a toolkit for building agentfi
- Host: GitHub
- URL: https://github.com/sendaifun/solana-agent-kit
- Owner: sendaifun
- Created: 2024-11-17T09:10:19.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-26T10:17:21.000Z (about 1 month ago)
- Last Synced: 2024-11-26T12:35:08.762Z (about 1 month ago)
- Topics: ai, langchain, langchain-js, solana, solana-langchain, web3js
- Language: TypeScript
- Homepage: https://solanaagentkit.xyz
- Size: 146 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-solana-ai-hackathon - SDK Support for Building AI Agents
- awesome - sendaifun/solana-agent-kit - connect any ai agents to solana protocols (TypeScript)
README
# Solana Agent Kit
A powerful toolkit for interacting with the Solana blockchain, providing easy-to-use functions for token operations, NFT management, and trading. Now integrated with LangChain for enhanced functionality.
## Features
- 🪙 Token Operations
- Deploy new SPL tokens
- Transfer SOL and SPL tokens
- Check token balances- 🖼️ NFT Management
- Deploy NFT collections
- Mint NFTs to collections
- Manage metadata and royalties- 💱 Trading
- Integrated Jupiter Exchange support
- Token swaps with customizable slippage
- Direct routing options- 🏦 Yield Farming
- Lend idle assets to earn interest with Lulo- 🔗 LangChain Integration
- Utilize LangChain tools for enhanced blockchain interactions
- Access a suite of tools for balance checks, transfers, token deployments, and more## Installation
```bash
npm install solana-agent-kit
```## Quick Start
```typescript
import { SolanaAgentKit, createSolanaTools } from 'solana-agent-kit';// Initialize with private key and optional RPC URL
const agent = new SolanaAgentKit(
'your-private-key',
'https://api.mainnet-beta.solana.com'
);// Create LangChain tools
const tools = createSolanaTools(agent);
```## Usage Examples
### Deploy a New Token
```typescript
import { deploy_token } from 'solana-agent-kit';const result = await deploy_token(
agent,
9, // decimals
1000000 // initial supply
);console.log('Token Mint Address:', result.mint.toString());
```### Create NFT Collection
```typescript
import { deploy_collection } from 'solana-agent-kit';const collection = await deploy_collection(agent, {
name: "My NFT Collection",
uri: "https://arweave.net/metadata.json",
royaltyBasisPoints: 500, // 5%
creators: [
{
address: "creator-wallet-address",
percentage: 100
}
]
});
```### Swap Tokens
```typescript
import { trade } from 'solana-agent-kit';
import { PublicKey } from '@solana/web3.js';const signature = await trade(
agent,
new PublicKey('target-token-mint'),
100, // amount
new PublicKey('source-token-mint'),
300 // 3% slippage
);
```### Lend Tokens
```typescript
import { lendAsset } from 'solana-agent-kit';
import { PublicKey } from '@solana/web3.js';const signature = await lendAsset(
agent,
new PublicKey('asset-mint'),
100, // amount
"lulo-api-key"
);
```## API Reference
### Core Functions
#### `deploy_token(agent, decimals?, initialSupply?)`
Deploy a new SPL token with optional initial supply.#### `deploy_collection(agent, options)`
Create a new NFT collection with customizable metadata and royalties.#### `mintCollectionNFT(agent, collectionMint, metadata, recipient?)`
Mint a new NFT as part of an existing collection.#### `transfer(agent, to, amount, mint?)`
Transfer SOL or SPL tokens to a recipient.#### `trade(agent, outputMint, inputAmount, inputMint?, slippageBps?)`
Swap tokens using Jupiter Exchange integration.#### `get_balance(agent, token_address)`
Check SOL or token balance for the agent's wallet.#### `lendAsset(agent, assetMint, amount, apiKey)`
Lend idle assets to earn interest with Lulo.## Dependencies
The toolkit relies on several key Solana and Metaplex libraries:
- @solana/web3.js
- @solana/spl-token
- @metaplex-foundation/mpl-token-metadata
- @metaplex-foundation/umi## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
ISC 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.