fixes and renames

This commit is contained in:
Arihant Bansal
2024-12-22 01:20:29 +05:30
parent f84a618c6c
commit ed689f5efd
31 changed files with 510 additions and 440 deletions

View File

@@ -1,16 +1,15 @@
import { VersionedTransaction } from "@solana/web3.js";
import { LuloAccountDetailsResponse } from "../types";
import { SolanaAgentKit } from "../agent";
import { SolanaAgent } from "../index";
/**
* Lend tokens for yields using Lulo
* @param agent SolanaAgentKit instance
* @param agent SolanaAgent instance
* @param amount Amount of USDC to lend
* @returns Transaction signature
*/
export async function lendAsset(
agent: SolanaAgentKit,
amount: number
agent: SolanaAgent,
amount: number,
): Promise<string> {
try {
const response = await fetch(
@@ -23,14 +22,14 @@ export async function lendAsset(
body: JSON.stringify({
account: agent.wallet.publicKey.toBase58(),
}),
}
},
);
const data = await response.json();
// Deserialize the transaction
const luloTxn = VersionedTransaction.deserialize(
Buffer.from(data.transaction, "base64")
Buffer.from(data.transaction, "base64"),
);
// Get a recent blockhash and set it