@pump-fun/pump-sdk 1.4.2 → 1.4.3
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 +18 -14
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -14
- package/package.json +1 -1
- package/src/sdk.ts +21 -14
package/dist/esm/index.js
CHANGED
|
@@ -2777,38 +2777,42 @@ var PumpSdk = class {
|
|
|
2777
2777
|
constructor(connection, pumpProgramId = PUMP_PROGRAM_ID, pumpAmmProgramId = PUMP_AMM_PROGRAM_ID) {
|
|
2778
2778
|
this.connection = connection;
|
|
2779
2779
|
this.pumpProgram = getPumpProgram(connection, pumpProgramId);
|
|
2780
|
+
this.offlinePumpProgram = getPumpProgram(
|
|
2781
|
+
null,
|
|
2782
|
+
pumpProgramId
|
|
2783
|
+
);
|
|
2780
2784
|
this.pumpAmmSdk = new PumpAmmSdk(connection, pumpAmmProgramId.toBase58());
|
|
2781
2785
|
}
|
|
2782
2786
|
programId() {
|
|
2783
|
-
return this.
|
|
2787
|
+
return this.offlinePumpProgram.programId;
|
|
2784
2788
|
}
|
|
2785
2789
|
globalPda() {
|
|
2786
|
-
return globalPda(this.
|
|
2790
|
+
return globalPda(this.offlinePumpProgram.programId);
|
|
2787
2791
|
}
|
|
2788
2792
|
bondingCurvePda(mint) {
|
|
2789
|
-
return bondingCurvePda(this.
|
|
2793
|
+
return bondingCurvePda(this.offlinePumpProgram.programId, mint);
|
|
2790
2794
|
}
|
|
2791
2795
|
creatorVaultPda(creator) {
|
|
2792
|
-
return creatorVaultPda(this.
|
|
2796
|
+
return creatorVaultPda(this.offlinePumpProgram.programId, creator);
|
|
2793
2797
|
}
|
|
2794
2798
|
pumpPoolAuthorityPda(mint) {
|
|
2795
|
-
return pumpPoolAuthorityPda(mint, this.
|
|
2799
|
+
return pumpPoolAuthorityPda(mint, this.offlinePumpProgram.programId);
|
|
2796
2800
|
}
|
|
2797
2801
|
canonicalPumpPoolPda(mint) {
|
|
2798
2802
|
return canonicalPumpPoolPda(
|
|
2799
|
-
this.
|
|
2803
|
+
this.offlinePumpProgram.programId,
|
|
2800
2804
|
this.pumpAmmSdk.programId(),
|
|
2801
2805
|
mint
|
|
2802
2806
|
);
|
|
2803
2807
|
}
|
|
2804
2808
|
decodeGlobal(accountInfo) {
|
|
2805
|
-
return this.
|
|
2809
|
+
return this.offlinePumpProgram.coder.accounts.decode(
|
|
2806
2810
|
"global",
|
|
2807
2811
|
accountInfo.data
|
|
2808
2812
|
);
|
|
2809
2813
|
}
|
|
2810
2814
|
decodeBondingCurve(accountInfo) {
|
|
2811
|
-
return this.
|
|
2815
|
+
return this.offlinePumpProgram.coder.accounts.decode(
|
|
2812
2816
|
"bondingCurve",
|
|
2813
2817
|
accountInfo.data
|
|
2814
2818
|
);
|
|
@@ -2860,7 +2864,7 @@ var PumpSdk = class {
|
|
|
2860
2864
|
creator,
|
|
2861
2865
|
user
|
|
2862
2866
|
}) {
|
|
2863
|
-
return await this.
|
|
2867
|
+
return await this.offlinePumpProgram.methods.create(name, symbol, uri, creator).accountsPartial({
|
|
2864
2868
|
mint,
|
|
2865
2869
|
user
|
|
2866
2870
|
}).instruction();
|
|
@@ -2956,7 +2960,7 @@ var PumpSdk = class {
|
|
|
2956
2960
|
solAmount,
|
|
2957
2961
|
slippage
|
|
2958
2962
|
}) {
|
|
2959
|
-
return await this.
|
|
2963
|
+
return await this.offlinePumpProgram.methods.buy(
|
|
2960
2964
|
amount,
|
|
2961
2965
|
solAmount.add(
|
|
2962
2966
|
solAmount.mul(new BN2(Math.floor(slippage * 10))).div(new BN2(1e3))
|
|
@@ -2989,7 +2993,7 @@ var PumpSdk = class {
|
|
|
2989
2993
|
);
|
|
2990
2994
|
}
|
|
2991
2995
|
instructions.push(
|
|
2992
|
-
await this.
|
|
2996
|
+
await this.offlinePumpProgram.methods.sell(
|
|
2993
2997
|
amount,
|
|
2994
2998
|
solAmount.sub(
|
|
2995
2999
|
solAmount.mul(new BN2(Math.floor(slippage * 10))).div(new BN2(1e3))
|
|
@@ -3008,7 +3012,7 @@ var PumpSdk = class {
|
|
|
3008
3012
|
account,
|
|
3009
3013
|
user
|
|
3010
3014
|
}) {
|
|
3011
|
-
return this.
|
|
3015
|
+
return this.offlinePumpProgram.methods.extendAccount().accountsPartial({
|
|
3012
3016
|
account,
|
|
3013
3017
|
user
|
|
3014
3018
|
}).instruction();
|
|
@@ -3018,7 +3022,7 @@ var PumpSdk = class {
|
|
|
3018
3022
|
mint,
|
|
3019
3023
|
user
|
|
3020
3024
|
}) {
|
|
3021
|
-
return this.
|
|
3025
|
+
return this.offlinePumpProgram.methods.migrate().accountsPartial({
|
|
3022
3026
|
mint,
|
|
3023
3027
|
user,
|
|
3024
3028
|
pumpAmm: this.pumpAmmSdk.programId(),
|
|
@@ -3045,7 +3049,7 @@ var PumpSdk = class {
|
|
|
3045
3049
|
coinCreatorTokenAccount
|
|
3046
3050
|
]);
|
|
3047
3051
|
return [
|
|
3048
|
-
await this.
|
|
3052
|
+
await this.offlinePumpProgram.methods.collectCreatorFee().accountsPartial({
|
|
3049
3053
|
creator: coinCreator
|
|
3050
3054
|
}).instruction(),
|
|
3051
3055
|
...await this.pumpAmmSdk.collectCoinCreatorFee({
|
package/dist/index.d.mts
CHANGED
|
@@ -5655,6 +5655,7 @@ declare const BONDING_CURVE_NEW_SIZE = 150;
|
|
|
5655
5655
|
declare class PumpSdk {
|
|
5656
5656
|
private readonly connection;
|
|
5657
5657
|
private readonly pumpProgram;
|
|
5658
|
+
private readonly offlinePumpProgram;
|
|
5658
5659
|
private readonly pumpAmmSdk;
|
|
5659
5660
|
constructor(connection: Connection, pumpProgramId?: PublicKey, pumpAmmProgramId?: PublicKey);
|
|
5660
5661
|
programId(): PublicKey;
|
package/dist/index.d.ts
CHANGED
|
@@ -5655,6 +5655,7 @@ declare const BONDING_CURVE_NEW_SIZE = 150;
|
|
|
5655
5655
|
declare class PumpSdk {
|
|
5656
5656
|
private readonly connection;
|
|
5657
5657
|
private readonly pumpProgram;
|
|
5658
|
+
private readonly offlinePumpProgram;
|
|
5658
5659
|
private readonly pumpAmmSdk;
|
|
5659
5660
|
constructor(connection: Connection, pumpProgramId?: PublicKey, pumpAmmProgramId?: PublicKey);
|
|
5660
5661
|
programId(): PublicKey;
|
package/dist/index.js
CHANGED
|
@@ -2821,38 +2821,42 @@ var PumpSdk = class {
|
|
|
2821
2821
|
constructor(connection, pumpProgramId = PUMP_PROGRAM_ID, pumpAmmProgramId = PUMP_AMM_PROGRAM_ID) {
|
|
2822
2822
|
this.connection = connection;
|
|
2823
2823
|
this.pumpProgram = getPumpProgram(connection, pumpProgramId);
|
|
2824
|
+
this.offlinePumpProgram = getPumpProgram(
|
|
2825
|
+
null,
|
|
2826
|
+
pumpProgramId
|
|
2827
|
+
);
|
|
2824
2828
|
this.pumpAmmSdk = new import_pump_swap_sdk2.PumpAmmSdk(connection, pumpAmmProgramId.toBase58());
|
|
2825
2829
|
}
|
|
2826
2830
|
programId() {
|
|
2827
|
-
return this.
|
|
2831
|
+
return this.offlinePumpProgram.programId;
|
|
2828
2832
|
}
|
|
2829
2833
|
globalPda() {
|
|
2830
|
-
return globalPda(this.
|
|
2834
|
+
return globalPda(this.offlinePumpProgram.programId);
|
|
2831
2835
|
}
|
|
2832
2836
|
bondingCurvePda(mint) {
|
|
2833
|
-
return bondingCurvePda(this.
|
|
2837
|
+
return bondingCurvePda(this.offlinePumpProgram.programId, mint);
|
|
2834
2838
|
}
|
|
2835
2839
|
creatorVaultPda(creator) {
|
|
2836
|
-
return creatorVaultPda(this.
|
|
2840
|
+
return creatorVaultPda(this.offlinePumpProgram.programId, creator);
|
|
2837
2841
|
}
|
|
2838
2842
|
pumpPoolAuthorityPda(mint) {
|
|
2839
|
-
return pumpPoolAuthorityPda(mint, this.
|
|
2843
|
+
return pumpPoolAuthorityPda(mint, this.offlinePumpProgram.programId);
|
|
2840
2844
|
}
|
|
2841
2845
|
canonicalPumpPoolPda(mint) {
|
|
2842
2846
|
return canonicalPumpPoolPda(
|
|
2843
|
-
this.
|
|
2847
|
+
this.offlinePumpProgram.programId,
|
|
2844
2848
|
this.pumpAmmSdk.programId(),
|
|
2845
2849
|
mint
|
|
2846
2850
|
);
|
|
2847
2851
|
}
|
|
2848
2852
|
decodeGlobal(accountInfo) {
|
|
2849
|
-
return this.
|
|
2853
|
+
return this.offlinePumpProgram.coder.accounts.decode(
|
|
2850
2854
|
"global",
|
|
2851
2855
|
accountInfo.data
|
|
2852
2856
|
);
|
|
2853
2857
|
}
|
|
2854
2858
|
decodeBondingCurve(accountInfo) {
|
|
2855
|
-
return this.
|
|
2859
|
+
return this.offlinePumpProgram.coder.accounts.decode(
|
|
2856
2860
|
"bondingCurve",
|
|
2857
2861
|
accountInfo.data
|
|
2858
2862
|
);
|
|
@@ -2904,7 +2908,7 @@ var PumpSdk = class {
|
|
|
2904
2908
|
creator,
|
|
2905
2909
|
user
|
|
2906
2910
|
}) {
|
|
2907
|
-
return await this.
|
|
2911
|
+
return await this.offlinePumpProgram.methods.create(name, symbol, uri, creator).accountsPartial({
|
|
2908
2912
|
mint,
|
|
2909
2913
|
user
|
|
2910
2914
|
}).instruction();
|
|
@@ -3000,7 +3004,7 @@ var PumpSdk = class {
|
|
|
3000
3004
|
solAmount,
|
|
3001
3005
|
slippage
|
|
3002
3006
|
}) {
|
|
3003
|
-
return await this.
|
|
3007
|
+
return await this.offlinePumpProgram.methods.buy(
|
|
3004
3008
|
amount,
|
|
3005
3009
|
solAmount.add(
|
|
3006
3010
|
solAmount.mul(new import_bn2.default(Math.floor(slippage * 10))).div(new import_bn2.default(1e3))
|
|
@@ -3033,7 +3037,7 @@ var PumpSdk = class {
|
|
|
3033
3037
|
);
|
|
3034
3038
|
}
|
|
3035
3039
|
instructions.push(
|
|
3036
|
-
await this.
|
|
3040
|
+
await this.offlinePumpProgram.methods.sell(
|
|
3037
3041
|
amount,
|
|
3038
3042
|
solAmount.sub(
|
|
3039
3043
|
solAmount.mul(new import_bn2.default(Math.floor(slippage * 10))).div(new import_bn2.default(1e3))
|
|
@@ -3052,7 +3056,7 @@ var PumpSdk = class {
|
|
|
3052
3056
|
account,
|
|
3053
3057
|
user
|
|
3054
3058
|
}) {
|
|
3055
|
-
return this.
|
|
3059
|
+
return this.offlinePumpProgram.methods.extendAccount().accountsPartial({
|
|
3056
3060
|
account,
|
|
3057
3061
|
user
|
|
3058
3062
|
}).instruction();
|
|
@@ -3062,7 +3066,7 @@ var PumpSdk = class {
|
|
|
3062
3066
|
mint,
|
|
3063
3067
|
user
|
|
3064
3068
|
}) {
|
|
3065
|
-
return this.
|
|
3069
|
+
return this.offlinePumpProgram.methods.migrate().accountsPartial({
|
|
3066
3070
|
mint,
|
|
3067
3071
|
user,
|
|
3068
3072
|
pumpAmm: this.pumpAmmSdk.programId(),
|
|
@@ -3089,7 +3093,7 @@ var PumpSdk = class {
|
|
|
3089
3093
|
coinCreatorTokenAccount
|
|
3090
3094
|
]);
|
|
3091
3095
|
return [
|
|
3092
|
-
await this.
|
|
3096
|
+
await this.offlinePumpProgram.methods.collectCreatorFee().accountsPartial({
|
|
3093
3097
|
creator: coinCreator
|
|
3094
3098
|
}).instruction(),
|
|
3095
3099
|
...await this.pumpAmmSdk.collectCoinCreatorFee({
|
package/package.json
CHANGED
package/src/sdk.ts
CHANGED
|
@@ -52,6 +52,7 @@ export const BONDING_CURVE_NEW_SIZE = 150;
|
|
|
52
52
|
export class PumpSdk {
|
|
53
53
|
private readonly connection: Connection;
|
|
54
54
|
private readonly pumpProgram: Program<Pump>;
|
|
55
|
+
private readonly offlinePumpProgram: Program<Pump>;
|
|
55
56
|
private readonly pumpAmmSdk: PumpAmmSdk;
|
|
56
57
|
|
|
57
58
|
constructor(
|
|
@@ -60,47 +61,53 @@ export class PumpSdk {
|
|
|
60
61
|
pumpAmmProgramId: PublicKey = PUMP_AMM_PROGRAM_ID,
|
|
61
62
|
) {
|
|
62
63
|
this.connection = connection;
|
|
64
|
+
|
|
63
65
|
this.pumpProgram = getPumpProgram(connection, pumpProgramId);
|
|
66
|
+
this.offlinePumpProgram = getPumpProgram(
|
|
67
|
+
null as any as Connection,
|
|
68
|
+
pumpProgramId,
|
|
69
|
+
);
|
|
70
|
+
|
|
64
71
|
this.pumpAmmSdk = new PumpAmmSdk(connection, pumpAmmProgramId.toBase58());
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
programId(): PublicKey {
|
|
68
|
-
return this.
|
|
75
|
+
return this.offlinePumpProgram.programId;
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
globalPda() {
|
|
72
|
-
return globalPda(this.
|
|
79
|
+
return globalPda(this.offlinePumpProgram.programId);
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
bondingCurvePda(mint: PublicKeyInitData): PublicKey {
|
|
76
|
-
return bondingCurvePda(this.
|
|
83
|
+
return bondingCurvePda(this.offlinePumpProgram.programId, mint);
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
creatorVaultPda(creator: PublicKey) {
|
|
80
|
-
return creatorVaultPda(this.
|
|
87
|
+
return creatorVaultPda(this.offlinePumpProgram.programId, creator);
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
pumpPoolAuthorityPda(mint: PublicKey): [PublicKey, number] {
|
|
84
|
-
return pumpPoolAuthorityPda(mint, this.
|
|
91
|
+
return pumpPoolAuthorityPda(mint, this.offlinePumpProgram.programId);
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
canonicalPumpPoolPda(mint: PublicKey): [PublicKey, number] {
|
|
88
95
|
return canonicalPumpPoolPda(
|
|
89
|
-
this.
|
|
96
|
+
this.offlinePumpProgram.programId,
|
|
90
97
|
this.pumpAmmSdk.programId(),
|
|
91
98
|
mint,
|
|
92
99
|
);
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
decodeGlobal(accountInfo: AccountInfo<Buffer>): Global {
|
|
96
|
-
return this.
|
|
103
|
+
return this.offlinePumpProgram.coder.accounts.decode<Global>(
|
|
97
104
|
"global",
|
|
98
105
|
accountInfo.data,
|
|
99
106
|
);
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
decodeBondingCurve(accountInfo: AccountInfo<Buffer>): BondingCurve {
|
|
103
|
-
return this.
|
|
110
|
+
return this.offlinePumpProgram.coder.accounts.decode<BondingCurve>(
|
|
104
111
|
"bondingCurve",
|
|
105
112
|
accountInfo.data,
|
|
106
113
|
);
|
|
@@ -171,7 +178,7 @@ export class PumpSdk {
|
|
|
171
178
|
creator: PublicKey;
|
|
172
179
|
user: PublicKey;
|
|
173
180
|
}): Promise<TransactionInstruction> {
|
|
174
|
-
return await this.
|
|
181
|
+
return await this.offlinePumpProgram.methods
|
|
175
182
|
.create(name, symbol, uri, creator)
|
|
176
183
|
.accountsPartial({
|
|
177
184
|
mint,
|
|
@@ -307,7 +314,7 @@ export class PumpSdk {
|
|
|
307
314
|
solAmount: BN;
|
|
308
315
|
slippage: number;
|
|
309
316
|
}) {
|
|
310
|
-
return await this.
|
|
317
|
+
return await this.offlinePumpProgram.methods
|
|
311
318
|
.buy(
|
|
312
319
|
amount,
|
|
313
320
|
solAmount.add(
|
|
@@ -355,7 +362,7 @@ export class PumpSdk {
|
|
|
355
362
|
}
|
|
356
363
|
|
|
357
364
|
instructions.push(
|
|
358
|
-
await this.
|
|
365
|
+
await this.offlinePumpProgram.methods
|
|
359
366
|
.sell(
|
|
360
367
|
amount,
|
|
361
368
|
solAmount.sub(
|
|
@@ -382,7 +389,7 @@ export class PumpSdk {
|
|
|
382
389
|
account: PublicKey;
|
|
383
390
|
user: PublicKey;
|
|
384
391
|
}): Promise<TransactionInstruction> {
|
|
385
|
-
return this.
|
|
392
|
+
return this.offlinePumpProgram.methods
|
|
386
393
|
.extendAccount()
|
|
387
394
|
.accountsPartial({
|
|
388
395
|
account,
|
|
@@ -400,7 +407,7 @@ export class PumpSdk {
|
|
|
400
407
|
mint: PublicKey;
|
|
401
408
|
user: PublicKey;
|
|
402
409
|
}): Promise<TransactionInstruction> {
|
|
403
|
-
return this.
|
|
410
|
+
return this.offlinePumpProgram.methods
|
|
404
411
|
.migrate()
|
|
405
412
|
.accountsPartial({
|
|
406
413
|
mint,
|
|
@@ -438,7 +445,7 @@ export class PumpSdk {
|
|
|
438
445
|
]);
|
|
439
446
|
|
|
440
447
|
return [
|
|
441
|
-
await this.
|
|
448
|
+
await this.offlinePumpProgram.methods
|
|
442
449
|
.collectCreatorFee()
|
|
443
450
|
.accountsPartial({
|
|
444
451
|
creator: coinCreator,
|