@meteora-ag/dynamic-bonding-curve-sdk 1.5.7-rc.0 → 1.5.8

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/dist/index.cjs CHANGED
@@ -2651,7 +2651,7 @@ function computeSqrtPriceStepBps(priceMultiple, numberOfPeriod) {
2651
2651
  }
2652
2652
  return sqrtPriceStepBps;
2653
2653
  }
2654
- function getMigratedPoolMarketCapFeeSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, dammV2BaseFeeMode, numberOfPeriod, startingMarketCap, endingMarketCap, schedulerExpirationDuration) {
2654
+ function getMigratedPoolMarketCapFeeSchedulerParams(startingBaseFeeBps, endingBaseFeeBps, dammV2BaseFeeMode, numberOfPeriod, priceMultiple, schedulerExpirationDuration) {
2655
2655
  if (dammV2BaseFeeMode === 0 /* FeeTimeSchedulerLinear */ || dammV2BaseFeeMode === 1 /* FeeTimeSchedulerExponential */) {
2656
2656
  return DEFAULT_MIGRATED_POOL_MARKET_CAP_FEE_SCHEDULER_PARAMS;
2657
2657
  }
@@ -2669,10 +2669,8 @@ function getMigratedPoolMarketCapFeeSchedulerParams(startingBaseFeeBps, endingBa
2669
2669
  `startingBaseFeeBps (${startingBaseFeeBps} bps) must be greater than endingBaseFeeBps (${endingBaseFeeBps} bps)`
2670
2670
  );
2671
2671
  }
2672
- if (endingMarketCap <= startingMarketCap) {
2673
- throw new Error(
2674
- `endingMarketCap (${endingMarketCap}) must be greater than startingMarketCap (${startingMarketCap})`
2675
- );
2672
+ if (priceMultiple <= 1) {
2673
+ throw new Error("priceMultiple must be greater than 1");
2676
2674
  }
2677
2675
  if (startingBaseFeeBps > poolMaxFeeBps) {
2678
2676
  throw new Error(
@@ -2682,7 +2680,6 @@ function getMigratedPoolMarketCapFeeSchedulerParams(startingBaseFeeBps, endingBa
2682
2680
  if (schedulerExpirationDuration == 0) {
2683
2681
  throw new Error("schedulerExpirationDuration must be greater than zero");
2684
2682
  }
2685
- const priceMultiple = endingMarketCap / startingMarketCap;
2686
2683
  const sqrtPriceStepBps = computeSqrtPriceStepBps(
2687
2684
  priceMultiple,
2688
2685
  numberOfPeriod
@@ -2944,8 +2941,7 @@ function getMigratedPoolFeeParams(migrationOption, migrationFeeOption, migratedP
2944
2941
  migratedPoolFee.marketCapFeeSchedulerParams.endingBaseFeeBps,
2945
2942
  baseFeeMode,
2946
2943
  migratedPoolFee.marketCapFeeSchedulerParams.numberOfPeriod,
2947
- migratedPoolFee.marketCapFeeSchedulerParams.startingMarketCap,
2948
- migratedPoolFee.marketCapFeeSchedulerParams.endingMarketCap,
2944
+ migratedPoolFee.marketCapFeeSchedulerParams.priceMultiple,
2949
2945
  migratedPoolFee.marketCapFeeSchedulerParams.schedulerExpirationDuration
2950
2946
  );
2951
2947
  return {
@@ -3325,6 +3321,13 @@ function deriveBaseKeyForLocker(virtualPool) {
3325
3321
 
3326
3322
 
3327
3323
 
3324
+
3325
+
3326
+
3327
+
3328
+
3329
+ var DAMM_V2_MIN_FEE_NUMERATOR = 1e5;
3330
+ var DAMM_V2_MAX_FEE_NUMERATOR = 99e7;
3328
3331
  function validatePoolFees(poolFees, collectFeeMode, activationType) {
3329
3332
  if (!poolFees) return false;
3330
3333
  if (poolFees.baseFee) {
@@ -3355,6 +3358,9 @@ function validatePoolFees(poolFees, collectFeeMode, activationType) {
3355
3358
  }
3356
3359
  }
3357
3360
  }
3361
+ if (!validateDynamicFee(_nullishCoalesce(poolFees.dynamicFee, () => ( void 0)))) {
3362
+ return false;
3363
+ }
3358
3364
  return true;
3359
3365
  }
3360
3366
  function validateFeeScheduler(numberOfPeriod, periodFrequency, reductionFactor, cliffFeeNumerator, baseFeeMode) {
@@ -3379,6 +3385,9 @@ function validateFeeRateLimiter(cliffFeeNumerator, feeIncrementBps, maxLimiterDu
3379
3385
  if (collectFeeMode !== 0 /* QuoteToken */) {
3380
3386
  return false;
3381
3387
  }
3388
+ if (cliffFeeNumerator.lt(new (0, _bnjs2.default)(MIN_FEE_NUMERATOR)) || cliffFeeNumerator.gt(new (0, _bnjs2.default)(MAX_FEE_NUMERATOR))) {
3389
+ return false;
3390
+ }
3382
3391
  const isZeroRateLimiter2 = referenceAmount.eq(new (0, _bnjs2.default)(0)) && maxLimiterDuration.eq(new (0, _bnjs2.default)(0)) && feeIncrementBps.eq(new (0, _bnjs2.default)(0));
3383
3392
  if (isZeroRateLimiter2) {
3384
3393
  return true;
@@ -3398,9 +3407,6 @@ function validateFeeRateLimiter(cliffFeeNumerator, feeIncrementBps, maxLimiterDu
3398
3407
  if (feeIncrementNumerator.gte(new (0, _bnjs2.default)(FEE_DENOMINATOR))) {
3399
3408
  return false;
3400
3409
  }
3401
- if (cliffFeeNumerator.lt(new (0, _bnjs2.default)(MIN_FEE_NUMERATOR)) || cliffFeeNumerator.gt(new (0, _bnjs2.default)(MAX_FEE_NUMERATOR))) {
3402
- return false;
3403
- }
3404
3410
  const minFeeNumerator = getFeeNumeratorFromIncludedAmount(
3405
3411
  cliffFeeNumerator,
3406
3412
  referenceAmount,
@@ -3519,6 +3525,49 @@ function validateTokenAuthorityOptions(option) {
3519
3525
  4 /* PartnerUpdateAndMintAuthority */
3520
3526
  ].includes(option);
3521
3527
  }
3528
+ function hasMintAuthority(option) {
3529
+ return option === 3 /* CreatorUpdateAndMintAuthority */ || option === 4 /* PartnerUpdateAndMintAuthority */;
3530
+ }
3531
+ function validateTransferHookProgram(transferHookProgram) {
3532
+ if (!transferHookProgram) {
3533
+ return false;
3534
+ }
3535
+ if (!(transferHookProgram instanceof _web3js.PublicKey)) {
3536
+ return false;
3537
+ }
3538
+ if (transferHookProgram.equals(_web3js.PublicKey.default)) {
3539
+ return false;
3540
+ }
3541
+ if (transferHookProgram.equals(DYNAMIC_BONDING_CURVE_PROGRAM_ID)) {
3542
+ return false;
3543
+ }
3544
+ if (transferHookProgram.equals(_spltoken.TOKEN_PROGRAM_ID)) {
3545
+ return false;
3546
+ }
3547
+ if (transferHookProgram.equals(_spltoken.TOKEN_2022_PROGRAM_ID)) {
3548
+ return false;
3549
+ }
3550
+ return true;
3551
+ }
3552
+ async function validateTransferHookProgramExecutable(connection, transferHookProgram) {
3553
+ if (!validateTransferHookProgram(transferHookProgram)) {
3554
+ return false;
3555
+ }
3556
+ const accountInfo = await connection.getAccountInfo(transferHookProgram);
3557
+ if (!accountInfo) {
3558
+ return false;
3559
+ }
3560
+ return accountInfo.executable;
3561
+ }
3562
+ function validateQuoteMintBasic(quoteMint) {
3563
+ if (!quoteMint || quoteMint.equals(_web3js.PublicKey.default)) {
3564
+ return false;
3565
+ }
3566
+ if (quoteMint.equals(_spltoken.NATIVE_MINT_2022)) {
3567
+ return false;
3568
+ }
3569
+ return true;
3570
+ }
3522
3571
  function validatePoolCreationFee(poolCreationFee) {
3523
3572
  if (poolCreationFee.eq(new (0, _bnjs2.default)(0))) {
3524
3573
  return true;
@@ -3533,10 +3582,43 @@ function validateLiquidityVestingInfo(vestingInfo) {
3533
3582
  if (vestingInfo.vestingPercentage < 0 || vestingInfo.vestingPercentage > 100) {
3534
3583
  return false;
3535
3584
  }
3536
- if (vestingInfo.vestingPercentage > 0 && vestingInfo.frequency === 0) {
3585
+ const totalBpsAfterCliff = vestingInfo.bpsPerPeriod * vestingInfo.numberOfPeriods;
3586
+ if (totalBpsAfterCliff > U16_MAX) {
3537
3587
  return false;
3538
3588
  }
3539
- return true;
3589
+ const totalVestedLiquidity = U128_MAX.mul(
3590
+ new (0, _bnjs2.default)(vestingInfo.vestingPercentage)
3591
+ ).div(new (0, _bnjs2.default)(100));
3592
+ const totalVestingLiquidityAfterCliff = totalVestedLiquidity.mul(new (0, _bnjs2.default)(totalBpsAfterCliff)).div(new (0, _bnjs2.default)(MAX_BASIS_POINT));
3593
+ const liquidityPerPeriod = vestingInfo.numberOfPeriods > 0 ? totalVestingLiquidityAfterCliff.div(
3594
+ new (0, _bnjs2.default)(vestingInfo.numberOfPeriods)
3595
+ ) : new (0, _bnjs2.default)(0);
3596
+ let effectiveNumberOfPeriods = vestingInfo.numberOfPeriods;
3597
+ let effectiveFrequency = vestingInfo.frequency;
3598
+ let effectiveCliffDuration = vestingInfo.cliffDurationFromMigrationTime;
3599
+ if (liquidityPerPeriod.gt(new (0, _bnjs2.default)(0))) {
3600
+ if (vestingInfo.numberOfPeriods === 0) {
3601
+ return false;
3602
+ }
3603
+ if (vestingInfo.frequency === 0) {
3604
+ return false;
3605
+ }
3606
+ } else {
3607
+ effectiveNumberOfPeriods = 0;
3608
+ effectiveFrequency = 0;
3609
+ effectiveCliffDuration = Math.max(effectiveCliffDuration, 1);
3610
+ }
3611
+ const totalPeriodicLiquidity = liquidityPerPeriod.mul(
3612
+ new (0, _bnjs2.default)(effectiveNumberOfPeriods)
3613
+ );
3614
+ if (totalPeriodicLiquidity.gt(totalVestedLiquidity)) {
3615
+ return false;
3616
+ }
3617
+ const cliffUnlockLiquidity = totalVestedLiquidity.sub(
3618
+ totalPeriodicLiquidity
3619
+ );
3620
+ const vestingDuration = effectiveCliffDuration + effectiveFrequency * effectiveNumberOfPeriods;
3621
+ return vestingDuration <= MAX_LOCK_DURATION_IN_SECONDS && cliffUnlockLiquidity.add(totalPeriodicLiquidity).gt(new (0, _bnjs2.default)(0));
3540
3622
  }
3541
3623
  function validateMinimumLockedLiquidity(partnerPermanentLockedLiquidityPercentage, creatorPermanentLockedLiquidityPercentage, partnerLiquidityVestingInfo, creatorLiquidityVestingInfo) {
3542
3624
  const lockedBpsAtDay1 = calculateLockedLiquidityBpsAtTime(
@@ -3557,30 +3639,28 @@ function validateCompoundingFeeBps(collectFeeMode, compoundingFeeBps) {
3557
3639
  }
3558
3640
  return compoundingFeeBps === 0;
3559
3641
  }
3560
- function validateMigratedPoolFee(migratedPoolFee, migrationOption, migrationFeeOption, migratedPoolMarketCapFeeSchedulerParams, compoundingFeeBps) {
3642
+ function validateMigratedPoolFee(migratedPoolFee, migrationOption, migrationFeeOption, migratedPoolMarketCapFeeSchedulerParams, compoundingFeeBps, migratedPoolBaseFeeMode = 0 /* FeeTimeSchedulerLinear */) {
3561
3643
  const effectiveCompoundingFeeBps = _nullishCoalesce(compoundingFeeBps, () => ( 0));
3562
- const isEmpty = () => {
3563
- return migratedPoolFee.collectFeeMode === 0 && migratedPoolFee.dynamicFee === 0 && migratedPoolFee.poolFeeBps === 0 && effectiveCompoundingFeeBps === 0;
3564
- };
3565
- const isMarketCapFeeSchedulerConfigured = () => {
3566
- if (!migratedPoolMarketCapFeeSchedulerParams) return false;
3567
- return migratedPoolMarketCapFeeSchedulerParams.numberOfPeriod > 0 || migratedPoolMarketCapFeeSchedulerParams.sqrtPriceStepBps > 0 || migratedPoolMarketCapFeeSchedulerParams.schedulerExpirationDuration > 0 || !migratedPoolMarketCapFeeSchedulerParams.reductionFactor.eq(
3644
+ const isMarketCapFeeSchedulerParamsZero = () => {
3645
+ if (!migratedPoolMarketCapFeeSchedulerParams) return true;
3646
+ return migratedPoolMarketCapFeeSchedulerParams.numberOfPeriod === 0 && migratedPoolMarketCapFeeSchedulerParams.sqrtPriceStepBps === 0 && migratedPoolMarketCapFeeSchedulerParams.schedulerExpirationDuration === 0 && migratedPoolMarketCapFeeSchedulerParams.reductionFactor.eq(
3568
3647
  new (0, _bnjs2.default)(0)
3569
3648
  );
3570
3649
  };
3650
+ const isNone = () => {
3651
+ return migratedPoolFee.collectFeeMode === 0 && migratedPoolFee.dynamicFee === 0 && migratedPoolFee.poolFeeBps === 0 && effectiveCompoundingFeeBps === 0 && migratedPoolBaseFeeMode === 0 /* FeeTimeSchedulerLinear */ && isMarketCapFeeSchedulerParamsZero();
3652
+ };
3571
3653
  if (migrationOption !== void 0 && migrationFeeOption !== void 0) {
3572
3654
  if (migrationOption === 0 /* MET_DAMM */) {
3573
- return isEmpty();
3655
+ return isNone();
3574
3656
  }
3575
3657
  if (migrationOption === 1 /* MET_DAMM_V2 */) {
3576
3658
  if (migrationFeeOption !== 6 /* Customizable */) {
3577
- if (!isMarketCapFeeSchedulerConfigured()) {
3578
- return isEmpty();
3579
- }
3659
+ return isNone();
3580
3660
  }
3581
3661
  }
3582
3662
  }
3583
- if (isEmpty()) {
3663
+ if (isNone()) {
3584
3664
  return true;
3585
3665
  }
3586
3666
  if (migratedPoolFee.poolFeeBps < MIN_MIGRATED_POOL_FEE_BPS || migratedPoolFee.poolFeeBps > MAX_MIGRATED_POOL_FEE_BPS) {
@@ -3598,9 +3678,30 @@ function validateMigratedPoolFee(migratedPoolFee, migrationOption, migrationFeeO
3598
3678
  if (migratedPoolFee.dynamicFee !== 0 /* Disabled */ && migratedPoolFee.dynamicFee !== 1 /* Enabled */) {
3599
3679
  return false;
3600
3680
  }
3681
+ if (migrationOption === void 0 || migrationOption === 1 /* MET_DAMM_V2 */) {
3682
+ try {
3683
+ validateMigratedPoolBaseFeeMode(
3684
+ migratedPoolBaseFeeMode,
3685
+ _nullishCoalesce(migratedPoolMarketCapFeeSchedulerParams, () => ( {
3686
+ numberOfPeriod: 0,
3687
+ sqrtPriceStepBps: 0,
3688
+ schedulerExpirationDuration: 0,
3689
+ reductionFactor: new (0, _bnjs2.default)(0)
3690
+ })),
3691
+ migrationOption,
3692
+ migratedPoolFee.poolFeeBps
3693
+ );
3694
+ } catch (e2) {
3695
+ return false;
3696
+ }
3697
+ }
3601
3698
  return true;
3602
3699
  }
3603
- function validateConfigParameters(configParam) {
3700
+ function validateConfigParameters(configParam, options = false) {
3701
+ const { isTransferHook, transferHookProgram } = typeof options === "boolean" ? { isTransferHook: options, transferHookProgram: void 0 } : {
3702
+ isTransferHook: _nullishCoalesce(options.isTransferHook, () => ( false)),
3703
+ transferHookProgram: options.transferHookProgram
3704
+ };
3604
3705
  if (!configParam.poolFees) {
3605
3706
  throw new Error("Pool fees are required");
3606
3707
  }
@@ -3617,6 +3718,23 @@ function validateConfigParameters(configParam) {
3617
3718
  if (!validateTokenAuthorityOptions(configParam.tokenUpdateAuthority)) {
3618
3719
  throw new Error("Invalid option for token update authority");
3619
3720
  }
3721
+ if (!isTransferHook && hasMintAuthority(configParam.tokenUpdateAuthority)) {
3722
+ throw new Error(
3723
+ "Mint authority token update options are only supported for transfer-hook configs"
3724
+ );
3725
+ }
3726
+ if (isTransferHook && configParam.tokenType !== 1 /* Token2022 */) {
3727
+ throw new Error(
3728
+ "Transfer-hook configs require tokenType to be Token2022"
3729
+ );
3730
+ }
3731
+ if (isTransferHook && transferHookProgram !== void 0) {
3732
+ if (!validateTransferHookProgram(transferHookProgram)) {
3733
+ throw new Error(
3734
+ "Invalid transfer hook program: cannot be the DBC program, SPL Token, SPL Token-2022, or the default pubkey"
3735
+ );
3736
+ }
3737
+ }
3620
3738
  if (!validateMigrationAndTokenType(
3621
3739
  configParam.migrationOption,
3622
3740
  configParam.tokenType
@@ -3692,6 +3810,26 @@ function validateConfigParameters(configParam) {
3692
3810
  if (sqrtMigrationPrice.gte(new (0, _bnjs2.default)(MAX_SQRT_PRICE))) {
3693
3811
  throw new Error("Migration sqrt price exceeds maximum");
3694
3812
  }
3813
+ const swapBaseAmountForCurve = getBaseTokenForSwap(
3814
+ configParam.sqrtStartPrice,
3815
+ sqrtMigrationPrice,
3816
+ configParam.curve
3817
+ );
3818
+ const migrationBaseAmountForCurve = getMigrationBaseToken(
3819
+ convertDecimalToBN(
3820
+ getMigrationQuoteAmountFromMigrationQuoteThreshold(
3821
+ new (0, _decimaljs2.default)(configParam.migrationQuoteThreshold.toString()),
3822
+ configParam.migrationFee.feePercentage
3823
+ )
3824
+ ),
3825
+ sqrtMigrationPrice,
3826
+ configParam.migrationOption
3827
+ );
3828
+ if (swapBaseAmountForCurve.lte(new (0, _bnjs2.default)(0)) || migrationBaseAmountForCurve.lte(new (0, _bnjs2.default)(0))) {
3829
+ throw new Error(
3830
+ "Invalid curve: swap base amount and migration base amount must both be greater than 0"
3831
+ );
3832
+ }
3695
3833
  if (!validateMinimumLockedLiquidity(
3696
3834
  configParam.partnerPermanentLockedLiquidityPercentage,
3697
3835
  configParam.creatorPermanentLockedLiquidityPercentage,
@@ -3721,7 +3859,8 @@ function validateConfigParameters(configParam) {
3721
3859
  configParam.migrationOption,
3722
3860
  configParam.migrationFeeOption,
3723
3861
  configParam.migratedPoolMarketCapFeeSchedulerParams,
3724
- configParam.compoundingFeeBps
3862
+ configParam.compoundingFeeBps,
3863
+ configParam.migratedPoolBaseFeeMode
3725
3864
  )) {
3726
3865
  throw new Error("Invalid migrated pool fee parameters");
3727
3866
  }
@@ -3730,7 +3869,8 @@ function validateConfigParameters(configParam) {
3730
3869
  validateMigratedPoolBaseFeeMode(
3731
3870
  configParam.migratedPoolBaseFeeMode,
3732
3871
  configParam.migratedPoolMarketCapFeeSchedulerParams,
3733
- configParam.migrationOption
3872
+ configParam.migrationOption,
3873
+ configParam.migratedPoolFee.poolFeeBps
3734
3874
  );
3735
3875
  validateMarketCapFeeSchedulerRequiresPoolFeeBps(
3736
3876
  configParam.migratedPoolMarketCapFeeSchedulerParams,
@@ -3828,7 +3968,7 @@ function validateSwapAmount(amountIn) {
3828
3968
  }
3829
3969
  return true;
3830
3970
  }
3831
- function validateMigratedPoolBaseFeeMode(migratedPoolBaseFeeMode, migratedPoolMarketCapFeeSchedulerParams, migrationOption) {
3971
+ function validateMigratedPoolBaseFeeMode(migratedPoolBaseFeeMode, migratedPoolMarketCapFeeSchedulerParams, migrationOption, poolFeeBps = MIN_MIGRATED_POOL_FEE_BPS) {
3832
3972
  if (migrationOption !== void 0 && migrationOption !== 1 /* MET_DAMM_V2 */) {
3833
3973
  return true;
3834
3974
  }
@@ -3847,14 +3987,27 @@ function validateMigratedPoolBaseFeeMode(migratedPoolBaseFeeMode, migratedPoolMa
3847
3987
  return true;
3848
3988
  }
3849
3989
  if (migratedPoolBaseFeeMode === 3 /* FeeMarketCapSchedulerLinear */ || migratedPoolBaseFeeMode === 4 /* FeeMarketCapSchedulerExponential */) {
3850
- if (isFixedFeeParams) {
3851
- return true;
3852
- }
3853
- if (migratedPoolMarketCapFeeSchedulerParams.numberOfPeriod <= 0 || migratedPoolMarketCapFeeSchedulerParams.sqrtPriceStepBps <= 0 || migratedPoolMarketCapFeeSchedulerParams.schedulerExpirationDuration <= 0) {
3990
+ if (migratedPoolMarketCapFeeSchedulerParams.numberOfPeriod <= 0 || migratedPoolMarketCapFeeSchedulerParams.sqrtPriceStepBps <= 0 || migratedPoolMarketCapFeeSchedulerParams.schedulerExpirationDuration <= 0 || migratedPoolMarketCapFeeSchedulerParams.reductionFactor.lte(
3991
+ new (0, _bnjs2.default)(0)
3992
+ )) {
3854
3993
  throw new Error(
3855
- `For FeeMarketCapSchedulerLinear (3) and FeeMarketCapSchedulerExponential (4) modes, if using dynamic fee scheduling, numberOfPeriod, sqrtPriceStepBps, and schedulerExpirationDuration must all be greater than 0.`
3994
+ `For FeeMarketCapSchedulerLinear (3) and FeeMarketCapSchedulerExponential (4) modes, if using dynamic fee scheduling, numberOfPeriod, sqrtPriceStepBps, and schedulerExpirationDuration must all be greater than 0, and reductionFactor must be greater than 0.`
3856
3995
  );
3857
3996
  }
3997
+ const schedulerMode = migratedPoolBaseFeeMode === 3 /* FeeMarketCapSchedulerLinear */ ? 0 /* FeeSchedulerLinear */ : 1 /* FeeSchedulerExponential */;
3998
+ const cliffFeeNumerator = toNumerator(
3999
+ new (0, _bnjs2.default)(poolFeeBps),
4000
+ new (0, _bnjs2.default)(FEE_DENOMINATOR)
4001
+ );
4002
+ const minFeeNumerator = getFeeSchedulerMinBaseFeeNumerator(
4003
+ cliffFeeNumerator,
4004
+ migratedPoolMarketCapFeeSchedulerParams.numberOfPeriod,
4005
+ migratedPoolMarketCapFeeSchedulerParams.reductionFactor,
4006
+ schedulerMode
4007
+ );
4008
+ if (minFeeNumerator.lt(new (0, _bnjs2.default)(DAMM_V2_MIN_FEE_NUMERATOR)) || cliffFeeNumerator.gt(new (0, _bnjs2.default)(DAMM_V2_MAX_FEE_NUMERATOR))) {
4009
+ throw new Error("Invalid market cap fee scheduler fee bounds");
4010
+ }
3858
4011
  return true;
3859
4012
  }
3860
4013
  throw new Error(
@@ -3888,6 +4041,11 @@ function validateMigrationFee(migrationFee) {
3888
4041
  `Migration creator fee percentage must be between 0 and ${MAX_CREATOR_MIGRATION_FEE_PERCENTAGE}`
3889
4042
  );
3890
4043
  }
4044
+ if (migrationFee.feePercentage === 0 && migrationFee.creatorFeePercentage !== 0) {
4045
+ throw new Error(
4046
+ "Migration creator fee percentage must be 0 when migration fee percentage is 0"
4047
+ );
4048
+ }
3891
4049
  return true;
3892
4050
  }
3893
4051
 
@@ -28907,7 +29065,10 @@ var DynamicBondingCurveProgram = class {
28907
29065
  }).transaction();
28908
29066
  }
28909
29067
  async buildCreateConfigWithTransferHookTx(configParam, config, feeClaimer, leftoverReceiver, quoteMint, transferHookProgram, payer) {
28910
- validateConfigParameters({ ...configParam, leftoverReceiver });
29068
+ validateConfigParameters(
29069
+ { ...configParam, leftoverReceiver },
29070
+ { isTransferHook: true, transferHookProgram }
29071
+ );
28911
29072
  return this.program.methods.createConfigWithTransferHook(configParam).accountsPartial({
28912
29073
  config,
28913
29074
  feeClaimer,
@@ -29054,6 +29215,11 @@ var DynamicBondingCurveProgram = class {
29054
29215
  payer,
29055
29216
  transferHookProgram
29056
29217
  } = createPoolParam;
29218
+ if (!validateTransferHookProgram(transferHookProgram)) {
29219
+ throw new Error(
29220
+ "Invalid transfer hook program: cannot be the DBC program, SPL Token, SPL Token-2022, or the default pubkey"
29221
+ );
29222
+ }
29057
29223
  const pool = deriveDbcPoolAddress(quoteMint, baseMint, config);
29058
29224
  const baseVault = deriveDbcTokenVaultAddress(pool, baseMint);
29059
29225
  const quoteVault = deriveDbcTokenVaultAddress(pool, quoteMint);
@@ -29282,7 +29448,7 @@ var DynamicBondingCurveProgram = class {
29282
29448
  baseMint,
29283
29449
  transferHookAccountTypes
29284
29450
  );
29285
- } catch (e2) {
29451
+ } catch (e3) {
29286
29452
  throw new Error(
29287
29453
  `Unable to resolve transfer-hook remaining accounts for ${baseMint.toString()}. When bundling pool initialization with the first buy, pass transferHookAccountsInfo and transferHookAccounts on the first-buy params.`
29288
29454
  );
@@ -29536,13 +29702,13 @@ var StateService = class extends DynamicBondingCurveProgram {
29536
29702
  if (poolConfig) {
29537
29703
  return poolConfig;
29538
29704
  }
29539
- } catch (e3) {
29705
+ } catch (e4) {
29540
29706
  }
29541
29707
  const configWithTransferHook = await this.program.account.configWithTransferHook.fetchNullable(
29542
29708
  address,
29543
29709
  this.commitment
29544
29710
  );
29545
- return _optionalChain([configWithTransferHook, 'optionalAccess', _29 => _29.config]);
29711
+ return _nullishCoalesce(_optionalChain([configWithTransferHook, 'optionalAccess', _29 => _29.config]), () => ( null));
29546
29712
  }
29547
29713
  /**
29548
29714
  * Fetch all pool config accounts.
@@ -29570,7 +29736,7 @@ var StateService = class extends DynamicBondingCurveProgram {
29570
29736
  if (virtualPool) {
29571
29737
  return virtualPool;
29572
29738
  }
29573
- } catch (e4) {
29739
+ } catch (e5) {
29574
29740
  }
29575
29741
  return await this.program.account.transferHookPool.fetchNullable(
29576
29742
  address,
@@ -30667,7 +30833,11 @@ var PartnerService = class extends DynamicBondingCurveProgram {
30667
30833
  tokenBaseProgram,
30668
30834
  tokenQuoteProgram
30669
30835
  });
30670
- return this.program.methods.claimTradingFee(maxBaseAmount, maxQuoteAmount).accountsPartial({ ...result.accounts, feeClaimer }).preInstructions(result.preInstructions).postInstructions(result.postInstructions).transaction();
30836
+ return this.program.methods.claimTradingFee(maxBaseAmount, maxQuoteAmount).accountsPartial({
30837
+ ...result.accounts,
30838
+ config: virtualPool.poolState.config,
30839
+ feeClaimer
30840
+ }).preInstructions(result.preInstructions).postInstructions(result.postInstructions).transaction();
30671
30841
  } else {
30672
30842
  const result = await this.buildClaimTradingFeeAccountsForNonSol({
30673
30843
  payer,
@@ -30678,7 +30848,11 @@ var PartnerService = class extends DynamicBondingCurveProgram {
30678
30848
  tokenBaseProgram,
30679
30849
  tokenQuoteProgram
30680
30850
  });
30681
- return this.program.methods.claimTradingFee(maxBaseAmount, maxQuoteAmount).accountsPartial({ ...result.accounts, feeClaimer }).preInstructions(result.preInstructions).postInstructions([]).transaction();
30851
+ return this.program.methods.claimTradingFee(maxBaseAmount, maxQuoteAmount).accountsPartial({
30852
+ ...result.accounts,
30853
+ config: virtualPool.poolState.config,
30854
+ feeClaimer
30855
+ }).preInstructions(result.preInstructions).postInstructions([]).transaction();
30682
30856
  }
30683
30857
  }
30684
30858
  /**
@@ -31643,7 +31817,10 @@ var CreatorService = class extends DynamicBondingCurveProgram {
31643
31817
  */
31644
31818
  async transferPoolCreator(params) {
31645
31819
  const { pool, creator, newCreator } = params;
31646
- const { virtualPool } = await this.getPoolWithConfig(pool);
31820
+ const virtualPool = await this.state.getPool(pool);
31821
+ if (!virtualPool) {
31822
+ throw new Error(`Pool not found: ${pool.toString()}`);
31823
+ }
31647
31824
  const migrationMetadata = deriveDammV1MigrationMetadataAddress(pool);
31648
31825
  const transaction = await this.program.methods.transferPoolCreator().accountsPartial({
31649
31826
  virtualPool: pool,
@@ -31955,5 +32132,9 @@ var DynamicBondingCurveClient = class _DynamicBondingCurveClient {
31955
32132
 
31956
32133
 
31957
32134
 
31958
- exports.AccountsType = AccountsType; exports.ActivationType = ActivationType; exports.BASE_ADDRESS = BASE_ADDRESS; exports.BIN_STEP_BPS_DEFAULT = BIN_STEP_BPS_DEFAULT; exports.BIN_STEP_BPS_U128_DEFAULT = BIN_STEP_BPS_U128_DEFAULT; exports.BaseFeeMode = BaseFeeMode; exports.CollectFeeMode = CollectFeeMode; exports.CreatorService = CreatorService; exports.DAMM_V1_MIGRATION_FEE_ADDRESS = DAMM_V1_MIGRATION_FEE_ADDRESS; exports.DAMM_V1_PROGRAM_ID = DAMM_V1_PROGRAM_ID; exports.DAMM_V2_MIGRATION_FEE_ADDRESS = DAMM_V2_MIGRATION_FEE_ADDRESS; exports.DAMM_V2_PROGRAM_ID = DAMM_V2_PROGRAM_ID; exports.DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS = DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS; exports.DEFAULT_MIGRATED_POOL_FEE_PARAMS = DEFAULT_MIGRATED_POOL_FEE_PARAMS; exports.DEFAULT_MIGRATED_POOL_MARKET_CAP_FEE_SCHEDULER_PARAMS = DEFAULT_MIGRATED_POOL_MARKET_CAP_FEE_SCHEDULER_PARAMS; exports.DYNAMIC_BONDING_CURVE_PROGRAM_ID = DYNAMIC_BONDING_CURVE_PROGRAM_ID; exports.DYNAMIC_FEE_DECAY_PERIOD_DEFAULT = DYNAMIC_FEE_DECAY_PERIOD_DEFAULT; exports.DYNAMIC_FEE_FILTER_PERIOD_DEFAULT = DYNAMIC_FEE_FILTER_PERIOD_DEFAULT; exports.DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT; exports.DYNAMIC_FEE_ROUNDING_OFFSET = DYNAMIC_FEE_ROUNDING_OFFSET; exports.DYNAMIC_FEE_SCALING_FACTOR = DYNAMIC_FEE_SCALING_FACTOR; exports.DammV2BaseFeeMode = DammV2BaseFeeMode; exports.DammV2DynamicFeeMode = DammV2DynamicFeeMode; exports.DynamicBondingCurveClient = DynamicBondingCurveClient; exports.DynamicBondingCurveIdl = idl_default; exports.DynamicBondingCurveProgram = DynamicBondingCurveProgram; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeRateLimiter = FeeRateLimiter; exports.FeeScheduler = FeeScheduler; exports.HOST_FEE_PERCENT = HOST_FEE_PERCENT; exports.LOCKER_PROGRAM_ID = LOCKER_PROGRAM_ID; exports.MAX_BASIS_POINT = MAX_BASIS_POINT; exports.MAX_CREATOR_MIGRATION_FEE_PERCENTAGE = MAX_CREATOR_MIGRATION_FEE_PERCENTAGE; exports.MAX_CURVE_POINT = MAX_CURVE_POINT; exports.MAX_FEE_BPS = MAX_FEE_BPS; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_LOCK_DURATION_IN_SECONDS = MAX_LOCK_DURATION_IN_SECONDS; exports.MAX_MIGRATED_POOL_FEE_BPS = MAX_MIGRATED_POOL_FEE_BPS; exports.MAX_MIGRATION_FEE_PERCENTAGE = MAX_MIGRATION_FEE_PERCENTAGE; exports.MAX_POOL_CREATION_FEE = MAX_POOL_CREATION_FEE; exports.MAX_PRICE_CHANGE_BPS_DEFAULT = MAX_PRICE_CHANGE_BPS_DEFAULT; exports.MAX_RATE_LIMITER_DURATION_IN_SECONDS = MAX_RATE_LIMITER_DURATION_IN_SECONDS; exports.MAX_RATE_LIMITER_DURATION_IN_SLOTS = MAX_RATE_LIMITER_DURATION_IN_SLOTS; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.METAPLEX_PROGRAM_ID = METAPLEX_PROGRAM_ID; exports.MIN_FEE_BPS = MIN_FEE_BPS; exports.MIN_FEE_NUMERATOR = MIN_FEE_NUMERATOR; exports.MIN_LOCKED_LIQUIDITY_BPS = MIN_LOCKED_LIQUIDITY_BPS; exports.MIN_MIGRATED_POOL_FEE_BPS = MIN_MIGRATED_POOL_FEE_BPS; exports.MIN_POOL_CREATION_FEE = MIN_POOL_CREATION_FEE; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.MigratedCollectFeeMode = MigratedCollectFeeMode; exports.MigrationFeeOption = MigrationFeeOption; exports.MigrationOption = MigrationOption; exports.MigrationService = MigrationService; exports.OFFSET = OFFSET; exports.ONE_Q64 = ONE_Q64; exports.PROTOCOL_FEE_PERCENT = PROTOCOL_FEE_PERCENT; exports.PROTOCOL_POOL_CREATION_FEE_PERCENT = PROTOCOL_POOL_CREATION_FEE_PERCENT; exports.PartnerService = PartnerService; exports.PoolService = PoolService; exports.RESOLUTION = RESOLUTION; exports.Rounding = Rounding; exports.SECONDS_PER_DAY = SECONDS_PER_DAY; exports.SWAP_BUFFER_PERCENTAGE = SWAP_BUFFER_PERCENTAGE; exports.SafeMath = SafeMath; exports.StateService = StateService; exports.SwapMode = SwapMode; exports.TokenAuthorityOption = TokenAuthorityOption; exports.TokenDecimal = TokenDecimal; exports.TokenType = TokenType; exports.TradeDirection = TradeDirection; exports.U128_MAX = U128_MAX; exports.U16_MAX = U16_MAX; exports.U24_MAX = U24_MAX; exports.U64_MAX = U64_MAX; exports.VAULT_PROGRAM_ID = VAULT_PROGRAM_ID; exports.bpsToFeeNumerator = bpsToFeeNumerator; exports.buildCurve = buildCurve; exports.buildCurveWithCustomSqrtPrices = buildCurveWithCustomSqrtPrices; exports.buildCurveWithLiquidityWeights = buildCurveWithLiquidityWeights; exports.buildCurveWithMarketCap = buildCurveWithMarketCap; exports.buildCurveWithMidPrice = buildCurveWithMidPrice; exports.buildCurveWithTwoSegments = buildCurveWithTwoSegments; exports.calculateAdjustedPercentageSupplyOnMigration = calculateAdjustedPercentageSupplyOnMigration; exports.calculateBaseToQuoteFromAmountIn = calculateBaseToQuoteFromAmountIn; exports.calculateBaseToQuoteFromAmountOut = calculateBaseToQuoteFromAmountOut; exports.calculateFeeSchedulerEndingBaseFeeBps = calculateFeeSchedulerEndingBaseFeeBps; exports.calculateLockedLiquidityBpsAtTime = calculateLockedLiquidityBpsAtTime; exports.calculateQuoteToBaseFromAmountIn = calculateQuoteToBaseFromAmountIn; exports.calculateQuoteToBaseFromAmountOut = calculateQuoteToBaseFromAmountOut; exports.checkRateLimiterApplied = checkRateLimiterApplied; exports.cleanUpTokenAccountTx = cleanUpTokenAccountTx; exports.computeSqrtPriceStepBps = computeSqrtPriceStepBps; exports.convertDecimalToBN = convertDecimalToBN; exports.convertToLamports = convertToLamports; exports.createDammV1Program = createDammV1Program; exports.createDammV2Program = createDammV2Program; exports.createDbcProgram = createDbcProgram; exports.createDynamicVaultProgram = createDynamicVaultProgram; exports.createInitializePermissionlessDynamicVaultIx = createInitializePermissionlessDynamicVaultIx; exports.createLockEscrowIx = createLockEscrowIx; exports.createProgramAccountFilter = createProgramAccountFilter; exports.createSqrtPrices = createSqrtPrices; exports.deriveBaseKeyForLocker = deriveBaseKeyForLocker; exports.deriveDammV1EventAuthority = deriveDammV1EventAuthority; exports.deriveDammV1LockEscrowAddress = deriveDammV1LockEscrowAddress; exports.deriveDammV1LpMintAddress = deriveDammV1LpMintAddress; exports.deriveDammV1MigrationMetadataAddress = deriveDammV1MigrationMetadataAddress; exports.deriveDammV1PoolAddress = deriveDammV1PoolAddress; exports.deriveDammV1PoolAuthority = deriveDammV1PoolAuthority; exports.deriveDammV1ProtocolFeeAddress = deriveDammV1ProtocolFeeAddress; exports.deriveDammV1VaultLPAddress = deriveDammV1VaultLPAddress; exports.deriveDammV2EventAuthority = deriveDammV2EventAuthority; exports.deriveDammV2LockEscrowAddress = deriveDammV2LockEscrowAddress; exports.deriveDammV2MigrationMetadataAddress = deriveDammV2MigrationMetadataAddress; exports.deriveDammV2PoolAddress = deriveDammV2PoolAddress; exports.deriveDammV2PoolAuthority = deriveDammV2PoolAuthority; exports.deriveDammV2TokenVaultAddress = deriveDammV2TokenVaultAddress; exports.deriveDbcEventAuthority = deriveDbcEventAuthority; exports.deriveDbcPoolAddress = deriveDbcPoolAddress; exports.deriveDbcPoolAuthority = deriveDbcPoolAuthority; exports.deriveDbcPoolMetadata = deriveDbcPoolMetadata; exports.deriveDbcTokenVaultAddress = deriveDbcTokenVaultAddress; exports.deriveEscrow = deriveEscrow; exports.deriveLockerEventAuthority = deriveLockerEventAuthority; exports.deriveMintMetadata = deriveMintMetadata; exports.derivePartnerMetadata = derivePartnerMetadata; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveTokenVaultKey = deriveTokenVaultKey; exports.deriveVaultAddress = deriveVaultAddress; exports.deriveVaultLpMintAddress = deriveVaultLpMintAddress; exports.deriveVaultPdas = deriveVaultPdas; exports.feeNumeratorToBps = feeNumeratorToBps; exports.findAssociatedTokenAddress = findAssociatedTokenAddress; exports.fromDecimalToBN = fromDecimalToBN; exports.getAccountCreationTimestamp = getAccountCreationTimestamp; exports.getAccountCreationTimestamps = getAccountCreationTimestamps; exports.getAccountData = getAccountData; exports.getBaseFeeHandler = getBaseFeeHandler; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getBaseFeeNumeratorByPeriod = getBaseFeeNumeratorByPeriod; exports.getBaseFeeParams = getBaseFeeParams; exports.getBaseTokenForSwap = getBaseTokenForSwap; exports.getCheckedAmounts = getCheckedAmounts; exports.getCurrentPoint = getCurrentPoint; exports.getCurveBreakdown = getCurveBreakdown; exports.getDeltaAmountBaseUnsigned = getDeltaAmountBaseUnsigned; exports.getDeltaAmountBaseUnsigned256 = getDeltaAmountBaseUnsigned256; exports.getDeltaAmountBaseUnsignedUnchecked = getDeltaAmountBaseUnsignedUnchecked; exports.getDeltaAmountQuoteUnsigned = getDeltaAmountQuoteUnsigned; exports.getDeltaAmountQuoteUnsigned256 = getDeltaAmountQuoteUnsigned256; exports.getDeltaAmountQuoteUnsignedUnchecked = getDeltaAmountQuoteUnsignedUnchecked; exports.getDynamicFeeParams = getDynamicFeeParams; exports.getExcludedFeeAmount = getExcludedFeeAmount; exports.getFeeMode = getFeeMode; exports.getFeeNumeratorFromExcludedAmount = getFeeNumeratorFromExcludedAmount; exports.getFeeNumeratorFromIncludedAmount = getFeeNumeratorFromIncludedAmount; exports.getFeeNumeratorOnExponentialFeeScheduler = getFeeNumeratorOnExponentialFeeScheduler; exports.getFeeNumeratorOnLinearFeeScheduler = getFeeNumeratorOnLinearFeeScheduler; exports.getFeeOnAmount = getFeeOnAmount; exports.getFeeSchedulerMaxBaseFeeNumerator = getFeeSchedulerMaxBaseFeeNumerator; exports.getFeeSchedulerMinBaseFeeNumerator = getFeeSchedulerMinBaseFeeNumerator; exports.getFeeSchedulerParams = getFeeSchedulerParams; exports.getFirstCurve = getFirstCurve; exports.getFirstKey = getFirstKey; exports.getIncludedFeeAmount = getIncludedFeeAmount; exports.getInitialLiquidityFromDeltaBase = getInitialLiquidityFromDeltaBase; exports.getInitialLiquidityFromDeltaQuote = getInitialLiquidityFromDeltaQuote; exports.getLiquidity = getLiquidity; exports.getLiquidityVestingInfoParams = getLiquidityVestingInfoParams; exports.getLockedVestingParams = getLockedVestingParams; exports.getMaxIndex = getMaxIndex; exports.getMaxOutAmountWithMinBaseFee = getMaxOutAmountWithMinBaseFee; exports.getMigratedPoolFeeParams = getMigratedPoolFeeParams; exports.getMigratedPoolMarketCapFeeSchedulerParams = getMigratedPoolMarketCapFeeSchedulerParams; exports.getMigrationBaseToken = getMigrationBaseToken; exports.getMigrationQuoteAmount = getMigrationQuoteAmount; exports.getMigrationQuoteAmountFromMigrationQuoteThreshold = getMigrationQuoteAmountFromMigrationQuoteThreshold; exports.getMigrationQuoteThresholdFromMigrationQuoteAmount = getMigrationQuoteThresholdFromMigrationQuoteAmount; exports.getMigrationThresholdPrice = getMigrationThresholdPrice; exports.getNextSqrtPriceFromBaseAmountInRoundingUp = getNextSqrtPriceFromBaseAmountInRoundingUp; exports.getNextSqrtPriceFromBaseAmountOutRoundingUp = getNextSqrtPriceFromBaseAmountOutRoundingUp; exports.getNextSqrtPriceFromInput = getNextSqrtPriceFromInput; exports.getNextSqrtPriceFromOutput = getNextSqrtPriceFromOutput; exports.getNextSqrtPriceFromQuoteAmountInRoundingDown = getNextSqrtPriceFromQuoteAmountInRoundingDown; exports.getNextSqrtPriceFromQuoteAmountOutRoundingDown = getNextSqrtPriceFromQuoteAmountOutRoundingDown; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPercentageSupplyOnMigration = getPercentageSupplyOnMigration; exports.getPriceFromSqrtPrice = getPriceFromSqrtPrice; exports.getProtocolMigrationFee = getProtocolMigrationFee; exports.getQuoteReserveFromNextSqrtPrice = getQuoteReserveFromNextSqrtPrice; exports.getRateLimiterExcludedFeeAmount = getRateLimiterExcludedFeeAmount; exports.getRateLimiterMinBaseFeeNumerator = getRateLimiterMinBaseFeeNumerator; exports.getRateLimiterParams = getRateLimiterParams; exports.getSecondKey = getSecondKey; exports.getSqrtPriceFromMarketCap = getSqrtPriceFromMarketCap; exports.getSqrtPriceFromPrice = getSqrtPriceFromPrice; exports.getStartingBaseFeeBpsFromBaseFeeParams = getStartingBaseFeeBpsFromBaseFeeParams; exports.getSwapAmountWithBuffer = getSwapAmountWithBuffer; exports.getSwapResult = getSwapResult; exports.getSwapResultFromExactInput = getSwapResultFromExactInput; exports.getSwapResultFromExactOutput = getSwapResultFromExactOutput; exports.getSwapResultFromPartialInput = getSwapResultFromPartialInput; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getTokenType = getTokenType; exports.getTokenomics = getTokenomics; exports.getTotalFeeNumerator = getTotalFeeNumerator; exports.getTotalFeeNumeratorFromExcludedFeeAmount = getTotalFeeNumeratorFromExcludedFeeAmount; exports.getTotalFeeNumeratorFromIncludedFeeAmount = getTotalFeeNumeratorFromIncludedFeeAmount; exports.getTotalSupplyFromCurve = getTotalSupplyFromCurve; exports.getTotalTokenSupply = getTotalTokenSupply; exports.getTotalVestingAmount = getTotalVestingAmount; exports.getTwoCurve = getTwoCurve; exports.getVariableFeeNumerator = getVariableFeeNumerator; exports.getVestingLockedLiquidityBpsAtNSeconds = getVestingLockedLiquidityBpsAtNSeconds; exports.isDefaultLockedVesting = isDefaultLockedVesting; exports.isDynamicFeeEnabled = isDynamicFeeEnabled; exports.isNativeSol = isNativeSol; exports.isNonZeroRateLimiter = isNonZeroRateLimiter; exports.isRateLimiterApplied = isRateLimiterApplied; exports.isZeroRateLimiter = isZeroRateLimiter; exports.mulDiv = mulDiv; exports.mulShr = mulShr; exports.pow = pow; exports.prepareSwapAmountParam = prepareSwapAmountParam; exports.prepareTokenAccountTx = prepareTokenAccountTx; exports.splitFees = splitFees; exports.sqrt = sqrt; exports.swapQuote = swapQuote; exports.swapQuoteExactIn = swapQuoteExactIn; exports.swapQuoteExactOut = swapQuoteExactOut; exports.swapQuotePartialFill = swapQuotePartialFill; exports.toNumerator = toNumerator; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.validateActivationType = validateActivationType; exports.validateBalance = validateBalance; exports.validateBaseTokenType = validateBaseTokenType; exports.validateCollectFeeMode = validateCollectFeeMode; exports.validateCompoundingFeeBps = validateCompoundingFeeBps; exports.validateConfigParameters = validateConfigParameters; exports.validateCurve = validateCurve; exports.validateDynamicFee = validateDynamicFee; exports.validateFeeRateLimiter = validateFeeRateLimiter; exports.validateFeeScheduler = validateFeeScheduler; exports.validateLPPercentages = validateLPPercentages; exports.validateLiquidityVestingInfo = validateLiquidityVestingInfo; exports.validateMarketCapFeeSchedulerRequiresPoolFeeBps = validateMarketCapFeeSchedulerRequiresPoolFeeBps; exports.validateMigratedCollectFeeMode = validateMigratedCollectFeeMode; exports.validateMigratedPoolBaseFeeMode = validateMigratedPoolBaseFeeMode; exports.validateMigratedPoolFee = validateMigratedPoolFee; exports.validateMigrationAndTokenType = validateMigrationAndTokenType; exports.validateMigrationFee = validateMigrationFee; exports.validateMigrationFeeOption = validateMigrationFeeOption; exports.validateMinimumLockedLiquidity = validateMinimumLockedLiquidity; exports.validatePoolCreationFee = validatePoolCreationFee; exports.validatePoolFees = validatePoolFees; exports.validateSwapAmount = validateSwapAmount; exports.validateTokenAuthorityOptions = validateTokenAuthorityOptions; exports.validateTokenDecimals = validateTokenDecimals; exports.validateTokenSupply = validateTokenSupply; exports.wrapSOLInstruction = wrapSOLInstruction;
32135
+
32136
+
32137
+
32138
+
32139
+ exports.AccountsType = AccountsType; exports.ActivationType = ActivationType; exports.BASE_ADDRESS = BASE_ADDRESS; exports.BIN_STEP_BPS_DEFAULT = BIN_STEP_BPS_DEFAULT; exports.BIN_STEP_BPS_U128_DEFAULT = BIN_STEP_BPS_U128_DEFAULT; exports.BaseFeeMode = BaseFeeMode; exports.CollectFeeMode = CollectFeeMode; exports.CreatorService = CreatorService; exports.DAMM_V1_MIGRATION_FEE_ADDRESS = DAMM_V1_MIGRATION_FEE_ADDRESS; exports.DAMM_V1_PROGRAM_ID = DAMM_V1_PROGRAM_ID; exports.DAMM_V2_MIGRATION_FEE_ADDRESS = DAMM_V2_MIGRATION_FEE_ADDRESS; exports.DAMM_V2_PROGRAM_ID = DAMM_V2_PROGRAM_ID; exports.DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS = DEFAULT_LIQUIDITY_VESTING_INFO_PARAMS; exports.DEFAULT_MIGRATED_POOL_FEE_PARAMS = DEFAULT_MIGRATED_POOL_FEE_PARAMS; exports.DEFAULT_MIGRATED_POOL_MARKET_CAP_FEE_SCHEDULER_PARAMS = DEFAULT_MIGRATED_POOL_MARKET_CAP_FEE_SCHEDULER_PARAMS; exports.DYNAMIC_BONDING_CURVE_PROGRAM_ID = DYNAMIC_BONDING_CURVE_PROGRAM_ID; exports.DYNAMIC_FEE_DECAY_PERIOD_DEFAULT = DYNAMIC_FEE_DECAY_PERIOD_DEFAULT; exports.DYNAMIC_FEE_FILTER_PERIOD_DEFAULT = DYNAMIC_FEE_FILTER_PERIOD_DEFAULT; exports.DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT; exports.DYNAMIC_FEE_ROUNDING_OFFSET = DYNAMIC_FEE_ROUNDING_OFFSET; exports.DYNAMIC_FEE_SCALING_FACTOR = DYNAMIC_FEE_SCALING_FACTOR; exports.DammV2BaseFeeMode = DammV2BaseFeeMode; exports.DammV2DynamicFeeMode = DammV2DynamicFeeMode; exports.DynamicBondingCurveClient = DynamicBondingCurveClient; exports.DynamicBondingCurveIdl = idl_default; exports.DynamicBondingCurveProgram = DynamicBondingCurveProgram; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeRateLimiter = FeeRateLimiter; exports.FeeScheduler = FeeScheduler; exports.HOST_FEE_PERCENT = HOST_FEE_PERCENT; exports.LOCKER_PROGRAM_ID = LOCKER_PROGRAM_ID; exports.MAX_BASIS_POINT = MAX_BASIS_POINT; exports.MAX_CREATOR_MIGRATION_FEE_PERCENTAGE = MAX_CREATOR_MIGRATION_FEE_PERCENTAGE; exports.MAX_CURVE_POINT = MAX_CURVE_POINT; exports.MAX_FEE_BPS = MAX_FEE_BPS; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_LOCK_DURATION_IN_SECONDS = MAX_LOCK_DURATION_IN_SECONDS; exports.MAX_MIGRATED_POOL_FEE_BPS = MAX_MIGRATED_POOL_FEE_BPS; exports.MAX_MIGRATION_FEE_PERCENTAGE = MAX_MIGRATION_FEE_PERCENTAGE; exports.MAX_POOL_CREATION_FEE = MAX_POOL_CREATION_FEE; exports.MAX_PRICE_CHANGE_BPS_DEFAULT = MAX_PRICE_CHANGE_BPS_DEFAULT; exports.MAX_RATE_LIMITER_DURATION_IN_SECONDS = MAX_RATE_LIMITER_DURATION_IN_SECONDS; exports.MAX_RATE_LIMITER_DURATION_IN_SLOTS = MAX_RATE_LIMITER_DURATION_IN_SLOTS; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.METAPLEX_PROGRAM_ID = METAPLEX_PROGRAM_ID; exports.MIN_FEE_BPS = MIN_FEE_BPS; exports.MIN_FEE_NUMERATOR = MIN_FEE_NUMERATOR; exports.MIN_LOCKED_LIQUIDITY_BPS = MIN_LOCKED_LIQUIDITY_BPS; exports.MIN_MIGRATED_POOL_FEE_BPS = MIN_MIGRATED_POOL_FEE_BPS; exports.MIN_POOL_CREATION_FEE = MIN_POOL_CREATION_FEE; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.MigratedCollectFeeMode = MigratedCollectFeeMode; exports.MigrationFeeOption = MigrationFeeOption; exports.MigrationOption = MigrationOption; exports.MigrationService = MigrationService; exports.OFFSET = OFFSET; exports.ONE_Q64 = ONE_Q64; exports.PROTOCOL_FEE_PERCENT = PROTOCOL_FEE_PERCENT; exports.PROTOCOL_POOL_CREATION_FEE_PERCENT = PROTOCOL_POOL_CREATION_FEE_PERCENT; exports.PartnerService = PartnerService; exports.PoolService = PoolService; exports.RESOLUTION = RESOLUTION; exports.Rounding = Rounding; exports.SECONDS_PER_DAY = SECONDS_PER_DAY; exports.SWAP_BUFFER_PERCENTAGE = SWAP_BUFFER_PERCENTAGE; exports.SafeMath = SafeMath; exports.StateService = StateService; exports.SwapMode = SwapMode; exports.TokenAuthorityOption = TokenAuthorityOption; exports.TokenDecimal = TokenDecimal; exports.TokenType = TokenType; exports.TradeDirection = TradeDirection; exports.U128_MAX = U128_MAX; exports.U16_MAX = U16_MAX; exports.U24_MAX = U24_MAX; exports.U64_MAX = U64_MAX; exports.VAULT_PROGRAM_ID = VAULT_PROGRAM_ID; exports.bpsToFeeNumerator = bpsToFeeNumerator; exports.buildCurve = buildCurve; exports.buildCurveWithCustomSqrtPrices = buildCurveWithCustomSqrtPrices; exports.buildCurveWithLiquidityWeights = buildCurveWithLiquidityWeights; exports.buildCurveWithMarketCap = buildCurveWithMarketCap; exports.buildCurveWithMidPrice = buildCurveWithMidPrice; exports.buildCurveWithTwoSegments = buildCurveWithTwoSegments; exports.calculateAdjustedPercentageSupplyOnMigration = calculateAdjustedPercentageSupplyOnMigration; exports.calculateBaseToQuoteFromAmountIn = calculateBaseToQuoteFromAmountIn; exports.calculateBaseToQuoteFromAmountOut = calculateBaseToQuoteFromAmountOut; exports.calculateFeeSchedulerEndingBaseFeeBps = calculateFeeSchedulerEndingBaseFeeBps; exports.calculateLockedLiquidityBpsAtTime = calculateLockedLiquidityBpsAtTime; exports.calculateQuoteToBaseFromAmountIn = calculateQuoteToBaseFromAmountIn; exports.calculateQuoteToBaseFromAmountOut = calculateQuoteToBaseFromAmountOut; exports.checkRateLimiterApplied = checkRateLimiterApplied; exports.cleanUpTokenAccountTx = cleanUpTokenAccountTx; exports.computeSqrtPriceStepBps = computeSqrtPriceStepBps; exports.convertDecimalToBN = convertDecimalToBN; exports.convertToLamports = convertToLamports; exports.createDammV1Program = createDammV1Program; exports.createDammV2Program = createDammV2Program; exports.createDbcProgram = createDbcProgram; exports.createDynamicVaultProgram = createDynamicVaultProgram; exports.createInitializePermissionlessDynamicVaultIx = createInitializePermissionlessDynamicVaultIx; exports.createLockEscrowIx = createLockEscrowIx; exports.createProgramAccountFilter = createProgramAccountFilter; exports.createSqrtPrices = createSqrtPrices; exports.deriveBaseKeyForLocker = deriveBaseKeyForLocker; exports.deriveDammV1EventAuthority = deriveDammV1EventAuthority; exports.deriveDammV1LockEscrowAddress = deriveDammV1LockEscrowAddress; exports.deriveDammV1LpMintAddress = deriveDammV1LpMintAddress; exports.deriveDammV1MigrationMetadataAddress = deriveDammV1MigrationMetadataAddress; exports.deriveDammV1PoolAddress = deriveDammV1PoolAddress; exports.deriveDammV1PoolAuthority = deriveDammV1PoolAuthority; exports.deriveDammV1ProtocolFeeAddress = deriveDammV1ProtocolFeeAddress; exports.deriveDammV1VaultLPAddress = deriveDammV1VaultLPAddress; exports.deriveDammV2EventAuthority = deriveDammV2EventAuthority; exports.deriveDammV2LockEscrowAddress = deriveDammV2LockEscrowAddress; exports.deriveDammV2MigrationMetadataAddress = deriveDammV2MigrationMetadataAddress; exports.deriveDammV2PoolAddress = deriveDammV2PoolAddress; exports.deriveDammV2PoolAuthority = deriveDammV2PoolAuthority; exports.deriveDammV2TokenVaultAddress = deriveDammV2TokenVaultAddress; exports.deriveDbcEventAuthority = deriveDbcEventAuthority; exports.deriveDbcPoolAddress = deriveDbcPoolAddress; exports.deriveDbcPoolAuthority = deriveDbcPoolAuthority; exports.deriveDbcPoolMetadata = deriveDbcPoolMetadata; exports.deriveDbcTokenVaultAddress = deriveDbcTokenVaultAddress; exports.deriveEscrow = deriveEscrow; exports.deriveLockerEventAuthority = deriveLockerEventAuthority; exports.deriveMintMetadata = deriveMintMetadata; exports.derivePartnerMetadata = derivePartnerMetadata; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveTokenVaultKey = deriveTokenVaultKey; exports.deriveVaultAddress = deriveVaultAddress; exports.deriveVaultLpMintAddress = deriveVaultLpMintAddress; exports.deriveVaultPdas = deriveVaultPdas; exports.feeNumeratorToBps = feeNumeratorToBps; exports.findAssociatedTokenAddress = findAssociatedTokenAddress; exports.fromDecimalToBN = fromDecimalToBN; exports.getAccountCreationTimestamp = getAccountCreationTimestamp; exports.getAccountCreationTimestamps = getAccountCreationTimestamps; exports.getAccountData = getAccountData; exports.getBaseFeeHandler = getBaseFeeHandler; exports.getBaseFeeNumerator = getBaseFeeNumerator; exports.getBaseFeeNumeratorByPeriod = getBaseFeeNumeratorByPeriod; exports.getBaseFeeParams = getBaseFeeParams; exports.getBaseTokenForSwap = getBaseTokenForSwap; exports.getCheckedAmounts = getCheckedAmounts; exports.getCurrentPoint = getCurrentPoint; exports.getCurveBreakdown = getCurveBreakdown; exports.getDeltaAmountBaseUnsigned = getDeltaAmountBaseUnsigned; exports.getDeltaAmountBaseUnsigned256 = getDeltaAmountBaseUnsigned256; exports.getDeltaAmountBaseUnsignedUnchecked = getDeltaAmountBaseUnsignedUnchecked; exports.getDeltaAmountQuoteUnsigned = getDeltaAmountQuoteUnsigned; exports.getDeltaAmountQuoteUnsigned256 = getDeltaAmountQuoteUnsigned256; exports.getDeltaAmountQuoteUnsignedUnchecked = getDeltaAmountQuoteUnsignedUnchecked; exports.getDynamicFeeParams = getDynamicFeeParams; exports.getExcludedFeeAmount = getExcludedFeeAmount; exports.getFeeMode = getFeeMode; exports.getFeeNumeratorFromExcludedAmount = getFeeNumeratorFromExcludedAmount; exports.getFeeNumeratorFromIncludedAmount = getFeeNumeratorFromIncludedAmount; exports.getFeeNumeratorOnExponentialFeeScheduler = getFeeNumeratorOnExponentialFeeScheduler; exports.getFeeNumeratorOnLinearFeeScheduler = getFeeNumeratorOnLinearFeeScheduler; exports.getFeeOnAmount = getFeeOnAmount; exports.getFeeSchedulerMaxBaseFeeNumerator = getFeeSchedulerMaxBaseFeeNumerator; exports.getFeeSchedulerMinBaseFeeNumerator = getFeeSchedulerMinBaseFeeNumerator; exports.getFeeSchedulerParams = getFeeSchedulerParams; exports.getFirstCurve = getFirstCurve; exports.getFirstKey = getFirstKey; exports.getIncludedFeeAmount = getIncludedFeeAmount; exports.getInitialLiquidityFromDeltaBase = getInitialLiquidityFromDeltaBase; exports.getInitialLiquidityFromDeltaQuote = getInitialLiquidityFromDeltaQuote; exports.getLiquidity = getLiquidity; exports.getLiquidityVestingInfoParams = getLiquidityVestingInfoParams; exports.getLockedVestingParams = getLockedVestingParams; exports.getMaxIndex = getMaxIndex; exports.getMaxOutAmountWithMinBaseFee = getMaxOutAmountWithMinBaseFee; exports.getMigratedPoolFeeParams = getMigratedPoolFeeParams; exports.getMigratedPoolMarketCapFeeSchedulerParams = getMigratedPoolMarketCapFeeSchedulerParams; exports.getMigrationBaseToken = getMigrationBaseToken; exports.getMigrationQuoteAmount = getMigrationQuoteAmount; exports.getMigrationQuoteAmountFromMigrationQuoteThreshold = getMigrationQuoteAmountFromMigrationQuoteThreshold; exports.getMigrationQuoteThresholdFromMigrationQuoteAmount = getMigrationQuoteThresholdFromMigrationQuoteAmount; exports.getMigrationThresholdPrice = getMigrationThresholdPrice; exports.getNextSqrtPriceFromBaseAmountInRoundingUp = getNextSqrtPriceFromBaseAmountInRoundingUp; exports.getNextSqrtPriceFromBaseAmountOutRoundingUp = getNextSqrtPriceFromBaseAmountOutRoundingUp; exports.getNextSqrtPriceFromInput = getNextSqrtPriceFromInput; exports.getNextSqrtPriceFromOutput = getNextSqrtPriceFromOutput; exports.getNextSqrtPriceFromQuoteAmountInRoundingDown = getNextSqrtPriceFromQuoteAmountInRoundingDown; exports.getNextSqrtPriceFromQuoteAmountOutRoundingDown = getNextSqrtPriceFromQuoteAmountOutRoundingDown; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPercentageSupplyOnMigration = getPercentageSupplyOnMigration; exports.getPriceFromSqrtPrice = getPriceFromSqrtPrice; exports.getProtocolMigrationFee = getProtocolMigrationFee; exports.getQuoteReserveFromNextSqrtPrice = getQuoteReserveFromNextSqrtPrice; exports.getRateLimiterExcludedFeeAmount = getRateLimiterExcludedFeeAmount; exports.getRateLimiterMinBaseFeeNumerator = getRateLimiterMinBaseFeeNumerator; exports.getRateLimiterParams = getRateLimiterParams; exports.getSecondKey = getSecondKey; exports.getSqrtPriceFromMarketCap = getSqrtPriceFromMarketCap; exports.getSqrtPriceFromPrice = getSqrtPriceFromPrice; exports.getStartingBaseFeeBpsFromBaseFeeParams = getStartingBaseFeeBpsFromBaseFeeParams; exports.getSwapAmountWithBuffer = getSwapAmountWithBuffer; exports.getSwapResult = getSwapResult; exports.getSwapResultFromExactInput = getSwapResultFromExactInput; exports.getSwapResultFromExactOutput = getSwapResultFromExactOutput; exports.getSwapResultFromPartialInput = getSwapResultFromPartialInput; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getTokenType = getTokenType; exports.getTokenomics = getTokenomics; exports.getTotalFeeNumerator = getTotalFeeNumerator; exports.getTotalFeeNumeratorFromExcludedFeeAmount = getTotalFeeNumeratorFromExcludedFeeAmount; exports.getTotalFeeNumeratorFromIncludedFeeAmount = getTotalFeeNumeratorFromIncludedFeeAmount; exports.getTotalSupplyFromCurve = getTotalSupplyFromCurve; exports.getTotalTokenSupply = getTotalTokenSupply; exports.getTotalVestingAmount = getTotalVestingAmount; exports.getTwoCurve = getTwoCurve; exports.getVariableFeeNumerator = getVariableFeeNumerator; exports.getVestingLockedLiquidityBpsAtNSeconds = getVestingLockedLiquidityBpsAtNSeconds; exports.hasMintAuthority = hasMintAuthority; exports.isDefaultLockedVesting = isDefaultLockedVesting; exports.isDynamicFeeEnabled = isDynamicFeeEnabled; exports.isNativeSol = isNativeSol; exports.isNonZeroRateLimiter = isNonZeroRateLimiter; exports.isRateLimiterApplied = isRateLimiterApplied; exports.isZeroRateLimiter = isZeroRateLimiter; exports.mulDiv = mulDiv; exports.mulShr = mulShr; exports.pow = pow; exports.prepareSwapAmountParam = prepareSwapAmountParam; exports.prepareTokenAccountTx = prepareTokenAccountTx; exports.splitFees = splitFees; exports.sqrt = sqrt; exports.swapQuote = swapQuote; exports.swapQuoteExactIn = swapQuoteExactIn; exports.swapQuoteExactOut = swapQuoteExactOut; exports.swapQuotePartialFill = swapQuotePartialFill; exports.toNumerator = toNumerator; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.validateActivationType = validateActivationType; exports.validateBalance = validateBalance; exports.validateBaseTokenType = validateBaseTokenType; exports.validateCollectFeeMode = validateCollectFeeMode; exports.validateCompoundingFeeBps = validateCompoundingFeeBps; exports.validateConfigParameters = validateConfigParameters; exports.validateCurve = validateCurve; exports.validateDynamicFee = validateDynamicFee; exports.validateFeeRateLimiter = validateFeeRateLimiter; exports.validateFeeScheduler = validateFeeScheduler; exports.validateLPPercentages = validateLPPercentages; exports.validateLiquidityVestingInfo = validateLiquidityVestingInfo; exports.validateMarketCapFeeSchedulerRequiresPoolFeeBps = validateMarketCapFeeSchedulerRequiresPoolFeeBps; exports.validateMigratedCollectFeeMode = validateMigratedCollectFeeMode; exports.validateMigratedPoolBaseFeeMode = validateMigratedPoolBaseFeeMode; exports.validateMigratedPoolFee = validateMigratedPoolFee; exports.validateMigrationAndTokenType = validateMigrationAndTokenType; exports.validateMigrationFee = validateMigrationFee; exports.validateMigrationFeeOption = validateMigrationFeeOption; exports.validateMinimumLockedLiquidity = validateMinimumLockedLiquidity; exports.validatePoolCreationFee = validatePoolCreationFee; exports.validatePoolFees = validatePoolFees; exports.validateQuoteMintBasic = validateQuoteMintBasic; exports.validateSwapAmount = validateSwapAmount; exports.validateTokenAuthorityOptions = validateTokenAuthorityOptions; exports.validateTokenDecimals = validateTokenDecimals; exports.validateTokenSupply = validateTokenSupply; exports.validateTransferHookProgram = validateTransferHookProgram; exports.validateTransferHookProgramExecutable = validateTransferHookProgramExecutable; exports.wrapSOLInstruction = wrapSOLInstruction;
31959
32140
  //# sourceMappingURL=index.cjs.map