@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 +210 -84
- package/dist/index.d.mts +63 -10
- package/dist/index.d.ts +63 -10
- package/dist/index.js +210 -83
- package/package.json +1 -1
- package/src/bondingCurve.ts +32 -8
- package/src/index.ts +1 -0
- package/src/pda.ts +8 -8
- package/src/sdk.ts +254 -137
- package/src/bondingCurve.spec.ts +0 -65
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(index_exports, {
|
|
|
43
43
|
getPumpProgram: () => getPumpProgram,
|
|
44
44
|
getSellSolAmountFromTokenAmount: () => getSellSolAmountFromTokenAmount,
|
|
45
45
|
globalPda: () => globalPda,
|
|
46
|
+
newBondingCurve: () => newBondingCurve,
|
|
46
47
|
pumpIdl: () => pump_default,
|
|
47
48
|
pumpPoolAuthorityPda: () => pumpPoolAuthorityPda
|
|
48
49
|
});
|
|
@@ -2684,9 +2685,9 @@ var pump_default = {
|
|
|
2684
2685
|
// src/bondingCurve.ts
|
|
2685
2686
|
var import_web3 = require("@solana/web3.js");
|
|
2686
2687
|
var import_bn = __toESM(require("bn.js"));
|
|
2687
|
-
function getFee(global, bondingCurve, amount,
|
|
2688
|
+
function getFee(global, bondingCurve, amount, isNewBondingCurve) {
|
|
2688
2689
|
return computeFee(amount, global.feeBasisPoints).add(
|
|
2689
|
-
|
|
2690
|
+
isNewBondingCurve || !import_web3.PublicKey.default.equals(bondingCurve.creator) ? computeFee(amount, global.creatorFeeBasisPoints) : new import_bn.default(0)
|
|
2690
2691
|
);
|
|
2691
2692
|
}
|
|
2692
2693
|
function computeFee(amount, feeBasisPoints) {
|
|
@@ -2695,30 +2696,51 @@ function computeFee(amount, feeBasisPoints) {
|
|
|
2695
2696
|
function ceilDiv(a, b) {
|
|
2696
2697
|
return a.add(b.subn(1)).div(b);
|
|
2697
2698
|
}
|
|
2698
|
-
function
|
|
2699
|
+
function newBondingCurve(global) {
|
|
2700
|
+
return {
|
|
2701
|
+
virtualTokenReserves: global.initialVirtualTokenReserves,
|
|
2702
|
+
virtualSolReserves: global.initialVirtualSolReserves,
|
|
2703
|
+
realTokenReserves: global.initialRealTokenReserves,
|
|
2704
|
+
realSolReserves: new import_bn.default(0),
|
|
2705
|
+
tokenTotalSupply: global.tokenTotalSupply,
|
|
2706
|
+
complete: false,
|
|
2707
|
+
creator: import_web3.PublicKey.default
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
function getBuyTokenAmountFromSolAmount(global, bondingCurve, amount) {
|
|
2699
2711
|
if (amount.eq(new import_bn.default(0))) {
|
|
2700
2712
|
return new import_bn.default(0);
|
|
2701
2713
|
}
|
|
2714
|
+
let isNewBondingCurve = false;
|
|
2715
|
+
if (bondingCurve === null) {
|
|
2716
|
+
bondingCurve = newBondingCurve(global);
|
|
2717
|
+
isNewBondingCurve = true;
|
|
2718
|
+
}
|
|
2702
2719
|
if (bondingCurve.virtualTokenReserves.eq(new import_bn.default(0))) {
|
|
2703
2720
|
return new import_bn.default(0);
|
|
2704
2721
|
}
|
|
2705
2722
|
const totalFeeBasisPoints = global.feeBasisPoints.add(
|
|
2706
|
-
|
|
2723
|
+
isNewBondingCurve || !import_web3.PublicKey.default.equals(bondingCurve.creator) ? global.creatorFeeBasisPoints : new import_bn.default(0)
|
|
2707
2724
|
);
|
|
2708
2725
|
const inputAmount = amount.muln(1e4).div(totalFeeBasisPoints.addn(1e4));
|
|
2709
2726
|
const tokensReceived = inputAmount.mul(bondingCurve.virtualTokenReserves).div(bondingCurve.virtualSolReserves.add(inputAmount));
|
|
2710
2727
|
return import_bn.default.min(tokensReceived, bondingCurve.realTokenReserves);
|
|
2711
2728
|
}
|
|
2712
|
-
function getBuySolAmountFromTokenAmount(global, bondingCurve, amount
|
|
2729
|
+
function getBuySolAmountFromTokenAmount(global, bondingCurve, amount) {
|
|
2713
2730
|
if (amount.eq(new import_bn.default(0))) {
|
|
2714
2731
|
return new import_bn.default(0);
|
|
2715
2732
|
}
|
|
2733
|
+
let isNewBondingCurve = false;
|
|
2734
|
+
if (bondingCurve === null) {
|
|
2735
|
+
bondingCurve = newBondingCurve(global);
|
|
2736
|
+
isNewBondingCurve = true;
|
|
2737
|
+
}
|
|
2716
2738
|
if (bondingCurve.virtualTokenReserves.eq(new import_bn.default(0))) {
|
|
2717
2739
|
return new import_bn.default(0);
|
|
2718
2740
|
}
|
|
2719
2741
|
const minAmount = import_bn.default.min(amount, bondingCurve.realTokenReserves);
|
|
2720
2742
|
const solCost = minAmount.mul(bondingCurve.virtualSolReserves).div(bondingCurve.virtualTokenReserves.sub(minAmount)).add(new import_bn.default(1));
|
|
2721
|
-
return solCost.add(getFee(global, bondingCurve, solCost,
|
|
2743
|
+
return solCost.add(getFee(global, bondingCurve, solCost, isNewBondingCurve));
|
|
2722
2744
|
}
|
|
2723
2745
|
function getSellSolAmountFromTokenAmount(global, bondingCurve, amount) {
|
|
2724
2746
|
if (amount.eq(new import_bn.default(0))) {
|
|
@@ -2843,103 +2865,208 @@ var PumpSdk = class {
|
|
|
2843
2865
|
this.bondingCurvePda(mint)
|
|
2844
2866
|
);
|
|
2845
2867
|
}
|
|
2846
|
-
async
|
|
2868
|
+
async fetchBuyState(mint, user) {
|
|
2869
|
+
const [bondingCurveAccountInfo, associatedUserAccountInfo] = await this.connection.getMultipleAccountsInfo([
|
|
2870
|
+
this.bondingCurvePda(mint),
|
|
2871
|
+
(0, import_spl_token2.getAssociatedTokenAddressSync)(mint, user, true)
|
|
2872
|
+
]);
|
|
2873
|
+
if (!bondingCurveAccountInfo) {
|
|
2874
|
+
throw new Error(
|
|
2875
|
+
`Bonding curve account not found for mint: ${mint.toBase58()}`
|
|
2876
|
+
);
|
|
2877
|
+
}
|
|
2878
|
+
const bondingCurve = this.decodeBondingCurve(bondingCurveAccountInfo);
|
|
2879
|
+
return { bondingCurveAccountInfo, bondingCurve, associatedUserAccountInfo };
|
|
2880
|
+
}
|
|
2881
|
+
async fetchSellState(mint, user) {
|
|
2882
|
+
const [bondingCurveAccountInfo, associatedUserAccountInfo] = await this.connection.getMultipleAccountsInfo([
|
|
2883
|
+
this.bondingCurvePda(mint),
|
|
2884
|
+
(0, import_spl_token2.getAssociatedTokenAddressSync)(mint, user, true)
|
|
2885
|
+
]);
|
|
2886
|
+
if (!bondingCurveAccountInfo) {
|
|
2887
|
+
throw new Error(
|
|
2888
|
+
`Bonding curve account not found for mint: ${mint.toBase58()}`
|
|
2889
|
+
);
|
|
2890
|
+
}
|
|
2891
|
+
if (!associatedUserAccountInfo) {
|
|
2892
|
+
throw new Error(
|
|
2893
|
+
`Associated token account not found for mint: ${mint.toBase58()} and user: ${user.toBase58()}`
|
|
2894
|
+
);
|
|
2895
|
+
}
|
|
2896
|
+
const bondingCurve = this.decodeBondingCurve(bondingCurveAccountInfo);
|
|
2897
|
+
return { bondingCurveAccountInfo, bondingCurve };
|
|
2898
|
+
}
|
|
2899
|
+
async createInstruction({
|
|
2900
|
+
mint,
|
|
2901
|
+
name,
|
|
2902
|
+
symbol,
|
|
2903
|
+
uri,
|
|
2904
|
+
creator,
|
|
2905
|
+
user
|
|
2906
|
+
}) {
|
|
2847
2907
|
return await this.pumpProgram.methods.create(name, symbol, uri, creator).accountsPartial({
|
|
2848
2908
|
mint,
|
|
2849
2909
|
user
|
|
2850
2910
|
}).instruction();
|
|
2851
2911
|
}
|
|
2852
|
-
async buyInstructions(
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2912
|
+
async buyInstructions({
|
|
2913
|
+
global,
|
|
2914
|
+
bondingCurveAccountInfo,
|
|
2915
|
+
bondingCurve,
|
|
2916
|
+
associatedUserAccountInfo,
|
|
2917
|
+
mint,
|
|
2918
|
+
user,
|
|
2919
|
+
amount,
|
|
2920
|
+
solAmount,
|
|
2921
|
+
slippage
|
|
2922
|
+
}) {
|
|
2923
|
+
const instructions = [];
|
|
2924
|
+
if (bondingCurveAccountInfo.data.length < BONDING_CURVE_NEW_SIZE) {
|
|
2925
|
+
instructions.push(
|
|
2926
|
+
await this.extendAccountInstruction({
|
|
2927
|
+
account: this.bondingCurvePda(mint),
|
|
2928
|
+
user
|
|
2929
|
+
})
|
|
2930
|
+
);
|
|
2931
|
+
}
|
|
2932
|
+
const associatedUser = (0, import_spl_token2.getAssociatedTokenAddressSync)(mint, user, true);
|
|
2933
|
+
if (!associatedUserAccountInfo) {
|
|
2934
|
+
instructions.push(
|
|
2935
|
+
(0, import_spl_token2.createAssociatedTokenAccountIdempotentInstruction)(
|
|
2936
|
+
user,
|
|
2937
|
+
associatedUser,
|
|
2938
|
+
user,
|
|
2939
|
+
mint
|
|
2940
|
+
)
|
|
2941
|
+
);
|
|
2942
|
+
}
|
|
2943
|
+
instructions.push(
|
|
2944
|
+
await this.buyInstruction({
|
|
2945
|
+
global,
|
|
2946
|
+
mint,
|
|
2947
|
+
creator: bondingCurve.creator,
|
|
2948
|
+
user,
|
|
2949
|
+
associatedUser,
|
|
2950
|
+
amount,
|
|
2951
|
+
solAmount,
|
|
2952
|
+
slippage
|
|
2953
|
+
})
|
|
2892
2954
|
);
|
|
2955
|
+
return instructions;
|
|
2893
2956
|
}
|
|
2894
|
-
async
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2957
|
+
async createAndBuyInstructions({
|
|
2958
|
+
global,
|
|
2959
|
+
mint,
|
|
2960
|
+
name,
|
|
2961
|
+
symbol,
|
|
2962
|
+
uri,
|
|
2963
|
+
creator,
|
|
2964
|
+
user,
|
|
2965
|
+
amount,
|
|
2966
|
+
solAmount
|
|
2967
|
+
}) {
|
|
2968
|
+
const associatedUser = (0, import_spl_token2.getAssociatedTokenAddressSync)(mint, user, true);
|
|
2969
|
+
return [
|
|
2970
|
+
await this.createInstruction({ mint, name, symbol, uri, creator, user }),
|
|
2971
|
+
await this.extendAccountInstruction({
|
|
2972
|
+
account: this.bondingCurvePda(mint),
|
|
2973
|
+
user
|
|
2974
|
+
}),
|
|
2975
|
+
(0, import_spl_token2.createAssociatedTokenAccountIdempotentInstruction)(
|
|
2976
|
+
user,
|
|
2977
|
+
associatedUser,
|
|
2978
|
+
user,
|
|
2979
|
+
mint
|
|
2980
|
+
),
|
|
2981
|
+
await this.buyInstruction({
|
|
2982
|
+
global,
|
|
2983
|
+
mint,
|
|
2984
|
+
creator,
|
|
2985
|
+
user,
|
|
2986
|
+
associatedUser,
|
|
2987
|
+
amount,
|
|
2988
|
+
solAmount,
|
|
2989
|
+
slippage: 1
|
|
2990
|
+
})
|
|
2991
|
+
];
|
|
2915
2992
|
}
|
|
2916
|
-
async
|
|
2917
|
-
|
|
2993
|
+
async buyInstruction({
|
|
2994
|
+
global,
|
|
2995
|
+
mint,
|
|
2996
|
+
creator,
|
|
2997
|
+
user,
|
|
2998
|
+
associatedUser,
|
|
2999
|
+
amount,
|
|
3000
|
+
solAmount,
|
|
3001
|
+
slippage
|
|
3002
|
+
}) {
|
|
3003
|
+
return await this.pumpProgram.methods.buy(
|
|
3004
|
+
amount,
|
|
3005
|
+
solAmount.add(
|
|
3006
|
+
solAmount.mul(new import_bn2.default(Math.floor(slippage * 10))).div(new import_bn2.default(1e3))
|
|
3007
|
+
)
|
|
3008
|
+
).accountsPartial({
|
|
3009
|
+
feeRecipient: getFeeRecipient(global),
|
|
2918
3010
|
mint,
|
|
2919
|
-
|
|
3011
|
+
associatedUser,
|
|
2920
3012
|
user,
|
|
2921
|
-
|
|
2922
|
-
);
|
|
3013
|
+
creatorVault: this.creatorVaultPda(creator)
|
|
3014
|
+
}).instruction();
|
|
2923
3015
|
}
|
|
2924
|
-
async
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3016
|
+
async sellInstructions({
|
|
3017
|
+
global,
|
|
3018
|
+
bondingCurveAccountInfo,
|
|
3019
|
+
bondingCurve,
|
|
3020
|
+
mint,
|
|
3021
|
+
user,
|
|
3022
|
+
amount,
|
|
3023
|
+
solAmount,
|
|
3024
|
+
slippage
|
|
3025
|
+
}) {
|
|
3026
|
+
const instructions = [];
|
|
3027
|
+
if (bondingCurveAccountInfo.data.length < BONDING_CURVE_NEW_SIZE) {
|
|
3028
|
+
instructions.push(
|
|
3029
|
+
await this.extendAccountInstruction({
|
|
3030
|
+
account: this.bondingCurvePda(mint),
|
|
3031
|
+
user
|
|
3032
|
+
})
|
|
3033
|
+
);
|
|
2930
3034
|
}
|
|
2931
|
-
|
|
3035
|
+
instructions.push(
|
|
3036
|
+
await this.pumpProgram.methods.sell(
|
|
3037
|
+
amount,
|
|
3038
|
+
solAmount.sub(
|
|
3039
|
+
solAmount.mul(new import_bn2.default(Math.floor(slippage * 10))).div(new import_bn2.default(1e3))
|
|
3040
|
+
)
|
|
3041
|
+
).accountsPartial({
|
|
3042
|
+
feeRecipient: getFeeRecipient(global),
|
|
3043
|
+
mint,
|
|
3044
|
+
associatedUser: (0, import_spl_token2.getAssociatedTokenAddressSync)(mint, user, true),
|
|
3045
|
+
user,
|
|
3046
|
+
creatorVault: this.creatorVaultPda(bondingCurve.creator)
|
|
3047
|
+
}).instruction()
|
|
3048
|
+
);
|
|
3049
|
+
return instructions;
|
|
2932
3050
|
}
|
|
2933
|
-
async
|
|
3051
|
+
async extendAccountInstruction({
|
|
3052
|
+
account,
|
|
3053
|
+
user
|
|
3054
|
+
}) {
|
|
2934
3055
|
return this.pumpProgram.methods.extendAccount().accountsPartial({
|
|
2935
3056
|
account,
|
|
2936
3057
|
user
|
|
2937
3058
|
}).instruction();
|
|
2938
3059
|
}
|
|
2939
|
-
async migrateInstruction(
|
|
3060
|
+
async migrateInstruction({
|
|
3061
|
+
global,
|
|
3062
|
+
mint,
|
|
3063
|
+
user
|
|
3064
|
+
}) {
|
|
2940
3065
|
return this.pumpProgram.methods.migrate().accountsPartial({
|
|
2941
3066
|
mint,
|
|
2942
|
-
user
|
|
3067
|
+
user,
|
|
3068
|
+
pumpAmm: this.pumpAmmSdk.programId(),
|
|
3069
|
+
withdrawAuthority: global.withdrawAuthority
|
|
2943
3070
|
}).instruction();
|
|
2944
3071
|
}
|
|
2945
3072
|
async collectCoinCreatorFeeInstructions(coinCreator) {
|
package/package.json
CHANGED
package/src/bondingCurve.ts
CHANGED
|
@@ -6,10 +6,10 @@ function getFee(
|
|
|
6
6
|
global: Global,
|
|
7
7
|
bondingCurve: BondingCurve,
|
|
8
8
|
amount: BN,
|
|
9
|
-
|
|
9
|
+
isNewBondingCurve: boolean,
|
|
10
10
|
): BN {
|
|
11
11
|
return computeFee(amount, global.feeBasisPoints).add(
|
|
12
|
-
|
|
12
|
+
isNewBondingCurve || !PublicKey.default.equals(bondingCurve.creator)
|
|
13
13
|
? computeFee(amount, global.creatorFeeBasisPoints)
|
|
14
14
|
: new BN(0),
|
|
15
15
|
);
|
|
@@ -23,23 +23,41 @@ function ceilDiv(a: BN, b: BN): BN {
|
|
|
23
23
|
return a.add(b.subn(1)).div(b);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export function newBondingCurve(global: Global): BondingCurve {
|
|
27
|
+
return {
|
|
28
|
+
virtualTokenReserves: global.initialVirtualTokenReserves,
|
|
29
|
+
virtualSolReserves: global.initialVirtualSolReserves,
|
|
30
|
+
realTokenReserves: global.initialRealTokenReserves,
|
|
31
|
+
realSolReserves: new BN(0),
|
|
32
|
+
tokenTotalSupply: global.tokenTotalSupply,
|
|
33
|
+
complete: false,
|
|
34
|
+
creator: PublicKey.default,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
export function getBuyTokenAmountFromSolAmount(
|
|
27
39
|
global: Global,
|
|
28
|
-
bondingCurve: BondingCurve,
|
|
40
|
+
bondingCurve: BondingCurve | null,
|
|
29
41
|
amount: BN,
|
|
30
|
-
newCoin: boolean,
|
|
31
42
|
): BN {
|
|
32
43
|
if (amount.eq(new BN(0))) {
|
|
33
44
|
return new BN(0);
|
|
34
45
|
}
|
|
35
46
|
|
|
47
|
+
let isNewBondingCurve = false;
|
|
48
|
+
|
|
49
|
+
if (bondingCurve === null) {
|
|
50
|
+
bondingCurve = newBondingCurve(global);
|
|
51
|
+
isNewBondingCurve = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
36
54
|
// migrated bonding curve
|
|
37
55
|
if (bondingCurve.virtualTokenReserves.eq(new BN(0))) {
|
|
38
56
|
return new BN(0);
|
|
39
57
|
}
|
|
40
58
|
|
|
41
59
|
const totalFeeBasisPoints = global.feeBasisPoints.add(
|
|
42
|
-
|
|
60
|
+
isNewBondingCurve || !PublicKey.default.equals(bondingCurve.creator)
|
|
43
61
|
? global.creatorFeeBasisPoints
|
|
44
62
|
: new BN(0),
|
|
45
63
|
);
|
|
@@ -55,14 +73,20 @@ export function getBuyTokenAmountFromSolAmount(
|
|
|
55
73
|
|
|
56
74
|
export function getBuySolAmountFromTokenAmount(
|
|
57
75
|
global: Global,
|
|
58
|
-
bondingCurve: BondingCurve,
|
|
76
|
+
bondingCurve: BondingCurve | null,
|
|
59
77
|
amount: BN,
|
|
60
|
-
newCoin: boolean,
|
|
61
78
|
): BN {
|
|
62
79
|
if (amount.eq(new BN(0))) {
|
|
63
80
|
return new BN(0);
|
|
64
81
|
}
|
|
65
82
|
|
|
83
|
+
let isNewBondingCurve = false;
|
|
84
|
+
|
|
85
|
+
if (bondingCurve === null) {
|
|
86
|
+
bondingCurve = newBondingCurve(global);
|
|
87
|
+
isNewBondingCurve = true;
|
|
88
|
+
}
|
|
89
|
+
|
|
66
90
|
// migrated bonding curve
|
|
67
91
|
if (bondingCurve.virtualTokenReserves.eq(new BN(0))) {
|
|
68
92
|
return new BN(0);
|
|
@@ -75,7 +99,7 @@ export function getBuySolAmountFromTokenAmount(
|
|
|
75
99
|
.div(bondingCurve.virtualTokenReserves.sub(minAmount))
|
|
76
100
|
.add(new BN(1));
|
|
77
101
|
|
|
78
|
-
return solCost.add(getFee(global, bondingCurve, solCost,
|
|
102
|
+
return solCost.add(getFee(global, bondingCurve, solCost, isNewBondingCurve));
|
|
79
103
|
}
|
|
80
104
|
|
|
81
105
|
export function getSellSolAmountFromTokenAmount(
|
package/src/index.ts
CHANGED
package/src/pda.ts
CHANGED
|
@@ -5,18 +5,18 @@ import { poolPda } from "@pump-fun/pump-swap-sdk";
|
|
|
5
5
|
export function globalPda(programId: PublicKey): PublicKey {
|
|
6
6
|
const [globalPda] = PublicKey.findProgramAddressSync(
|
|
7
7
|
[Buffer.from("global")],
|
|
8
|
-
programId
|
|
8
|
+
programId,
|
|
9
9
|
);
|
|
10
10
|
return globalPda;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function bondingCurvePda(
|
|
14
14
|
programId: PublicKey,
|
|
15
|
-
mint: PublicKeyInitData
|
|
15
|
+
mint: PublicKeyInitData,
|
|
16
16
|
): PublicKey {
|
|
17
17
|
const [bondingCurvePda] = PublicKey.findProgramAddressSync(
|
|
18
18
|
[Buffer.from("bonding-curve"), new PublicKey(mint).toBuffer()],
|
|
19
|
-
programId
|
|
19
|
+
programId,
|
|
20
20
|
);
|
|
21
21
|
return bondingCurvePda;
|
|
22
22
|
}
|
|
@@ -24,18 +24,18 @@ export function bondingCurvePda(
|
|
|
24
24
|
export function creatorVaultPda(programId: PublicKey, creator: PublicKey) {
|
|
25
25
|
const [creatorVault] = PublicKey.findProgramAddressSync(
|
|
26
26
|
[Buffer.from("creator-vault"), creator.toBuffer()],
|
|
27
|
-
programId
|
|
27
|
+
programId,
|
|
28
28
|
);
|
|
29
29
|
return creatorVault;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function pumpPoolAuthorityPda(
|
|
33
33
|
mint: PublicKey,
|
|
34
|
-
pumpProgramId: PublicKey
|
|
34
|
+
pumpProgramId: PublicKey,
|
|
35
35
|
): [PublicKey, number] {
|
|
36
36
|
return PublicKey.findProgramAddressSync(
|
|
37
37
|
[Buffer.from("pool-authority"), mint.toBuffer()],
|
|
38
|
-
pumpProgramId
|
|
38
|
+
pumpProgramId,
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ export const CANONICAL_POOL_INDEX = 0;
|
|
|
44
44
|
export function canonicalPumpPoolPda(
|
|
45
45
|
pumpProgramId: PublicKey,
|
|
46
46
|
pumpAmmProgramId: PublicKey,
|
|
47
|
-
mint: PublicKey
|
|
47
|
+
mint: PublicKey,
|
|
48
48
|
): [PublicKey, number] {
|
|
49
49
|
const [pumpPoolAuthority] = pumpPoolAuthorityPda(mint, pumpProgramId);
|
|
50
50
|
|
|
@@ -53,6 +53,6 @@ export function canonicalPumpPoolPda(
|
|
|
53
53
|
pumpPoolAuthority,
|
|
54
54
|
mint,
|
|
55
55
|
NATIVE_MINT,
|
|
56
|
-
pumpAmmProgramId
|
|
56
|
+
pumpAmmProgramId,
|
|
57
57
|
);
|
|
58
58
|
}
|