import { SolanaAgentKit } from "solana-agent-kit";
import { PublicKey } from "@solana/web3.js";
async function sanctumOperations(agent: SolanaAgentKit) {
try {
// Get APY for different LSTs
const apys = await agent.methods.sanctumGetLstApy([
"INF",
"pwrsol",
"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
"laineSOL"
]);
console.log("LST APYs:", apys);
// Get prices for different LSTs
const prices = await agent.methods.sanctumGetLstPrice([
"INF",
"pwrsol",
"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
"laineSOL"
]);
console.log("LST Prices:", prices);
// Get TVL for different LSTs
const tvl = await agent.methods.sanctumGetLstTvl([
"INF",
"pwrsol",
"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
"laineSOL"
]);
console.log("LST TVL:", tvl);
// Get owned LSTs
const ownedLsts = await agent.methods.sanctumGetOwnedLst();
console.log("Owned LSTs:", ownedLsts);
// Add liquidity to a Sanctum pool
const addLiquidityTx = await agent.methods.sanctumAddLiquidity(
"So11111111111111111111111111111111111111112", // SOL mint
"1000000000", // 1 SOL
"900000000", // Quoted amount
5000 // Priority fee
);
console.log("Add liquidity transaction:", addLiquidityTx);
// Swap LSTs
const swapTx = await agent.methods.sanctumSwapLst(
"So11111111111111111111111111111111111111112", // SOL mint
"1000000000", // 1 SOL
"900000000", // Quoted amount
5000, // Priority fee
"bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1" // bSOL mint
);
console.log("Swap LST transaction:", swapTx);
// Remove liquidity from a Sanctum pool
const removeLiquidityTx = await agent.methods.sanctumRemoveLiquidity(
"So11111111111111111111111111111111111111112", // SOL mint
"1000000000", // 1 SOL
"900000000", // Quoted amount
5000 // Priority fee
);
console.log("Remove liquidity transaction:", removeLiquidityTx);
} catch (error) {
console.error("Sanctum operations failed:", error);
}
}