Merge pull request #1 from arihantbansal/main

add idle asset lending with lulo
This commit is contained in:
ARYAN
2024-11-27 17:34:46 +05:30
committed by GitHub
27 changed files with 519 additions and 2122 deletions

View File

@@ -19,6 +19,9 @@ A powerful toolkit for interacting with the Solana blockchain, providing easy-to
- 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
@@ -93,6 +96,20 @@ const signature = await trade(
);
```
### 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
@@ -115,13 +132,15 @@ 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/js
- @metaplex-foundation/mpl-token-metadata
- @metaplex-foundation/umi
@@ -135,4 +154,4 @@ 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.
This toolkit handles private keys and transactions. Always ensure you're using it in a secure environment and never share your private keys.

View File

@@ -1 +1 @@
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE4XQwQrCMAwG4HfJeTgcOmQ3UbyICrqbeCg1c8UuLWsERfbuMie6YZ2XXPL3S9L9HRivDAnsjBYkpickXiqGAKzgHBKQWjiHLuz2BzkXGgI4KzpCMowmVfCWZkZrlKwMzdFqcyuQWp4ixjITEl3oC3bhaBx74Y2tq/ujvlK9ZImCTemHml7f85Ui/sxbL9ItOmvIoRf8me4bIestsPn91BjdOjq70FNy4VeoK8aj6vAA1ZERvOoBAAA="
window.navigationData = "data:application/oct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r1mRWOIV9SwJbU/Ekc1Q7ZEmC90+YfsoGUCwtaJZk2W9mOLH5kDOMIzjM76tuZnc1uD+oZKJMJK1H4ggzBAGjxYo/2qCMmgLvGwPtX3/KjAiEcI47H7gBBVBBXkBIkHYvOK5lrAVLuP2DbbqjzTii3j+5eX/wGMkws5bSoAAA==";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -57,7 +57,6 @@
<ul>
<li>@solana/web3.js</li>
<li>@solana/spl-token</li>
<li>@metaplex-foundation/js</li>
<li>@metaplex-foundation/mpl-token-metadata</li>
<li>@metaplex-foundation/umi</li>
</ul>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,8 @@
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Interfaces</h3><div class="tsd-index-list"><a href="interfaces/CollectionDeployment.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Collection<wbr/>Deployment</span></a>
<a href="interfaces/CollectionOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Collection<wbr/>Options</span></a>
<a href="interfaces/Creator.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Creator</span></a>
<a href="interfaces/LuloAccountDetailsResponse.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Lulo<wbr/>Account<wbr/>Details<wbr/>Response</span></a>
<a href="interfaces/MintCollectionNFTResponse.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-256"></use></svg><span>Mint<wbr/>CollectionNFTResponse</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Type Aliases</h3><div class="tsd-index-list"><a href="types/LuloDepositAssetMint.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-2097152"></use></svg><span>Lulo<wbr/>Deposit<wbr/>Asset<wbr/>Mint</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Functions</h3><div class="tsd-index-list"><a href="functions/createSolanaTools.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-64"></use></svg><span>create<wbr/>Solana<wbr/>Tools</span></a>
</div></section></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="modules.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="assets/icons.svg#icon-1"></use></svg><span>solana-agent-kit</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base="."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>

View File

@@ -0,0 +1,2 @@
<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>LuloDepositAssetMint | solana-agent-kit</title><meta name="description" content="Documentation for solana-agent-kit"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">solana-agent-kit</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">solana-agent-kit</a></li><li><a href="LuloDepositAssetMint.html">LuloDepositAssetMint</a></li></ul><h1>Type Alias LuloDepositAssetMint</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Lulo<wbr/>Deposit<wbr/>Asset<wbr/>Mint</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-keyword">typeof </span><span class="tsd-signature-type">TOKENS</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-keyword">keyof </span><span class="tsd-signature-keyword">typeof </span><span class="tsd-signature-type">TOKENS</span><span class="tsd-signature-symbol">]</span></div><div class="tsd-comment tsd-typography"><p>Mint addresses of supported tokens for lending on Lulo</p>
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/arihantbansal/solana-agent-kit/blob/e3d1ff1d419696356ab6c10021d694b51a86f79c/src/types/index.ts#L30">types/index.ts:30</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>solana-agent-kit</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>

View File

@@ -8,7 +8,6 @@
"build": "tsc",
"docs": "typedoc src --out docs",
"test": "ts-node test/index.ts"
},
"keywords": [],
"author": "",
@@ -17,7 +16,6 @@
"@bonfida/spl-name-service": "^3.0.7",
"@langchain/core": "^0.3.18",
"@langchain/openai": "^0.3.13",
"@metaplex-foundation/js": "^0.20.1",
"@metaplex-foundation/mpl-core": "^1.1.1",
"@metaplex-foundation/mpl-token-metadata": "^3.3.0",
"@metaplex-foundation/umi": "^0.9.2",
@@ -26,10 +24,12 @@
"@solana/spl-token": "^0.4.9",
"@solana/web3.js": "^1.95.4",
"bs58": "^6.0.0",
"dotenv": "^16.4.5",
"langchain": "^0.3.6",
"typedoc": "^0.26.11"
},
"devDependencies": {
"@types/node": "^22.9.0"
"@types/node": "^22.9.0",
"ts-node": "^10.9.2"
}
}

2107
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,15 +8,17 @@ import {
mintCollectionNFT,
transfer,
trade,
registerDomain
registerDomain,
lendAsset,
getLendingDetails,
} from "../tools";
import { CollectionOptions } from "../types";
import { CollectionOptions, LuloDepositAssetMint } from "../types";
import { DEFAULT_OPTIONS } from "../constants";
/**
* Main class for interacting with Solana blockchain
* Provides a unified interface for token operations, NFT management, and trading
*
*
* @class SolanaAgentKit
* @property {Connection} connection - Solana RPC connection
* @property {Keypair} wallet - Wallet keypair for signing transactions
@@ -28,11 +30,11 @@ export class SolanaAgentKit {
public wallet_address: PublicKey;
constructor(
private_key: string,
rpc_url = "https://api.mainnet-beta.solana.com"
privateKey: string,
rpcURL = "https://api.mainnet-beta.solana.com",
) {
this.connection = new Connection(rpc_url);
this.wallet = Keypair.fromSecretKey(bs58.decode(private_key));
this.connection = new Connection(rpcURL);
this.wallet = Keypair.fromSecretKey(bs58.decode(privateKey));
this.wallet_address = this.wallet.publicKey;
}
@@ -59,7 +61,7 @@ export class SolanaAgentKit {
async mintNFT(
collectionMint: PublicKey,
metadata: Parameters<typeof mintCollectionNFT>[2],
recipient?: PublicKey
recipient?: PublicKey,
) {
return mintCollectionNFT(this, collectionMint, metadata, recipient);
}
@@ -76,8 +78,20 @@ export class SolanaAgentKit {
outputMint: PublicKey,
inputAmount: number,
inputMint?: PublicKey,
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS,
) {
return trade(this, outputMint, inputAmount, inputMint, slippageBps);
}
async lendAssets(
asset: LuloDepositAssetMint,
amount: number,
LULO_API_KEY: string,
) {
return lendAsset(this, asset, amount, LULO_API_KEY);
}
async fetchLendingDetails(LULO_API_KEY: string) {
return getLendingDetails(this, LULO_API_KEY);
}
}

View File

@@ -5,6 +5,13 @@ import { PublicKey } from "@solana/web3.js";
*/
export const TOKENS = {
USDC: new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),
USDT: new PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),
USDS: new PublicKey("USDSwr9ApdHk5bvJKMjzff41FfuX8bSxdKcR81vTwcA"),
SOL: new PublicKey("So11111111111111111111111111111111111111112"),
jitoSOL: new PublicKey("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"),
bSOL: new PublicKey("bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1"),
mSOL: new PublicKey("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"),
BONK: new PublicKey("DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"),
} as const;
/**
@@ -16,3 +23,13 @@ export const DEFAULT_OPTIONS = {
SLIPPAGE_BPS: 300,
TOKEN_DECIMALS: 9,
} as const;
/**
* Jupiter API URL
*/
export const JUP_API = "https://quote-api.jup.ag/v6";
/**
* LULO (fka Flexlend) API URL
*/
export const LULO_API = "https://api.flexlend.fi";

View File

@@ -4,8 +4,9 @@ import { PublicKey } from "@solana/web3.js";
export class SolanaBalanceTool extends Tool {
name = "solana_balance";
description = "Get the balance of a Solana wallet or token account. Input can be a token address or empty for SOL balance.";
description =
"Get the balance of a Solana wallet or token account. Input can be a token address or empty for SOL balance.";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
@@ -23,8 +24,9 @@ export class SolanaBalanceTool extends Tool {
export class SolanaTransferTool extends Tool {
name = "solana_transfer";
description = "Transfer tokens or SOL to another address. Input should be JSON string with: {to: string, amount: number, mint?: string}";
description =
"Transfer tokens or SOL to another address. Input should be JSON string with: {to: string, amount: number, mint?: string}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
@@ -34,7 +36,7 @@ export class SolanaTransferTool extends Tool {
const { to, amount, mint } = JSON.parse(input);
const recipient = new PublicKey(to);
const mintAddress = mint ? new PublicKey(mint) : undefined;
await this.solanaKit.transfer(recipient, amount, mintAddress);
return `Successfully transferred ${amount} to ${to}`;
} catch (error: any) {
@@ -45,15 +47,16 @@ export class SolanaTransferTool extends Tool {
export class SolanaDeployTokenTool extends Tool {
name = "solana_deploy_token";
description = "Deploy a new SPL token. Input should be JSON string with: {decimals?: number, initialSupply?: number}";
description =
"Deploy a new SPL token. Input should be JSON string with: {decimals?: number, initialSupply?: number}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
async _call(input: string): Promise<string> {
try {
const validJson = input
const validJson = input
.replace(/([a-zA-Z0-9_]+):/g, '"$1":') // Add quotes around keys
.trim();
const { decimals = 9 } = JSON.parse(validJson);
@@ -67,8 +70,9 @@ export class SolanaDeployTokenTool extends Tool {
export class SolanaDeployCollectionTool extends Tool {
name = "solana_deploy_collection";
description = "Deploy a new NFT collection. Input should be JSON with: {name: string, uri: string, royaltyBasisPoints?: number, creators?: Array<{address: string, percentage: number}>}";
description =
"Deploy a new NFT collection. Input should be JSON with: {name: string, uri: string, royaltyBasisPoints?: number, creators?: Array<{address: string, percentage: number}>}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
@@ -86,8 +90,9 @@ export class SolanaDeployCollectionTool extends Tool {
export class SolanaMintNFTTool extends Tool {
name = "solana_mint_nft";
description = "Mint a new NFT in a collection. Input should be JSON with: {collectionMint: string, metadata: {name: string, symbol: string, uri: string}, recipient?: string}";
description =
"Mint a new NFT in a collection. Input should be JSON with: {collectionMint: string, metadata: {name: string, symbol: string, uri: string}, recipient?: string}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
@@ -99,7 +104,7 @@ export class SolanaMintNFTTool extends Tool {
const result = await this.solanaKit.mintNFT(
new PublicKey(collectionMint),
metadata,
recipientPubkey
recipientPubkey,
);
return `NFT minted successfully. Mint address: ${result.mint.toString()}`;
} catch (error: any) {
@@ -110,20 +115,22 @@ export class SolanaMintNFTTool extends Tool {
export class SolanaTradeTool extends Tool {
name = "solana_trade";
description = "Swap tokens using Jupiter Exchange. Input should be JSON with: {outputMint: string, inputAmount: number, inputMint?: string, slippageBps?: number}";
description =
"Swap tokens using Jupiter Exchange. Input should be JSON with: {outputMint: string, inputAmount: number, inputMint?: string, slippageBps?: number}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
async _call(input: string): Promise<string> {
try {
const { outputMint, inputAmount, inputMint, slippageBps } = JSON.parse(input);
const { outputMint, inputAmount, inputMint, slippageBps } =
JSON.parse(input);
const tx = await this.solanaKit.trade(
new PublicKey(outputMint),
inputAmount,
inputMint ? new PublicKey(inputMint) : undefined,
slippageBps
slippageBps,
);
return `Trade executed successfully. Transaction: ${tx}`;
} catch (error: any) {
@@ -135,7 +142,7 @@ export class SolanaTradeTool extends Tool {
export class SolanaRequestFundsTool extends Tool {
name = "solana_request_funds";
description = "Request SOL from Solana faucet (devnet/testnet only)";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
@@ -152,8 +159,9 @@ export class SolanaRequestFundsTool extends Tool {
export class SolanaRegisterDomainTool extends Tool {
name = "solana_register_domain";
description = "Register a .sol domain name. Input should be JSON with: {name: string, spaceKB?: number}";
description =
"Register a .sol domain name. Input should be JSON with: {name: string, spaceKB?: number}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
@@ -172,7 +180,7 @@ export class SolanaRegisterDomainTool extends Tool {
export class SolanaGetWalletAddressTool extends Tool {
name = "solana_get_wallet_address";
description = "Get the wallet address of the agent";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
@@ -182,6 +190,55 @@ export class SolanaGetWalletAddressTool extends Tool {
}
}
export class SolanaLendAssetTool extends Tool {
name = "solana_lend_asset";
description =
"Lend idle assets for yield using Lulo. Input should be JSON with: {asset: string, amount: number, luloApiKey: string}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
async _call(input: string): Promise<string> {
try {
const { asset, amount, luloApiKey } = JSON.parse(input);
const tx = await this.solanaKit.lendAssets(
new PublicKey(asset),
amount,
luloApiKey,
);
return `Asset lent successfully. Transaction: ${tx}`;
} catch (error: any) {
return `Error lending asset: ${error.message}`;
}
}
}
export class SolanaFetchLendingDetailsTool extends Tool {
name = "solana_get_lending_details";
description =
"Get details of assets lent on Lulo. Input should be JSON with: {luloApiKey: string}";
constructor(private solanaKit: SolanaAgentKit) {
super();
}
async _call(input: string): Promise<string> {
try {
const { luloApiKey } = JSON.parse(input);
const lendingDetails =
await this.solanaKit.fetchLendingDetails(luloApiKey);
return `Lending details: ${lendingDetails}`;
} catch (error: any) {
return `Error fetching lending details: ${error.message}`;
}
}
}
// Updated createSolanaTools function
export function createSolanaTools(solanaKit: SolanaAgentKit) {
return [
@@ -194,5 +251,7 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) {
new SolanaRequestFundsTool(solanaKit),
new SolanaRegisterDomainTool(solanaKit),
new SolanaGetWalletAddressTool(solanaKit),
new SolanaLendAssetTool(solanaKit),
new SolanaFetchLendingDetailsTool(solanaKit),
];
}

View File

@@ -1,13 +1,10 @@
import { SolanaAgentKit } from "../index";
import {
createUmi,
generateSigner,
publicKey,
} from '@metaplex-foundation/umi';
import { createCollection, ruleSet } from '@metaplex-foundation/mpl-core';
import { mplTokenMetadata } from '@metaplex-foundation/mpl-token-metadata';
import { CollectionOptions, CollectionDeployment } from '../types';
import { toWeb3JsPublicKey } from '@metaplex-foundation/umi-web3js-adapters';
import { createUmi, generateSigner, publicKey } from "@metaplex-foundation/umi";
import { createCollection, ruleSet } from "@metaplex-foundation/mpl-core";
import { mplTokenMetadata } from "@metaplex-foundation/mpl-token-metadata";
import { CollectionOptions, CollectionDeployment } from "../types";
import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
/**
* Deploy a new NFT collection
* @param agent SolanaAgentKit instance
@@ -16,24 +13,25 @@ import { toWeb3JsPublicKey } from '@metaplex-foundation/umi-web3js-adapters';
*/
export async function deploy_collection(
agent: SolanaAgentKit,
options: CollectionOptions
options: CollectionOptions,
): Promise<CollectionDeployment> {
try {
// Initialize Umi
const umi = createUmi()
.use(mplTokenMetadata());
const umi = createUmi().use(mplTokenMetadata());
// Generate collection signer
const collectionSigner = generateSigner(umi);
// Format creators if provided
const formattedCreators = options.creators?.map(creator => ({
const formattedCreators = options.creators?.map((creator) => ({
address: publicKey(creator.address),
percentage: creator.percentage,
})) || [{
address: publicKey(agent.wallet_address.toString()),
percentage: 100,
}];
})) || [
{
address: publicKey(agent.wallet_address.toString()),
percentage: 100,
},
];
// Create collection
const tx = await createCollection(umi, {
@@ -42,17 +40,17 @@ export async function deploy_collection(
uri: options.uri,
plugins: [
{
type: 'Royalties',
type: "Royalties",
basisPoints: options.royaltyBasisPoints || 500, // Default 5%
creators: formattedCreators,
ruleSet: ruleSet('None'), // Compatibility rule set
ruleSet: ruleSet("None"), // Compatibility rule set
},
],
}).sendAndConfirm(umi);
return {
collectionAddress: toWeb3JsPublicKey(collectionSigner.publicKey),
signature: tx.signature
signature: tx.signature,
};
} catch (error: any) {
throw new Error(`Collection deployment failed: ${error.message}`);

View File

@@ -1,8 +1,9 @@
export * from './request_faucet_funds';
export * from './deploy_token';
export * from './deploy_collection';
export * from './get_balance';
export * from './mint_nft';
export * from './transfer';
export * from './trade';
export * from './register_domain';
export * from "./request_faucet_funds";
export * from "./deploy_token";
export * from "./deploy_collection";
export * from "./get_balance";
export * from "./mint_nft";
export * from "./transfer";
export * from "./trade";
export * from "./register_domain";
export * from "./lend";

94
src/tools/lend.ts Normal file
View File

@@ -0,0 +1,94 @@
import { VersionedTransaction } from "@solana/web3.js";
import { SolanaAgentKit } from "../index";
import { LuloAccountDetailsResponse, LuloDepositAssetMint } from "../types";
import { getPriorityFees } from "../utils/send_tx";
import { LULO_API } from "../constants";
/**
* Lend tokens for yields using Lulo
* @param agent SolanaAgentKit instance
* @param asset Mint address of the token to lend (as supported by Lulo)
* @param amount Amount to lend (in token decimals)
* @param LULO_API_KEY Valid API key for Lulo
* @returns Transaction signature
*/
export async function lendAsset(
agent: SolanaAgentKit,
asset: LuloDepositAssetMint,
amount: number,
LULO_API_KEY = "",
): Promise<string> {
try {
if (!LULO_API_KEY) {
throw new Error("Missing Lulo API key");
}
const request = {
owner: agent.wallet.publicKey.toBase58(),
mintAddress: asset.toBase58(),
depositAmount: amount.toString(),
};
const priorityFees = await getPriorityFees(agent.connection);
const priority = `?priorityFee=${priorityFees.median}`;
const response = await fetch(
`${LULO_API}/generate/account/deposit${priority}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-wallet-pubkey": agent.wallet.publicKey.toBase58(),
"x-api-key": LULO_API_KEY,
},
body: JSON.stringify(request),
},
);
const {
data: { transactionMeta },
} = await response.json();
const luloTxn = VersionedTransaction.deserialize(
Buffer.from(transactionMeta[0].transaction, "base64"),
);
// Sign and send transaction
luloTxn.sign([agent.wallet]);
const signature = await agent.connection.sendTransaction(luloTxn);
return signature;
} catch (error: any) {
throw new Error(`Lending failed: ${error.message}`);
}
}
/**
* Fetch lending details for agent
* @param agent SolanaAgentKit instance
* @param LULO_API_KEY Valid API key for Lulo
* @returns Lending account details
*/
export async function getLendingDetails(
agent: SolanaAgentKit,
LULO_API_KEY = "",
): Promise<LuloAccountDetailsResponse> {
try {
if (!LULO_API_KEY) {
throw new Error("Missing Lulo API key");
}
const response = await fetch(`${LULO_API}/account`, {
headers: {
"x-wallet-pubkey": agent.wallet.publicKey.toBase58(),
"x-api-key": LULO_API_KEY,
},
});
const { data } = await response.json();
return data as LuloAccountDetailsResponse;
} catch (error: any) {
throw new Error(`Failed to fetch lending details: ${error.message}`);
}
}

View File

@@ -3,6 +3,7 @@ import { Transaction } from "@solana/web3.js";
import { SolanaAgentKit } from "../index";
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
import { TOKENS } from "../constants";
/**
* Register a .sol domain name using Bonfida Name Service
* @param agent SolanaAgentKit instance
@@ -13,7 +14,7 @@ import { TOKENS } from "../constants";
export async function registerDomain(
agent: SolanaAgentKit,
name: string,
spaceKB: number = 1
spaceKB: number = 1,
): Promise<string> {
try {
// Validate space size
@@ -26,7 +27,7 @@ export async function registerDomain(
const buyerTokenAccount = await getAssociatedTokenAddressSync(
agent.wallet_address,
TOKENS.USDC
TOKENS.USDC,
);
// Create registration instruction
@@ -35,7 +36,7 @@ export async function registerDomain(
name,
space,
agent.wallet_address,
buyerTokenAccount
buyerTokenAccount,
);
// Create and sign transaction

View File

@@ -4,13 +4,24 @@ import { LAMPORTS_PER_SOL } from "@solana/web3.js";
/**
* Request SOL from the Solana faucet (devnet/testnet only)
* @param agent - SolanaAgentKit instance
* @returns Promise that resolves when the airdrop is confirmed
* @returns Transaction signature
* @throws Error if the request fails or times out
*/
export async function request_faucet_funds(agent: SolanaAgentKit) {
export async function request_faucet_funds(
agent: SolanaAgentKit,
): Promise<string> {
const tx = await agent.connection.requestAirdrop(
agent.wallet_address,
5 * LAMPORTS_PER_SOL
5 * LAMPORTS_PER_SOL,
);
await agent.connection.confirmTransaction(tx);
}
const latestBlockHash = await agent.connection.getLatestBlockhash();
await agent.connection.confirmTransaction({
signature: tx,
blockhash: latestBlockHash.blockhash,
lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
});
return tx;
}

View File

@@ -1,9 +1,7 @@
import {
VersionedTransaction,
PublicKey,
} from "@solana/web3.js";
import { VersionedTransaction, PublicKey } from "@solana/web3.js";
import { SolanaAgentKit } from "../index";
import { TOKENS, DEFAULT_OPTIONS } from "../constants";
import { TOKENS, DEFAULT_OPTIONS, JUP_API } from "../constants";
/**
* Swap tokens using Jupiter Exchange
* @param agent SolanaAgentKit instance
@@ -18,19 +16,19 @@ export async function trade(
outputMint: PublicKey,
inputAmount: number,
inputMint: PublicKey = TOKENS.USDC,
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS
slippageBps: number = DEFAULT_OPTIONS.SLIPPAGE_BPS,
): Promise<string> {
try {
// Get quote for the swap
const quoteResponse = await (
await fetch(
`https://quote-api.jup.ag/v6/quote?` +
`${JUP_API}/quote?` +
`inputMint=${inputMint.toString()}` +
`&outputMint=${outputMint.toString()}` +
`&amount=${inputAmount}` +
`&slippageBps=${slippageBps}` +
`&onlyDirectRoutes=true` +
`&maxAccounts=20`
`&maxAccounts=20`,
)
).json();

View File

@@ -1,4 +1,5 @@
import { PublicKey } from "@solana/web3.js";
import { TOKENS } from "../constants";
export interface Creator {
address: string;
@@ -22,3 +23,23 @@ export interface MintCollectionNFTResponse {
mint: PublicKey;
metadata: PublicKey;
}
/**
* Mint addresses of supported tokens for lending on Lulo
*/
export type LuloDepositAssetMint = (typeof TOKENS)[keyof typeof TOKENS];
/**
* Lulo Account Details response format
*/
export interface LuloAccountDetailsResponse {
totalValue: number;
interestEarned: number;
realtimeApy: number;
settings: {
owner: string;
allowedProtocols: string | null;
homebase: string | null;
minimumRate: string;
};
}

View File

@@ -1,5 +1,5 @@
import { SolanaAgentKit } from "../agent";
import { Transaction, Keypair } from "@solana/web3.js";
import { Transaction, Keypair, TransactionInstruction } from "@solana/web3.js";
import { Connection, ComputeBudgetProgram } from "@solana/web3.js";
/**
@@ -7,7 +7,16 @@ import { Connection, ComputeBudgetProgram } from "@solana/web3.js";
* @param connection - Solana RPC connection
* @returns Priority fees statistics and instructions for different fee levels
*/
async function getPriorityFees(connection: Connection) {
export async function getPriorityFees(connection: Connection): Promise<{
min: number;
median: number;
max: number;
instructions?: {
low: TransactionInstruction;
medium: TransactionInstruction;
high: TransactionInstruction;
};
}> {
try {
// Get recent prioritization fees
const priorityFees = await connection.getRecentPrioritizationFees();
@@ -32,7 +41,7 @@ async function getPriorityFees(connection: Connection) {
const median =
sortedFees.length % 2 === 0
? ((sortedFees[mid - 1] ?? 0) + (sortedFees[mid] ?? 0)) / 2
: sortedFees[mid] ?? 0;
: (sortedFees[mid] ?? 0);
// Helper to create priority fee IX based on chosen strategy
const createPriorityFeeIx = (fee: number) => {
@@ -67,7 +76,7 @@ async function getPriorityFees(connection: Connection) {
export async function sendTx(
agent: SolanaAgentKit,
tx: Transaction,
otherKeypairs?: Keypair[]
otherKeypairs?: Keypair[],
) {
tx.recentBlockhash = (await agent.connection.getLatestBlockhash()).blockhash;
tx.feePayer = agent.wallet_address;
@@ -81,9 +90,8 @@ export async function sendTx(
await agent.connection.confirmTransaction({
signature: txid,
blockhash: (await agent.connection.getLatestBlockhash()).blockhash,
lastValidBlockHeight: (
await agent.connection.getLatestBlockhash()
).lastValidBlockHeight,
lastValidBlockHeight: (await agent.connection.getLatestBlockhash())
.lastValidBlockHeight,
});
return txid;
}

View File

@@ -1,48 +1,42 @@
import { SolanaAgentKit } from "../src";
import { createSolanaTools } from "../src/langchain";
import { OpenAI } from "@langchain/openai";
import { AgentExecutor } from "langchain/agents";
import { PromptTemplate } from "@langchain/core/prompts";
import { pull } from "langchain/hub";
import { createReactAgent } from "langchain/agents";
// import { SolanaAgentKit } from "../src";
// import { createSolanaTools } from "../src/langchain";
// import { OpenAI } from "@langchain/openai";
// import { AgentExecutor } from "langchain/agents";
// import { PromptTemplate } from "@langchain/core/prompts";
// import { pull } from "langchain/hub";
// import { createReactAgent } from "langchain/agents";
// Initialize SolanaAgentKit
const solanaKit = new SolanaAgentKit(
"",
"https://mainnet.helius-rpc.com/?api-key="
);
// // Initialize SolanaAgentKit
// const solanaKit = new SolanaAgentKit(undefined, "rpc-url");
solanaKit.connection.getRecentPrioritizationFees
// // Create Solana-specific tools
// const tools = createSolanaTools(solanaKit);
// Create Solana-specific tools
const tools = createSolanaTools(solanaKit);
// (async () => {
// // Define a Prompt Template for the Agent
// const prompt = await pull<PromptTemplate>("hwchase17/react");
(async () => {
// Define a Prompt Template for the Agent
const prompt = await pull<PromptTemplate>("hwchase17/react");
// // Create an LLM Chain
// const llm = new OpenAI({
// modelName: "gpt-4o-mini",
// temperature: 0,
// });
// Create an LLM Chain
const llm = new OpenAI({
modelName: "gpt-4o-mini",
temperature: 0,
});
// const agent = await createReactAgent({
// llm,
// tools,
// prompt,
// });
const agent = await createReactAgent({
llm,
tools,
prompt,
});
// const agentExecutor = new AgentExecutor({
// agent,
// tools,
// maxIterations: 50,
// });
const agentExecutor = new AgentExecutor({
agent,
tools,
maxIterations: 50,
});
// const result = await agentExecutor.invoke({
// input: "Deploy a token with 6 decimals ",
// });
const result = await agentExecutor.invoke({
input:
"Deploy a token with 6 decimals ",
});
console.log(result);
})();
// console.log(result);
// })();