This commit is contained in:
Arihant Bansal
2024-12-11 02:05:22 +05:30
parent b943dbb23e
commit 12af3c434f
3 changed files with 6 additions and 16 deletions

View File

@@ -104,9 +104,7 @@ import { PublicKey } from '@solana/web3.js';
const signature = await lendAsset(
agent,
new PublicKey('asset-mint'),
100, // amount
"lulo-api-key"
);
```

View File

@@ -13,7 +13,7 @@ import {
getLendingDetails,
getTPS,
} from "../tools";
import { CollectionOptions, LuloDepositAssetMint } from "../types";
import { CollectionOptions } from "../types";
import { DEFAULT_OPTIONS } from "../constants";
/**
@@ -96,12 +96,8 @@ export class SolanaAgentKit {
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 lendAssets(amount: number) {
return lendAsset(this, amount);
}
async fetchLendingDetails(LULO_API_KEY: string) {

View File

@@ -193,7 +193,7 @@ 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}";
"Lend idle assets for yield using Lulo. Input should be JSON with: {amount: number}";
constructor(private solanaKit: SolanaAgentKit) {
super();
@@ -201,13 +201,9 @@ export class SolanaLendAssetTool extends Tool {
async _call(input: string): Promise<string> {
try {
const { asset, amount, luloApiKey } = JSON.parse(input);
const { amount } = JSON.parse(input);
const tx = await this.solanaKit.lendAssets(
new PublicKey(asset),
amount,
luloApiKey,
);
const tx = await this.solanaKit.lendAssets(amount);
return `Asset lent successfully. Transaction: ${tx}`;
} catch (error: any) {