@pump-fun/pump-sdk 1.22.1 → 1.24.0
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 +341 -9
- package/dist/index.d.mts +653 -98
- package/dist/index.d.ts +653 -98
- package/dist/index.js +341 -9
- package/package.json +1 -1
- package/src/idl/pump.json +277 -0
- package/src/idl/pump.ts +277 -0
- package/src/sdk.ts +115 -46
package/dist/index.js
CHANGED
|
@@ -5399,6 +5399,226 @@ var pump_default = {
|
|
|
5399
5399
|
}
|
|
5400
5400
|
]
|
|
5401
5401
|
},
|
|
5402
|
+
{
|
|
5403
|
+
name: "set_mayhem_virtual_params",
|
|
5404
|
+
discriminator: [
|
|
5405
|
+
61,
|
|
5406
|
+
169,
|
|
5407
|
+
188,
|
|
5408
|
+
191,
|
|
5409
|
+
153,
|
|
5410
|
+
149,
|
|
5411
|
+
42,
|
|
5412
|
+
97
|
|
5413
|
+
],
|
|
5414
|
+
accounts: [
|
|
5415
|
+
{
|
|
5416
|
+
name: "sol_vault_authority",
|
|
5417
|
+
writable: true,
|
|
5418
|
+
signer: true,
|
|
5419
|
+
pda: {
|
|
5420
|
+
seeds: [
|
|
5421
|
+
{
|
|
5422
|
+
kind: "const",
|
|
5423
|
+
value: [
|
|
5424
|
+
115,
|
|
5425
|
+
111,
|
|
5426
|
+
108,
|
|
5427
|
+
45,
|
|
5428
|
+
118,
|
|
5429
|
+
97,
|
|
5430
|
+
117,
|
|
5431
|
+
108,
|
|
5432
|
+
116
|
|
5433
|
+
]
|
|
5434
|
+
}
|
|
5435
|
+
],
|
|
5436
|
+
program: {
|
|
5437
|
+
kind: "const",
|
|
5438
|
+
value: [
|
|
5439
|
+
5,
|
|
5440
|
+
42,
|
|
5441
|
+
229,
|
|
5442
|
+
215,
|
|
5443
|
+
167,
|
|
5444
|
+
218,
|
|
5445
|
+
167,
|
|
5446
|
+
36,
|
|
5447
|
+
166,
|
|
5448
|
+
234,
|
|
5449
|
+
176,
|
|
5450
|
+
167,
|
|
5451
|
+
41,
|
|
5452
|
+
84,
|
|
5453
|
+
145,
|
|
5454
|
+
133,
|
|
5455
|
+
90,
|
|
5456
|
+
212,
|
|
5457
|
+
160,
|
|
5458
|
+
103,
|
|
5459
|
+
22,
|
|
5460
|
+
96,
|
|
5461
|
+
103,
|
|
5462
|
+
76,
|
|
5463
|
+
78,
|
|
5464
|
+
3,
|
|
5465
|
+
69,
|
|
5466
|
+
89,
|
|
5467
|
+
128,
|
|
5468
|
+
61,
|
|
5469
|
+
101,
|
|
5470
|
+
163
|
|
5471
|
+
]
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
},
|
|
5475
|
+
{
|
|
5476
|
+
name: "mayhem_token_vault",
|
|
5477
|
+
writable: true,
|
|
5478
|
+
pda: {
|
|
5479
|
+
seeds: [
|
|
5480
|
+
{
|
|
5481
|
+
kind: "account",
|
|
5482
|
+
path: "sol_vault_authority"
|
|
5483
|
+
},
|
|
5484
|
+
{
|
|
5485
|
+
kind: "account",
|
|
5486
|
+
path: "token_program"
|
|
5487
|
+
},
|
|
5488
|
+
{
|
|
5489
|
+
kind: "account",
|
|
5490
|
+
path: "mint"
|
|
5491
|
+
}
|
|
5492
|
+
],
|
|
5493
|
+
program: {
|
|
5494
|
+
kind: "const",
|
|
5495
|
+
value: [
|
|
5496
|
+
140,
|
|
5497
|
+
151,
|
|
5498
|
+
37,
|
|
5499
|
+
143,
|
|
5500
|
+
78,
|
|
5501
|
+
36,
|
|
5502
|
+
137,
|
|
5503
|
+
241,
|
|
5504
|
+
187,
|
|
5505
|
+
61,
|
|
5506
|
+
16,
|
|
5507
|
+
41,
|
|
5508
|
+
20,
|
|
5509
|
+
142,
|
|
5510
|
+
13,
|
|
5511
|
+
131,
|
|
5512
|
+
11,
|
|
5513
|
+
90,
|
|
5514
|
+
19,
|
|
5515
|
+
153,
|
|
5516
|
+
218,
|
|
5517
|
+
255,
|
|
5518
|
+
16,
|
|
5519
|
+
132,
|
|
5520
|
+
4,
|
|
5521
|
+
142,
|
|
5522
|
+
123,
|
|
5523
|
+
216,
|
|
5524
|
+
219,
|
|
5525
|
+
233,
|
|
5526
|
+
248,
|
|
5527
|
+
89
|
|
5528
|
+
]
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
},
|
|
5532
|
+
{
|
|
5533
|
+
name: "mint"
|
|
5534
|
+
},
|
|
5535
|
+
{
|
|
5536
|
+
name: "global",
|
|
5537
|
+
pda: {
|
|
5538
|
+
seeds: [
|
|
5539
|
+
{
|
|
5540
|
+
kind: "const",
|
|
5541
|
+
value: [
|
|
5542
|
+
103,
|
|
5543
|
+
108,
|
|
5544
|
+
111,
|
|
5545
|
+
98,
|
|
5546
|
+
97,
|
|
5547
|
+
108
|
|
5548
|
+
]
|
|
5549
|
+
}
|
|
5550
|
+
]
|
|
5551
|
+
}
|
|
5552
|
+
},
|
|
5553
|
+
{
|
|
5554
|
+
name: "bonding_curve",
|
|
5555
|
+
writable: true,
|
|
5556
|
+
pda: {
|
|
5557
|
+
seeds: [
|
|
5558
|
+
{
|
|
5559
|
+
kind: "const",
|
|
5560
|
+
value: [
|
|
5561
|
+
98,
|
|
5562
|
+
111,
|
|
5563
|
+
110,
|
|
5564
|
+
100,
|
|
5565
|
+
105,
|
|
5566
|
+
110,
|
|
5567
|
+
103,
|
|
5568
|
+
45,
|
|
5569
|
+
99,
|
|
5570
|
+
117,
|
|
5571
|
+
114,
|
|
5572
|
+
118,
|
|
5573
|
+
101
|
|
5574
|
+
]
|
|
5575
|
+
},
|
|
5576
|
+
{
|
|
5577
|
+
kind: "account",
|
|
5578
|
+
path: "mint"
|
|
5579
|
+
}
|
|
5580
|
+
]
|
|
5581
|
+
}
|
|
5582
|
+
},
|
|
5583
|
+
{
|
|
5584
|
+
name: "token_program",
|
|
5585
|
+
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
5586
|
+
},
|
|
5587
|
+
{
|
|
5588
|
+
name: "event_authority",
|
|
5589
|
+
pda: {
|
|
5590
|
+
seeds: [
|
|
5591
|
+
{
|
|
5592
|
+
kind: "const",
|
|
5593
|
+
value: [
|
|
5594
|
+
95,
|
|
5595
|
+
95,
|
|
5596
|
+
101,
|
|
5597
|
+
118,
|
|
5598
|
+
101,
|
|
5599
|
+
110,
|
|
5600
|
+
116,
|
|
5601
|
+
95,
|
|
5602
|
+
97,
|
|
5603
|
+
117,
|
|
5604
|
+
116,
|
|
5605
|
+
104,
|
|
5606
|
+
111,
|
|
5607
|
+
114,
|
|
5608
|
+
105,
|
|
5609
|
+
116,
|
|
5610
|
+
121
|
|
5611
|
+
]
|
|
5612
|
+
}
|
|
5613
|
+
]
|
|
5614
|
+
}
|
|
5615
|
+
},
|
|
5616
|
+
{
|
|
5617
|
+
name: "program"
|
|
5618
|
+
}
|
|
5619
|
+
],
|
|
5620
|
+
args: []
|
|
5621
|
+
},
|
|
5402
5622
|
{
|
|
5403
5623
|
name: "set_metaplex_creator",
|
|
5404
5624
|
docs: [
|
|
@@ -6450,6 +6670,19 @@ var pump_default = {
|
|
|
6450
6670
|
207,
|
|
6451
6671
|
247
|
|
6452
6672
|
]
|
|
6673
|
+
},
|
|
6674
|
+
{
|
|
6675
|
+
name: "UpdateMayhemVirtualParamsEvent",
|
|
6676
|
+
discriminator: [
|
|
6677
|
+
117,
|
|
6678
|
+
123,
|
|
6679
|
+
228,
|
|
6680
|
+
182,
|
|
6681
|
+
161,
|
|
6682
|
+
168,
|
|
6683
|
+
220,
|
|
6684
|
+
214
|
|
6685
|
+
]
|
|
6453
6686
|
}
|
|
6454
6687
|
],
|
|
6455
6688
|
errors: [
|
|
@@ -7559,6 +7792,10 @@ var pump_default = {
|
|
|
7559
7792
|
{
|
|
7560
7793
|
name: "ix_name",
|
|
7561
7794
|
type: "string"
|
|
7795
|
+
},
|
|
7796
|
+
{
|
|
7797
|
+
name: "mayhem_mode",
|
|
7798
|
+
type: "bool"
|
|
7562
7799
|
}
|
|
7563
7800
|
]
|
|
7564
7801
|
}
|
|
@@ -7587,6 +7824,46 @@ var pump_default = {
|
|
|
7587
7824
|
]
|
|
7588
7825
|
}
|
|
7589
7826
|
},
|
|
7827
|
+
{
|
|
7828
|
+
name: "UpdateMayhemVirtualParamsEvent",
|
|
7829
|
+
type: {
|
|
7830
|
+
kind: "struct",
|
|
7831
|
+
fields: [
|
|
7832
|
+
{
|
|
7833
|
+
name: "timestamp",
|
|
7834
|
+
type: "i64"
|
|
7835
|
+
},
|
|
7836
|
+
{
|
|
7837
|
+
name: "mint",
|
|
7838
|
+
type: "pubkey"
|
|
7839
|
+
},
|
|
7840
|
+
{
|
|
7841
|
+
name: "virtual_token_reserves",
|
|
7842
|
+
type: "u64"
|
|
7843
|
+
},
|
|
7844
|
+
{
|
|
7845
|
+
name: "virtual_sol_reserves",
|
|
7846
|
+
type: "u64"
|
|
7847
|
+
},
|
|
7848
|
+
{
|
|
7849
|
+
name: "new_virtual_token_reserves",
|
|
7850
|
+
type: "u64"
|
|
7851
|
+
},
|
|
7852
|
+
{
|
|
7853
|
+
name: "new_virtual_sol_reserves",
|
|
7854
|
+
type: "u64"
|
|
7855
|
+
},
|
|
7856
|
+
{
|
|
7857
|
+
name: "real_token_reserves",
|
|
7858
|
+
type: "u64"
|
|
7859
|
+
},
|
|
7860
|
+
{
|
|
7861
|
+
name: "real_sol_reserves",
|
|
7862
|
+
type: "u64"
|
|
7863
|
+
}
|
|
7864
|
+
]
|
|
7865
|
+
}
|
|
7866
|
+
},
|
|
7590
7867
|
{
|
|
7591
7868
|
name: "UserVolumeAccumulator",
|
|
7592
7869
|
type: {
|
|
@@ -8262,6 +8539,15 @@ var PumpSdk = class {
|
|
|
8262
8539
|
}
|
|
8263
8540
|
decodeBondingCurveNullable(accountInfo) {
|
|
8264
8541
|
try {
|
|
8542
|
+
let data = accountInfo.data;
|
|
8543
|
+
if (data.length < 82) {
|
|
8544
|
+
const padded = Buffer.alloc(82);
|
|
8545
|
+
data.copy(padded);
|
|
8546
|
+
accountInfo = {
|
|
8547
|
+
...accountInfo,
|
|
8548
|
+
data: padded
|
|
8549
|
+
};
|
|
8550
|
+
}
|
|
8265
8551
|
return this.decodeBondingCurve(accountInfo);
|
|
8266
8552
|
} catch (e) {
|
|
8267
8553
|
console.warn("Failed to decode bonding curve", e);
|
|
@@ -8346,7 +8632,12 @@ var PumpSdk = class {
|
|
|
8346
8632
|
})
|
|
8347
8633
|
);
|
|
8348
8634
|
}
|
|
8349
|
-
const associatedUser = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8635
|
+
const associatedUser = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8636
|
+
mint,
|
|
8637
|
+
user,
|
|
8638
|
+
true,
|
|
8639
|
+
tokenProgram
|
|
8640
|
+
);
|
|
8350
8641
|
if (!associatedUserAccountInfo) {
|
|
8351
8642
|
instructions.push(
|
|
8352
8643
|
(0, import_spl_token2.createAssociatedTokenAccountIdempotentInstruction)(
|
|
@@ -8386,9 +8677,22 @@ var PumpSdk = class {
|
|
|
8386
8677
|
solAmount,
|
|
8387
8678
|
mayhemMode
|
|
8388
8679
|
}) {
|
|
8389
|
-
const associatedUser = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8680
|
+
const associatedUser = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8681
|
+
mint,
|
|
8682
|
+
user,
|
|
8683
|
+
true,
|
|
8684
|
+
import_spl_token2.TOKEN_2022_PROGRAM_ID
|
|
8685
|
+
);
|
|
8390
8686
|
return [
|
|
8391
|
-
await this.createV2Instruction({
|
|
8687
|
+
await this.createV2Instruction({
|
|
8688
|
+
mint,
|
|
8689
|
+
name,
|
|
8690
|
+
symbol,
|
|
8691
|
+
uri,
|
|
8692
|
+
creator,
|
|
8693
|
+
user,
|
|
8694
|
+
mayhemMode
|
|
8695
|
+
}),
|
|
8392
8696
|
await this.extendAccountInstruction({
|
|
8393
8697
|
account: bondingCurvePda(mint),
|
|
8394
8698
|
user
|
|
@@ -8532,11 +8836,26 @@ var PumpSdk = class {
|
|
|
8532
8836
|
tokenProgram = import_spl_token2.TOKEN_PROGRAM_ID
|
|
8533
8837
|
}) {
|
|
8534
8838
|
const bondingCurve = bondingCurvePda(mint);
|
|
8535
|
-
const associatedBondingCurve = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8839
|
+
const associatedBondingCurve = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8840
|
+
mint,
|
|
8841
|
+
bondingCurve,
|
|
8842
|
+
true,
|
|
8843
|
+
tokenProgram
|
|
8844
|
+
);
|
|
8536
8845
|
const poolAuthority = pumpPoolAuthorityPda(mint);
|
|
8537
|
-
const poolAuthorityMintAccount = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8846
|
+
const poolAuthorityMintAccount = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8847
|
+
mint,
|
|
8848
|
+
poolAuthority,
|
|
8849
|
+
true,
|
|
8850
|
+
tokenProgram
|
|
8851
|
+
);
|
|
8538
8852
|
const pool = canonicalPumpPoolPda(mint);
|
|
8539
|
-
const poolBaseTokenAccount = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8853
|
+
const poolBaseTokenAccount = (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8854
|
+
mint,
|
|
8855
|
+
pool,
|
|
8856
|
+
true,
|
|
8857
|
+
tokenProgram
|
|
8858
|
+
);
|
|
8540
8859
|
return this.offlinePumpProgram.methods.migrate().accountsPartial({
|
|
8541
8860
|
mint,
|
|
8542
8861
|
user,
|
|
@@ -8585,7 +8904,12 @@ var PumpSdk = class {
|
|
|
8585
8904
|
}) {
|
|
8586
8905
|
return await this.getBuyInstructionInternal({
|
|
8587
8906
|
user,
|
|
8588
|
-
associatedUser: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8907
|
+
associatedUser: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8908
|
+
mint,
|
|
8909
|
+
user,
|
|
8910
|
+
true,
|
|
8911
|
+
tokenProgram
|
|
8912
|
+
),
|
|
8589
8913
|
mint,
|
|
8590
8914
|
creator,
|
|
8591
8915
|
feeRecipient,
|
|
@@ -8643,7 +8967,12 @@ var PumpSdk = class {
|
|
|
8643
8967
|
return await this.offlinePumpProgram.methods.sell(amount, solAmount).accountsPartial({
|
|
8644
8968
|
feeRecipient,
|
|
8645
8969
|
mint,
|
|
8646
|
-
associatedUser: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8970
|
+
associatedUser: (0, import_spl_token2.getAssociatedTokenAddressSync)(
|
|
8971
|
+
mint,
|
|
8972
|
+
user,
|
|
8973
|
+
true,
|
|
8974
|
+
tokenProgram
|
|
8975
|
+
),
|
|
8647
8976
|
user,
|
|
8648
8977
|
creatorVault: creatorVaultPda(creator),
|
|
8649
8978
|
tokenProgram
|
|
@@ -8653,7 +8982,10 @@ var PumpSdk = class {
|
|
|
8653
8982
|
var PUMP_SDK = new PumpSdk();
|
|
8654
8983
|
function getFeeRecipient(global, mayhemMode) {
|
|
8655
8984
|
if (mayhemMode) {
|
|
8656
|
-
const feeRecipients = [
|
|
8985
|
+
const feeRecipients = [
|
|
8986
|
+
global.reservedFeeRecipient,
|
|
8987
|
+
...global.reservedFeeRecipients
|
|
8988
|
+
];
|
|
8657
8989
|
return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
|
|
8658
8990
|
} else {
|
|
8659
8991
|
const feeRecipients = [global.feeRecipient, ...global.feeRecipients];
|