DBC TypeScript SDK
Typescript SDK for interacting with the Dynamic Bonding Curve on Meteora.
Getting Started
For an overview on how Dynamic Bonding Curve works, please read this.
This SDK provides a set of tools and methods to interact with the Meteora Dynamic Bonding Curve. It enables developers to easily create and manage dynamic bonding curves, with support for custom configurations and fee structures.
Program Repo: https://github.com/MeteoraAg/dynamic-bonding-curve
SDK on Github: https://github.com/MeteoraAg/ts-sdk
DBC Migrator Keeper docs: https://github.com/MeteoraAg/dbc-keeper
Installation
npm install @meteora-ag/dynamic-bonding-curve-sdk
# or
pnpm install @meteora-ag/dynamic-bonding-curve-sdk
# or
yarn add @meteora-ag/dynamic-bonding-curve-sdk
Initialization
import { Connection } from '@solana/web3.js'
import { DynamicBondingCurveClient } from '@meteora-ag/dynamic-bonding-curve-sdk'
const connection = new Connection('https://api.mainnet-beta.solana.com')
const client = new DynamicBondingCurveClient(connection, 'confirmed')
Test
bun install
bun test
Program ID address:
Mainnet-beta:
dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN
Devnet:
dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN
Example Flow
Partner will create a unique config key, that includes all configuration for their Dynamic Bonding Curve (DBC) on their platform (e.g. a launchpad).
This can be done using the DBC SDK
Creators (users of the platform) can create a token and create a Dynamic Bonding Curve pool using this unique partner config key
Trading platforms (e.g. Jupiter, trading bots) can swap with the Dynamic Bonding Curve pool
When the DBC pool reaches a pre-defined minimum quote threshold, no one can swap with that pool anymore
For the last swap that makes the DBC reach the minimum quote threshold and migrate the token liquidity to an actual liquidity pool, there might be some spare base tokens that do not match exactly with the last intended swap amount. In such scenarios, Partners can use the
partial fill
instruction to help users fill only a portion of the their swap amount. Alternatively, Jupiter can use theexact out
instruction, to achieve the same result.Meteora's migrator keeper service then migrates the DBC pool by sending a crank to create a new Meteora Dynamic AMM v1 or v2 pool
The last swap will create a surplus on the quote token, that will be shared between the creator, partner, and the protocol (Meteora). The current allocation:
Creator: 40% of the surplus amount
Partner: 40% of the surplus amount
Meteora: 20% of the surplus amount
Upon migration LP tokens are locked by the launchpad, with fees claimable by the partner or creator. This is optional and can be configured as part of the config key.
Key Parameters for configuration
Partner can specify these parameters when they create a configuration on all their pools:
pool_fees
: includebase_fee
anddynamic_fee
(optional). Partner can add fee scheduler inbase_fee
or just a fixed fee.pool_fees
defines the trading fee for any pool that is created from this configuration.collect_fee_mode
(0 | 1
):0
means the virtual pool will only collect fee in quote token,1
means virtual pool will collect fee in both tokens.migration_option
: right now we only support migration to Meteora DAMM, so partner must set the value as0
for this field.activation_type
(0 | 1
):0
means slot,1
means timestamp, this field indicates the time unit that pool will work with, mostly in calculating fee scheduler and dynamic fee.token_type
(0 | 1
):0
means SPL Token,1
means Token2022.token_decimal
: the token decimals that the token will use when user creates the virtual pool with this configuration, we only support token decimals from 6 to 9.partner_lp_percentage
: the percentage of LP that partner can claim after token is migrated.partner_locked_lp_percentage
: the percentage of LP that partner will locked permanently after token is migrated.creator_lp_percentage
: the percentage of LP that creator can claim after token is migrated.creator_locked_lp_percentage
: the percentage of LP that creator will be locked permanently after token is migrated.migration_quote_threshold
: the threhold for quote token, that after virtual pool reserve get such quote token amount, the token will graduate from the launch pool and will be migrated.fee_claimer
: the address of partner that can claim trading fees from the virtual pools as well as fees from the locked LPs.owner
: owner of the configuration.quote_mint
: the quote mint address that virtual pool will support.locked_vesting
: locked vesting for creator after token is migrated (token will be migrated to Jup lock)migration_fee_option
: allow partner to choose a fee option on graduated pool (currently support 0.25% | 0.3% | 1% | 2% | 4% | 6%)token_supply
: when the fields are specified, token will have fixed supply in pre and post migration, leftover will be returned to leftover_receiver (configured in config key)sqrt_start_price
: square root of min price in the bonding curve for the virtual pools.curve
: an array of square price and liquidity, that defines the liquidity distribution for the virtual pools.
Example math to build a simple curve (constant-product) from your parameters
initial base reserve: x tokens (a decimals)
initial quote reserve: y tokens (b decimals) (SOL)
migration threshold: z tokens (SOL)
Calculate price = y * (10^(b-a)) / x (pls keep floating point)
Calculate sqrtStartPrice = floor(sqrt(price) * 2^64) (cut all floating point)
Set maxSqrtPrice = 79226673521066979257578248091
Calculate liquidity:
liquidity = z * 10^b * 2^128 / (maxSqrtPrice - sqrtStartPrice)
Set curve:
curve = [{sqrtPrice: maxSqrtPrice, liquidity=liquidity}]
Post-Migration Graduated Pool Config key
Using the parameter migration_fee_option
partners can choose a fee option for the graduated pool.
DAMM V1
Current fee tiers supported: 0.25% | 0.3% | 1% | 2% | 4% | 6% which corresponds to 0 | 1 | 2 | 3 | 4 | 5 below.
MigrationFeeOption.FixedBps25 == 0: 8f848CEy8eY6PhJ3VcemtBDzPPSD4Vq7aJczLZ3o8MmX
MigrationFeeOption.FixedBps30 == 1: HBxB8Lf14Yj8pqeJ8C4qDb5ryHL7xwpuykz31BLNYr7S
MigrationFeeOption.FixedBps100 == 2: 7v5vBdUQHTNeqk1HnduiXcgbvCyVEZ612HLmYkQoAkik
MigrationFeeOption.FixedBps200 == 3: EkvP7d5yKxovj884d2DwmBQbrHUWRLGK6bympzrkXGja
MigrationFeeOption.FixedBps400 == 4: 9EZYAJrcqNWNQzP2trzZesP7XKMHA1jEomHzbRsdX8R2
MigrationFeeOption.FixedBps600 == 5: 8cdKo87jZU2R12KY1BUjjRPwyjgdNjLGqSGQyrDshhud
DAMM V2
Current fee tiers supported: 0.25% | 0.3% | 1% | 2% | 4% | 6% which corresponds to 0 | 1 | 2 | 3 | 4 | 5 below.
migration_fee_option == 0: 7F6dnUcRuyM2TwR8myT1dYypFXpPSxqwKNSFNkxyNESd
migration_fee_option == 1: 2nHK1kju6XjphBLbNxpM5XRGFj7p9U8vvNzyZiha1z6k
migration_fee_option == 2: Hv8Lmzmnju6m7kcokVKvwqz7QPmdX9XfKjJsXz8RXcjp
migration_fee_option == 3: 2c4cYd4reUYVRAB9kUUkrq55VPyy2FNQ3FDL4o12JXmq
migration_fee_option == 4: AkmQWebAwFvWk55wBoCr5D62C6VVDTzi84NJuD9H7cFD
migration_fee_option == 5: DbCRBj8McvPYHJG1ukj8RE15h2dCNUdTAESG49XpQ44u
Dynamic Bonding Curve SDK: Function Documentation
You can also find all the functions on Github here.
Main functions
Partner Functions
Pool Functions
Migration Functions
Creator Functions
State Functions
Helper Functions
Partner Functions
createConfig
Creates a new configuration key that will dictate the behavior of all pools created with this key.
Function
async createConfig(createConfigParam: CreateConfigParam): Promise<Transaction>
Parameters
interface CreateConfigParam {
payer: PublicKey // The wallet paying for the transaction
config: PublicKey // The config account address (generated by the partner)
feeClaimer: PublicKey // The wallet that will be able to claim the fee
leftoverReceiver: PublicKey // The wallet that will receive the bonding curve leftover
quoteMint: PublicKey // The quote mint address
poolFees: {
// The pool fees
baseFee: {
cliffFeeNumerator: BN // Initial fee numerator (base fee)
numberOfPeriod: number // The number of reduction periods
reductionFactor: BN // How much fee reduces in each period
periodFrequency: BN // How often fees change
feeSchedulerMode: number // 0: Linear, 1: Exponential
}
dynamicFee: {
// Optional dynamic fee
binStep: number // u16 value representing the bin step in bps
binStepU128: BN // u128 value for a more accurate bin step
filterPeriod: number // Minimum time that must pass between fee updates
decayPeriod: number // Period after the volatility starts decaying (must be > filterPeriod)
reductionFactor: number // Controls how quickly volatility decys over time
variableFeeControl: number // Multiplier that determines how much volatility affects fees
maxVolatilityAccumulator: number // Caps the maximum volatility that can be accumulated
} | null
}
activationType: number // 0: Slot, 1: Timestamp
collectFeeMode: number // 0: Only Quote, 1: Both
migrationOption: number // 0: DAMM V1, 1: DAMM v2
tokenType: number // 0: SPL, 1: Token2022
tokenDecimal: number // The number of decimals for the token
migrationQuoteThreshold: BN // The quote threshold for migration
partnerLpPercentage: number // The percentage of the pool that will be allocated to the partner (0-100)
creatorLpPercentage: number // The percentage of the pool that will be allocated to the creator (0-100)
partnerLockedLpPercentage: number // The percentage of the pool that will be allocated to the partner locked (0-100)
creatorLockedLpPercentage: number // The percentage of the pool that will be allocated to the creator locked (0-100)
sqrtStartPrice: BN // The starting price of the pool
lockedVesting: {
// Optional locked vesting (BN (0) for all fields for no vesting)
amountPerPeriod: BN // The amount of tokens that will be vested per period
cliffDurationFromMigrationTime: BN // The duration of the cliff period
frequency: BN // The frequency of the vesting
numberOfPeriod: BN // The number of periods
cliffUnlockAmount: BN // The amount of tokens that will be unlocked at the cliff
}
migrationFeeOption: number // 0: Fixed 25bps, 1: Fixed 30bps, 2: Fixed 100bps, 3: Fixed 200bps, 4: Fixed 400bps, 5: Fixed 600bps
tokenSupply: {
// Optional token supply
preMigrationTokenSupply: BN // The token supply before migration
postMigrationTokenSupply: BN // The token supply after migration
} | null
creatorTradingFeePercentage: number // The percentage of the trading fee that will be allocated to the creator
padding0: []
padding1: []
curve: {
// The curve of the pool
sqrtPrice: BN // The square root of the curve point price
liquidity: BN // The liquidity of the curve point
}[]
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.partner.createConfig({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
config: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
feeClaimer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
leftoverReceiver: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
quoteMint: new PublicKey('So11111111111111111111111111111111111111112'),
poolFees: {
baseFee: {
cliffFeeNumerator: new BN('2500000'),
numberOfPeriod: 0,
reductionFactor: new BN('0'),
periodFrequency: new BN('0'),
feeSchedulerMode: FeeSchedulerMode.Linear,
},
dynamicFee: {
binStep: 1,
binStepU128: new BN('1844674407370955'),
filterPeriod: 10,
decayPeriod: 120,
reductionFactor: 1000,
variableFeeControl: 100000,
maxVolatilityAccumulator: 100000,
},
},
activationType: 0,
collectFeeMode: 0,
migrationOption: 0
tokenType: 0,
tokenDecimal: 9,
migrationQuoteThreshold: new BN('1000000000'),
partnerLpPercentage: 25,
creatorLpPercentage: 25,
partnerLockedLpPercentage: 25,
creatorLockedLpPercentage: 25,
sqrtStartPrice: new BN('58333726687135158'),
lockedVesting: {
amountPerPeriod: new BN('0'),
cliffDurationFromMigrationTime: new BN('0'),
frequency: new BN('0'),
numberOfPeriod: new BN('0'),
cliffUnlockAmount: new BN('0'),
},
migrationFeeOption: 0,
tokenSupply: {
preMigrationTokenSupply: new BN('10000000000000000000'),
postMigrationTokenSupply: new BN('10000000000000000000'),
},
creatorTradingFeePercentage: 0,
padding0: [],
padding1: [],
curve: [
{
sqrtPrice: new BN('233334906748540631'),
liquidity: new BN('622226417996106429201027821619672729'),
},
{
sqrtPrice: new BN('79226673521066979257578248091'),
liquidity: new BN('1'),
},
],
})
Notes
When creating a new configuration for a dynamic bonding curve, several validations are performed to ensure the parameters are valid:
Pool Fees
Pool fees are required and must be valid
Base fee must have a positive cliff fee numerator
Fee Scheduler
when in linear feeSchedulerMode:
fee = cliff_fee_numerator - (period * reduction_factor)
when in exponential feeSchedulerMode:
fee = cliff_fee_numerator * (1 - reduction_factor/10_000)^period
Fee Mode
Collect fee mode must be either
OnlyQuote
(0) orBoth
(1)
Migration and Token Type
For migration to DAMM v1 (MigrationOption: 0), token type must be type SPL (TokenType: 0)
Activation Type
Must be either Slot (0) or Timestamp (1)
Migration Fee
Must be a valid option: FixedBps25 (0), FixedBps30 (1), FixedBps100 (2), FixedBps200 (3), FixedBps400 (4), FixedBps600 (5)
Token Decimals
Must be between 6 and 9
LP Percentages
The sum of partner LP, creator LP, partner locked LP, and creator locked LP percentages must equal 100
Migration Quote Threshold
Must be greater than 0
Price
Square root start price must be within valid range (MIN_SQRT_PRICE to MAX_SQRT_PRICE)
Curve
Must have at least one point and not exceed MAX_CURVE_POINT
First curve point must have sqrt price greater than start price and positive liquidity
Curve points must be in ascending order by sqrt price
All points must have positive liquidity
Last point's sqrt price must not exceed MAX_SQRT_PRICE
Locked Vesting
If not default (all zeros), must have valid frequency and total amount greater than 0
Token Supply
Must be valid in relation to swap base amount, migration base amount, and locked vesting
Post-migration supply must not exceed pre-migration supply
Total required tokens (swap + migration + vesting) must not exceed pre-migration supply
Leftover receiver must be a valid PublicKey (not default/zero address)
buildCurveAndCreateConfig
Builds a new constant product config with customisable parameters based on percentage of supply on migration and migration quote threshold. This creates a new configuration key that will dictate the behavior of all pools created with this key.
Function
async buildCurveAndCreateConfig(buildCurveAndCreateConfigParam: BuildCurveAndCreateConfigParam): Promise<Transaction>
Parameters
interface BuildCurveAndCreateConfigParam {
buildCurveParam: {
totalTokenSupply: number // The total token supply
percentageSupplyOnMigration: number // The percentage of the supply that will be migrated
migrationQuoteThreshold: number // The quote threshold for migration
migrationOption: number // 0: DAMM V1, 1: DAMM v2
tokenBaseDecimal: number // The number of decimals for the base token
tokenQuoteDecimal: number // The number of decimals for the quote token
lockedVesting: {
// Optional locked vesting (BN (0) for all fields for no vesting)
amountPerPeriod: BN // The amount of tokens that will be vested per period
cliffDurationFromMigrationTime: BN // The duration of the cliff period
frequency: BN // The frequency of the vesting
numberOfPeriod: BN // The number of periods
cliffUnlockAmount: BN // The amount of tokens that will be unlocked at the cliff
}
feeSchedulerParam: {
// Optional fee scheduler (BN (0) for all fields for no fee scheduler)
numberOfPeriod: number // The number of periods
reductionFactor: number // The reduction factor
periodFrequency: number // The frequency of the fee reduction
feeSchedulerMode: number // 0: Linear, 1: Exponential
}
baseFeeBps: number // The base fee in bps
dynamicFeeEnabled: boolean // Whether dynamic fee is enabled (true: enabled, false: disabled)
activationType: number // 0: Slot, 1: Timestamp
collectFeeMode: number // 0: Only Quote, 1: Both
migrationFeeOption: number // 0: Fixed 25bps, 1: Fixed 30bps, 2: Fixed 100bps, 3: Fixed 200bps, 4: Fixed 400bps, 5: Fixed 600bps
tokenType: number // 0: SPL, 1: Token2022
partnerLpPercentage: number // The percentage of the pool that will be allocated to the partner
creatorLpPercentage: number // The percentage of the pool that will be allocated to the creator
partnerLockedLpPercentage: number // The percentage of the pool that will be allocated to the partner locked
creatorLockedLpPercentage: number // The percentage of the pool that will be allocated to the creator locked
creatorTradingFeePercentage: number // The percentage of the trading fee that will be allocated to the creator
}
feeClaimer: PublicKey // The wallet that will be able to claim the fee
leftoverReceiver: PublicKey // The wallet that will receive the bonding curve leftover
payer: PublicKey // The wallet that will pay for the transaction
quoteMint: PublicKey // The quote mint address
config: PublicKey // The config account address (generated by the partner)
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.partner.buildCurveAndCreateConfig({
buildCurveParam: {
totalTokenSupply: 1000000000,
percentageSupplyOnMigration: 3,
migrationQuoteThreshold: 0.5,
migrationOption: 0,
tokenBaseDecimal: 9,
tokenQuoteDecimal: 9,
lockedVesting: {
amountPerPeriod: new BN(1000000),
cliffDurationFromMigrationTime: new BN(0),
frequency: new BN(30 * 24 * 60 * 60),
numberOfPeriod: new BN(12),
cliffUnlockAmount: new BN(5000000),
},
feeSchedulerParam: {
numberOfPeriod: 0,
reductionFactor: 0,
periodFrequency: 0,
feeSchedulerMode: 0,
},
baseFeeBps: 100,
dynamicFeeEnabled: true,
activationType: 0,
collectFeeMode: 0,
migrationFeeOption: 0,
tokenType: 0,
partnerLpPercentage: 25,
creatorLpPercentage: 25,
partnerLockedLpPercentage: 25,
creatorLockedLpPercentage: 25,
creatorTradingFeePercentage: 0,
},
feeClaimer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
leftoverReceiver: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
quoteMint: new PublicKey('So11111111111111111111111111111111111111112'),
config: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
})
Notes
Same validation checks as createConfig
Use
createConfig
when you understand the bonding curve math and want more customization to the curve structureUse
buildCurveAndCreateConfig
when you want to create a curve structure based on percentage of supply on migration and migration quote threshold. We handle the math for you.
buildCurveAndCreateConfigByMarketCap
Builds a new constant product config with customisable parameters based on market cap. This creates a new configuration key that will dictate the behavior of all pools created with this key.
Function
async buildCurveAndCreateConfigByMarketCap(buildCurveAndCreateConfigByMarketCapParam: BuildCurveAndCreateConfigByMarketCapParam): Promise<Transaction>
Parameters
interface BuildCurveAndCreateConfigByMarketCapParam {
buildCurveByMarketCapParam: {
totalTokenSupply: number // The total token supply
initialMarketCap: number // The initial market cap
migrationMarketCap: number // The migration market cap
migrationOption: number // 0: DAMM V1, 1: DAMM v2
tokenBaseDecimal: number // The number of decimals for the base token
tokenQuoteDecimal: number // The number of decimals for the quote token
lockedVesting: {
// Optional locked vesting (BN (0) for all fields for no vesting)
amountPerPeriod: BN // The amount of tokens that will be vested per period
cliffDurationFromMigrationTime: BN // The duration of the cliff period
frequency: BN // The frequency of the vesting
numberOfPeriod: BN // The number of periods
cliffUnlockAmount: BN // The amount of tokens that will be unlocked at the cliff
}
feeSchedulerParam: {
// Optional fee scheduler (BN (0) for all fields for no fee scheduler)
numberOfPeriod: number // The number of periods
reductionFactor: number // The reduction factor
periodFrequency: number // The frequency of the fee reduction
feeSchedulerMode: number // 0: Linear, 1: Exponential
}
baseFeeBps: number // The base fee in bps
dynamicFeeEnabled: boolean // Whether dynamic fee is enabled (true: enabled, false: disabled)
activationType: number // 0: Slot, 1: Timestamp
collectFeeMode: number // 0: Only Quote, 1: Both
migrationFeeOption: number // 0: Fixed 25bps, 1: Fixed 30bps, 2: Fixed 100bps, 3: Fixed 200bps, 4: Fixed 400bps, 5: Fixed 600bps
tokenType: number // 0: SPL, 1: Token2022
partnerLpPercentage: number // The percentage of the pool that will be allocated to the partner
creatorLpPercentage: number // The percentage of the pool that will be allocated to the creator
partnerLockedLpPercentage: number // The percentage of the pool that will be allocated to the partner locked
creatorLockedLpPercentage: number // The percentage of the pool that will be allocated to the creator locked
creatorTradingFeePercentage: number // The percentage of the trading fee that will be allocated to the creator
}
feeClaimer: PublicKey // The wallet that will be able to claim the fee
leftoverReceiver: PublicKey // The wallet that will receive the bonding curve leftover
payer: PublicKey // The wallet that will pay for the transaction
quoteMint: PublicKey // The quote mint address
config: PublicKey // The config account address (generated by the partner)
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.partner.buildCurveAndCreateConfigByMarketCap({
buildCurveByMarketCapParam: {
totalTokenSupply: 1000000000,
initialMarketCap: 98.58,
migrationMarketCap: 3187.61,
migrationOption: 0,
tokenBaseDecimal: 9,
tokenQuoteDecimal: 9,
lockedVesting: {
amountPerPeriod: new BN(0),
cliffDurationFromMigrationTime: new BN(0),
frequency: new BN(0),
numberOfPeriod: new BN(0),
cliffUnlockAmount: new BN(0),
},
feeSchedulerParam: {
numberOfPeriod: 0,
reductionFactor: 0,
periodFrequency: 0,
feeSchedulerMode: 0,
},
baseFeeBps: 100,
dynamicFeeEnabled: true,
activationType: 0,
collectFeeMode: 0,
migrationFeeOption: 0,
tokenType: TokenType.SPL,
partnerLpPercentage: 25,
creatorLpPercentage: 25,
partnerLockedLpPercentage: 25,
creatorLockedLpPercentage: 25,
creatorTradingFeePercentage: 0,
},
feeClaimer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
leftoverReceiver: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
quoteMint: new PublicKey('So11111111111111111111111111111111111111112'),
config: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
})
Notes
Same validation checks as createConfig
Use
createConfig
when you understand the bonding curve math and want more customization to the curve structureUse
buildCurveAndCreateConfigByMarketCap
when you want to create a curve structure based on market cap. We handle the math for you.
createPartnerMetadata
Creates a new partner metadata account. This partner metadata will be tagged to a wallet address that holds the config keys.
Function
async createPartnerMetadata(createPartnerMetadataParam: CreatePartnerMetadataParam): Promise<Transaction>
Parameters
interface CreatePartnerMetadataParam {
name: string // The name of the partner
website: string // The website of the partner
logo: string // The logo of the partner
feeClaimer: PublicKey // The wallet that will be able to claim the fee
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.partner.createPartnerMetadata({
name: 'Meteora',
website: 'https://meteora.ag',
logo: 'https://launch.meteora.ag',
feeClaimer: wallet.publicKey,
payer: wallet.publicKey,
})
claimPartnerTradingFee
Claims the trading fee for the partner.
Function
async claimPartnerTradingFee(claimTradingFeeParam: ClaimTradingFeeParam): Promise<Transaction>
Parameters
interface ClaimTradingFeeParam {
pool: PublicKey // The pool address
feeClaimer: PublicKey // The wallet that will claim the fee
maxBaseAmount: BN // The maximum base amount to claim (use 0 to not claim base tokens)
maxQuoteAmount: BN // The maximum quote amount to claim (use 0 to not claim quote tokens)
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.partner.claimPartnerTradingFee({
pool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
feeClaimer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
maxBaseAmount: new BN(1000000),
maxQuoteAmount: new BN(1000000),
})
Notes
The feeClaimer of the pool must be the same as the feeClaimer in the
ClaimTradingFeeParam
params.You can indicate maxBaseAmount or maxQuoteAmount to be 0 to not claim Base or Quote tokens respectively.
partnerWithdrawSurplus
Withdraws the partner's surplus from the pool.
Function
async partnerWithdrawSurplus(partnerWithdrawSurplusParam: PartnerWithdrawSurplusParam): Promise<Transaction>
Parameters
interface PartnerWithdrawSurplusParam {
feeClaimer: PublicKey // The wallet that will claim the fee
virtualPool: PublicKey // The virtual pool address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.partner.partnerWithdrawSurplus({
feeClaimer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
})
Notes
The feeClaimer of the pool must be the same as the feeClaimer in the
PartnerWithdrawSurplusParam
params.
Pool Functions
createPool
Creates a new pool with the configuration key.
Function
async createPool(createPoolParam: CreatePoolParam): Promise<Transaction>
Parameters
interface CreatePoolParam {
quoteMint: PublicKey // The quote mint address
baseMint: PublicKey // The base mint address (generated by you)
config: PublicKey // The config account address
baseTokenType: number // The base token type
quoteTokenType: number // The quote token type
name: string // The name of the pool
symbol: string // The symbol of the pool
uri: string // The uri of the pool
payer: PublicKey // The payer of the transaction
poolCreator: PublicKey // The pool creator of the transaction
}
Returns
A transaction that requires signatures from the payer, the baseMint keypair, and the poolCreator before being submitted to the network.
Example
const transaction = await client.pool.createPool({
quoteMint: new PublicKey('So11111111111111111111111111111111111111112'),
baseMint: new PublicKey('0987654321zyxwvutsrqponmlkjihgfedcba'),
config: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
baseTokenType: 0,
quoteTokenType: 0,
name: 'Meteora',
website: 'https://launch.meteora.ag',
logo: 'https://launch.meteora.ag/icons/logo.svg',
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
poolCreator: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
})
Notes
The payer must be the same as the payer in the
CreatePoolParam
params.The poolCreator is required to sign when creating the pool.
The baseMint token type must be the same as the config key's token type.
The quoteMint must be the same as the config key's quoteMint.
createPoolAndBuy
Creates a new pool with the configuration key and buys the token immediately.
Function
async createPoolAndBuy(createPoolAndBuyParam: CreatePoolAndBuyParam): Promise<Transaction>
Parameters
interface CreatePoolAndBuyParam {
createPoolParam: CreatePoolParam // The create pool parameters
buyAmount: BN // The amount of tokens to buy
minimumAmountOut: BN // The minimum amount of tokens to receive
referralTokenAccount: PublicKey | null // The referral token account (optional)
}
Returns
A transaction that requires signatures from the payer, the baseMint keypair, and the poolCreator before being submitted to the network.
Example
const transaction = await client.pool.createPoolAndBuy({
createPoolParam: {
quoteMint: new PublicKey('So11111111111111111111111111111111111111112'),
baseMint: new PublicKey('0987654321zyxwvutsrqponmlkjihgfedcba'),
config: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
baseTokenType: 0,
quoteTokenType: 0,
name: 'Meteora',
website: 'https://launch.meteora.ag',
logo: 'https://launch.meteora.ag/icons/logo.svg',
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
poolCreator: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
},
buyAmount: new BN(0.1 * 1e9),
minimumAmountOut: new BN(1),
referralTokenAccount: null,
})
Notes
The
payer
must be the same as the payer in theCreatePoolParam
params.The
poolCreator
is required to sign when creating the pool.The
baseMint
token type must be the same as the config key's token type.The
quoteMint
must be the same as the config key's quoteMint.The
buyAmount
must be greater than 0.The
minimumAmountOut
parameter protects against slippage. Set it to a value slightly lower than the expected output.The
referralTokenAccount
parameter is an optional token account. If provided, the referral fee will be applied to the transaction.
swap
Swaps between base and quote or quote and base on the Dynamic Bonding Curve.
Function
async swap(pool: PublicKey, swapParam: SwapParam): Promise<Transaction>
Parameters
interface SwapParam {
owner: PublicKey // The person swapping the tokens
amountIn: BN // The amount of quote or base tokens to swap
minimumAmountOut: BN // The minimum amount of quote or base tokens to receive
swapBaseForQuote: boolean // Whether to swap base for quote. true = swap base for quote, false = swap quote for base
poolAddress: PublicKey // The pool address
referralTokenAccount: PublicKey | null // The referral token account (optional)
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.pool.swap({
owner: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
amountIn: new BN(1000000000),
minimumAmountOut: new BN(0),
swapBaseForQuote: false,
poolAddress: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
referralTokenAccount: null,
})
Notes
The owner must have sufficient balance for the swap.
For SOL swaps, the owner needs additional SOL for transaction fees (approximately 0.01 SOL).
When swapping quote for base (buying tokens), set
swapBaseForQuote
tofalse
.When swapping base for quote (selling tokens), set
swapBaseForQuote
totrue
.The
minimumAmountOut
parameter protects against slippage. Set it to a value slightly lower than the expected output.The
referralTokenAccount
parameter is an optional token account. If provided, the referral fee will be applied to the transaction.If the transaction fails with "insufficient balance", check that you have enough tokens plus fees for the transaction.
The pool address can be derived using
client.getDbcPoolAddress(quoteMint, baseMint, config)
.
swapQuote
Gets the swap quotation between base and quote swaps or quote and base swaps.
Function
swapQuote(swapQuoteParam: SwapQuoteParam): Promise<QuoteResult>
Parameters
interface SwapQuoteParam {
virtualPool: VirtualPool
config: PoolConfig
swapBaseForQuote: boolean
amountIn: BN
slippageBps?: number
hasReferral: boolean
currentPoint: BN
}
Returns
The quote result of the swap.
Example
const virtualPoolState = await client.getPool(poolAddress)
const poolConfigState = await client.getPoolConfig(virtualPoolState.config)
const quote = await client.pool.swapQuote({
virtualPool: virtualPoolState, // The virtual pool state
config: poolConfigState, // The pool config state
swapBaseForQuote: false, // Whether to swap base for quote
amountIn: new BN(100000000), // The amount of tokens to swap
slippageBps: 100, // The slippage in basis points (optional)
hasReferral: false, // Whether to include a referral fee
currentPoint: new BN(0), // The current point
})
Notes
The
swapBaseForQuote
parameter determines the direction of the swap:true
: Swap base tokens for quote tokensfalse
: Swap quote tokens for base tokens
The
amountIn
is the amount of tokens you want to swap, denominated in the smallest unit and token decimals. (e.g., lamports for SOL).The
slippageBps
parameter is the slippage in basis points (optional). This will calculate the minimum amount out based on the slippage.The
hasReferral
parameter indicates whether a referral fee should be included in the calculation.The
currentPoint
parameter is typically used in cases where the config has applied a fee scheduler. If activationType == 0, then it is current slot. If activationType == 1, then it is the current block timestamp. You can fill in accordingly based on slot or timestamp.
Migration Functions
createLocker
Creates a new locker account when migrating from Dynamic Bonding Curve to DAMM V1 or DAMM V2.
Function
async createLocker(createLockerParam: CreateLockerParam): Promise<Transaction>
Parameters
interface CreateLockerParam {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.createLocker({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
})
Notes
This function is called when lockedVesting is enabled in the config key.
withdrawLeftover
Withdraws leftover tokens from the Dynamic Bonding Curve pool.
Function
async withdrawLeftover(withdrawLeftoverParam: WithdrawLeftoverParam): Promise<Transaction>
Parameters
interface WithdrawLeftoverParam {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.withdrawLeftover({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
})
Notes
This function is called when there are leftover tokens in the Dynamic Bonding Curve pool.
The leftover tokens will be sent to the
leftoverReceiver
that was specified in the config key.
createDammV1MigrationMetadata
Creates a new DAMM V1 migration metadata account.
Function
async createDammV1MigrationMetadata(createDammV1MigrationMetadataParam: CreateDammV1MigrationMetadataParam): Promise<Transaction>
Parameters
interface CreateDammV1MigrationMetadataParam {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
config: PublicKey // The config address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.createDammV1MigrationMetadata({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
config: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
})
Notes
When migrating to DAMM V1, the
createDammV1MigrationMetadata
function must be the first function called.
migrateToDammV1
Migrates the Dynamic Bonding Curve pool to DAMM V1.
Function
async migrateToDammV1(migrateToDammV1Param: MigrateToDammV1Param): Promise<Transaction>
Parameters
interface MigrateToDammV1Param {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
dammConfig: PublicKey // The damm graduation fee config address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.migrateToDammV1({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
dammConfig: new PublicKey('8f848CEy8eY6PhJ3VcemtBDzPPSD4Vq7aJczLZ3o8MmX'),
})
Notes
When migrating to DAMM V1, the flow would be the following:
createDammV1MigrationMetadata
createLocker
(if the token has locked vesting)migrateToDammV1
lockDammV1LpToken
(if creatorLp or partnerLp is >0)claimDammV1LpToken
(if creatorLp or partnerLp is >0)
Ensure that when attempting to migrate the virtual pool, all these validation checks pass:
The
MigrationFeeOption
must be a valid enum value with a valid base fee in basis pointsThe pool's config account must have:
pool_creator_authority matching the pool_authority key
activation_duration set to 0
partner_fee_numerator set to 0
vault_config_key set to the default Pubkey (all zeros)
The virtual pool's migration progress must be in the LockedVesting state
The pool must be "complete" based on the migration_quote_threshold (checked via is_curve_complete)
The migration option must be valid and specifically set to MeteoraDamm
The account relationships must be valid:
virtual_pool must have matching base_vault and quote_vault
virtual_pool must have a matching config
migration_metadata must have a matching virtual_pool
You can get the dammConfig key from the README.md
lockDammV1LpToken
Locks a DAMM V1 LP token for a partner or creator.
Function
async lockDammV1LpToken(lockDammV1LpTokenParam: DammLpTokenParam): Promise<Transaction>
Parameters
interface DammLpTokenParam {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
dammConfig: PublicKey // The damm graduation fee config address
isPartner: boolean // Whether the LP token is a partner
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.lockDammV1LpToken({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
dammConfig: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
isPartner: true,
})
Notes
This function is called when the creator or partner would like to lock their LP tokens.
claimDammV1LpToken
Claims a DAMM V1 LP token for a partner or creator.
Function
async claimDammV1LpToken(claimDammV1LpTokenParam: DammLpTokenParam): Promise<Transaction>
Parameters
interface DammLpTokenParam {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
dammConfig: PublicKey // The damm graduation fee config address
isPartner: boolean // Whether the LP token is a partner
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.claimDammV1LpToken({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
dammConfig: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
isPartner: true,
})
Notes
This function is called when the creator or partner would like to claim their LP tokens.
createDammV2MigrationMetadata
Creates a new DAMM V2 migration metadata account.
Function
async createDammV2MigrationMetadata(createDammV2MigrationMetadataParam: CreateDammV2MigrationMetadataParam): Promise<Transaction>
Parameters
interface CreateDammV2MigrationMetadataParam {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
config: PublicKey // The config address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.createDammV2MigrationMetadata({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
config: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
})
Notes
When migrating to DAMM V2, the
createDammV2MigrationMetadata
function must be the first function called.
migrateToDammV2
Migrates the Dynamic Bonding Curve pool to DAMM V2.
Function
async migrateToDammV2(migrateToDammV2Param: MigrateToDammV2Param): Promise<Transaction>
Parameters
interface MigrateToDammV2Param {
payer: PublicKey // The payer of the transaction
virtualPool: PublicKey // The virtual pool address
dammConfig: PublicKey // The damm graduation fee config address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.migration.migrateToDammV2({
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
dammConfig: new PublicKey('7F6dnUcRuyM2TwR8myT1dYypFXpPSxqwKNSFNkxyNESd'),
})
Notes
When migrating to DAMM V2, the flow would be the following:
createDammV2MigrationMetadata
createLocker
(if the token has locked vesting)migrateToDammV2
Ensure that when attempting to migrate the virtual pool, all these validation checks pass:
The
MigrationFeeOption
must be a valid enum value with a valid base fee in basis pointsFor fixed BPS fee options (25, 30, 100, 200, 400, 600), the pool_fees.base_fee.period_frequency must be 0
The pool's config account must have:
pool_creator_authority matching the pool_authority key
partner_fee_percent set to 0
sqrt_min_price equal to MIN_SQRT_PRICE
sqrt_max_price equal to MAX_SQRT_PRICE
vault_config_key set to the default Pubkey (all zeros)
The virtual pool's migration progress must be in the LockedVesting state
The pool must be "complete" based on the migration_quote_threshold (checked via is_curve_complete)
The migration option must be valid and specifically set to DammV2
The account relationships must be valid:
virtual_pool must have matching base_vault and quote_vault
virtual_pool must have a matching config
migration_metadata must have a matching virtual_pool
first_position_nft_mint must not equal second_position_nft_mint
Exactly one remaining account must be provided (for the DAMM V2 config)
You can get the dammConfig key from the README.md
Creator Functions
createPoolMetadata
Creates a new pool metadata account.
Function
async createPoolMetadata(createVirtualPoolMetadataParam: CreateVirtualPoolMetadataParam): Promise<Transaction>
Parameters
interface CreatePoolMetadataParam {
virtualPool: PublicKey // The virtual pool address
name: string // The name of the pool
website: string // The website of the pool
logo: string // The logo of the pool
creator: PublicKey // The creator of the pool
payer: PublicKey // The payer of the transaction
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.creator.createPoolMetadata({
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
creator: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
name: 'Meteora',
website: 'https://launch.meteora.ag',
logo: 'https://launch.meteora.ag/icons/logo.svg',
feeClaimer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
payer: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
})
claimCreatorTradingFee
Claims a creator trading fee.
Function
async claimCreatorTradingFee(claimCreatorTradingFeeParam: ClaimCreatorTradingFeeParam): Promise<Transaction>
Parameters
interface ClaimCreatorTradingFeeParam {
creator: PublicKey // The creator of the pool
pool: PublicKey // The pool address
maxBaseAmount: BN // The maximum amount of base tokens to claim
maxQuoteAmount: BN // The maximum amount of quote tokens to claim
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.creator.claimCreatorTradingFee({
creator: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
pool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
maxBaseAmount: new BN(1000000000),
maxQuoteAmount: new BN(1000000000),
})
Notes
The creator of the pool must be the same as the creator in the
ClaimTradingFeeParam
params.You can indicate maxBaseAmount or maxQuoteAmount to be 0 to not claim Base or Quote tokens respectively.
creatorWithdrawSurplus
Withdraws surplus tokens from the pool.
Function
async creatorWithdrawSurplus(creatorWithdrawSurplusParam: CreatorWithdrawSurplusParam): Promise<Transaction>
Parameters
interface CreatorWithdrawSurplusParam {
creator: PublicKey // The creator of the pool
virtualPool: PublicKey // The virtual pool address
}
Returns
A transaction that can be signed and sent to the network.
Example
const transaction = await client.creator.creatorWithdrawSurplus({
creator: new PublicKey('boss1234567890abcdefghijklmnopqrstuvwxyz'),
virtualPool: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
})
Notes
The creator of the pool must be the same as the creator in the
CreatorWithdrawSurplusParam
params.
State Functions
getPoolConfig
Gets the config key details.
Function
async getPoolConfig(configAddress: PublicKey | string): Promise<PoolConfig>
Parameters
configAddress: PublicKey | string // The address of the config key
Returns
A PoolConfig
object containing the config key details.
Example
const config = await client.state.getPoolConfig(configAddress)
getPoolConfigs
Retrieves all config keys.
Function
async getPoolConfigs(): Promise<ProgramAccount<PoolConfig>[]>
Returns
An array of config keys.
Example
const configs = await client.state.getPoolConfigs()
getPoolConfigsByOwner
Retrieves all config keys owned by a specific wallet.
Function
async getPoolConfigsByOwner(owner: PublicKey | string): Promise<ProgramAccount<PoolConfig>[]>
Parameters
owner: PublicKey | string // The owner's wallet address
Returns
An array of config keys owned by the specified wallet.
Example
const configs = await client.state.getPoolConfigsByOwner(wallet.publicKey)
getPool
Gets the details of a specific pool.
Function
async getPool(poolAddress: PublicKey | string): Promise<VirtualPool | null>
Parameters
poolAddress: PublicKey | string // The address of the pool
Returns
A VirtualPool
object containing the pool's details, or null if not found.
Example
const pool = await client.state.getPool(poolAddress)
getPools
Retrieves all pools.
Function
async getPools(): Promise<ProgramAccount<VirtualPool>[]>
Returns
An array of all pools.
Example
const pools = await client.state.getPools()
getPoolsByConfig
Retrieves all pools by config key address.
Function
async getPoolsByConfig(configAddress: PublicKey | string): Promise<ProgramAccount<VirtualPool>[]>
Parameters
configAddress: PublicKey | string // The address of the config key
Returns
An array of pools.
Example
const pools = await client.state.getPoolsByConfig(configAddress)
getPoolMigrationQuoteThreshold
Gets the migration quote threshold for a specific pool.
Function
async getPoolMigrationQuoteThreshold(poolAddress: PublicKey | string): Promise<BN>
Parameters
poolAddress: PublicKey | string // The address of the pool
Returns
A BN
object representing the migration quote threshold.
Example
const threshold = await client.state.getPoolMigrationQuoteThreshold(poolAddress)
getPoolCurveProgress
Gets the progress of the curve by comparing current quote reserve to migration threshold.
Function
async getPoolCurveProgress(poolAddress: PublicKey | string): Promise<number>
Parameters
poolAddress: PublicKey | string // The address of the pool
Returns
A number between 0 and 1 representing the curve progress.
Example
const progress = await client.state.getPoolCurveProgress(poolAddress)
getPoolMetadata
Gets the metadata for a specific pool.
Function
async getPoolMetadata(poolAddress: PublicKey | string): Promise<VirtualPoolMetadata[]>
Parameters
poolAddress: PublicKey | string // The address of the pool
Returns
An array of VirtualPoolMetadata
objects containing the pool's metadata.
Example
const metadata = await client.state.getPoolMetadata(poolAddress)
getPartnerMetadata
Gets the metadata for a specific partner.
Function
async getPartnerMetadata(walletAddress: PublicKey | string): Promise<PartnerMetadata[]>
Parameters
walletAddress: PublicKey | string // The partner's wallet address
Returns
An array of PartnerMetadata
objects containing the partner's metadata.
Example
const metadata = await client.state.getPartnerMetadata(wallet.publicKey)
getDammV1LockEscrow
Gets the lock escrow details for a DAMM V1 pool.
Function
async getDammV1LockEscrow(lockEscrowAddress: PublicKey | string): Promise<LockEscrow>
Parameters
lockEscrowAddress: PublicKey | string // The address of the lock escrow
Returns
A LockEscrow
object containing the lock escrow details.
Example
const escrow = await client.state.getDammV1LockEscrow(escrowAddress)
getDammV1MigrationMetadata
Gets the migration metadata for a DAMM V1 pool.
Function
async getDammV1MigrationMetadata(poolAddress: PublicKey | string): Promise<MeteoraDammMigrationMetadata>
Parameters
poolAddress: PublicKey | string // The address of the DAMM V1 pool
Returns
A MeteoraDammMigrationMetadata
object containing the migration metadata.
Example
const metadata = await client.state.getDammV1MigrationMetadata(poolAddress)
getDammV2MigrationMetadata
Gets the migration metadata for a DAMM V2 pool.
Function
async getDammV2MigrationMetadata(poolAddress: PublicKey | string): Promise<MeteoraDammV2MigrationMetadata>
Parameters
poolAddress: PublicKey | string // The address of the DAMM V2 pool
Returns
A MeteoraDammV2MigrationMetadata
object containing the migration metadata.
Example
const metadata = await client.state.getDammV2MigrationMetadata(poolAddress)
getPoolFeeMetrics
Gets the fee metrics for a specific pool.
Function
async getPoolFeeMetrics(poolAddress: PublicKey): Promise<{
current: {
partnerBaseFee: BN
partnerQuoteFee: BN
creatorBaseFee: BN
creatorQuoteFee: BN
}
total: {
totalTradingBaseFee: BN
totalTradingQuoteFee: BN
}
}>
Parameters
poolAddress: PublicKey // The address of the pool
Returns
An object containing current and total fee metrics for the pool.
Example
const metrics = await client.state.getPoolFeeMetrics(poolAddress)
getPoolCreatorFeeMetrics
Gets the creator fee metrics for a specific pool.
Function
async getPoolCreatorFeeMetrics(poolAddress: PublicKey): Promise<{
creatorBaseFee: BN
creatorQuoteFee: BN
}>
Parameters
poolAddress: PublicKey // The address of the pool
Returns
An object containing the creator's fee metrics.
Example
const metrics = await client.state.getPoolCreatorFeeMetrics(poolAddress)
getPoolPartnerFeeMetrics
Gets the partner fee metrics for a specific pool.
Function
async getPoolPartnerFeeMetrics(poolAddress: PublicKey): Promise<{
partnerBaseFee: BN
partnerQuoteFee: BN
}>
Parameters
poolAddress: PublicKey // The address of the pool
Returns
An object containing the partner's fee metrics.
Example
const metrics = await client.state.getPoolPartnerFeeMetrics(poolAddress)
getPoolsQuoteFeesByConfig
Gets all quote fees for pools linked to a specific config key.
Function
async getPoolsQuoteFeesByConfig(configAddress: PublicKey): Promise<Array<{
poolAddress: PublicKey
partnerQuoteFee: BN
creatorQuoteFee: BN
totalTradingQuoteFee: BN
}>>
Parameters
configAddress: PublicKey // The address of the pool config
Returns
An array of objects containing quote fee metrics for each pool.
Example
const fees = await client.state.getPoolsQuoteFeesByConfig(configAddress)
getPoolsBaseFeesByConfig
Gets all base fees for pools linked to a specific config key.
Function
async getPoolsBaseFeesByConfig(configAddress: PublicKey): Promise<Array<{
poolAddress: PublicKey
partnerBaseFee: BN
creatorBaseFee: BN
totalTradingBaseFee: BN
}>>
Parameters
configAddress: PublicKey // The address of the pool config
Returns
An array of objects containing base fee metrics for each pool.
Example
const fees = await client.state.getPoolsBaseFeesByConfig(configAddress)
getTokenDecimals
Gets the number of decimals for a specific token.
Function
async getTokenDecimals(
mintAddress: PublicKey | string,
tokenType: TokenType
): Promise<number>
Parameters
mintAddress: PublicKey | string // The mint address
tokenType: TokenType // The token type (SPL = 0 or Token2022 = 1)
Returns
The number of decimals for the token.
Example
const decimals = await client.state.getTokenDecimals(mintAddress, TokenType.SPL)
Helper Functions
deriveDbcPoolAddress
Derives the address of a Dynamic Bonding Curve pool.
Function
function deriveDbcPoolAddress(
quoteMint: PublicKey,
baseMint: PublicKey,
config: PublicKey
): PublicKey
Parameters
quoteMint: PublicKey // The quote mint
baseMint: PublicKey // The base mint
config: PublicKey // The config
Returns
The address of the Dynamic Bonding Curve pool.
Example
const dbcPoolAddress = deriveDbcPoolAddress(
quoteMint: new PublicKey('abcdefghijklmnopqrstuvwxyz1234567890'),
baseMint: new PublicKey('1234567890abcdefghijklmnopqrstuvwxyz'),
config: new PublicKey('config1234567890abcdefghijklmnopqrstuvwxyz')
)
deriveDammV1PoolAddress
Derives the address of a DAMM V1 pool.
Function
function deriveDammV1PoolAddress(
dammConfig: PublicKey,
tokenAMint: PublicKey,
tokenBMint: PublicKey
): PublicKey
Parameters
dammConfig: PublicKey // The DAMM V1 graduation config key (retrievable from the README.md)
tokenAMint: PublicKey // The A token mint
tokenBMint: PublicKey // The B token mint
Returns
The address of the DAMM V1 pool.
Example
const dammV1PoolAddress = deriveDammV1PoolAddress(
dammConfig: new PublicKey('8f848CEy8eY6PhJ3VcemtBDzPPSD4Vq7aJczLZ3o8MmX'),
tokenAMint: new PublicKey('tokenA1234567890abcdefghijklmnopqrstuvwxyz'),
tokenBMint: new PublicKey('tokenB1234567890abcdefghijklmnopqrstuvwxyz')
)
deriveDammV2PoolAddress
Derives the address of a DAMM V2 pool.
Function
function deriveDammV2PoolAddress(
dammConfig: PublicKey,
tokenAMint: PublicKey,
tokenBMint: PublicKey
): PublicKey
Parameters
dammConfig: PublicKey // The DAMM V2 graduation config key (retrievable from the README.md)
tokenAMint: PublicKey // The A token mint
tokenBMint: PublicKey // The B token mint
Returns
The address of the DAMM V2 pool.
Example
const dammV2PoolAddress = deriveDammV2PoolAddress(
dammConfig: new PublicKey('7F6dnUcRuyM2TwR8myT1dYypFXpPSxqwKNSFNkxyNESd'),
tokenAMint: new PublicKey('tokenA1234567890abcdefghijklmnopqrstuvwxyz'),
tokenBMint: new PublicKey('tokenB1234567890abcdefghijklmnopqrstuvwxyz')
)
Last updated