Documentation Index
Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
Use this file to discover all available pages before exploring further.
Core Functions
createFeeVault
Creates a fee vault.
Function
async createFeeVault(params: CreateFeeVaultParam): Promise<Transaction>
Parameters
interface CreateFeeVaultParams {
feeVault: PublicKey; // The fee vault address
tokenMint: PublicKey; // The token mint address
tokenProgram: PublicKey; // The token program address
owner: PublicKey; // The owner of the fee vault
payer: PublicKey; // The wallet that will pay for the transaction
userShare: UserShare[]; // The user share of the fee vault
}
interface UserShare {
address: PublicKey; // The user address
share: number; // The user share
}
Returns
A transaction that can be signed and sent to the network.
Example
const feeVault = Keypair.generate();
const transaction = await client.createFeeVault({
feeVault: feeVault.publicKey,
tokenMint: new PublicKey("tokenMint1234567890abcdefghijklmnopqrstuvwxyz"),
tokenProgram: TOKEN_PROGRAM_ID,
owner: owner.publicKey,
payer: payer.publicKey,
userShare: [
{
address: new PublicKey("user1234567890abcdefghijklmnopqrstuvwxyz"),
share: 60,
},
{
address: new PublicKey("user1234567890abcdefghijklmnopqrstuvwxyz"),
share: 40,
},
],
});
Notes
- The
payer and feeVault is required to sign the transaction.
UserShare is an array of objects with address and share.
- Minimum: At least 2 users must be included
- Maximum: No more than 5 users can be included
createFeeVaultPda
Creates a fee vault PDA.
Function
async createFeeVaultPda(params: CreateFeeVaultPdaParams): Promise<Transaction>
Parameters
interface CreateFeeVaultParams {
base: PublicKey; // The base address
tokenMint: PublicKey; // The token mint address
owner: PublicKey; // The owner of the fee vault
payer: PublicKey; // The wallet that will pay for the transaction
userShare: UserShare[]; // The user share of the fee vault
}
interface UserShare {
address: PublicKey; // The user address
share: number; // The user share
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = Keypair.generate();
const transaction = await client.createFeeVaultPda({
base: base.publicKey,
tokenMint: new PublicKey("tokenMint1234567890abcdefghijklmnopqrstuvwxyz"),
owner: owner.publicKey,
payer: payer.publicKey,
userShare: [
{
address: new PublicKey("user1234567890abcdefghijklmnopqrstuvwxyz"),
share: 60,
},
{
address: new PublicKey("user1234567890abcdefghijklmnopqrstuvwxyz"),
share: 40,
},
],
});
Notes
- The
payer and base is required to sign the transaction.
UserShare is an array of objects with address and share.
- Minimum: At least 2 users must be included
- Maximum: No more than 5 users can be included
fundFeeVault
Funds the fee vault.
Function
async fundFeeVault(params: FundFeeVaultParams): Promise<Transaction>
Parameters
interface FundFeeVaultParams {
fundAmount: BN; // The amount to fund
feeVault: PublicKey; // The fee vault address
funder: PublicKey; // The funder address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.fundFeeVault({
fundAmount: new BN(1000000),
feeVault: new PublicKey("user1234567890abcdefghijklmnopqrstuvwxyz"),
funder: funder.publicKey,
});
Notes
- The
funder is required to sign the transaction.
fundByClaimDammV2Fee
Funds the fee vault by claiming fee from a DAMM v2 pool.
Function
async fundByClaimDammV2Fee(params: FundByClaimDammV2FeeParams): Promise<Transaction>
Parameters
interface FundByClaimDammV2FeeParams {
signer: PublicKey; // The signer of the transaction
owner: PublicKey; // The owner of the fee vault
feeVault: PublicKey; // The fee vault address
dammV2Pool: PublicKey; // The DAMM v2 pool address
dammV2Position: PublicKey; // The DAMM v2 position address
dammV2PositionNftAccount: PublicKey; // The DAMM v2 position NFT account address
dammV2PoolState?: PoolState; // The DAMM v2 pool state
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz");
const tokenMint = new PublicKey("So11111111111111111111111111111111111111112");
const feeVault = deriveFeeVaultPdaAddress(base, tokenMint);
const transaction = await client.fundByClaimDammV2Fee({
signer: signer.publicKey,
owner: owner.publicKey,
feeVault,
dammV2Pool: new PublicKey("dammv2Pool1234567890abcdefghijklmnopqrstuvwxyz"),
dammV2Position: new PublicKey(
"dammv2Position1234567890abcdefghijklmnopqrstuvwxyz"
),
dammV2PositionNftAccount: new PublicKey(
"dammv2PositionNftAccount1234567890abcdefghijklmnopqrstuvwxyz"
),
});
Notes
- The
signer is required to sign the transaction.
- If you have not set the owner of the position NFT account to the fee vault, you can use the
setTokenAccountOwnerTx function to set it.
- The
dammV2PoolState is optional and will be fetched from the network if not provided.
fundByClaimDammV2Reward
Funds the fee vault by claiming reward from a DAMM v2 pool.
Function
async fundByClaimDammV2Reward(params: FundByClaimDammV2RewardParams): Promise<Transaction>
Parameters
interface FundByClaimDammV2RewardParams {
signer: PublicKey; // The signer of the transaction
rewardIndex: number; // The reward index
feeVault: PublicKey; // The fee vault address
dammV2Position: PublicKey; // The DAMM v2 position address
dammV2PositionNftAccount: PublicKey; // The DAMM v2 position NFT account address
dammV2Pool: PublicKey; // The DAMM v2 pool address
dammV2PoolState?: PoolState; // The DAMM v2 pool state
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz");
const tokenMint = new PublicKey("So11111111111111111111111111111111111111112");
const feeVault = deriveFeeVaultPdaAddress(base, tokenMint);
const transaction = await client.fundByClaimDammV2Reward({
signer: signer.publicKey,
rewardIndex: 0,
feeVault,
dammV2Pool: new PublicKey("dammv2Pool1234567890abcdefghijklmnopqrstuvwxyz"),
dammV2Position: new PublicKey(
"dammv2Position1234567890abcdefghijklmnopqrstuvwxyz"
),
dammV2PositionNftAccount: new PublicKey(
"dammv2PositionNftAccount1234567890abcdefghijklmnopqrstuvwxyz"
),
});
Notes
- The
signer is required to sign the transaction.
- The
rewardIndex is the index of the reward to claim.
- The
dammV2PoolState is optional and will be fetched from the network if not provided.
fundByClaimDbcCreatorTradingFee
Funds the fee vault by claiming creator trading fee from a DBC pool.
Function
async fundByClaimDbcCreatorTradingFee(params: FundByClaimDbcCreatorTradingFeeParam): Promise<Transaction>
Parameters
interface FundByClaimDbcCreatorTradingFeeParams {
signer: PublicKey; // The signer of the transaction
creator: PublicKey; // The creator of the fee vault
feeVault: PublicKey; // The fee vault address
poolConfig: PublicKey; // The DBC config address
virtualPool: PublicKey; // The DBC pool address
poolConfigState?: PoolConfig; // The DBC config state
virtualPoolState?: VirtualPool; // The DBC pool state
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz");
const tokenMint = new PublicKey("So11111111111111111111111111111111111111112");
const feeVault = deriveFeeVaultPdaAddress(base, tokenMint);
const transaction = await client.fundByClaimDbcCreatorTradingFee({
signer: signer.publicKey,
creator: creator.publicKey,
feeVault,
poolConfig: new PublicKey("poolConfig1234567890abcdefghijklmnopqrstuvwxyz"),
virtualPool: new PublicKey("virtualPool1234567890abcdefghijklmnopqrstuvwxyz"),
});
Notes
- The
signer is required to sign the transaction.
- The
virtualPoolState is optional and will be fetched from the network if not provided.
- The
poolConfigState is optional and will be fetched from the network if not provided.
- You would need to ensure that the DBC pool config’s creator is the fee vault address.
fundByClaimDbcPartnerTradingFee
Funds the fee vault by claiming partner trading fee from a DBC pool.
Function
async fundByClaimDbcPartnerTradingFee(params: FundByClaimDbcPartnerTradingFeeParams): Promise<Transaction>
Parameters
interface FundByClaimDbcPartnerTradingFeeParams {
signer: PublicKey; // The signer of the transaction
feeClaimer: PublicKey; // The fee claimer of the fee vault
feeVault: PublicKey; // The fee vault address
poolConfig: PublicKey; // The DBC config address
virtualPool: PublicKey; // The DBC pool address
poolConfigState?: PoolConfig; // The DBC config state
virtualPoolState?: VirtualPool; // The DBC pool state
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz");
const tokenMint = new PublicKey("So11111111111111111111111111111111111111112");
const feeVault = deriveFeeVaultPdaAddress(base, tokenMint);
const transaction = await client.fundByClaimDbcPartnerTradingFee({
signer: signer.publicKey,
feeClaimer: feeClaimer.publicKey,
feeVault,
poolConfig: new PublicKey("poolConfig1234567890abcdefghijklmnopqrstuvwxyz"),
virtualPool: new PublicKey("virtualPool1234567890abcdefghijklmnopqrstuvwxyz"),
});
Notes
- The
signer is required to sign the transaction.
- The
virtualPoolState is optional and will be fetched from the network if not provided.
- The
poolConfigState is optional and will be fetched from the network if not provided.
- You would need to ensure that the DBC pool config’s fee claimer is the fee vault address.
fundByWithdrawDbcCreatorSurplus
Funds the fee vault by withdrawing creator surplus from a DBC pool.
Function
async fundByWithdrawDbcCreatorSurplus(params: FundByWithdrawDbcCreatorSurplusParams): Promise<Transaction>
Parameters
interface FundByWithdrawDbcCreatorSurplusParams {
signer: PublicKey; // The signer of the transaction
feeVault: PublicKey; // The fee vault address
poolConfig: PublicKey; // The DBC config address
virtualPool: PublicKey; // The DBC pool address
poolConfigState?: PoolConfig; // The DBC config state
virtualPoolState?: VirtualPool; // The DBC pool state
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz");
const tokenMint = new PublicKey("So11111111111111111111111111111111111111112");
const feeVault = deriveFeeVaultPdaAddress(base, tokenMint);
const transaction = await client.fundByWithdrawDbcCreatorSurplus({
signer: signer.publicKey,
feeVault,
poolConfig: new PublicKey("poolConfig1234567890abcdefghijklmnopqrstuvwxyz"),
virtualPool: new PublicKey("virtualPool1234567890abcdefghijklmnopqrstuvwxyz"),
});
Notes
- The
signer is required to sign the transaction.
- The
virtualPoolState is optional and will be fetched from the network if not provided.
- The
poolConfigState is optional and will be fetched from the network if not provided.
- You would need to ensure that the DBC pool config’s creator is the fee vault address.
fundByWithdrawDbcPartnerSurplus
Funds the fee vault by withdrawing partner surplus from a DBC pool.
Function
async fundByWithdrawDbcPartnerSurplus(params: FundByWithdrawDbcPartnerSurplusParams): Promise<Transaction>
Parameters
interface FundByWithdrawDbcPartnerSurplusParams {
signer: PublicKey; // The signer of the transaction
feeVault: PublicKey; // The fee vault address
poolConfig: PublicKey; // The DBC config address
virtualPool: PublicKey; // The DBC pool address
poolConfigState?: PoolConfig; // The DBC config state
virtualPoolState?: VirtualPool; // The DBC pool state
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz");
const tokenMint = new PublicKey("So11111111111111111111111111111111111111112");
const feeVault = deriveFeeVaultPdaAddress(base, tokenMint);
const transaction = await client.fundByWithdrawDbcPartnerSurplus({
signer: signer.publicKey,
feeVault,
poolConfig: new PublicKey("poolConfig1234567890abcdefghijklmnopqrstuvwxyz"),
virtualPool: new PublicKey("virtualPool1234567890abcdefghijklmnopqrstuvwxyz"),
});
Notes
- The
signer is required to sign the transaction.
- The
virtualPoolState is optional and will be fetched from the network if not provided.
- The
poolConfigState is optional and will be fetched from the network if not provided.
- You would need to ensure that the DBC pool config’s fee claimer is the fee vault address.
fundByWithdrawDbcMigrationFee
Funds the fee vault by withdrawing migration fee from a DBC pool.
Function
async fundByWithdrawDbcMigrationFee(params: FundByWithdrawDbcMigrationFeeParams): Promise<Transaction>
Parameters
interface FundByWithdrawDbcMigrationFeeParams {
signer: PublicKey; // The signer of the transaction
isPartner: boolean; // Whether the fee vault is a partner
feeVault: PublicKey; // The fee vault address
poolConfig: PublicKey; // The DBC config address
virtualPool: PublicKey; // The DBC pool address
poolConfigState?: PoolConfig; // The DBC config state
virtualPoolState?: VirtualPool; // The DBC pool state
}
Returns
A transaction that can be signed and sent to the network.
Example
const base = new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz");
const tokenMint = new PublicKey("So11111111111111111111111111111111111111112");
const feeVault = deriveFeeVaultPdaAddress(base, tokenMint);
const transaction = await client.fundByWithdrawDbcMigrationFee({
signer: signer.publicKey,
isPartner: true,
feeVault,
poolConfig: new PublicKey("poolConfig1234567890abcdefghijklmnopqrstuvwxyz"),
virtualPool: new PublicKey("virtualPool1234567890abcdefghijklmnopqrstuvwxyz"),
});
Notes
- The
signer is required to sign the transaction.
- The
virtualPoolState is optional and will be fetched from the network if not provided.
- The
poolConfigState is optional and will be fetched from the network if not provided.
- You would need to ensure that the DBC pool config’s fee claimer / creator is the fee vault address.
claimUserFee
Claims the fee for the user.
Function
async claimUserFee(claimUserFeeParam: ClaimUserFeeParam): Promise<Transaction>
Parameters
interface ClaimUserFeeParams {
feeVault: PublicKey; // The fee vault address
user: PublicKey; // The user address
payer: PublicKey; // The wallet that will pay for the transaction
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.claimUserFee({
feeVault: new PublicKey("user1234567890abcdefghijklmnopqrstuvwxyz"),
user: user.publicKey,
payer: payer.publicKey,
});
Notes
- The
payer and user is required to sign the transaction.
State Functions
getFeeVault
Get the fee vault state.
Function
async getFeeVault(feeVault: PublicKey): Promise<FeeVault>
Parameters
Returns
A fee vault state object.
Example
const feeVault = await client.getFeeVault(
new PublicKey("vault1234567890abcdefghijklmnopqrstuvwxyz")
});
Notes
- This function returns the fee vault state.
getFeeBreakdown
Get the fee breakdown in the fee vault.
Function
async getFeeBreakdown(feeVault: PublicKey): Promise<{
totalFundedFee: BN;
totalClaimedFee: BN;
totalUnclaimedFee: BN;
userFees: {
address: PublicKey;
totalFee: BN;
feeClaimed: BN;
feeUnclaimed: BN;
}[];
}>
Parameters
Returns
A fee breakdown object.
Example
const feeBreakdown = await client.getFeeBreakdown(
new PublicKey("vault1234567890abcdefghijklmnopqrstuvwxyz")
);
console.log(feeBreakdown);
Notes
- This function returns the fee breakdown object consisting of the total funded fee, total claimed fee, total unclaimed fee, and user fees.
Helper Functions
deriveFeeVaultPdaAddress
Derive the fee vault PDA address.
Function
deriveFeeVaultPdaAddress(base: PublicKey, tokenMint: PublicKey): PublicKey
Parameters
base: PublicKey;
tokenMint: PublicKey;
Returns
A PDA address.
Example
const feeVaultPda = deriveFeeVaultPdaAddress(
new PublicKey("base1234567890abcdefghijklmnopqrstuvwxyz"),
new PublicKey("tokenMint1234567890abcdefghijklmnopqrstuvwxyz")
);
Notes
- This function returns the PDA address of the fee vault.
convertToLamportsBN
Convert to lamports in BN type.
Function
convertToLamportsBN(amount: number | string, tokenDecimal: number): BN
Parameters
amount: number | string;
tokenDecimal: number;
Returns
A token amount in BN type.
Example
const fundAmount = convertToLamportsBN(1, 9);
Notes
- This function returns the lamports in BN type.
setTokenAccountOwnerTx
Set the owner of a token account.
Function
setTokenAccountOwnerTx(tokenAccount: PublicKey, from: PublicKey, to: PublicKey, tokenProgramId: PublicKey): Transaction
Parameters
tokenAccount: PublicKey;
from: PublicKey;
to: PublicKey;
tokenProgramId: PublicKey;
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = setTokenAccountOwnerTx(
new PublicKey("tokenAccount1234567890abcdefghijklmnopqrstuvwxyz"),
from.publicKey,
to.publicKey,
TOKEN_2022_PROGRAM_ID
);
Notes
- This function returns the transaction that can be signed and sent to the network.
- Can be used to transfer DAMM v2 position NFT to the fee vault.