@meteora-ag/dynamic-bonding-curve-sdk 1.5.13 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,718 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Dynamic Bonding Curve SDK will be documented in this file.
4
+
5
+ ## [2.0.0] - 2026-10-10
6
+
7
+ Syncs the SDK with dynamic-bonding-curve 0.2.2 (audited release, program commit 82054df) and defines the 2.0 public API.
8
+
9
+ ### Added
10
+
11
+ - `client.partner.createConfig2`. Pass `transferFeeParameters` for a base-mint transfer fee, or `null` when there is none. `0` basis points still creates a `TransferFeeConfig` and is rejected with `MigratedTransferFeeAuthorityOption.Immutable` or `RevokeZeroFee`.
12
+ - `TransferFeeWithheldAuthority` and `MigratedTransferFeeAuthorityOption`.
13
+ - Swap quotes account for Token-2022 transfer fees and return `includedTransferFeeAmountIn` and `excludedTransferFeeAmountOut`. `getSwapQuoteTransferFees(connection, config, { commitment?, baseMint? })` fetches the quote mint, the base mint when `baseMint` is passed, and the current epoch.
14
+ - `getQuoteFromInputAmount` and `getQuoteFromOutputAmount` quote a `buildCurve` result as its pool would be right after `initialize_pool`. `client.pool.swapQuote2` quotes an existing pool and requires `currentPoint`.
15
+ - `@meteora-ag/dynamic-bonding-curve-sdk/math`: the ports of the program's curve, fee, transfer fee and swap math, plus `ProgramError`, the program's error strings the SDK throws.
16
+ - `QuotePoolConfig`, `QuoteVirtualPool`, `QuotePoolFees`, `QuoteDynamicFee` and `QuoteVolatilityTracker`: the fields the quote math reads. A `PoolConfig` and a `VirtualPool` satisfy them.
17
+ - `client.state.getPoolWithKind` and `client.state.getPoolConfigWithKind` fetch an account once and say whether it is the transfer-hook variant.
18
+ - `getMigrationQuoteAmountFromThreshold`, `getTransferFeeMigrationPositionSplit`, `EpochTransferFee`, `TransferFeeMigrationPositionSplit` and `PoolFeeSummary` at the package root.
19
+ - `rateLimiterApplied` at the package root, for callers who build the swap instruction themselves and need to know whether to pass the instructions sysvar.
20
+ - `MAX_DYNAMIC_FEE_PERCENT` and `PARTNER_AND_CREATOR_SURPLUS_SHARE`.
21
+ - `getSurplusBreakdown` and `client.state.getPoolSurplus`: the surplus split the program pays on `partnerWithdrawSurplus` and `creatorWithdrawSurplus`, and whether each side has withdrawn.
22
+ - `liveCurve` on `./math`: a stored `PoolConfig.curve` up to its first zero point.
23
+
24
+ ### Changed
25
+
26
+ - `createConfigAndPool` and `createConfigAndPoolWithFirstBuy` always use `createConfig2`. Omitting `transferFeeParameters` is the same as `null`.
27
+ - A base transfer fee, or a quote mint with a non-zero transfer fee or a live transfer fee config authority, requires a constant token supply, no locked vesting, `MigrationFeeOption.Customizable` and `MigratedCollectFeeMode.Compounding`. The base fee is Token-2022 only and at most 10%. A partner transfer-fee authority, and a Token-2022 partner token-update authority, require a non-default `feeClaimer`.
28
+ - `MigratedCollectFeeMode.Compounding` allows `compoundingFeeBps` of `0`.
29
+ - Configs created by program 0.2.2 have `PoolConfig.version` 1 and `transferFeeFlag`. Swap quotes read the base transfer fee from that flag unless `baseMint` or `baseTransferFeeBasisPoints` is passed. A transfer fee is zero when its basis points are 0 or its maximum fee is 0.
30
+ - A legacy config (`version` 0) cannot initialize a pool on a quote mint with a non-zero transfer fee or a live transfer fee config authority, and `migrateToDammV2` rejects it when the quote mint's current transfer fee is non-zero. Transfer-hook pool initialization rejects those quote mints at any version.
31
+ - Compounding migration deposits round the scaled base up and the quote down.
32
+ - Partial-fill quotes throw `Required input amount exceeds the provided amount in` when the reconstructed input is larger than `amountIn`.
33
+ - `withdrawLeftover` makes `leftoverReceiver` a signer when the leftover charges a transfer fee.
34
+ - Curve builders reserve the program migration base, `ceil(migrationQuoteThreshold * (100 - migrationFee.feePercentage) / 100)`. `buildCurveWithLiquidityWeights` and `buildCurveWithCustomSqrtPrices` use constant product for `Compounding` and concentrated liquidity otherwise, and the last segment of `buildCurveWithLiquidityWeights` now ends exactly at the migration sqrt price. `buildCurveWithTwoSegments` and `buildCurveWithMidPrice` keep a fractional `percentageSupplyOnMigration`.
35
+ - Builders throw instead of returning an unusable config: when the migration base, locked vesting and leftover exceed the supply, when no mid price gives positive liquidity, when a fee schedule cannot reach its ending fee, when a period frequency floors to zero, and when a fixed `MigrationFeeOption` is combined with a custom migrated pool base fee mode or market cap scheduler. `getMigratedPoolFeeParams` takes three arguments and requires a market cap scheduler base fee mode exactly when `marketCapFeeSchedulerParams` is set.
36
+ - `getFeeSchedulerParams` checks both fees against the program bounds, also when the fee is constant. Exponential schedulers, including the migrated market-cap scheduler, choose `reductionFactor` with the program's Q64 decay so the last period stays at or above the ending fee. `calculateFeeSchedulerEndingBaseFeeBps` uses the program's integer conversion.
37
+ - `getLockedVestingParams` and `getLiquidityVestingInfoParams` floor their frequency and reject a duration shorter than the number of periods.
38
+ - `validateConfigParameters` takes an options object, checks the curve shape before any curve math runs on it, and only applies the fee-claimer rule when `feeClaimer` is passed.
39
+ - Rate-limiter validation checks the fee at `u64::MAX`. Swap quotes reject amounts outside the program's `u64` and `u128` bounds and `slippageBps` outside `[0, 10_000]`.
40
+ - Errors that mirror a program error use the program's message: `Math operation overflow`, `Type cast error`, `Pool is completed`, `Amount left is not zero`, `Liquidity in bonding curve is insufficient`, `Invalid collect fee mode`, and so on. `ProgramError` in `./math` lists them.
41
+ - `client.state.getPoolConfigsByOwner` filters on the config's fee claimer. It filtered on the leftover receiver since 1.0.
42
+ - `getCurveBreakdown` consumes only the remaining threshold on each segment and stops at exact cumulative completion (PR #120, snuff12).
43
+ - `getBaseTokenForSwap`, `getMigrationThresholdPrice`, `getSwapAmountWithBuffer`, `getCurveBreakdown` and `getQuoteReserveFromNextSqrtPrice` stop at the first zero point of a stored curve, like the program. `client.state.getPoolBaseTokenCurveProgress` threw `Math operation overflow` once the price reached the last curve point, and at any time for a config whose last point is the migration price.
44
+ - `getBaseTokenForSwap`, `getMigrationThresholdPrice` and `getCurveBreakdown` accumulate without a `u64` bound. `getSwapAmountWithBuffer` casts only the amount it keeps, and `validateConfigParameters` casts the swap base with `Type cast error` before it computes the migration amounts.
45
+ - The first-buy builders pass the instructions sysvar only when the config enables the first swap with the minimum fee.
46
+ - `client.state.getDammV1MigrationMetadata` returns `null` instead of throwing when the account does not exist.
47
+ - `client.state.getPoolMetadata(pool)` and `client.state.getPartnerMetadata(feeClaimer)` fetch the metadata PDA and return the account, or `null` when none was created, instead of an array.
48
+ - `getTokenType` takes an optional commitment.
49
+ - Synced the DAMM v2 IDL and `cp_amm.so` fixture to cp_amm 0.2.5.
50
+ - `docs.md` and `CHANGELOG.md` ship in the package.
51
+
52
+ ### Deprecated
53
+
54
+ - `client.partner.createConfig` in favour of `createConfig2`. `createConfig` and `createConfigWithTransferHook` reject a quote mint with a non-zero transfer fee or a live transfer fee config authority.
55
+ - `getRateLimiterParams`. The program rejects `BaseFeeMode.RateLimiter` for new configs.
56
+
57
+ ### Removed
58
+
59
+ - Helpers nothing referenced: `getAccountData`, `getAccountCreationTimestamp`, `getAccountCreationTimestamps`, `prepareTokenAccountTx`, `cleanUpTokenAccountTx`, `checkRateLimiterApplied`, `validateBalance`, `validateBaseTokenType`, `validateQuoteMintBasic`, `deriveDammV1EventAuthority`, `deriveDammV1PoolAuthority`, `deriveDammV2LockEscrowAddress`, `findAssociatedTokenAddress`, `deriveVaultAddress`, `deriveTokenVaultKey`, `deriveVaultLpMintAddress`, `convertDecimalToBN` (use `fromDecimalToBN`), `mulShr`, `SafeMath.mod`, `getFeeSchedulerMaxBaseFeeNumerator`, `getRateLimiterMinBaseFeeNumerator`, `getDeltaAmountBaseUnsignedUnchecked` and `getDeltaAmountQuoteUnsignedUnchecked` (the `256` variants are the unbounded ones), `BaseFeeHandler.validate`, `getProgram()` on the services (use `program`), and `DynamicBondingCurveClient.create` (the constructor defaults `commitment` to `confirmed`).
60
+ - Types nothing used: `SwapQuoteConfig`, `DynamicCurveProgram`, `CreateConfigAccounts`, `InitializeSplPoolAccounts`, `InitializeToken2022PoolAccounts`, `InitializePoolParameters`, `LockEscrow`, `FeeResult`, `ClaimCreatorTradingFeeWithQuoteMintNotSolParams` and `ClaimCreatorTradingFeeWithQuoteMintSolParams`.
61
+ - The `jito-ts` dev dependency.
62
+
63
+ ### Breaking Changes
64
+
65
+ - Import from `@meteora-ag/dynamic-bonding-curve-sdk` or `@meteora-ag/dynamic-bonding-curve-sdk/math`. The package root is an explicit export list and the `exports` map exposes only those two entries. The curve, fee, transfer fee and swap math moved to `./math` (57 functions, among them `calculateBaseToQuoteFromAmountIn`, `getFeeMode`, `getIncludedFeeAmount`, `getFeeNumeratorFromIncludedAmount`, `getSwapResult`, the `getDeltaAmount*` and `getNextSqrtPrice*` functions, `SafeMath`, `mulDiv` and `pow`). `swapQuoteExactIn`, `swapQuoteExactOut`, `swapQuotePartialFill` and `DynamicBondingCurveProgram` are not exported; `swapQuote` stays on the root. Internal helpers such as `getOrCreateATAInstruction`, `unwrapSOLInstruction`, `wrapSOLInstruction`, `deriveMintMetadata`, `derivePositionAddress`, `createDammV1Program`, `getFirstCurve`, `getTwoCurve`, `isDefaultLockedVesting` and the `validate*` building blocks are no longer exported.
66
+ - Construct the services through `DynamicBondingCurveClient`. `new PoolService(connection, commitment)` and the same constructor on the other services are no longer supported.
67
+ - `CreateConfigParams`, `CreateConfig2Params` and `CreateConfigWithTransferHookParams` declare `config`, `feeClaimer`, `leftoverReceiver`, `quoteMint` and `payer` as required `PublicKey`s.
68
+ - Swap quotes for a Token-2022 quote mint require `quoteMint` and `currentEpoch`.
69
+ - `getFeeOnAmount` and `splitFees` no longer take `poolFees`. `calculateBaseToQuoteFromAmountOut` and `calculateQuoteToBaseFromAmountOut` return `{ amountIn, nextSqrtPrice }`.
70
+ - `createDbcProgram` returns the `Program` instead of `{ program }`. `deriveEscrow` is `deriveLockerEscrowAddress`.
71
+ - `getMigratedPoolFeeParams` throws for `MigrationFeeOption.Customizable` when `migratedPoolFee.poolFeeBps` is not set.
72
+ - `swap`, `swap2`, `claimPartnerTradingFee`, `claimPartnerTradingFeeToReceiver`, `claimCreatorTradingFee` and `claimCreatorTradingFeeToReceiver` reject transfer-hook pools. Use `swap2WithTransferHook`, `claimPartnerTradingFee2` and `claimCreatorTradingFee2`. Standard pool creation rejects a transfer-hook config, and transfer-hook pool creation rejects a standard config.
73
+ - `transferPoolCreator` rejects a `newCreator` equal to `creator`.
74
+ - `tempWSolAcc` is gone from `claimPartnerTradingFee` and `claimCreatorTradingFee`. With a native SOL quote the fee is wrapped into the fee claimer's or creator's token account and unwrapped to `receiver`, so only the claimer signs.
75
+
76
+ ## [1.5.13] - 2026-09-24
77
+
78
+ ### Changed
79
+
80
+ - `tokenQuoteDecimal` now accepts any quote mint decimals, for example 5 for BONK. The program only restricts the base token decimals to 6 to 9, and `tokenBaseDecimal` keeps that restriction. This applies to `buildCurve*`, `createSqrtPrices`, `getPriceFromSqrtPrice`, and `getRateLimiterParams`.
81
+
82
+ ## [1.5.12] - 2026-09-07
83
+
84
+ ### Added
85
+
86
+ - Added optional `tokenBadge` remaining account support on config and pool creation. Required when the quote mint is not permissionless-supported.
87
+ - Added `deriveTokenBadgeAddress` and `getTokenBadgeRemainingAccounts` helpers.
88
+ - Added `TokenBadge` account type and `client.state.getTokenBadge`.
89
+
90
+ ### Changed
91
+
92
+ - Updated the DBC IDL to program version 0.2.1.
93
+ - `getOrCreateATAInstruction` and `prepareTokenAccountTx` now accept an optional `commitment` (defaults to `confirmed`) and pass it through to the token account fetch.
94
+ - Synced the DAMM v2 IDL and test-validator `cp_amm.so` fixture to cp_amm 0.2.4. DAMM v2 configs now include a `permission` bitmask. Migration tests create a private DAMM v2 config with `CreatePoolWithoutMintValidation` so Token-2022 quote mints that need a DBC token badge can still migrate. Token-2022 wrapped SOL is still rejected.
95
+
96
+ ### Deprecated
97
+
98
+ - Deprecated `BaseFeeMode.RateLimiter` for new configs and new pools. Existing rate-limiter pools can still be quoted and swapped.
99
+ - Deprecated `MigrationOption.MET_DAMM` (DAMM v1) for new configs and new pools. Existing DAMM v1 pools can still migrate.
100
+
101
+ ### Breaking Changes
102
+
103
+ - `createConfig`, `createPool`, and `buildCurve*` now reject `BaseFeeMode.RateLimiter` and `MigrationOption.MET_DAMM`.
104
+ - `getMigratedPoolFeeParams` now rejects `MigrationOption.MET_DAMM`.
105
+ - `getBaseFeeParams` no longer takes `tokenQuoteDecimal` or `activationType`. Those arguments were only used to encode RateLimiter params, which this helper now rejects.
106
+
107
+ ## [1.5.11] - 2026-07-30
108
+
109
+ ### Changed
110
+
111
+ - Updated `StateService` to be a standalone read-only service that no longer extends `DynamicBondingCurveProgram`, removing the circular inheritance between the two.
112
+ - Updated `PoolService`, `PartnerService`, `CreatorService`, and `MigrationService` to create their own internal `StateService`, since `StateService` holds no shared state or caching.
113
+
114
+ ### Breaking Changes
115
+
116
+ - **Service constructors no longer accept a `StateService` argument.** `DynamicBondingCurveProgram`, `PoolService`, `PartnerService`, `CreatorService`, and `MigrationService` are now constructed with `(connection, commitment)` only. Callers passing a third `StateService` argument must drop it; runtime behavior is unchanged because `StateService` is stateless and each service now creates its own.
117
+ - **`StateService` no longer inherits `DynamicBondingCurveProgram` members.** It keeps `program` and `getProgram()`, but code relying on inherited members such as `connection`, `poolAuthority`, or `instanceof DynamicBondingCurveProgram` checks must be updated.
118
+
119
+ ## [1.5.10] - 2026-06-08
120
+
121
+ ### Added
122
+
123
+ - Added `client.pool.getQuoteFromInputAmount` and `client.pool.getQuoteFromOutputAmount` for quoting launch-state swaps before a pool exists.
124
+ - Added `SwapQuoteConfig`, `SimulatedQuoteFromInputAmountParams`, and `SimulatedQuoteFromOutputAmountParams` types for pre-pool swap quote simulations.
125
+
126
+ ### Changed
127
+
128
+ - Updated pool quote simulation to accept either an existing pool config or a `buildCurve` output, deriving `migrationSqrtPrice` when it is not present.
129
+
130
+ ## [1.5.9] - 2026-06-03
131
+
132
+ ### Fixed
133
+
134
+ - Fixed `StateService` endpoints to correctly fetch both regular and transfer-hook pool and config accounts.
135
+
136
+ ## [1.5.8] - 2026-05-26
137
+
138
+ ### Added
139
+
140
+ - Added Token-2022 transfer-hook support for DBC pool configs and pools:
141
+ - `client.partner.createConfigWithTransferHook`
142
+ - `client.partner.createConfigAndPoolWithTransferHook`
143
+ - `client.partner.createConfigAndPoolWithFirstBuyWithTransferHook`
144
+ - `client.creator.createPoolWithTransferHook`
145
+ - `client.creator.createPoolWithFirstBuyWithTransferHook`
146
+ - `client.creator.createPoolWithPartnerAndCreatorFirstBuyWithTransferHook`
147
+ - Added transfer-hook swap and fee claim endpoints:
148
+ - `client.pool.swap2WithTransferHook`
149
+ - `client.partner.claimPartnerTradingFee2`
150
+ - `client.creator.claimCreatorTradingFee2`
151
+ - Added transfer-hook account helper types:
152
+ - `TransferHookAccountsInfo`
153
+ - `TransferHookRemainingAccounts`
154
+ - `FirstBuyWithTransferHookParams`
155
+ - `PartnerFirstBuyWithTransferHookParams`
156
+ - `CreatorFirstBuyWithTransferHookParams`
157
+ - `AccountsType`
158
+ - Added account types for transfer-hook program accounts:
159
+ - `ConfigWithTransferHook`
160
+ - `TransferHookPool`
161
+ - Added `CreateVirtualPoolMetadataParameters` as an exported IDL-derived type.
162
+ - Added `client.partner.createConfigAndPool` and `client.partner.createConfigAndPoolWithFirstBuy` so partner-owned config-and-pool flows live under the partner service.
163
+ - Added `client.creator.createPool`, `client.creator.createPoolWithFirstBuy`, and `client.creator.createPoolWithPartnerAndCreatorFirstBuy` so creator-owned pool initialization flows live under the creator service.
164
+ - Added `client.partner.claimPartnerTradingFeeToReceiver` and `client.creator.claimCreatorTradingFeeToReceiver` for the non-transfer-hook fee claim flows that do not require `tempWSolAcc`.
165
+ - Added test coverage for transfer-hook config creation, pool creation, swaps, first buys, and fee claims using the new `transfer_hook_counter` test program.
166
+
167
+ ### Changed
168
+
169
+ - Updated the DBC IDL and generated types to include transfer-hook instructions and account layouts.
170
+ - Updated DAMM V1, DAMM V2, and Dynamic Vault IDLs and generated types.
171
+ - Updated `DynamicBondingCurveClient` so all services share one `StateService` instance.
172
+ - Updated `StateService.getPoolConfig` to fetch both regular `poolConfig` accounts and transfer-hook config accounts.
173
+ - Updated `StateService.getPool` to fetch both regular `virtualPool` accounts and transfer-hook pool accounts.
174
+ - Updated swap quote math and state helpers to read virtual pool fields from the new nested `poolState` layout.
175
+ - Updated `buildCurve*` helpers to accept `token.tokenAuthorityOption` and map it to the on-chain `tokenUpdateAuthority` field.
176
+ - Renamed `createVaultProgram` to `createDynamicVaultProgram` to match the Dynamic Vault IDL naming.
177
+ - Renamed internal/public DAMM V1 and Dynamic Vault generated IDL program types from `DammV1` and `DynamicVault` to `Amm` and `Vault`.
178
+ - Updated validator and CI setup to use the `mercurial_vault.so` fixture and include the `transfer_hook_counter.so` fixture.
179
+ - Reworked `docs.md` with the current SDK service layout and transfer-hook function documentation.
180
+ - Updated `getMigratedPoolMarketCapFeeSchedulerParams` and `MigratedPoolMarketCapFeeSchedulerParams` to use `priceMultiple` directly.
181
+
182
+ ### Breaking Changes
183
+
184
+ - **Pool creation methods moved service namespaces.** Existing callers must update:
185
+ - `client.pool.createPool(...)` -> `client.creator.createPool(...)`
186
+ - `client.pool.createPoolWithFirstBuy(...)` -> `client.creator.createPoolWithFirstBuy(...)`
187
+ - `client.pool.createPoolWithPartnerAndCreatorFirstBuy(...)` -> `client.creator.createPoolWithPartnerAndCreatorFirstBuy(...)`
188
+ - `client.pool.createConfigAndPool(...)` -> `client.partner.createConfigAndPool(...)`
189
+ - `client.pool.createConfigAndPoolWithFirstBuy(...)` -> `client.partner.createConfigAndPoolWithFirstBuy(...)`
190
+ - **Pool address params were renamed from `virtualPool` to `pool` across SDK request types.** Update call sites for:
191
+ - `CreateLockerParams`
192
+ - `WithdrawLeftoverParams`
193
+ - `MigrateToDammV1Params`
194
+ - `MigrateToDammV2Params`
195
+ - `DammLpTokenParams`
196
+ - `PartnerWithdrawSurplusParams`
197
+ - `CreatorWithdrawSurplusParams`
198
+ - `TransferPoolCreatorParams`
199
+ - `WithdrawMigrationFeeParams`
200
+ - `ClaimPartnerPoolCreationFeeParams`
201
+ - **Virtual pool account data now uses the nested `poolState` layout.** Code that directly reads `VirtualPool` fields must migrate from flat fields like `pool.config`, `pool.baseMint`, `pool.quoteReserve`, `pool.sqrtPrice`, and `pool.metrics` to `pool.poolState.config`, `pool.poolState.baseMint`, `pool.poolState.quoteReserve`, `pool.poolState.sqrtPrice`, and `pool.poolState.metrics`.
202
+ - **`TokenType.SPL` was renamed to `TokenType.SPLToken`.** The enum value remains `0`, but TypeScript callers must update the enum member name.
203
+ - **`TokenUpdateAuthorityOption` was renamed to `TokenAuthorityOption`.** Update imports and references.
204
+ - **`TokenConfig.tokenUpdateAuthority` was renamed to `tokenAuthorityOption` for all `buildCurve*` helpers.** The helper still maps this value to the on-chain `tokenUpdateAuthority` config field.
205
+ - **`PreCreatePoolParams` was renamed to `CreatePoolBaseParams`.** Update imports and any explicit type annotations.
206
+ - **The old no-`tempWSolAcc` trading fee claim types were renamed.**
207
+ - `ClaimTradingFeeParams` -> `ClaimPartnerTradingFeeParams`
208
+ - `ClaimTradingFee2Params` -> `ClaimPartnerTradingFeeToReceiverParams`
209
+ - `ClaimCreatorTradingFee2Params` -> `ClaimCreatorTradingFeeToReceiverParams`
210
+ - **The old `claimPartnerTradingFee2` and `claimCreatorTradingFee2` non-transfer-hook behavior moved to `claimPartnerTradingFeeToReceiver` and `claimCreatorTradingFeeToReceiver`.** In `1.5.8`, `claimPartnerTradingFee2` and `claimCreatorTradingFee2` build transfer-hook fee claim instructions and should be used only for transfer-hook pools.
211
+ - **`createVaultProgram` was renamed to `createDynamicVaultProgram`.** Update helper imports.
212
+ - **`StateService.getDammV1LockEscrow` was removed.** Consumers that need lock escrow data must fetch it through the relevant generated program client.
213
+ - **`LockEscrow` now comes from IDL types instead of IDL accounts.** Update assumptions if you were treating it as an Anchor account object.
214
+ - **Raw IDL instruction indexes changed.** Code using `DynamicBondingCurve['instructions'][index]` directly must be updated because transfer-hook instructions shifted the generated instruction order.
215
+ - **Market cap fee scheduler config now uses `priceMultiple`.** Replace `marketCapFeeSchedulerParams.startingMarketCap` and `marketCapFeeSchedulerParams.endingMarketCap` with `marketCapFeeSchedulerParams.priceMultiple`.
216
+
217
+ ### Fixed
218
+
219
+ - Fixed state and quote helpers to work with the new nested virtual pool account layout.
220
+ - Fixed transfer-hook pool state reads so `getPoolConfig`, `getPool`, fee metrics, fee breakdowns, and curve progress helpers work with both regular and transfer-hook pools.
221
+ - Fixed SOL quote handling in transfer-hook fee claim flows by preserving the wrapped SOL post-instructions where needed.
222
+
223
+ ## [1.5.7] - 2026-03-24
224
+
225
+ ### Changed
226
+
227
+ - Updated `getMigratedPoolMarketCapFeeSchedulerParams` function to use `startingMarketCap` and `endingMarketCap` instead of `sqrtPriceStepBps`
228
+
229
+ ## [1.5.6] - 2026-03-12
230
+
231
+ ### Added
232
+
233
+ - Added `MigratedCollectFeeMode` enum with `Compounding` (2) support for migrated DAMM v2 pool configuration.
234
+ - Added `compoundingFeeBps` support in `MigratedPoolFeeConfig` and propagated it through all `buildCurve*` helpers.
235
+
236
+ ### Changed
237
+
238
+ - Updated migrated pool fee validation to require `compoundingFeeBps > 0` only when `collectFeeMode = MigratedCollectFeeMode.Compounding`, and `0` otherwise.
239
+ - Updated migration flow for DAMM v2 to remove position vesting accounts from `migrateDammV2` remaining accounts.
240
+ - Removed `deriveDammV2PositionVestingAccount` PDA helper.
241
+
242
+ ### Fixed
243
+
244
+ - Fixed `getDynamicFeeParams` function to correctly calculate the dynamic fee parameters based on the max price change bps
245
+
246
+ ## [1.5.5] - 2026-02-25
247
+
248
+ ### Changed
249
+
250
+ - Fixed `getPoolBaseTokenCurveProgress` function to correctly calculate the progress of the base token curve using `getBaseTokenForSwap` function
251
+ - `createConfigAndPoolWithFirstBuy` functions now return `createConfigTx` and `createPoolWithFirstBuyTx` as separate `Transaction` instead of an object containing 3 separate `Transaction`s
252
+ - `createPoolWithFirstBuy` functions now return a `Transaction` instead of an object containing the new config transaction and pool transaction
253
+ - `createPoolWithPartnerAndCreatorFirstBuy` functions now return a `Transaction` instead of an object containing the new config transaction and pool transaction
254
+
255
+ ## [1.5.4] - 2026-02-24
256
+
257
+ ### Added
258
+
259
+ - Added `getPoolBaseTokenCurveProgress` function to get the progress of the base token curve
260
+
261
+ ### Changed
262
+
263
+ - Renamed `getPoolCurveProgress` function to `getPoolQuoteTokenCurveProgress`
264
+
265
+ ## [1.5.3] - 2026-02-15
266
+
267
+ ### Added
268
+
269
+ - Added `TokenConfig`, `FeeConfig`, `MigrationConfig`, `MigrationFee`, `MigratedPoolFeeConfig`, `MigratedPoolMarketCapFeeSchedulerParams`, `LiquidityDistributionConfig` types for structured parameter grouping
270
+ - Added `MigratedPoolFeeResult` type for the return value of `getMigratedPoolFeeParams`
271
+ - Added `DEFAULT_MIGRATED_POOL_FEE_PARAMS` constant for default migrated pool fee values
272
+ - Added `validateMarketCapFeeSchedulerRequiresPoolFeeBps` validation to ensure `poolFeeBps > 0` when `marketCapFeeSchedulerParams` is configured
273
+ - Added comprehensive unit tests for `getMigratedPoolFeeParams` and migration fee option behavior in `buildCurve.test.ts`
274
+ - Added test coverage for all migration fee option cases: fixed options (0-5), customizable without market cap scheduler, customizable with market cap scheduler, and DAMM V1 defaults
275
+
276
+ ### Changed
277
+
278
+ - All `buildCurve*` functions now destructure the unified `MigratedPoolFeeResult` from `getMigratedPoolFeeParams` instead of separately calling `getMigratedPoolMarketCapFeeSchedulerParams`
279
+ - Updated `validateMigratedPoolFee` to accept `migratedPoolMarketCapFeeSchedulerParams` and allow non-empty `migratedPoolFee` when market cap fee scheduler is configured with a fixed fee option
280
+
281
+ ### Breaking Changes
282
+
283
+ - **`BuildCurveBaseParams` restructured** from flat parameters to nested groups: `token: TokenConfig`, `fee: FeeConfig`, `migration: MigrationConfig`, `liquidityDistribution: LiquidityDistributionConfig`, `lockedVesting: LockedVestingParams`, `activationType: ActivationType`. This affects all `buildCurve*` functions: `buildCurve`, `buildCurveWithMarketCap`, `buildCurveWithTwoSegments`, `buildCurveWithMidPrice`, `buildCurveWithLiquidityWeights`, `buildCurveWithCustomSqrtPrices`.
284
+
285
+ ## [1.5.2] - 2026-01-27
286
+
287
+ ### Added
288
+
289
+ - Added `getMigratedPoolMarketCapFeeSchedulerParams` helper function to craft `MigratedPoolMarketCapFeeSchedulerParams` object
290
+ - Added `decodePodAlignedFeeMarketCapScheduler` helper function to decode `PodAlignedFeeMarketCapScheduler` object from config account data
291
+ - Added `validateMigratedPoolBaseFeeMode` and `validateDynamicFeeParams` validation functions for config creation
292
+ - Added `getMinBaseFeeNumerator` into `BaseFeeHandler` class
293
+ - Added if `poolConfigState.enableFirstSwapWithMinFee` is true, then the `swap` and `swap2` functions will contain `SYSVAR_INSTRUCTIONS_PUBKEY` in remaining accounts
294
+
295
+ ### Changed
296
+
297
+ - Bumped DAMM v2 IDL to v0.1.7
298
+
299
+ ### Breaking Changes
300
+
301
+ - Added `migratedPoolBaseFeeMode`, `migratedPoolMarketCapFeeSchedulerParams` and `enableFirstSwapWithMinFee` parameters to `buildCurve`, `buildCurveWithMarketCap`, `buildCurveWithTwoSegments`, `buildCurveWithLiquidityWeights`, `buildCurveWithMidPrice`, `buildCurveWithCustomSqrtPrices` functions
302
+ - Added `eligibleForFirstSwapWithMinFee` parameter to `swapQuote`, `swapQuote2` functions when quoting for first swap with minimum fee
303
+
304
+ ## [1.5.1] - 2026-01-17
305
+
306
+ ### Fixed
307
+
308
+ - Fixed `calculateBaseToQuoteFromAmountIn` function to cap the sqrt price when the input amount is greater than the available liquidity
309
+
310
+ ## [1.5.0] - 2025-01-09
311
+
312
+ ### Added
313
+
314
+ - Added `firstPositionVestingAddress` and `secondPositionVestingAddress` into `remainingAccounts` in `migrateDammV2` function
315
+ - Added `claimPartnerPoolCreationFee` function
316
+ - Added validation checks for createConfig
317
+ - Added optional `partnerLiquidityVestingInfoParams` and `creatorLiquidityVestingInfoParams` parameters to all `buildCurve` functions
318
+ - Added `getLiquidityVestingInfoParams` helper function to craft `LiquidityVestingInfoParameters` object
319
+ - Added tests for `createConfig` validation, `createPool`, `swap` and `swap2`
320
+
321
+ ### Changed
322
+
323
+ - `partnerLpPercentage` and `creatorLpPercentage` has been renamed to `partnerLiquidityPercentage` and `creatorLiquidityPercentage` respectively
324
+ - `partnerLockedLpPercentage` and `creatorLockedLpPercentage` has been renamed to `partnerPermanentLockedLiquidityPercentage` and `creatorPermanentLockedLiquidityPercentage` respectively
325
+ - Renamed `BASIS_POINT_MAX` to `MAX_BASIS_POINT`
326
+
327
+ ## [1.4.10] - 2025-01-03
328
+
329
+ ### Added
330
+
331
+ - Added `buildCurveWithCustomSqrtPrices` function to build a curve with custom sqrt price points and optional liquidity weights
332
+
333
+ ## [1.4.9] - 2025-11-29
334
+
335
+ ### Added
336
+
337
+ - Added `buildCurveWithMidPrice` function to build a custom constant product curve with a mid price option.
338
+ - Added `getCurveBreakdown` helper function
339
+
340
+ ## [1.4.8] - 2025-11-23
341
+
342
+ ### Changed
343
+
344
+ - Moved `getCurrentPoint` in `if` statement to reduce unnecessary RPC calls
345
+
346
+ ## [1.4.7] - 2025-11-23
347
+
348
+ ### Added
349
+
350
+ - Added an `if` statement to check if the `baseFeeMode` is `RateLimiter` in `swap` and `swap2` endpoints
351
+
352
+ ## [1.4.6] - 2025-10-28
353
+
354
+ ### Added
355
+
356
+ - Added validation checks for migration fee percentages
357
+
358
+ ### Deprecated
359
+
360
+ - Endpoint `createDammV2MigrationMetadata` is deprecated as it is no longer needed when migrating a DAMM v2 pool.
361
+
362
+ ### Changed
363
+
364
+ - Minimum base fee increased from 1bp (0.01%) to 25 bps (0.25%). Affected endpoints: `createConfig`, `createPool`, `createConfigAndPool`, `createConfigAndPoolWithFirstBuy`, `createPoolWithFirstBuy`, `createPoolWithPartnerAndCreatorFirstBuy`
365
+ - Migration fee increased from 50% to 99%.
366
+
367
+ ## [1.4.5] - 2025-10-11
368
+
369
+ ### Changed
370
+
371
+ - Fixed `validateFeeScheduler` function to correctly validate the fee scheduler parameters
372
+ - Fixed `getMinBaseFeeNumerator` function to correctly calculate the min base fee numerator
373
+
374
+ ## [1.4.4] - 2025-09-24
375
+
376
+ ### Changed
377
+
378
+ - Bumped DAMM v2 IDL
379
+
380
+ ## [1.4.3] - 2025-09-19
381
+
382
+ ### Changed
383
+
384
+ - Fixed `getPoolFeeBreakdown` function to correctly calculate the fee breakdown for a token pool
385
+
386
+ ## [1.4.2] - 2025-09-19
387
+
388
+ ### Added
389
+
390
+ - `getPoolFeeBreakdown` function to get the fee breakdown for a token pool
391
+
392
+ ## [1.4.1] - 2025-09-15
393
+
394
+ ### Changed
395
+
396
+ - Removed `feePayer` parameter from `creatorWithdrawMigrationFee` and `partnerWithdrawMigrationFee` functions ++ Fixed functions
397
+
398
+ ## [1.4.0] - 2025-09-09
399
+
400
+ ### Changed
401
+
402
+ - Fixed `calculateFeeSchedulerEndingBaseFeeBps` function to correctly calculate the ending base fee when `numberOfPeriod` or `periodFrequency` is 0
403
+
404
+ ## [1.3.9] - 2025-09-05
405
+
406
+ ### Changed
407
+
408
+ - Remove console.log in `getDeltaAmountQuoteUnsigned` and `getDeltaAmountQuoteUnsigned256` functions
409
+
410
+ ## [1.3.8] - 2025-09-03
411
+
412
+ ### Changed
413
+
414
+ - Remove `U64_MAX` check in `getDeltaAmountQuoteUnsigned` and `getDeltaAmountQuoteUnsigned256` functions
415
+
416
+ ## [1.3.7] - 2025-08-14
417
+
418
+ ### Added
419
+
420
+ - `swap2` function with `swapMode` parameter
421
+ - `swapQuote2` function with `swapMode` parameter
422
+ - `prepareSwapAmountParam` helper function
423
+ - `getCurrentPoint` helper function
424
+
425
+ ### Changed
426
+
427
+ - `swapQuote` function now returns `SwapResult` instead of `QuoteResult`
428
+ - `getAccountData` function now requires a `commitment` parameter
429
+ - Deprecated `swapQuoteExactIn` function
430
+ - Deprecated `swapQuoteExactOut` function
431
+
432
+ ## [1.3.6] - 2025-08-08
433
+
434
+ ### Changed
435
+
436
+ - `withdrawLeftover` function fully permissionless and only `payer` needs to sign.
437
+
438
+ ## [1.3.5] - 2025-07-31
439
+
440
+ ### Added
441
+
442
+ - Added `MigrationFeeOption === 6` to `MigrationFeeOption` enum for customizable graduated pool fee. Only available for DAMM V2.
443
+ - Added new address in `DAMM_V2_MIGRATION_FEE_ADDRESS` fee address array for `MigrationFeeOption === 6`
444
+ - Validation checks for `migratedPoolFee` parameter
445
+
446
+ ### Changed
447
+
448
+ - `buildCurve`, `buildCurveWithMarketCap`, `buildCurveWithTwoSegments`, `buildCurveWithLiquidityWeights` functions now have an optional `migrationFeeOption` parameter
449
+
450
+ ## [1.3.4] - 2025-07-28
451
+
452
+ ### Added
453
+
454
+ - Added `getDammV1MigrationMetadata` to get DAMM v1 migration states
455
+
456
+ ## [1.3.3] - 2025-07-22
457
+
458
+ ### Changed
459
+
460
+ - Added compulsory `receiver` parameter for `partner` and `creator` first buy in `createPoolWithPartnerAndCreatorFirstBuy` function
461
+ - Added optional `receiver` parameter to `createPoolWithFirstBuy` and `createConfigAndPoolWithFirstBuy` functions
462
+
463
+ ## [1.3.2] - 2025-07-22
464
+
465
+ ### Changed
466
+
467
+ - Fixed precision issue in `getPoolCurveProgress` function
468
+
469
+ ## [1.3.1] - 2025-07-02
470
+
471
+ ### Added
472
+
473
+ - `swapQuoteExactOut` function
474
+
475
+ ## [1.3.0] - 2025-07-01
476
+
477
+ ### Added
478
+
479
+ - Added optional `payer` parameter to `swap` function
480
+ - Added `createPoolWithPartnerAndCreatorFirstBuy` function
481
+
482
+ ### Changed
483
+
484
+ - `createConfigAndPoolWithFirstBuy` and `createPoolWithFirstBuy` function now accepts a `buyer` parameter
485
+ - `createPoolWithFirstBuy` function now returns a `Transaction[]` containing `createPoolTx` and a `swapBuyTx` instead of a single `Transaction`
486
+
487
+ ## [1.2.9] - 2025-06-26
488
+
489
+ ### Added
490
+
491
+ - `TokenUpdateAuthorityOption` enum to have more options for token update authority:
492
+ - CreatorUpdateAuthority (0)
493
+ - Immutable (1)
494
+ - PartnerUpdateAuthority (2)
495
+ - CreatorUpdateAndMintAuthority (3)
496
+ - PartnerUpdateAndMintAuthority (4)
497
+
498
+ ### Changed
499
+
500
+ - Changed `CollectFeeMode` enums from `OnlyQuote` and `Both` to `QuoteToken` and `OutputToken`
501
+
502
+ ## [1.2.8] - 2025-06-24
503
+
504
+ ### Added
505
+
506
+ - `getQuoteReserveFromNextSqrtPrice` helper function
507
+
508
+ ## [1.2.7] - 2025-06-19
509
+
510
+ ### Changed
511
+
512
+ - Fixed `buildCurve` function to correctly calculate with precision for the `migrationBaseSupply`
513
+
514
+ ## [1.2.6] - 2025-06-13
515
+
516
+ ### Changed
517
+
518
+ - Fixed `getPercentageSupplyOnMigration` function to correctly calculate the percentage of supply on migration
519
+
520
+ ## [1.2.5] - 2025-06-12
521
+
522
+ ### Changed
523
+
524
+ - Removed `getDammV1MigrationMetadata` and `getDammV2MigrationMetadata` functions
525
+
526
+ ## [1.2.4] - 2025-06-12
527
+
528
+ ### Added
529
+
530
+ - Support for Rate Limiter mode in base fee configuration
531
+ - Allows partners to configure an alternative base fee mode that increases fee slope based on quote amount
532
+ - Only available when collect fee mode is in quote token only and for buy operations
533
+ - Prevents multiple swap instructions (or CPI) to the same pool in a single transaction
534
+
535
+ ### Breaking Changes
536
+
537
+ - Maximum `cliff_fee_numerator` increased from 50% (5000 bps / 500_000_000) to 99% (9900 bps / 990_000_000)
538
+ - `swap` instruction now requires `instruction_sysvar_account` in remaining_accounts when `is_rate_limiter_applied` is true
539
+ - `swap_quote` function updated to handle rate limiter math calculations and 99% max fee
540
+ - Base fee parameter structure updated:
541
+ - Renamed `fee_scheduler_mode` to `base_fee_mode`
542
+ - Updated parameter structure:
543
+ - New base fee modes:
544
+ - 0 = Fee Scheduler - Linear
545
+ - 1 = Fee Scheduler - Exponential
546
+ - 2 = Rate Limiter
547
+ - `buildCurve`, `buildCurveWithMarketCap`, `buildCurveWithTwoSegments`, `buildCurveWithLiquidityWeights` functions now require `baseFeeParams` parameter that can be either configured with `feeSchedulerParam` or `rateLimiterParam`
548
+
549
+ ### Changed
550
+
551
+ - Updated base fee parameter structure to support both fee scheduler and rate limiter modes
552
+ - Enhanced fee calculation logic to accommodate rate limiter functionality
553
+
554
+ ## [1.2.3] - 2025-06-07
555
+
556
+ ### Added
557
+
558
+ - `swapQuoteExactIn` function
559
+
560
+ ## [1.2.2] - 2025-06-02
561
+
562
+ ### Added
563
+
564
+ - `claimCreatorTradingFee2` function (without `tempWSolAcc` parameter)
565
+ - `claimPartnerTradingFee2` function (without `tempWSolAcc` parameter)
566
+
567
+ ## [1.2.1] - 2025-06-02
568
+
569
+ ### Changed
570
+
571
+ - Fixed `buildCurveWithMarketCap` function to correctly calculate the `migrationQuoteThreshold`
572
+ - Fixed `validateConfigParameters` function to calculate `migrationBaseAmount` correctly
573
+
574
+ ## [1.2.0] - 2025-05-31
575
+
576
+ ### Changed
577
+
578
+ - `withdrawMigrationFee` function for partner and creator is now called `partnerWithdrawMigrationFee` and `creatorWithdrawMigrationFee`
579
+ - `createConfigAndPoolWithFirstBuy` function now returns an object containing the new config transaction, new pool transaction, and first buy transaction
580
+
581
+ ## [1.1.9] - 2025-05-30
582
+
583
+ ### Added
584
+
585
+ - `transferPoolCreator` function for creator
586
+ - `withdrawMigrationFee` function for creator
587
+ - `withdrawMigrationFee` function for partner
588
+
589
+ ### Changed
590
+
591
+ - Removed `buildCurveWithCreatorFirstBuy` function
592
+
593
+ ### Breaking Changes
594
+
595
+ - `createConfig`'s `ConfigParameters` include `migrationFee` and `tokenUpdateAuthority` configurations.
596
+ - All `buildCurve` functions now require `migrationFee` and `tokenUpdateAuthority` configurations.
597
+
598
+ ## [1.1.8] - 2025-05-28
599
+
600
+ ### Added
601
+
602
+ - `createConfigAndPoolWithFirstBuy` function
603
+ - `getTokenType` helper function
604
+ - `prepareTokenAccountTx` helper function
605
+ - `cleanUpTokenAccountTx` helper function
606
+
607
+ ## [1.1.7] - 2025-05-27
608
+
609
+ ### Changed
610
+
611
+ - Fixed `buildCurveWithTwoSegments` function to correctly calculate the midSqrtPrice
612
+ - Fixed precision error of `buildCurveWithMarketCap` function
613
+ - Changed `periodFrequency` calculation in `getLockedVestingParams` function
614
+
615
+ ## [1.1.6] - 2025-05-23
616
+
617
+ ### Added
618
+
619
+ - `getPoolByBaseMint` function
620
+ - `buildCurveWithCreatorFirstBuy` function
621
+ - `buildCurveWithTwoSegments` function
622
+ - `getLockedVestingParams` function
623
+ - `getBaseFeeParams` function
624
+ - `DAMM_V1_MIGRATION_FEE_ADDRESS` and `DAMM_V2_MIGRATION_FEE_ADDRESS` fee address array
625
+ - `getPriceFromSqrtPrice` function
626
+
627
+ ### Changed
628
+
629
+ - Optimised `getPoolsQuoteFeesByConfig` and `getPoolsBaseFeesByConfig` functions
630
+ - Fixed `getDammV1MigrationMetadata` and `getDammV2MigrationMetadata` functions to derive the metadata address from the pool address
631
+ - Removed `buildCurveAndCreateConfig`, `buildCurveAndCreateConfigByMarketCap` and `buildCurveGraphAndCreateConfig` functions
632
+ - Added `tempWSolAcc` parameter to `claimPartnerTradingFee` and `claimCreatorTradingFee` functions
633
+ - Removed `getTokenDecimal` state function
634
+
635
+ ### Breaking Changes
636
+
637
+ - Curve building functions are now split into two steps:
638
+ 1. Use helper functions to build curve config:
639
+ - `buildCurve`
640
+ - `buildCurveWithMarketCap`
641
+ - `buildCurveWithTwoSegments`
642
+ - `buildCurveWithLiquidityWeights`
643
+ - `buildCurveWithCreatorFirstBuy`
644
+ 2. Call `createConfig` with the built config
645
+ - Added required `tempWSolAcc` parameter to fee claiming functions when receiver !== creator || feeClaimer
646
+
647
+ ## [1.1.5] - 2025-05-23
648
+
649
+ ### Added
650
+
651
+ - `createConfigAndPool` function
652
+
653
+ ### Changed
654
+
655
+ - `docs.md` updated with the correct createPool format
656
+ - `CHANGELOG.md` switched to DES format
657
+
658
+ ## [1.1.4] - 2025-05-09
659
+
660
+ ### Added
661
+
662
+ - New function: `buildCurveGraphAndCreateConfig`
663
+ - Added `leftover` parameter to curve building functions
664
+
665
+ ### Changed
666
+
667
+ - Updated fee claiming functions to support custom receivers
668
+
669
+ ### Breaking Changes
670
+
671
+ - `buildCurveAndCreateConfig` and `buildCurveAndCreateConfigByMarketCap` now require `leftover` parameter
672
+ - `buildCurveGraphAndCreateConfig` uses `liquidityWeights[]` instead of `kFactor`
673
+ - Added receiver option in `claimPartnerTradingFee` and `claimCreatorTradingFee`
674
+
675
+ ## [1.1.3] - 2025-05-07
676
+
677
+ ### Changed
678
+
679
+ - Updated `buildCurveGraphAndCreateConfig` to use `liquidityWeights[]` instead of `kFactor`
680
+ - Modified dynamic fee calculation to be 20% of minimum base fee
681
+ - Changed `createPoolAndBuy` buyer from `payer` to `poolCreator`
682
+
683
+ ### Added
684
+
685
+ - Payer option to `claimCreatorTradingFee` and `claimPartnerTradingFee` functions
686
+
687
+ ## [1.1.2] - 2025-04-30
688
+
689
+ ### Added
690
+
691
+ - New fee options: 4% and 6% graduation fees
692
+ - New functions:
693
+ - `creatorWithdrawSurplus`
694
+ - `claimCreatorTradingFee`
695
+ - `createPoolAndBuy`
696
+ - New getter functions
697
+ - SDK modularization and RPC call optimization
698
+
699
+ ### Changed
700
+
701
+ - Updated service and getter function calling patterns
702
+
703
+ ### Breaking Changes
704
+
705
+ - Added required `creatorTradingFeePercentage` parameter to:
706
+ - `createConfig`
707
+ - `buildCurveAndCreateConfig`
708
+ - `buildCurveAndCreateConfigByMarketCap`
709
+ - Updated function namespaces:
710
+ - `client.partners` → `client.partner`
711
+ - `client.migrations` → `client.migration`
712
+ - `client.creators` → `client.creator`
713
+ - `client.pools` → `client.pool`
714
+ - `client.getProgram()` → `client.state`
715
+ - New pool address derivation functions:
716
+ 1. `deriveDbcPoolAddress`
717
+ 2. `deriveDammV1PoolAddress`
718
+ 3. `deriveDammV2PoolAddress`