DeFi Plugin

The @solana-agent-kit/plugin-defi plugin provides a comprehensive suite of tools and actions to interact with various DeFi protocols on the Solana blockchain. It enables users to perform a wide range of DeFi operations, including trading, lending, borrowing, and cross-chain bridging.

Installation

Install the plugin alongside the core Solana Agent Kit:

npm install solana-agent-kit @solana-agent-kit/plugin-defi

Integration

Add the DeFi plugin to your agent:

import { SolanaAgentKit } from "solana-agent-kit";
import DefiPlugin from "@solana-agent-kit/plugin-defi";

const agent = new SolanaAgentKit(
  wallet,
  "YOUR_RPC_URL",
  {
    OPENAI_API_KEY: "YOUR_OPENAI_API_KEY",
  }
).use(DefiPlugin);

Available Tools

Adrena

Tool NameDescription
openPerpTradeLongOpen a long perpetual trade
openPerpTradeShortOpen a short perpetual trade
closePerpTradeLongClose a long perpetual trade
closePerpTradeShortClose a short perpetual trade

Flash

Tool NameDescription
flashOpenTradeOpen a flash trade
flashCloseTradeClose a flash trade

Lulo

Tool NameDescription
lendAssetLend an asset
luloLendLend using Lulo
luloWithdrawWithdraw from Lulo

Manifest

Tool NameDescription
limitOrderCreate a limit order
cancelAllOrdersCancel all orders
withdrawAllWithdraw all assets
manifestCreateMarketCreate a market on Manifest

Debridge

Tool NameDescription
checkDebridgeTransactionStatusCheck the status of a Debridge transaction
createDebridgeBridgeOrderCreate a bridge order
executeDebridgeBridgeOrderExecute a bridge order
getBridgeQuoteGet a bridge quote
getDebridgeSupportedChainsGet supported chains for Debridge
getDebridgeTokensInfoGet token information for Debridge

Drift

Tool NameDescription
driftPerpTradeOpen a perpetual trade on Drift
calculatePerpMarketFundingRateCalculate the funding rate for a perpetual market
createVaultCreate a vault
createDriftUserAccountCreate a Drift user account
depositIntoVaultDeposit into a vault
withdrawFromDriftVaultWithdraw from a Drift vault
stakeToDriftInsuranceFundStake to the Drift insurance fund

Openbook

Tool NameDescription
openbookCreateMarketCreate a market on the Openbook DEX

Fluxbeam

Tool NameDescription
fluxBeamCreatePoolCreate a pool on FluxBeam

Orca

Tool NameDescription
orcaClosePositionClose a position on Orca
orcaCreateCLMMCreate a CLMM on Orca
orcaOpenCenteredPositionWithLiquidityOpen a centered position with liquidity on Orca

Raydium

Tool NameDescription
raydiumCreateAmmV4Create an AMM v4 on Raydium
raydiumCreateClmmCreate a CLMM on Raydium
raydiumCreateCpmmCreate a CPMM on Raydium

Solayer

Tool NameDescription
stakeWithSolayerStake SOL with Solayer

Voltr

Tool NameDescription
voltrDepositStrategyDeposit into a Voltr strategy
voltrGetPositionValuesGet position values for Voltr

Sanctum

Tool NameDescription
sanctumSwapLSTSwap LSTs on Sanctum
sanctumAddLiquidityAdd liquidity on Sanctum
sanctumRemoveLiquidityRemove liquidity on Sanctum
sanctumGetLSTAPYGet the APY for LSTs on Sanctum
sanctumGetLSTPriceGet the price of LSTs on Sanctum
sanctumGetLSTTVLGet the TVL for LSTs on Sanctum
sanctumGetOwnedLSTGet owned LSTs on Sanctum

For more detailed information, please refer to the full documentation at docs.sendai.fun.