@pump-fun/pump-sdk 1.3.8-devnet.1 → 1.4.0-devnet.1

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/esm/index.js CHANGED
@@ -2634,9 +2634,9 @@ var pump_default = {
2634
2634
  // src/bondingCurve.ts
2635
2635
  import { PublicKey } from "@solana/web3.js";
2636
2636
  import BN from "bn.js";
2637
- function getFee(global, bondingCurve, amount, newCoin) {
2637
+ function getFee(global, bondingCurve, amount, isNewBondingCurve) {
2638
2638
  return computeFee(amount, global.feeBasisPoints).add(
2639
- newCoin || !PublicKey.default.equals(bondingCurve.creator) ? computeFee(amount, global.creatorFeeBasisPoints) : new BN(0)
2639
+ isNewBondingCurve || !PublicKey.default.equals(bondingCurve.creator) ? computeFee(amount, global.creatorFeeBasisPoints) : new BN(0)
2640
2640
  );
2641
2641
  }
2642
2642
  function computeFee(amount, feeBasisPoints) {
@@ -2645,30 +2645,51 @@ function computeFee(amount, feeBasisPoints) {
2645
2645
  function ceilDiv(a, b) {
2646
2646
  return a.add(b.subn(1)).div(b);
2647
2647
  }
2648
- function getBuyTokenAmountFromSolAmount(global, bondingCurve, amount, newCoin) {
2648
+ function newBondingCurve(global) {
2649
+ return {
2650
+ virtualTokenReserves: global.initialVirtualTokenReserves,
2651
+ virtualSolReserves: global.initialVirtualSolReserves,
2652
+ realTokenReserves: global.initialRealTokenReserves,
2653
+ realSolReserves: new BN(0),
2654
+ tokenTotalSupply: global.tokenTotalSupply,
2655
+ complete: false,
2656
+ creator: PublicKey.default
2657
+ };
2658
+ }
2659
+ function getBuyTokenAmountFromSolAmount(global, bondingCurve, amount) {
2649
2660
  if (amount.eq(new BN(0))) {
2650
2661
  return new BN(0);
2651
2662
  }
2663
+ let isNewBondingCurve = false;
2664
+ if (bondingCurve === null) {
2665
+ bondingCurve = newBondingCurve(global);
2666
+ isNewBondingCurve = true;
2667
+ }
2652
2668
  if (bondingCurve.virtualTokenReserves.eq(new BN(0))) {
2653
2669
  return new BN(0);
2654
2670
  }
2655
2671
  const totalFeeBasisPoints = global.feeBasisPoints.add(
2656
- newCoin || !PublicKey.default.equals(bondingCurve.creator) ? global.creatorFeeBasisPoints : new BN(0)
2672
+ isNewBondingCurve || !PublicKey.default.equals(bondingCurve.creator) ? global.creatorFeeBasisPoints : new BN(0)
2657
2673
  );
2658
2674
  const inputAmount = amount.muln(1e4).div(totalFeeBasisPoints.addn(1e4));
2659
2675
  const tokensReceived = inputAmount.mul(bondingCurve.virtualTokenReserves).div(bondingCurve.virtualSolReserves.add(inputAmount));
2660
2676
  return BN.min(tokensReceived, bondingCurve.realTokenReserves);
2661
2677
  }
2662
- function getBuySolAmountFromTokenAmount(global, bondingCurve, amount, newCoin) {
2678
+ function getBuySolAmountFromTokenAmount(global, bondingCurve, amount) {
2663
2679
  if (amount.eq(new BN(0))) {
2664
2680
  return new BN(0);
2665
2681
  }
2682
+ let isNewBondingCurve = false;
2683
+ if (bondingCurve === null) {
2684
+ bondingCurve = newBondingCurve(global);
2685
+ isNewBondingCurve = true;
2686
+ }
2666
2687
  if (bondingCurve.virtualTokenReserves.eq(new BN(0))) {
2667
2688
  return new BN(0);
2668
2689
  }
2669
2690
  const minAmount = BN.min(amount, bondingCurve.realTokenReserves);
2670
2691
  const solCost = minAmount.mul(bondingCurve.virtualSolReserves).div(bondingCurve.virtualTokenReserves.sub(minAmount)).add(new BN(1));
2671
- return solCost.add(getFee(global, bondingCurve, solCost, newCoin));
2692
+ return solCost.add(getFee(global, bondingCurve, solCost, isNewBondingCurve));
2672
2693
  }
2673
2694
  function getSellSolAmountFromTokenAmount(global, bondingCurve, amount) {
2674
2695
  if (amount.eq(new BN(0))) {
@@ -2729,7 +2750,6 @@ import { AnchorProvider, Program } from "@coral-xyz/anchor";
2729
2750
  import { PumpAmmSdk } from "@pump-fun/pump-swap-sdk";
2730
2751
  import {
2731
2752
  createAssociatedTokenAccountIdempotentInstruction,
2732
- getAccount,
2733
2753
  getAssociatedTokenAddressSync
2734
2754
  } from "@solana/spl-token";
2735
2755
  import {
@@ -2799,103 +2819,208 @@ var PumpSdk = class {
2799
2819
  this.bondingCurvePda(mint)
2800
2820
  );
2801
2821
  }
2802
- async createInstruction(mint, name, symbol, uri, creator, user) {
2822
+ async fetchBuyState(mint, user) {
2823
+ const [bondingCurveAccountInfo, associatedUserAccountInfo] = await this.connection.getMultipleAccountsInfo([
2824
+ this.bondingCurvePda(mint),
2825
+ getAssociatedTokenAddressSync(mint, user, true)
2826
+ ]);
2827
+ if (!bondingCurveAccountInfo) {
2828
+ throw new Error(
2829
+ `Bonding curve account not found for mint: ${mint.toBase58()}`
2830
+ );
2831
+ }
2832
+ const bondingCurve = this.decodeBondingCurve(bondingCurveAccountInfo);
2833
+ return { bondingCurveAccountInfo, bondingCurve, associatedUserAccountInfo };
2834
+ }
2835
+ async fetchSellState(mint, user) {
2836
+ const [bondingCurveAccountInfo, associatedUserAccountInfo] = await this.connection.getMultipleAccountsInfo([
2837
+ this.bondingCurvePda(mint),
2838
+ getAssociatedTokenAddressSync(mint, user, true)
2839
+ ]);
2840
+ if (!bondingCurveAccountInfo) {
2841
+ throw new Error(
2842
+ `Bonding curve account not found for mint: ${mint.toBase58()}`
2843
+ );
2844
+ }
2845
+ if (!associatedUserAccountInfo) {
2846
+ throw new Error(
2847
+ `Associated token account not found for mint: ${mint.toBase58()} and user: ${user.toBase58()}`
2848
+ );
2849
+ }
2850
+ const bondingCurve = this.decodeBondingCurve(bondingCurveAccountInfo);
2851
+ return { bondingCurveAccountInfo, bondingCurve };
2852
+ }
2853
+ async createInstruction({
2854
+ mint,
2855
+ name,
2856
+ symbol,
2857
+ uri,
2858
+ creator,
2859
+ user
2860
+ }) {
2803
2861
  return await this.pumpProgram.methods.create(name, symbol, uri, creator).accountsPartial({
2804
2862
  mint,
2805
2863
  user
2806
2864
  }).instruction();
2807
2865
  }
2808
- async buyInstructions(global, bondingCurveAccountInfo, bondingCurve, mint, user, amount, solAmount, slippage, newCoinCreator) {
2809
- return this.withFixBondingCurve(
2810
- mint,
2811
- bondingCurveAccountInfo,
2812
- user,
2813
- async () => {
2814
- const instructions = [];
2815
- const associatedUser = getAssociatedTokenAddressSync(mint, user, true);
2816
- const userTokenAccount = await getAccount(
2817
- this.connection,
2818
- associatedUser
2819
- ).catch((e) => null);
2820
- if (!userTokenAccount) {
2821
- instructions.push(
2822
- createAssociatedTokenAccountIdempotentInstruction(
2823
- user,
2824
- associatedUser,
2825
- user,
2826
- mint
2827
- )
2828
- );
2829
- }
2830
- instructions.push(
2831
- await this.pumpProgram.methods.buy(
2832
- amount,
2833
- solAmount.add(
2834
- solAmount.mul(new BN2(Math.floor(slippage * 10))).div(new BN2(1e3))
2835
- )
2836
- ).accountsPartial({
2837
- feeRecipient: getFeeRecipient(global),
2838
- mint,
2839
- associatedUser,
2840
- user,
2841
- creatorVault: this.creatorVaultPda(
2842
- bondingCurveAccountInfo === null ? newCoinCreator : bondingCurve.creator
2843
- )
2844
- }).instruction()
2845
- );
2846
- return instructions;
2847
- }
2866
+ async buyInstructions({
2867
+ global,
2868
+ bondingCurveAccountInfo,
2869
+ bondingCurve,
2870
+ associatedUserAccountInfo,
2871
+ mint,
2872
+ user,
2873
+ amount,
2874
+ solAmount,
2875
+ slippage
2876
+ }) {
2877
+ const instructions = [];
2878
+ if (bondingCurveAccountInfo.data.length < BONDING_CURVE_NEW_SIZE) {
2879
+ instructions.push(
2880
+ await this.extendAccountInstruction({
2881
+ account: this.bondingCurvePda(mint),
2882
+ user
2883
+ })
2884
+ );
2885
+ }
2886
+ const associatedUser = getAssociatedTokenAddressSync(mint, user, true);
2887
+ if (!associatedUserAccountInfo) {
2888
+ instructions.push(
2889
+ createAssociatedTokenAccountIdempotentInstruction(
2890
+ user,
2891
+ associatedUser,
2892
+ user,
2893
+ mint
2894
+ )
2895
+ );
2896
+ }
2897
+ instructions.push(
2898
+ await this.buyInstruction({
2899
+ global,
2900
+ mint,
2901
+ creator: bondingCurve.creator,
2902
+ user,
2903
+ associatedUser,
2904
+ amount,
2905
+ solAmount,
2906
+ slippage
2907
+ })
2848
2908
  );
2909
+ return instructions;
2849
2910
  }
2850
- async sellInstructions(global, bondingCurveAccountInfo, mint, user, amount, solAmount, slippage) {
2851
- return this.withFixBondingCurve(
2852
- mint,
2853
- bondingCurveAccountInfo,
2854
- user,
2855
- async () => {
2856
- return [
2857
- await this.pumpProgram.methods.sell(
2858
- amount,
2859
- solAmount.sub(
2860
- solAmount.mul(new BN2(Math.floor(slippage * 10))).div(new BN2(1e3))
2861
- )
2862
- ).accountsPartial({
2863
- feeRecipient: getFeeRecipient(global),
2864
- mint,
2865
- associatedUser: getAssociatedTokenAddressSync(mint, user, true),
2866
- user
2867
- }).instruction()
2868
- ];
2869
- }
2870
- );
2911
+ async createAndBuyInstructions({
2912
+ global,
2913
+ mint,
2914
+ name,
2915
+ symbol,
2916
+ uri,
2917
+ creator,
2918
+ user,
2919
+ amount,
2920
+ solAmount
2921
+ }) {
2922
+ const associatedUser = getAssociatedTokenAddressSync(mint, user, true);
2923
+ return [
2924
+ await this.createInstruction({ mint, name, symbol, uri, creator, user }),
2925
+ await this.extendAccountInstruction({
2926
+ account: this.bondingCurvePda(mint),
2927
+ user
2928
+ }),
2929
+ createAssociatedTokenAccountIdempotentInstruction(
2930
+ user,
2931
+ associatedUser,
2932
+ user,
2933
+ mint
2934
+ ),
2935
+ await this.buyInstruction({
2936
+ global,
2937
+ mint,
2938
+ creator,
2939
+ user,
2940
+ associatedUser,
2941
+ amount,
2942
+ solAmount,
2943
+ slippage: 1
2944
+ })
2945
+ ];
2871
2946
  }
2872
- async fixExistingBondingCurve(mint, bondingCurveAccountInfo, user) {
2873
- return this.withFixBondingCurve(
2947
+ async buyInstruction({
2948
+ global,
2949
+ mint,
2950
+ creator,
2951
+ user,
2952
+ associatedUser,
2953
+ amount,
2954
+ solAmount,
2955
+ slippage
2956
+ }) {
2957
+ return await this.pumpProgram.methods.buy(
2958
+ amount,
2959
+ solAmount.add(
2960
+ solAmount.mul(new BN2(Math.floor(slippage * 10))).div(new BN2(1e3))
2961
+ )
2962
+ ).accountsPartial({
2963
+ feeRecipient: getFeeRecipient(global),
2874
2964
  mint,
2875
- bondingCurveAccountInfo,
2965
+ associatedUser,
2876
2966
  user,
2877
- async () => []
2878
- );
2967
+ creatorVault: this.creatorVaultPda(creator)
2968
+ }).instruction();
2879
2969
  }
2880
- async withFixBondingCurve(mint, bondingCurveAccountInfo, user, block) {
2881
- if (bondingCurveAccountInfo === null || bondingCurveAccountInfo.data.length < BONDING_CURVE_NEW_SIZE) {
2882
- return [
2883
- await this.extendAccount(this.bondingCurvePda(mint), user),
2884
- ...await block()
2885
- ];
2970
+ async sellInstructions({
2971
+ global,
2972
+ bondingCurveAccountInfo,
2973
+ bondingCurve,
2974
+ mint,
2975
+ user,
2976
+ amount,
2977
+ solAmount,
2978
+ slippage
2979
+ }) {
2980
+ const instructions = [];
2981
+ if (bondingCurveAccountInfo.data.length < BONDING_CURVE_NEW_SIZE) {
2982
+ instructions.push(
2983
+ await this.extendAccountInstruction({
2984
+ account: this.bondingCurvePda(mint),
2985
+ user
2986
+ })
2987
+ );
2886
2988
  }
2887
- return await block();
2989
+ instructions.push(
2990
+ await this.pumpProgram.methods.sell(
2991
+ amount,
2992
+ solAmount.sub(
2993
+ solAmount.mul(new BN2(Math.floor(slippage * 10))).div(new BN2(1e3))
2994
+ )
2995
+ ).accountsPartial({
2996
+ feeRecipient: getFeeRecipient(global),
2997
+ mint,
2998
+ associatedUser: getAssociatedTokenAddressSync(mint, user, true),
2999
+ user,
3000
+ creatorVault: this.creatorVaultPda(bondingCurve.creator)
3001
+ }).instruction()
3002
+ );
3003
+ return instructions;
2888
3004
  }
2889
- async extendAccount(account, user) {
3005
+ async extendAccountInstruction({
3006
+ account,
3007
+ user
3008
+ }) {
2890
3009
  return this.pumpProgram.methods.extendAccount().accountsPartial({
2891
3010
  account,
2892
3011
  user
2893
3012
  }).instruction();
2894
3013
  }
2895
- async migrateInstruction(mint, user) {
3014
+ async migrateInstruction({
3015
+ global,
3016
+ mint,
3017
+ user
3018
+ }) {
2896
3019
  return this.pumpProgram.methods.migrate().accountsPartial({
2897
3020
  mint,
2898
- user
3021
+ user,
3022
+ pumpAmm: this.pumpAmmSdk.programId(),
3023
+ withdrawAuthority: global.withdrawAuthority
2899
3024
  }).instruction();
2900
3025
  }
2901
3026
  async collectCoinCreatorFeeInstructions(coinCreator) {
@@ -2939,6 +3064,7 @@ export {
2939
3064
  getPumpProgram,
2940
3065
  getSellSolAmountFromTokenAmount,
2941
3066
  globalPda,
3067
+ newBondingCurve,
2942
3068
  pump_default as pumpIdl,
2943
3069
  pumpPoolAuthorityPda
2944
3070
  };
package/dist/index.d.mts CHANGED
@@ -5636,8 +5636,9 @@ interface BondingCurve {
5636
5636
  creator: PublicKey;
5637
5637
  }
5638
5638
 
5639
- declare function getBuyTokenAmountFromSolAmount(global: Global, bondingCurve: BondingCurve, amount: BN, newCoin: boolean): BN;
5640
- declare function getBuySolAmountFromTokenAmount(global: Global, bondingCurve: BondingCurve, amount: BN, newCoin: boolean): BN;
5639
+ declare function newBondingCurve(global: Global): BondingCurve;
5640
+ declare function getBuyTokenAmountFromSolAmount(global: Global, bondingCurve: BondingCurve | null, amount: BN): BN;
5641
+ declare function getBuySolAmountFromTokenAmount(global: Global, bondingCurve: BondingCurve | null, amount: BN): BN;
5641
5642
  declare function getSellSolAmountFromTokenAmount(global: Global, bondingCurve: BondingCurve, amount: BN): BN;
5642
5643
 
5643
5644
  declare function globalPda(programId: PublicKey): PublicKey;
@@ -5666,15 +5667,67 @@ declare class PumpSdk {
5666
5667
  decodeBondingCurve(accountInfo: AccountInfo<Buffer>): BondingCurve;
5667
5668
  fetchGlobal(): Promise<Global>;
5668
5669
  fetchBondingCurve(mint: PublicKeyInitData): Promise<BondingCurve>;
5669
- createInstruction(mint: PublicKey, name: string, symbol: string, uri: string, creator: PublicKey, user: PublicKey): Promise<TransactionInstruction>;
5670
- buyInstructions(global: Global, bondingCurveAccountInfo: AccountInfo<Buffer> | null, bondingCurve: BondingCurve, mint: PublicKey, user: PublicKey, amount: BN, solAmount: BN, slippage: number, newCoinCreator: PublicKey): Promise<TransactionInstruction[]>;
5671
- sellInstructions(global: Global, bondingCurveAccountInfo: AccountInfo<Buffer> | null, mint: PublicKey, user: PublicKey, amount: BN, solAmount: BN, slippage: number): Promise<TransactionInstruction[]>;
5672
- fixExistingBondingCurve(mint: PublicKey, bondingCurveAccountInfo: AccountInfo<Buffer> | null, user: PublicKey): Promise<TransactionInstruction[]>;
5673
- private withFixBondingCurve;
5674
- extendAccount(account: PublicKey, user: PublicKey): Promise<TransactionInstruction>;
5675
- migrateInstruction(mint: PublicKey, user: PublicKey): Promise<TransactionInstruction>;
5670
+ fetchBuyState(mint: PublicKey, user: PublicKey): Promise<{
5671
+ bondingCurveAccountInfo: AccountInfo<Buffer<ArrayBufferLike>>;
5672
+ bondingCurve: BondingCurve;
5673
+ associatedUserAccountInfo: AccountInfo<Buffer<ArrayBufferLike>> | null;
5674
+ }>;
5675
+ fetchSellState(mint: PublicKey, user: PublicKey): Promise<{
5676
+ bondingCurveAccountInfo: AccountInfo<Buffer<ArrayBufferLike>>;
5677
+ bondingCurve: BondingCurve;
5678
+ }>;
5679
+ createInstruction({ mint, name, symbol, uri, creator, user, }: {
5680
+ mint: PublicKey;
5681
+ name: string;
5682
+ symbol: string;
5683
+ uri: string;
5684
+ creator: PublicKey;
5685
+ user: PublicKey;
5686
+ }): Promise<TransactionInstruction>;
5687
+ buyInstructions({ global, bondingCurveAccountInfo, bondingCurve, associatedUserAccountInfo, mint, user, amount, solAmount, slippage, }: {
5688
+ global: Global;
5689
+ bondingCurveAccountInfo: AccountInfo<Buffer>;
5690
+ bondingCurve: BondingCurve;
5691
+ associatedUserAccountInfo: AccountInfo<Buffer> | null;
5692
+ mint: PublicKey;
5693
+ user: PublicKey;
5694
+ amount: BN;
5695
+ solAmount: BN;
5696
+ slippage: number;
5697
+ }): Promise<TransactionInstruction[]>;
5698
+ createAndBuyInstructions({ global, mint, name, symbol, uri, creator, user, amount, solAmount, }: {
5699
+ global: Global;
5700
+ mint: PublicKey;
5701
+ name: string;
5702
+ symbol: string;
5703
+ uri: string;
5704
+ creator: PublicKey;
5705
+ user: PublicKey;
5706
+ amount: BN;
5707
+ solAmount: BN;
5708
+ }): Promise<TransactionInstruction[]>;
5709
+ private buyInstruction;
5710
+ sellInstructions({ global, bondingCurveAccountInfo, bondingCurve, mint, user, amount, solAmount, slippage, }: {
5711
+ global: Global;
5712
+ bondingCurveAccountInfo: AccountInfo<Buffer>;
5713
+ bondingCurve: BondingCurve;
5714
+ mint: PublicKey;
5715
+ user: PublicKey;
5716
+ amount: BN;
5717
+ solAmount: BN;
5718
+ slippage: number;
5719
+ }): Promise<TransactionInstruction[]>;
5720
+ extendAccountInstruction({ account, user, }: {
5721
+ account: PublicKey;
5722
+ user: PublicKey;
5723
+ }): Promise<TransactionInstruction>;
5724
+ migrateInstruction({ global, mint, user, }: {
5725
+ global: Global;
5726
+ mint: PublicKey;
5727
+ user: PublicKey;
5728
+ }): Promise<TransactionInstruction>;
5676
5729
  collectCoinCreatorFeeInstructions(coinCreator: PublicKey): Promise<TransactionInstruction[]>;
5677
5730
  getCreatorVaultBalance(creator: PublicKey): Promise<BN>;
5678
5731
  }
5679
5732
 
5680
- export { BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type Global, PUMP_AMM_PROGRAM_ID, PUMP_PROGRAM_ID, type Pump, PumpSdk, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getPumpProgram, getSellSolAmountFromTokenAmount, globalPda, pump as pumpIdl, pumpPoolAuthorityPda };
5733
+ export { BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type Global, PUMP_AMM_PROGRAM_ID, PUMP_PROGRAM_ID, type Pump, PumpSdk, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getPumpProgram, getSellSolAmountFromTokenAmount, globalPda, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda };
package/dist/index.d.ts CHANGED
@@ -5636,8 +5636,9 @@ interface BondingCurve {
5636
5636
  creator: PublicKey;
5637
5637
  }
5638
5638
 
5639
- declare function getBuyTokenAmountFromSolAmount(global: Global, bondingCurve: BondingCurve, amount: BN, newCoin: boolean): BN;
5640
- declare function getBuySolAmountFromTokenAmount(global: Global, bondingCurve: BondingCurve, amount: BN, newCoin: boolean): BN;
5639
+ declare function newBondingCurve(global: Global): BondingCurve;
5640
+ declare function getBuyTokenAmountFromSolAmount(global: Global, bondingCurve: BondingCurve | null, amount: BN): BN;
5641
+ declare function getBuySolAmountFromTokenAmount(global: Global, bondingCurve: BondingCurve | null, amount: BN): BN;
5641
5642
  declare function getSellSolAmountFromTokenAmount(global: Global, bondingCurve: BondingCurve, amount: BN): BN;
5642
5643
 
5643
5644
  declare function globalPda(programId: PublicKey): PublicKey;
@@ -5666,15 +5667,67 @@ declare class PumpSdk {
5666
5667
  decodeBondingCurve(accountInfo: AccountInfo<Buffer>): BondingCurve;
5667
5668
  fetchGlobal(): Promise<Global>;
5668
5669
  fetchBondingCurve(mint: PublicKeyInitData): Promise<BondingCurve>;
5669
- createInstruction(mint: PublicKey, name: string, symbol: string, uri: string, creator: PublicKey, user: PublicKey): Promise<TransactionInstruction>;
5670
- buyInstructions(global: Global, bondingCurveAccountInfo: AccountInfo<Buffer> | null, bondingCurve: BondingCurve, mint: PublicKey, user: PublicKey, amount: BN, solAmount: BN, slippage: number, newCoinCreator: PublicKey): Promise<TransactionInstruction[]>;
5671
- sellInstructions(global: Global, bondingCurveAccountInfo: AccountInfo<Buffer> | null, mint: PublicKey, user: PublicKey, amount: BN, solAmount: BN, slippage: number): Promise<TransactionInstruction[]>;
5672
- fixExistingBondingCurve(mint: PublicKey, bondingCurveAccountInfo: AccountInfo<Buffer> | null, user: PublicKey): Promise<TransactionInstruction[]>;
5673
- private withFixBondingCurve;
5674
- extendAccount(account: PublicKey, user: PublicKey): Promise<TransactionInstruction>;
5675
- migrateInstruction(mint: PublicKey, user: PublicKey): Promise<TransactionInstruction>;
5670
+ fetchBuyState(mint: PublicKey, user: PublicKey): Promise<{
5671
+ bondingCurveAccountInfo: AccountInfo<Buffer<ArrayBufferLike>>;
5672
+ bondingCurve: BondingCurve;
5673
+ associatedUserAccountInfo: AccountInfo<Buffer<ArrayBufferLike>> | null;
5674
+ }>;
5675
+ fetchSellState(mint: PublicKey, user: PublicKey): Promise<{
5676
+ bondingCurveAccountInfo: AccountInfo<Buffer<ArrayBufferLike>>;
5677
+ bondingCurve: BondingCurve;
5678
+ }>;
5679
+ createInstruction({ mint, name, symbol, uri, creator, user, }: {
5680
+ mint: PublicKey;
5681
+ name: string;
5682
+ symbol: string;
5683
+ uri: string;
5684
+ creator: PublicKey;
5685
+ user: PublicKey;
5686
+ }): Promise<TransactionInstruction>;
5687
+ buyInstructions({ global, bondingCurveAccountInfo, bondingCurve, associatedUserAccountInfo, mint, user, amount, solAmount, slippage, }: {
5688
+ global: Global;
5689
+ bondingCurveAccountInfo: AccountInfo<Buffer>;
5690
+ bondingCurve: BondingCurve;
5691
+ associatedUserAccountInfo: AccountInfo<Buffer> | null;
5692
+ mint: PublicKey;
5693
+ user: PublicKey;
5694
+ amount: BN;
5695
+ solAmount: BN;
5696
+ slippage: number;
5697
+ }): Promise<TransactionInstruction[]>;
5698
+ createAndBuyInstructions({ global, mint, name, symbol, uri, creator, user, amount, solAmount, }: {
5699
+ global: Global;
5700
+ mint: PublicKey;
5701
+ name: string;
5702
+ symbol: string;
5703
+ uri: string;
5704
+ creator: PublicKey;
5705
+ user: PublicKey;
5706
+ amount: BN;
5707
+ solAmount: BN;
5708
+ }): Promise<TransactionInstruction[]>;
5709
+ private buyInstruction;
5710
+ sellInstructions({ global, bondingCurveAccountInfo, bondingCurve, mint, user, amount, solAmount, slippage, }: {
5711
+ global: Global;
5712
+ bondingCurveAccountInfo: AccountInfo<Buffer>;
5713
+ bondingCurve: BondingCurve;
5714
+ mint: PublicKey;
5715
+ user: PublicKey;
5716
+ amount: BN;
5717
+ solAmount: BN;
5718
+ slippage: number;
5719
+ }): Promise<TransactionInstruction[]>;
5720
+ extendAccountInstruction({ account, user, }: {
5721
+ account: PublicKey;
5722
+ user: PublicKey;
5723
+ }): Promise<TransactionInstruction>;
5724
+ migrateInstruction({ global, mint, user, }: {
5725
+ global: Global;
5726
+ mint: PublicKey;
5727
+ user: PublicKey;
5728
+ }): Promise<TransactionInstruction>;
5676
5729
  collectCoinCreatorFeeInstructions(coinCreator: PublicKey): Promise<TransactionInstruction[]>;
5677
5730
  getCreatorVaultBalance(creator: PublicKey): Promise<BN>;
5678
5731
  }
5679
5732
 
5680
- export { BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type Global, PUMP_AMM_PROGRAM_ID, PUMP_PROGRAM_ID, type Pump, PumpSdk, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getPumpProgram, getSellSolAmountFromTokenAmount, globalPda, pump as pumpIdl, pumpPoolAuthorityPda };
5733
+ export { BONDING_CURVE_NEW_SIZE, type BondingCurve, CANONICAL_POOL_INDEX, type Global, PUMP_AMM_PROGRAM_ID, PUMP_PROGRAM_ID, type Pump, PumpSdk, bondingCurvePda, canonicalPumpPoolPda, creatorVaultPda, getBuySolAmountFromTokenAmount, getBuyTokenAmountFromSolAmount, getPumpProgram, getSellSolAmountFromTokenAmount, globalPda, newBondingCurve, pump as pumpIdl, pumpPoolAuthorityPda };