The ixProvideLiquidityClassic method on the MarketThree class provides liquidity using a combination of base assets and PT tokens. Unlike ixWrapperProvideLiquidity which only takes base assets, this method allows you to supply PT tokens you already hold alongside base assets.
Usage
import { MarketThree, LOCAL_ENV } from "@exponent-labs/exponent-sdk";
import { Connection, PublicKey, Transaction, sendAndConfirmTransaction, Keypair } from "@solana/web3.js";
const connection = new Connection("https://api.mainnet-beta.solana.com");
const market = await MarketThree.load(LOCAL_ENV, connection, marketAddress);
const { ixs, setupIxs, signers } = await market.ixProvideLiquidityClassic({
depositor: wallet.publicKey,
amountBase: 5_000_000_000n,
amountPt: 5_000_000_000n,
minLpOut: 9_000_000_000n,
lowerTickApy: 0.05, // 5% APY
upperTickApy: 0.15, // 15% APY
});
const tx = new Transaction().add(...setupIxs, ...ixs);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet, ...signers]);
The signers array contains the generated LP position keypair. You must include it when signing the transaction.
Required Parameters
| Parameter | Type | Description |
|---|
depositor | PublicKey | The depositor’s wallet public key |
amountBase | bigint | Amount of base asset to provide |
amountPt | bigint | Amount of PT tokens to provide |
minLpOut | bigint | Minimum amount of LP tokens to receive |
lowerTickApy | number | Lower bound APY for the liquidity range |
upperTickApy | number | Upper bound APY for the liquidity range |
Optional Parameters
| Parameter | Type | Description |
|---|
tokenSyDepositor | PublicKey | Intermediate SY token account. Defaults to depositor’s ATA |
tokenYtDepositor | PublicKey | Destination YT token account. Defaults to depositor’s ATA |
tokenPtDepositor | PublicKey | Source PT token account. Defaults to depositor’s ATA |
tokenBaseDepositor | PublicKey | Source base token account. Defaults to depositor’s ATA |
lpPositionParam | Keypair | PublicKey | LP position account. Defaults to a generated Keypair |
Returns
Returns a Promise<PreparedInstruction> with the following structure:
{
ixs: TransactionInstruction[], // Main instructions to execute
setupIxs: TransactionInstruction[], // Setup instructions for creating ATAs
signers?: Keypair[] // Optional signers (lpPosition if generated)
}