@pump-fun/pump-sdk 1.27.0-devnet.1 → 1.27.0-devnet.2

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/README.md CHANGED
@@ -101,3 +101,65 @@ console.log((await sdk.getCreatorVaultBalanceBothPrograms(user)).toString());
101
101
  // Collecting creator fees instructions
102
102
  const instructions = await sdk.collectCoinCreatorFeeInstructions(user);
103
103
  ```
104
+
105
+ ## Fee Sharing
106
+
107
+ Fee sharing allows token creators to set up fee distribution to multiple shareholders. The `OnlinePumpSdk` provides methods to check distributable fees and distribute them.
108
+
109
+ ```Typescript
110
+ import { OnlinePumpSdk } from "@pump-fun/pump-sdk";
111
+
112
+ const connection = new Connection(
113
+ "https://api.devnet.solana.com",
114
+ "confirmed",
115
+ );
116
+ const onlineSdk = new OnlinePumpSdk(connection);
117
+ const mint = new PublicKey("...");
118
+ ```
119
+
120
+ ### Check if Creator Has Migrated to Fee Sharing
121
+
122
+ Before checking or distributing fees, verify that the coin creator has set up fee sharing:
123
+
124
+ ```Typescript
125
+ const usingSharingConfig = isCreatorUsingSharingConfig({ mint, creator });
126
+
127
+ if (!usingSharingConfig) {
128
+ console.log("Creator has not set up fee sharing");
129
+ return;
130
+ }
131
+
132
+ // Creator has migrated, proceed with fee distribution
133
+ ```
134
+
135
+ ### Get Minimum Distributable Fee
136
+
137
+ Check whether a coin's fee sharing configuration balance and distributable fees
138
+
139
+ ```Typescript
140
+ const result = await onlineSdk.getMinimumDistributableFee(mint);
141
+
142
+ console.log("Minimum required:", result.minimumRequired.toString());
143
+ console.log("Distributable fees:", result.distributableFees.toString());
144
+ console.log("Can distribute:", result.canDistribute);
145
+ console.log("Is graduated:", result.isGraduated);
146
+ ```
147
+
148
+ This method handles both graduated (AMM) and non-graduated (bonding curve) tokens. For graduated tokens, it automatically consolidates fees from the AMM vault before calculating.
149
+
150
+ ### Distribute Creator Fees
151
+
152
+ Build instructions to distribute accumulated creator fees to shareholders:
153
+
154
+ ```Typescript
155
+ const { instructions, isGraduated } = await onlineSdk.buildDistributeCreatorFeesInstructions(mint);
156
+
157
+ // instructions contains:
158
+ // - For graduated tokens: transferCreatorFeesToPump + distributeCreatorFees
159
+ // - For non-graduated tokens: distributeCreatorFees only
160
+
161
+ // Add instructions to your transaction
162
+ const tx = new Transaction().add(...instructions);
163
+ ```
164
+
165
+ This method automatically handles graduated tokens by including the `transferCreatorFeesToPump` instruction to consolidate fees from the AMM vault before distributing.
package/dist/esm/index.js CHANGED
@@ -8965,7 +8965,9 @@ import {
8965
8965
  TOKEN_PROGRAM_ID
8966
8966
  } from "@solana/spl-token";
8967
8967
  import {
8968
- PublicKey as PublicKey3
8968
+ PublicKey as PublicKey3,
8969
+ TransactionMessage,
8970
+ VersionedTransaction
8969
8971
  } from "@solana/web3.js";
8970
8972
  import BN4 from "bn.js";
8971
8973
 
@@ -9039,6 +9041,7 @@ var OnlinePumpSdk = class {
9039
9041
  this.connection = connection;
9040
9042
  this.pumpProgram = getPumpProgram(connection);
9041
9043
  this.offlinePumpProgram = OFFLINE_PUMP_PROGRAM;
9044
+ this.pumpAmmProgram = getPumpAmmProgram(connection);
9042
9045
  this.pumpAmmSdk = new OnlinePumpAmmSdk(connection);
9043
9046
  this.pumpAmmAdminSdk = new PumpAmmAdminSdk(connection);
9044
9047
  }
@@ -9303,6 +9306,127 @@ var OnlinePumpSdk = class {
9303
9306
  await PUMP_AMM_SDK.syncUserVolumeAccumulator(user)
9304
9307
  ];
9305
9308
  }
9309
+ /**
9310
+ * Gets the minimum distributable fee for a token's fee sharing configuration.
9311
+ *
9312
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
9313
+ * For graduated tokens, it automatically consolidates fees from the AMM vault before
9314
+ * calculating the minimum distributable fee.
9315
+ *
9316
+ * @param mint - The mint address of the token
9317
+ * @param simulationSigner - Optional signer address for transaction simulation.
9318
+ * Must have a non-zero SOL balance. Defaults to a known funded address.
9319
+ * @returns The minimum distributable fee information including whether distribution is possible
9320
+ */
9321
+ async getMinimumDistributableFee(mint, simulationSigner = new PublicKey3("UqN2p5bAzBqYdHXcgB6WLtuVrdvmy9JSAtgqZb3CMKw")) {
9322
+ const sharingConfigPubkey = feeSharingConfigPda(mint);
9323
+ const poolAddress = canonicalPumpPoolPda(mint);
9324
+ const coinCreatorVaultAuthority = coinCreatorVaultAuthorityPda(sharingConfigPubkey);
9325
+ const ammVaultAta = coinCreatorVaultAtaPda(
9326
+ coinCreatorVaultAuthority,
9327
+ NATIVE_MINT,
9328
+ TOKEN_PROGRAM_ID
9329
+ );
9330
+ const [sharingConfigAccountInfo, poolAccountInfo, ammVaultAtaInfo] = await this.connection.getMultipleAccountsInfo([
9331
+ sharingConfigPubkey,
9332
+ poolAddress,
9333
+ ammVaultAta
9334
+ ]);
9335
+ if (!sharingConfigAccountInfo) {
9336
+ throw new Error(`Sharing config not found for mint: ${mint.toBase58()}`);
9337
+ }
9338
+ const sharingConfig = PUMP_SDK.decodeSharingConfig(sharingConfigAccountInfo);
9339
+ const instructions = [];
9340
+ const isGraduated = poolAccountInfo !== null;
9341
+ if (isGraduated && ammVaultAtaInfo) {
9342
+ const transferCreatorFeesToPumpIx = await this.pumpAmmProgram.methods.transferCreatorFeesToPump().accountsPartial({
9343
+ wsolMint: NATIVE_MINT,
9344
+ tokenProgram: TOKEN_PROGRAM_ID,
9345
+ coinCreator: sharingConfigPubkey
9346
+ }).instruction();
9347
+ instructions.push(transferCreatorFeesToPumpIx);
9348
+ }
9349
+ const getMinFeeIx = await PUMP_SDK.getMinimumDistributableFee({
9350
+ mint,
9351
+ sharingConfig,
9352
+ sharingConfigAddress: sharingConfigPubkey
9353
+ });
9354
+ instructions.push(getMinFeeIx);
9355
+ const { blockhash } = await this.connection.getLatestBlockhash();
9356
+ const tx = new VersionedTransaction(
9357
+ new TransactionMessage({
9358
+ payerKey: simulationSigner,
9359
+ recentBlockhash: blockhash,
9360
+ instructions
9361
+ }).compileToV0Message()
9362
+ );
9363
+ const result = await this.connection.simulateTransaction(tx);
9364
+ let minimumDistributableFee = {
9365
+ minimumRequired: new BN4(0),
9366
+ distributableFees: new BN4(0),
9367
+ canDistribute: false
9368
+ };
9369
+ if (!result.value.err) {
9370
+ const [data, encoding] = result.value.returnData?.data ?? [];
9371
+ if (data) {
9372
+ const buffer = Buffer.from(data, encoding);
9373
+ minimumDistributableFee = PUMP_SDK.decodeMinimumDistributableFee(buffer);
9374
+ }
9375
+ }
9376
+ return {
9377
+ ...minimumDistributableFee,
9378
+ isGraduated
9379
+ };
9380
+ }
9381
+ /**
9382
+ * Gets the instructions to distribute creator fees for a token's fee sharing configuration.
9383
+ *
9384
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
9385
+ * For graduated tokens, it automatically includes an instruction to consolidate fees
9386
+ * from the AMM vault before distributing.
9387
+ *
9388
+ * @param mint - The mint address of the token
9389
+ * @returns The instructions to distribute creator fees and whether the token is graduated
9390
+ */
9391
+ async buildDistributeCreatorFeesInstructions(mint) {
9392
+ const sharingConfigPubkey = feeSharingConfigPda(mint);
9393
+ const poolAddress = canonicalPumpPoolPda(mint);
9394
+ const coinCreatorVaultAuthority = coinCreatorVaultAuthorityPda(sharingConfigPubkey);
9395
+ const ammVaultAta = coinCreatorVaultAtaPda(
9396
+ coinCreatorVaultAuthority,
9397
+ NATIVE_MINT,
9398
+ TOKEN_PROGRAM_ID
9399
+ );
9400
+ const [sharingConfigAccountInfo, poolAccountInfo, ammVaultAtaInfo] = await this.connection.getMultipleAccountsInfo([
9401
+ sharingConfigPubkey,
9402
+ poolAddress,
9403
+ ammVaultAta
9404
+ ]);
9405
+ if (!sharingConfigAccountInfo) {
9406
+ throw new Error(`Sharing config not found for mint: ${mint.toBase58()}`);
9407
+ }
9408
+ const sharingConfig = PUMP_SDK.decodeSharingConfig(sharingConfigAccountInfo);
9409
+ const instructions = [];
9410
+ const isGraduated = poolAccountInfo !== null;
9411
+ if (isGraduated && ammVaultAtaInfo) {
9412
+ const transferCreatorFeesToPumpIx = await this.pumpAmmProgram.methods.transferCreatorFeesToPump().accountsPartial({
9413
+ wsolMint: NATIVE_MINT,
9414
+ tokenProgram: TOKEN_PROGRAM_ID,
9415
+ coinCreator: sharingConfigPubkey
9416
+ }).instruction();
9417
+ instructions.push(transferCreatorFeesToPumpIx);
9418
+ }
9419
+ const distributeCreatorFeesIx = await PUMP_SDK.distributeCreatorFees({
9420
+ mint,
9421
+ sharingConfig,
9422
+ sharingConfigAddress: sharingConfigPubkey
9423
+ });
9424
+ instructions.push(distributeCreatorFeesIx);
9425
+ return {
9426
+ instructions,
9427
+ isGraduated
9428
+ };
9429
+ }
9306
9430
  };
9307
9431
 
9308
9432
  // src/idl/pump_amm.json
@@ -18604,7 +18728,7 @@ var PumpSdk = class {
18604
18728
  }
18605
18729
  };
18606
18730
  var PUMP_SDK = new PumpSdk();
18607
- function hasCoinCreatorMigratedToSharingConfig({
18731
+ function isCreatorUsingSharingConfig({
18608
18732
  mint,
18609
18733
  creator
18610
18734
  }) {
@@ -18739,7 +18863,7 @@ export {
18739
18863
  getSellSolAmountFromTokenAmount,
18740
18864
  getSolVaultPda,
18741
18865
  getTokenVaultPda,
18742
- hasCoinCreatorMigratedToSharingConfig,
18866
+ isCreatorUsingSharingConfig,
18743
18867
  newBondingCurve,
18744
18868
  pump_default as pumpIdl,
18745
18869
  pumpPoolAuthorityPda,
package/dist/index.d.mts CHANGED
@@ -22704,13 +22704,13 @@ declare class PumpSdk {
22704
22704
  }
22705
22705
  declare const PUMP_SDK: PumpSdk;
22706
22706
  /**
22707
- * Checks if a creator has migrated to using a fee sharing configuration.
22707
+ * Checks if a creator has upgraded to using a fee sharing configuration.
22708
22708
  *
22709
22709
  * When a creator sets up fee sharing, the creator address in the BondingCurve or Pool
22710
22710
  * is replaced with the fee sharing config PDA address. This function checks if that
22711
- * migration has occurred.
22711
+ * upgrade has occurred.
22712
22712
  *
22713
- * @param params - Parameters for checking migration status
22713
+ * @param params - Parameters for checking upgrade status
22714
22714
  * @param params.mint - The mint address of the token
22715
22715
  * @param params.creator - The creator address to check
22716
22716
  * - For ungraduated coins: use BondingCurve.creator
@@ -22720,18 +22720,18 @@ declare const PUMP_SDK: PumpSdk;
22720
22720
  *
22721
22721
  * @example
22722
22722
  * ```typescript
22723
- * import { hasCoinCreatorMigratedToSharingConfig } from "@pump-fun/sdk";
22723
+ * import { isCreatorUsingSharingConfig } from "@pump-fun/sdk";
22724
22724
  *
22725
22725
  * // For an ungraduated coin
22726
22726
  * const bondingCurve = await program.account.bondingCurve.fetch(bondingCurvePda(mint));
22727
- * const hasMigrated = hasCoinCreatorMigratedToSharingConfig({
22727
+ * const hasMigrated = isCreatorUsingSharingConfig({
22728
22728
  * mint,
22729
22729
  * creator: bondingCurve.creator
22730
22730
  * });
22731
22731
  *
22732
22732
  * // For a graduated coin
22733
22733
  * const pool = await ammProgram.account.pool.fetch(poolAddress);
22734
- * const hasMigrated = hasCoinCreatorMigratedToSharingConfig({
22734
+ * const hasMigrated = isCreatorUsingSharingConfig({
22735
22735
  * mint,
22736
22736
  * creator: pool.coinCreator
22737
22737
  * });
@@ -22743,7 +22743,7 @@ declare const PUMP_SDK: PumpSdk;
22743
22743
  * }
22744
22744
  * ```
22745
22745
  */
22746
- declare function hasCoinCreatorMigratedToSharingConfig({ mint, creator, }: {
22746
+ declare function isCreatorUsingSharingConfig({ mint, creator, }: {
22747
22747
  mint: PublicKey;
22748
22748
  creator: PublicKey;
22749
22749
  }): boolean;
@@ -22752,6 +22752,7 @@ declare class OnlinePumpSdk {
22752
22752
  private readonly connection;
22753
22753
  private readonly pumpProgram;
22754
22754
  private readonly offlinePumpProgram;
22755
+ private readonly pumpAmmProgram;
22755
22756
  private readonly pumpAmmSdk;
22756
22757
  private readonly pumpAmmAdminSdk;
22757
22758
  constructor(connection: Connection);
@@ -22783,6 +22784,37 @@ declare class OnlinePumpSdk {
22783
22784
  getCurrentDayTokens(user: PublicKey): Promise<BN>;
22784
22785
  getCurrentDayTokensBothPrograms(user: PublicKey): Promise<BN>;
22785
22786
  syncUserVolumeAccumulatorBothPrograms(user: PublicKey): Promise<TransactionInstruction[]>;
22787
+ /**
22788
+ * Gets the minimum distributable fee for a token's fee sharing configuration.
22789
+ *
22790
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
22791
+ * For graduated tokens, it automatically consolidates fees from the AMM vault before
22792
+ * calculating the minimum distributable fee.
22793
+ *
22794
+ * @param mint - The mint address of the token
22795
+ * @param simulationSigner - Optional signer address for transaction simulation.
22796
+ * Must have a non-zero SOL balance. Defaults to a known funded address.
22797
+ * @returns The minimum distributable fee information including whether distribution is possible
22798
+ */
22799
+ getMinimumDistributableFee(mint: PublicKey, simulationSigner?: PublicKey): Promise<MinimumDistributableFeeResult>;
22800
+ /**
22801
+ * Gets the instructions to distribute creator fees for a token's fee sharing configuration.
22802
+ *
22803
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
22804
+ * For graduated tokens, it automatically includes an instruction to consolidate fees
22805
+ * from the AMM vault before distributing.
22806
+ *
22807
+ * @param mint - The mint address of the token
22808
+ * @returns The instructions to distribute creator fees and whether the token is graduated
22809
+ */
22810
+ buildDistributeCreatorFeesInstructions(mint: PublicKey): Promise<DistributeCreatorFeeResult>;
22811
+ }
22812
+ interface MinimumDistributableFeeResult extends MinimumDistributableFeeEvent {
22813
+ isGraduated: boolean;
22814
+ }
22815
+ interface DistributeCreatorFeeResult {
22816
+ instructions: TransactionInstruction[];
22817
+ isGraduated: boolean;
22786
22818
  }
22787
22819
 
22788
22820
  declare function totalUnclaimedTokens(globalVolumeAccumulator: GlobalVolumeAccumulator, userVolumeAccumulator: UserVolumeAccumulator, currentTimestamp?: number): BN;
@@ -22817,4 +22849,4 @@ declare class PoolRequiredForGraduatedError extends Error {
22817
22849
  constructor();
22818
22850
  }
22819
22851
 
22820
- export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK, PoolRequiredForGraduatedError, type Pump, type PumpFees, PumpSdk, ShareCalculationOverflowError, type Shareholder, type SharingConfig, TooManyShareholdersError, type UserVolumeAccumulator, type UserVolumeAccumulatorTotalStats, ZeroShareError, ammCreatorVaultPda, bondingCurveMarketCap, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, currentDayTokens, feeSharingConfigPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getEventAuthorityPda, getGlobalParamsPda, getMayhemStatePda, getPumpAmmProgram, getPumpFeeProgram, getPumpProgram, getSellSolAmountFromTokenAmount, getSolVaultPda, getTokenVaultPda, hasCoinCreatorMigratedToSharingConfig, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda, totalUnclaimedTokens, userVolumeAccumulatorPda };
22852
+ export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeeResult, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, type MinimumDistributableFeeResult, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK, PoolRequiredForGraduatedError, type Pump, type PumpFees, PumpSdk, ShareCalculationOverflowError, type Shareholder, type SharingConfig, TooManyShareholdersError, type UserVolumeAccumulator, type UserVolumeAccumulatorTotalStats, ZeroShareError, ammCreatorVaultPda, bondingCurveMarketCap, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, currentDayTokens, feeSharingConfigPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getEventAuthorityPda, getGlobalParamsPda, getMayhemStatePda, getPumpAmmProgram, getPumpFeeProgram, getPumpProgram, getSellSolAmountFromTokenAmount, getSolVaultPda, getTokenVaultPda, isCreatorUsingSharingConfig, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda, totalUnclaimedTokens, userVolumeAccumulatorPda };
package/dist/index.d.ts CHANGED
@@ -22704,13 +22704,13 @@ declare class PumpSdk {
22704
22704
  }
22705
22705
  declare const PUMP_SDK: PumpSdk;
22706
22706
  /**
22707
- * Checks if a creator has migrated to using a fee sharing configuration.
22707
+ * Checks if a creator has upgraded to using a fee sharing configuration.
22708
22708
  *
22709
22709
  * When a creator sets up fee sharing, the creator address in the BondingCurve or Pool
22710
22710
  * is replaced with the fee sharing config PDA address. This function checks if that
22711
- * migration has occurred.
22711
+ * upgrade has occurred.
22712
22712
  *
22713
- * @param params - Parameters for checking migration status
22713
+ * @param params - Parameters for checking upgrade status
22714
22714
  * @param params.mint - The mint address of the token
22715
22715
  * @param params.creator - The creator address to check
22716
22716
  * - For ungraduated coins: use BondingCurve.creator
@@ -22720,18 +22720,18 @@ declare const PUMP_SDK: PumpSdk;
22720
22720
  *
22721
22721
  * @example
22722
22722
  * ```typescript
22723
- * import { hasCoinCreatorMigratedToSharingConfig } from "@pump-fun/sdk";
22723
+ * import { isCreatorUsingSharingConfig } from "@pump-fun/sdk";
22724
22724
  *
22725
22725
  * // For an ungraduated coin
22726
22726
  * const bondingCurve = await program.account.bondingCurve.fetch(bondingCurvePda(mint));
22727
- * const hasMigrated = hasCoinCreatorMigratedToSharingConfig({
22727
+ * const hasMigrated = isCreatorUsingSharingConfig({
22728
22728
  * mint,
22729
22729
  * creator: bondingCurve.creator
22730
22730
  * });
22731
22731
  *
22732
22732
  * // For a graduated coin
22733
22733
  * const pool = await ammProgram.account.pool.fetch(poolAddress);
22734
- * const hasMigrated = hasCoinCreatorMigratedToSharingConfig({
22734
+ * const hasMigrated = isCreatorUsingSharingConfig({
22735
22735
  * mint,
22736
22736
  * creator: pool.coinCreator
22737
22737
  * });
@@ -22743,7 +22743,7 @@ declare const PUMP_SDK: PumpSdk;
22743
22743
  * }
22744
22744
  * ```
22745
22745
  */
22746
- declare function hasCoinCreatorMigratedToSharingConfig({ mint, creator, }: {
22746
+ declare function isCreatorUsingSharingConfig({ mint, creator, }: {
22747
22747
  mint: PublicKey;
22748
22748
  creator: PublicKey;
22749
22749
  }): boolean;
@@ -22752,6 +22752,7 @@ declare class OnlinePumpSdk {
22752
22752
  private readonly connection;
22753
22753
  private readonly pumpProgram;
22754
22754
  private readonly offlinePumpProgram;
22755
+ private readonly pumpAmmProgram;
22755
22756
  private readonly pumpAmmSdk;
22756
22757
  private readonly pumpAmmAdminSdk;
22757
22758
  constructor(connection: Connection);
@@ -22783,6 +22784,37 @@ declare class OnlinePumpSdk {
22783
22784
  getCurrentDayTokens(user: PublicKey): Promise<BN>;
22784
22785
  getCurrentDayTokensBothPrograms(user: PublicKey): Promise<BN>;
22785
22786
  syncUserVolumeAccumulatorBothPrograms(user: PublicKey): Promise<TransactionInstruction[]>;
22787
+ /**
22788
+ * Gets the minimum distributable fee for a token's fee sharing configuration.
22789
+ *
22790
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
22791
+ * For graduated tokens, it automatically consolidates fees from the AMM vault before
22792
+ * calculating the minimum distributable fee.
22793
+ *
22794
+ * @param mint - The mint address of the token
22795
+ * @param simulationSigner - Optional signer address for transaction simulation.
22796
+ * Must have a non-zero SOL balance. Defaults to a known funded address.
22797
+ * @returns The minimum distributable fee information including whether distribution is possible
22798
+ */
22799
+ getMinimumDistributableFee(mint: PublicKey, simulationSigner?: PublicKey): Promise<MinimumDistributableFeeResult>;
22800
+ /**
22801
+ * Gets the instructions to distribute creator fees for a token's fee sharing configuration.
22802
+ *
22803
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
22804
+ * For graduated tokens, it automatically includes an instruction to consolidate fees
22805
+ * from the AMM vault before distributing.
22806
+ *
22807
+ * @param mint - The mint address of the token
22808
+ * @returns The instructions to distribute creator fees and whether the token is graduated
22809
+ */
22810
+ buildDistributeCreatorFeesInstructions(mint: PublicKey): Promise<DistributeCreatorFeeResult>;
22811
+ }
22812
+ interface MinimumDistributableFeeResult extends MinimumDistributableFeeEvent {
22813
+ isGraduated: boolean;
22814
+ }
22815
+ interface DistributeCreatorFeeResult {
22816
+ instructions: TransactionInstruction[];
22817
+ isGraduated: boolean;
22786
22818
  }
22787
22819
 
22788
22820
  declare function totalUnclaimedTokens(globalVolumeAccumulator: GlobalVolumeAccumulator, userVolumeAccumulator: UserVolumeAccumulator, currentTimestamp?: number): BN;
@@ -22817,4 +22849,4 @@ declare class PoolRequiredForGraduatedError extends Error {
22817
22849
  constructor();
22818
22850
  }
22819
22851
 
22820
- export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK, PoolRequiredForGraduatedError, type Pump, type PumpFees, PumpSdk, ShareCalculationOverflowError, type Shareholder, type SharingConfig, TooManyShareholdersError, type UserVolumeAccumulator, type UserVolumeAccumulatorTotalStats, ZeroShareError, ammCreatorVaultPda, bondingCurveMarketCap, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, currentDayTokens, feeSharingConfigPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getEventAuthorityPda, getGlobalParamsPda, getMayhemStatePda, getPumpAmmProgram, getPumpFeeProgram, getPumpProgram, getSellSolAmountFromTokenAmount, getSolVaultPda, getTokenVaultPda, hasCoinCreatorMigratedToSharingConfig, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda, totalUnclaimedTokens, userVolumeAccumulatorPda };
22852
+ export { AMM_GLOBAL_PDA, AMM_GLOBAL_VOLUME_ACCUMULATOR_PDA, BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type DistributeCreatorFeeResult, type DistributeCreatorFeesEvent, DuplicateShareholderError, type FeeConfig, GLOBAL_PDA, GLOBAL_VOLUME_ACCUMULATOR_PDA, type Global, type GlobalVolumeAccumulator, InvalidShareTotalError, MAYHEM_PROGRAM_ID, type MinimumDistributableFeeEvent, type MinimumDistributableFeeResult, NoShareholdersError, OnlinePumpSdk, PUMP_AMM_EVENT_AUTHORITY_PDA, PUMP_AMM_PROGRAM_ID, PUMP_EVENT_AUTHORITY_PDA, PUMP_FEE_CONFIG_PDA, PUMP_FEE_EVENT_AUTHORITY_PDA, PUMP_FEE_PROGRAM_ID, PUMP_PROGRAM_ID, PUMP_SDK, PoolRequiredForGraduatedError, type Pump, type PumpFees, PumpSdk, ShareCalculationOverflowError, type Shareholder, type SharingConfig, TooManyShareholdersError, type UserVolumeAccumulator, type UserVolumeAccumulatorTotalStats, ZeroShareError, ammCreatorVaultPda, bondingCurveMarketCap, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, currentDayTokens, feeSharingConfigPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getEventAuthorityPda, getGlobalParamsPda, getMayhemStatePda, getPumpAmmProgram, getPumpFeeProgram, getPumpProgram, getSellSolAmountFromTokenAmount, getSolVaultPda, getTokenVaultPda, isCreatorUsingSharingConfig, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda, totalUnclaimedTokens, userVolumeAccumulatorPda };
package/dist/index.js CHANGED
@@ -1852,7 +1852,7 @@ __export(index_exports, {
1852
1852
  getSellSolAmountFromTokenAmount: () => getSellSolAmountFromTokenAmount,
1853
1853
  getSolVaultPda: () => getSolVaultPda,
1854
1854
  getTokenVaultPda: () => getTokenVaultPda,
1855
- hasCoinCreatorMigratedToSharingConfig: () => hasCoinCreatorMigratedToSharingConfig,
1855
+ isCreatorUsingSharingConfig: () => isCreatorUsingSharingConfig,
1856
1856
  newBondingCurve: () => newBondingCurve,
1857
1857
  pumpIdl: () => pump_default,
1858
1858
  pumpPoolAuthorityPda: () => pumpPoolAuthorityPda,
@@ -9078,6 +9078,7 @@ var OnlinePumpSdk = class {
9078
9078
  this.connection = connection;
9079
9079
  this.pumpProgram = getPumpProgram(connection);
9080
9080
  this.offlinePumpProgram = OFFLINE_PUMP_PROGRAM;
9081
+ this.pumpAmmProgram = getPumpAmmProgram(connection);
9081
9082
  this.pumpAmmSdk = new import_pump_swap_sdk.OnlinePumpAmmSdk(connection);
9082
9083
  this.pumpAmmAdminSdk = new import_pump_swap_sdk.PumpAmmAdminSdk(connection);
9083
9084
  }
@@ -9342,6 +9343,127 @@ var OnlinePumpSdk = class {
9342
9343
  await import_pump_swap_sdk.PUMP_AMM_SDK.syncUserVolumeAccumulator(user)
9343
9344
  ];
9344
9345
  }
9346
+ /**
9347
+ * Gets the minimum distributable fee for a token's fee sharing configuration.
9348
+ *
9349
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
9350
+ * For graduated tokens, it automatically consolidates fees from the AMM vault before
9351
+ * calculating the minimum distributable fee.
9352
+ *
9353
+ * @param mint - The mint address of the token
9354
+ * @param simulationSigner - Optional signer address for transaction simulation.
9355
+ * Must have a non-zero SOL balance. Defaults to a known funded address.
9356
+ * @returns The minimum distributable fee information including whether distribution is possible
9357
+ */
9358
+ async getMinimumDistributableFee(mint, simulationSigner = new import_web33.PublicKey("UqN2p5bAzBqYdHXcgB6WLtuVrdvmy9JSAtgqZb3CMKw")) {
9359
+ const sharingConfigPubkey = feeSharingConfigPda(mint);
9360
+ const poolAddress = canonicalPumpPoolPda(mint);
9361
+ const coinCreatorVaultAuthority = (0, import_pump_swap_sdk.coinCreatorVaultAuthorityPda)(sharingConfigPubkey);
9362
+ const ammVaultAta = (0, import_pump_swap_sdk.coinCreatorVaultAtaPda)(
9363
+ coinCreatorVaultAuthority,
9364
+ import_spl_token.NATIVE_MINT,
9365
+ import_spl_token.TOKEN_PROGRAM_ID
9366
+ );
9367
+ const [sharingConfigAccountInfo, poolAccountInfo, ammVaultAtaInfo] = await this.connection.getMultipleAccountsInfo([
9368
+ sharingConfigPubkey,
9369
+ poolAddress,
9370
+ ammVaultAta
9371
+ ]);
9372
+ if (!sharingConfigAccountInfo) {
9373
+ throw new Error(`Sharing config not found for mint: ${mint.toBase58()}`);
9374
+ }
9375
+ const sharingConfig = PUMP_SDK.decodeSharingConfig(sharingConfigAccountInfo);
9376
+ const instructions = [];
9377
+ const isGraduated = poolAccountInfo !== null;
9378
+ if (isGraduated && ammVaultAtaInfo) {
9379
+ const transferCreatorFeesToPumpIx = await this.pumpAmmProgram.methods.transferCreatorFeesToPump().accountsPartial({
9380
+ wsolMint: import_spl_token.NATIVE_MINT,
9381
+ tokenProgram: import_spl_token.TOKEN_PROGRAM_ID,
9382
+ coinCreator: sharingConfigPubkey
9383
+ }).instruction();
9384
+ instructions.push(transferCreatorFeesToPumpIx);
9385
+ }
9386
+ const getMinFeeIx = await PUMP_SDK.getMinimumDistributableFee({
9387
+ mint,
9388
+ sharingConfig,
9389
+ sharingConfigAddress: sharingConfigPubkey
9390
+ });
9391
+ instructions.push(getMinFeeIx);
9392
+ const { blockhash } = await this.connection.getLatestBlockhash();
9393
+ const tx = new import_web33.VersionedTransaction(
9394
+ new import_web33.TransactionMessage({
9395
+ payerKey: simulationSigner,
9396
+ recentBlockhash: blockhash,
9397
+ instructions
9398
+ }).compileToV0Message()
9399
+ );
9400
+ const result = await this.connection.simulateTransaction(tx);
9401
+ let minimumDistributableFee = {
9402
+ minimumRequired: new import_bn4.default(0),
9403
+ distributableFees: new import_bn4.default(0),
9404
+ canDistribute: false
9405
+ };
9406
+ if (!result.value.err) {
9407
+ const [data, encoding] = result.value.returnData?.data ?? [];
9408
+ if (data) {
9409
+ const buffer = Buffer.from(data, encoding);
9410
+ minimumDistributableFee = PUMP_SDK.decodeMinimumDistributableFee(buffer);
9411
+ }
9412
+ }
9413
+ return {
9414
+ ...minimumDistributableFee,
9415
+ isGraduated
9416
+ };
9417
+ }
9418
+ /**
9419
+ * Gets the instructions to distribute creator fees for a token's fee sharing configuration.
9420
+ *
9421
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
9422
+ * For graduated tokens, it automatically includes an instruction to consolidate fees
9423
+ * from the AMM vault before distributing.
9424
+ *
9425
+ * @param mint - The mint address of the token
9426
+ * @returns The instructions to distribute creator fees and whether the token is graduated
9427
+ */
9428
+ async buildDistributeCreatorFeesInstructions(mint) {
9429
+ const sharingConfigPubkey = feeSharingConfigPda(mint);
9430
+ const poolAddress = canonicalPumpPoolPda(mint);
9431
+ const coinCreatorVaultAuthority = (0, import_pump_swap_sdk.coinCreatorVaultAuthorityPda)(sharingConfigPubkey);
9432
+ const ammVaultAta = (0, import_pump_swap_sdk.coinCreatorVaultAtaPda)(
9433
+ coinCreatorVaultAuthority,
9434
+ import_spl_token.NATIVE_MINT,
9435
+ import_spl_token.TOKEN_PROGRAM_ID
9436
+ );
9437
+ const [sharingConfigAccountInfo, poolAccountInfo, ammVaultAtaInfo] = await this.connection.getMultipleAccountsInfo([
9438
+ sharingConfigPubkey,
9439
+ poolAddress,
9440
+ ammVaultAta
9441
+ ]);
9442
+ if (!sharingConfigAccountInfo) {
9443
+ throw new Error(`Sharing config not found for mint: ${mint.toBase58()}`);
9444
+ }
9445
+ const sharingConfig = PUMP_SDK.decodeSharingConfig(sharingConfigAccountInfo);
9446
+ const instructions = [];
9447
+ const isGraduated = poolAccountInfo !== null;
9448
+ if (isGraduated && ammVaultAtaInfo) {
9449
+ const transferCreatorFeesToPumpIx = await this.pumpAmmProgram.methods.transferCreatorFeesToPump().accountsPartial({
9450
+ wsolMint: import_spl_token.NATIVE_MINT,
9451
+ tokenProgram: import_spl_token.TOKEN_PROGRAM_ID,
9452
+ coinCreator: sharingConfigPubkey
9453
+ }).instruction();
9454
+ instructions.push(transferCreatorFeesToPumpIx);
9455
+ }
9456
+ const distributeCreatorFeesIx = await PUMP_SDK.distributeCreatorFees({
9457
+ mint,
9458
+ sharingConfig,
9459
+ sharingConfigAddress: sharingConfigPubkey
9460
+ });
9461
+ instructions.push(distributeCreatorFeesIx);
9462
+ return {
9463
+ instructions,
9464
+ isGraduated
9465
+ };
9466
+ }
9345
9467
  };
9346
9468
 
9347
9469
  // src/idl/pump_amm.json
@@ -18643,7 +18765,7 @@ var PumpSdk = class {
18643
18765
  }
18644
18766
  };
18645
18767
  var PUMP_SDK = new PumpSdk();
18646
- function hasCoinCreatorMigratedToSharingConfig({
18768
+ function isCreatorUsingSharingConfig({
18647
18769
  mint,
18648
18770
  creator
18649
18771
  }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pump-fun/pump-sdk",
3
- "version": "1.27.0-devnet.1",
3
+ "version": "1.27.0-devnet.2",
4
4
  "description": "Pump Bonding Curve SDK",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/pump-fun/pump-sdk#readme",
package/src/index.ts CHANGED
@@ -20,9 +20,9 @@ export {
20
20
  BONDING_CURVE_NEW_SIZE,
21
21
  PumpSdk,
22
22
  PUMP_SDK,
23
- hasCoinCreatorMigratedToSharingConfig,
23
+ isCreatorUsingSharingConfig,
24
24
  } from "./sdk";
25
- export { OnlinePumpSdk } from "./onlineSdk";
25
+ export { OnlinePumpSdk, MinimumDistributableFeeResult, DistributeCreatorFeeResult } from "./onlineSdk";
26
26
  export {
27
27
  FeeConfig,
28
28
  Global,
package/src/onlineSdk.ts CHANGED
@@ -17,13 +17,18 @@ import {
17
17
  PublicKey,
18
18
  PublicKeyInitData,
19
19
  TransactionInstruction,
20
+ TransactionMessage,
21
+ VersionedTransaction,
20
22
  } from "@solana/web3.js";
21
23
  import { Pump } from "./idl/pump";
24
+ import { PumpAmm } from "./idl/pump_amm";
22
25
  import BN from "bn.js";
23
26
 
24
27
  import {
25
28
  bondingCurvePda,
29
+ canonicalPumpPoolPda,
26
30
  creatorVaultPda,
31
+ feeSharingConfigPda,
27
32
  GLOBAL_PDA,
28
33
  GLOBAL_VOLUME_ACCUMULATOR_PDA,
29
34
  PUMP_FEE_CONFIG_PDA,
@@ -34,11 +39,12 @@ import {
34
39
  FeeConfig,
35
40
  Global,
36
41
  GlobalVolumeAccumulator,
42
+ MinimumDistributableFeeEvent,
37
43
  UserVolumeAccumulator,
38
44
  UserVolumeAccumulatorTotalStats,
39
45
  } from "./state";
40
46
  import { currentDayTokens, totalUnclaimedTokens } from "./tokenIncentives";
41
- import { getPumpProgram, PUMP_SDK, PUMP_TOKEN_MINT } from "./sdk";
47
+ import { getPumpAmmProgram, getPumpProgram, PUMP_SDK, PUMP_TOKEN_MINT } from "./sdk";
42
48
 
43
49
  export const OFFLINE_PUMP_PROGRAM = getPumpProgram(null as any as Connection);
44
50
 
@@ -46,6 +52,7 @@ export class OnlinePumpSdk {
46
52
  private readonly connection: Connection;
47
53
  private readonly pumpProgram: Program<Pump>;
48
54
  private readonly offlinePumpProgram: Program<Pump>;
55
+ private readonly pumpAmmProgram: Program<PumpAmm>;
49
56
  private readonly pumpAmmSdk: OnlinePumpAmmSdk;
50
57
  private readonly pumpAmmAdminSdk: PumpAmmAdminSdk;
51
58
 
@@ -54,6 +61,7 @@ export class OnlinePumpSdk {
54
61
 
55
62
  this.pumpProgram = getPumpProgram(connection);
56
63
  this.offlinePumpProgram = OFFLINE_PUMP_PROGRAM;
64
+ this.pumpAmmProgram = getPumpAmmProgram(connection);
57
65
 
58
66
  this.pumpAmmSdk = new OnlinePumpAmmSdk(connection);
59
67
  this.pumpAmmAdminSdk = new PumpAmmAdminSdk(connection);
@@ -426,4 +434,170 @@ export class OnlinePumpSdk {
426
434
  await PUMP_AMM_SDK.syncUserVolumeAccumulator(user),
427
435
  ];
428
436
  }
437
+
438
+ /**
439
+ * Gets the minimum distributable fee for a token's fee sharing configuration.
440
+ *
441
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
442
+ * For graduated tokens, it automatically consolidates fees from the AMM vault before
443
+ * calculating the minimum distributable fee.
444
+ *
445
+ * @param mint - The mint address of the token
446
+ * @param simulationSigner - Optional signer address for transaction simulation.
447
+ * Must have a non-zero SOL balance. Defaults to a known funded address.
448
+ * @returns The minimum distributable fee information including whether distribution is possible
449
+ */
450
+ async getMinimumDistributableFee(
451
+ mint: PublicKey,
452
+ simulationSigner: PublicKey = new PublicKey("UqN2p5bAzBqYdHXcgB6WLtuVrdvmy9JSAtgqZb3CMKw"),
453
+ ): Promise<MinimumDistributableFeeResult> {
454
+ const sharingConfigPubkey = feeSharingConfigPda(mint);
455
+ const poolAddress = canonicalPumpPoolPda(mint);
456
+ const coinCreatorVaultAuthority = coinCreatorVaultAuthorityPda(sharingConfigPubkey);
457
+ const ammVaultAta = coinCreatorVaultAtaPda(
458
+ coinCreatorVaultAuthority,
459
+ NATIVE_MINT,
460
+ TOKEN_PROGRAM_ID,
461
+ );
462
+
463
+ const [sharingConfigAccountInfo, poolAccountInfo, ammVaultAtaInfo] =
464
+ await this.connection.getMultipleAccountsInfo([
465
+ sharingConfigPubkey,
466
+ poolAddress,
467
+ ammVaultAta,
468
+ ]);
469
+
470
+ if (!sharingConfigAccountInfo) {
471
+ throw new Error(`Sharing config not found for mint: ${mint.toBase58()}`);
472
+ }
473
+
474
+ const sharingConfig = PUMP_SDK.decodeSharingConfig(sharingConfigAccountInfo);
475
+
476
+ const instructions: TransactionInstruction[] = [];
477
+
478
+ const isGraduated = poolAccountInfo !== null;
479
+ if (isGraduated && ammVaultAtaInfo) {
480
+ // Consolidate fees from AMM to bonding curve program for distribution
481
+ const transferCreatorFeesToPumpIx = await this.pumpAmmProgram.methods
482
+ .transferCreatorFeesToPump()
483
+ .accountsPartial({
484
+ wsolMint: NATIVE_MINT,
485
+ tokenProgram: TOKEN_PROGRAM_ID,
486
+ coinCreator: sharingConfigPubkey,
487
+ })
488
+ .instruction();
489
+ instructions.push(transferCreatorFeesToPumpIx);
490
+ }
491
+
492
+ const getMinFeeIx = await PUMP_SDK.getMinimumDistributableFee({
493
+ mint,
494
+ sharingConfig,
495
+ sharingConfigAddress: sharingConfigPubkey,
496
+ });
497
+ instructions.push(getMinFeeIx);
498
+
499
+ const { blockhash } = await this.connection.getLatestBlockhash();
500
+
501
+ const tx = new VersionedTransaction(
502
+ new TransactionMessage({
503
+ payerKey: simulationSigner,
504
+ recentBlockhash: blockhash,
505
+ instructions,
506
+ }).compileToV0Message(),
507
+ );
508
+
509
+ const result = await this.connection.simulateTransaction(tx);
510
+
511
+ let minimumDistributableFee: MinimumDistributableFeeEvent = {
512
+ minimumRequired: new BN(0),
513
+ distributableFees: new BN(0),
514
+ canDistribute: false,
515
+ };
516
+
517
+ if (!result.value.err) {
518
+ const [data, encoding] = result.value.returnData?.data ?? [];
519
+ if (data) {
520
+ const buffer = Buffer.from(data, encoding as BufferEncoding);
521
+ minimumDistributableFee = PUMP_SDK.decodeMinimumDistributableFee(buffer);
522
+ }
523
+ }
524
+
525
+ return {
526
+ ...minimumDistributableFee,
527
+ isGraduated,
528
+ };
529
+ }
530
+
531
+ /**
532
+ * Gets the instructions to distribute creator fees for a token's fee sharing configuration.
533
+ *
534
+ * This method handles both graduated (AMM) and non-graduated (bonding curve) tokens.
535
+ * For graduated tokens, it automatically includes an instruction to consolidate fees
536
+ * from the AMM vault before distributing.
537
+ *
538
+ * @param mint - The mint address of the token
539
+ * @returns The instructions to distribute creator fees and whether the token is graduated
540
+ */
541
+ async buildDistributeCreatorFeesInstructions(
542
+ mint: PublicKey,
543
+ ): Promise<DistributeCreatorFeeResult> {
544
+ const sharingConfigPubkey = feeSharingConfigPda(mint);
545
+ const poolAddress = canonicalPumpPoolPda(mint);
546
+ const coinCreatorVaultAuthority = coinCreatorVaultAuthorityPda(sharingConfigPubkey);
547
+ const ammVaultAta = coinCreatorVaultAtaPda(
548
+ coinCreatorVaultAuthority,
549
+ NATIVE_MINT,
550
+ TOKEN_PROGRAM_ID,
551
+ );
552
+
553
+ const [sharingConfigAccountInfo, poolAccountInfo, ammVaultAtaInfo] =
554
+ await this.connection.getMultipleAccountsInfo([
555
+ sharingConfigPubkey,
556
+ poolAddress,
557
+ ammVaultAta,
558
+ ]);
559
+
560
+ if (!sharingConfigAccountInfo) {
561
+ throw new Error(`Sharing config not found for mint: ${mint.toBase58()}`);
562
+ }
563
+
564
+ const sharingConfig = PUMP_SDK.decodeSharingConfig(sharingConfigAccountInfo);
565
+
566
+ const instructions: TransactionInstruction[] = [];
567
+
568
+ const isGraduated = poolAccountInfo !== null;
569
+ if (isGraduated && ammVaultAtaInfo) {
570
+ // Consolidate fees from AMM to bonding curve program for distribution
571
+ const transferCreatorFeesToPumpIx = await this.pumpAmmProgram.methods
572
+ .transferCreatorFeesToPump()
573
+ .accountsPartial({
574
+ wsolMint: NATIVE_MINT,
575
+ tokenProgram: TOKEN_PROGRAM_ID,
576
+ coinCreator: sharingConfigPubkey,
577
+ })
578
+ .instruction();
579
+ instructions.push(transferCreatorFeesToPumpIx);
580
+ }
581
+
582
+ const distributeCreatorFeesIx = await PUMP_SDK.distributeCreatorFees({
583
+ mint,
584
+ sharingConfig,
585
+ sharingConfigAddress: sharingConfigPubkey,
586
+ });
587
+ instructions.push(distributeCreatorFeesIx);
588
+
589
+ return {
590
+ instructions,
591
+ isGraduated,
592
+ };
593
+ }
594
+ }
595
+
596
+ export interface MinimumDistributableFeeResult extends MinimumDistributableFeeEvent {
597
+ isGraduated: boolean;
598
+ }
599
+
600
+ export interface DistributeCreatorFeeResult {
601
+ instructions: TransactionInstruction[];
602
+ isGraduated: boolean;
429
603
  }
package/src/sdk.ts CHANGED
@@ -964,13 +964,13 @@ export class PumpSdk {
964
964
  export const PUMP_SDK = new PumpSdk();
965
965
 
966
966
  /**
967
- * Checks if a creator has migrated to using a fee sharing configuration.
967
+ * Checks if a creator has upgraded to using a fee sharing configuration.
968
968
  *
969
969
  * When a creator sets up fee sharing, the creator address in the BondingCurve or Pool
970
970
  * is replaced with the fee sharing config PDA address. This function checks if that
971
- * migration has occurred.
971
+ * upgrade has occurred.
972
972
  *
973
- * @param params - Parameters for checking migration status
973
+ * @param params - Parameters for checking upgrade status
974
974
  * @param params.mint - The mint address of the token
975
975
  * @param params.creator - The creator address to check
976
976
  * - For ungraduated coins: use BondingCurve.creator
@@ -980,18 +980,18 @@ export const PUMP_SDK = new PumpSdk();
980
980
  *
981
981
  * @example
982
982
  * ```typescript
983
- * import { hasCoinCreatorMigratedToSharingConfig } from "@pump-fun/sdk";
983
+ * import { isCreatorUsingSharingConfig } from "@pump-fun/sdk";
984
984
  *
985
985
  * // For an ungraduated coin
986
986
  * const bondingCurve = await program.account.bondingCurve.fetch(bondingCurvePda(mint));
987
- * const hasMigrated = hasCoinCreatorMigratedToSharingConfig({
987
+ * const hasMigrated = isCreatorUsingSharingConfig({
988
988
  * mint,
989
989
  * creator: bondingCurve.creator
990
990
  * });
991
991
  *
992
992
  * // For a graduated coin
993
993
  * const pool = await ammProgram.account.pool.fetch(poolAddress);
994
- * const hasMigrated = hasCoinCreatorMigratedToSharingConfig({
994
+ * const hasMigrated = isCreatorUsingSharingConfig({
995
995
  * mint,
996
996
  * creator: pool.coinCreator
997
997
  * });
@@ -1003,7 +1003,7 @@ export const PUMP_SDK = new PumpSdk();
1003
1003
  * }
1004
1004
  * ```
1005
1005
  */
1006
- export function hasCoinCreatorMigratedToSharingConfig({
1006
+ export function isCreatorUsingSharingConfig({
1007
1007
  mint,
1008
1008
  creator,
1009
1009
  }: {