Skip to main content

@elizaos/core v1.0.6 / ILpService

Class: abstract ILpService

Abstract interface for a Liquidity Pool Service. DEX-specific plugins (e.g., for Orca, Raydium) must implement this service to allow the LP Manager to interact with them in a standardized way.

Extends​

Properties​

serviceType​

readonly static serviceType: "lp" = 'lp'

Service type

Overrides​

Service.serviceType

Defined in​

packages/core/src/types/lp.ts:62


capabilityDescription​

readonly capabilityDescription: "Provides standardized access to DEX liquidity pools." = 'Provides standardized access to DEX liquidity pools.'

Service name

Overrides​

Service.capabilityDescription

Defined in​

packages/core/src/types/lp.ts:64


runtime​

protected runtime: IAgentRuntime

Runtime instance

Inherited from​

Service.runtime

Defined in​

packages/core/src/types/service.ts:105


config?​

optional config: Metadata

Service configuration

Inherited from​

Service.config

Defined in​

packages/core/src/types/service.ts:122

Methods​

getDexName()​

abstract getDexName(): string

Returns the name of the DEX this service interacts with.

Returns​

string

The name of the DEX (e.g., "Orca", "Raydium").

Defined in​

packages/core/src/types/lp.ts:70


getPools()​

abstract getPools(tokenAMint?, tokenBMint?): Promise<PoolInfo[]>

Fetches a list of available liquidity pools from the DEX.

Parameters​

• tokenAMint?: string

Optional: Filter pools by the mint address of the first token.

• tokenBMint?: string

Optional: Filter pools by the mint address of the second token.

Returns​

Promise<PoolInfo[]>

A promise that resolves to an array of standardized PoolInfo objects.

Defined in​

packages/core/src/types/lp.ts:78


addLiquidity()​

abstract addLiquidity(params): Promise<TransactionResult & object>

Adds liquidity to a specified pool.

Parameters​

• params

The parameters for adding liquidity.

• params.userVault: any

• params.poolId: string

• params.tokenAAmountLamports: string

• params.tokenBAmountLamports?: string

• params.slippageBps: number

• params.tickLowerIndex?: number

• params.tickUpperIndex?: number

Returns​

Promise<TransactionResult & object>

A promise resolving to a transaction result, including the LP tokens received.

Defined in​

packages/core/src/types/lp.ts:85


removeLiquidity()​

abstract removeLiquidity(params): Promise<TransactionResult & object>

Removes liquidity from a specified pool.

Parameters​

• params

The parameters for removing liquidity.

• params.userVault: any

• params.poolId: string

• params.lpTokenAmountLamports: string

• params.slippageBps: number

Returns​

Promise<TransactionResult & object>

A promise resolving to a transaction result, including the tokens received.

Defined in​

packages/core/src/types/lp.ts:100


getLpPositionDetails()​

abstract getLpPositionDetails(userAccountPublicKey, poolOrPositionIdentifier): Promise<LpPositionDetails>

Fetches the details of a specific LP position for a user.

Parameters​

• userAccountPublicKey: string

The user's wallet public key.

• poolOrPositionIdentifier: string

The identifier for the pool or a specific position (e.g., position NFT mint).

Returns​

Promise<LpPositionDetails>

A promise resolving to the position details or null if not found.

Defined in​

packages/core/src/types/lp.ts:113


getMarketDataForPools()​

abstract getMarketDataForPools(poolIds): Promise<Record<string, Partial<PoolInfo>>>

Fetches the latest market data (e.g., APY, TVL) for a list of pools.

Parameters​

• poolIds: string[]

An array of pool IDs to fetch data for.

Returns​

Promise<Record<string, Partial<PoolInfo>>>

A promise resolving to a map of pool IDs to their partial market data.

Defined in​

packages/core/src/types/lp.ts:123


start()​

static start(_runtime): Promise<Service>

Start service connection

Parameters​

• _runtime: IAgentRuntime

Returns​

Promise<Service>

Inherited from​

Service.start

Defined in​

packages/core/src/types/service.ts:125


stop()​

static stop(_runtime): Promise<unknown>

Stop service connection

Parameters​

• _runtime: IAgentRuntime

Returns​

Promise<unknown>

Inherited from​

Service.stop

Defined in​

packages/core/src/types/service.ts:130