@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/esm/index.js
CHANGED
|
@@ -5359,6 +5359,226 @@ var pump_default = {
|
|
|
5359
5359
|
}
|
|
5360
5360
|
]
|
|
5361
5361
|
},
|
|
5362
|
+
{
|
|
5363
|
+
name: "set_mayhem_virtual_params",
|
|
5364
|
+
discriminator: [
|
|
5365
|
+
61,
|
|
5366
|
+
169,
|
|
5367
|
+
188,
|
|
5368
|
+
191,
|
|
5369
|
+
153,
|
|
5370
|
+
149,
|
|
5371
|
+
42,
|
|
5372
|
+
97
|
|
5373
|
+
],
|
|
5374
|
+
accounts: [
|
|
5375
|
+
{
|
|
5376
|
+
name: "sol_vault_authority",
|
|
5377
|
+
writable: true,
|
|
5378
|
+
signer: true,
|
|
5379
|
+
pda: {
|
|
5380
|
+
seeds: [
|
|
5381
|
+
{
|
|
5382
|
+
kind: "const",
|
|
5383
|
+
value: [
|
|
5384
|
+
115,
|
|
5385
|
+
111,
|
|
5386
|
+
108,
|
|
5387
|
+
45,
|
|
5388
|
+
118,
|
|
5389
|
+
97,
|
|
5390
|
+
117,
|
|
5391
|
+
108,
|
|
5392
|
+
116
|
|
5393
|
+
]
|
|
5394
|
+
}
|
|
5395
|
+
],
|
|
5396
|
+
program: {
|
|
5397
|
+
kind: "const",
|
|
5398
|
+
value: [
|
|
5399
|
+
5,
|
|
5400
|
+
42,
|
|
5401
|
+
229,
|
|
5402
|
+
215,
|
|
5403
|
+
167,
|
|
5404
|
+
218,
|
|
5405
|
+
167,
|
|
5406
|
+
36,
|
|
5407
|
+
166,
|
|
5408
|
+
234,
|
|
5409
|
+
176,
|
|
5410
|
+
167,
|
|
5411
|
+
41,
|
|
5412
|
+
84,
|
|
5413
|
+
145,
|
|
5414
|
+
133,
|
|
5415
|
+
90,
|
|
5416
|
+
212,
|
|
5417
|
+
160,
|
|
5418
|
+
103,
|
|
5419
|
+
22,
|
|
5420
|
+
96,
|
|
5421
|
+
103,
|
|
5422
|
+
76,
|
|
5423
|
+
78,
|
|
5424
|
+
3,
|
|
5425
|
+
69,
|
|
5426
|
+
89,
|
|
5427
|
+
128,
|
|
5428
|
+
61,
|
|
5429
|
+
101,
|
|
5430
|
+
163
|
|
5431
|
+
]
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
},
|
|
5435
|
+
{
|
|
5436
|
+
name: "mayhem_token_vault",
|
|
5437
|
+
writable: true,
|
|
5438
|
+
pda: {
|
|
5439
|
+
seeds: [
|
|
5440
|
+
{
|
|
5441
|
+
kind: "account",
|
|
5442
|
+
path: "sol_vault_authority"
|
|
5443
|
+
},
|
|
5444
|
+
{
|
|
5445
|
+
kind: "account",
|
|
5446
|
+
path: "token_program"
|
|
5447
|
+
},
|
|
5448
|
+
{
|
|
5449
|
+
kind: "account",
|
|
5450
|
+
path: "mint"
|
|
5451
|
+
}
|
|
5452
|
+
],
|
|
5453
|
+
program: {
|
|
5454
|
+
kind: "const",
|
|
5455
|
+
value: [
|
|
5456
|
+
140,
|
|
5457
|
+
151,
|
|
5458
|
+
37,
|
|
5459
|
+
143,
|
|
5460
|
+
78,
|
|
5461
|
+
36,
|
|
5462
|
+
137,
|
|
5463
|
+
241,
|
|
5464
|
+
187,
|
|
5465
|
+
61,
|
|
5466
|
+
16,
|
|
5467
|
+
41,
|
|
5468
|
+
20,
|
|
5469
|
+
142,
|
|
5470
|
+
13,
|
|
5471
|
+
131,
|
|
5472
|
+
11,
|
|
5473
|
+
90,
|
|
5474
|
+
19,
|
|
5475
|
+
153,
|
|
5476
|
+
218,
|
|
5477
|
+
255,
|
|
5478
|
+
16,
|
|
5479
|
+
132,
|
|
5480
|
+
4,
|
|
5481
|
+
142,
|
|
5482
|
+
123,
|
|
5483
|
+
216,
|
|
5484
|
+
219,
|
|
5485
|
+
233,
|
|
5486
|
+
248,
|
|
5487
|
+
89
|
|
5488
|
+
]
|
|
5489
|
+
}
|
|
5490
|
+
}
|
|
5491
|
+
},
|
|
5492
|
+
{
|
|
5493
|
+
name: "mint"
|
|
5494
|
+
},
|
|
5495
|
+
{
|
|
5496
|
+
name: "global",
|
|
5497
|
+
pda: {
|
|
5498
|
+
seeds: [
|
|
5499
|
+
{
|
|
5500
|
+
kind: "const",
|
|
5501
|
+
value: [
|
|
5502
|
+
103,
|
|
5503
|
+
108,
|
|
5504
|
+
111,
|
|
5505
|
+
98,
|
|
5506
|
+
97,
|
|
5507
|
+
108
|
|
5508
|
+
]
|
|
5509
|
+
}
|
|
5510
|
+
]
|
|
5511
|
+
}
|
|
5512
|
+
},
|
|
5513
|
+
{
|
|
5514
|
+
name: "bonding_curve",
|
|
5515
|
+
writable: true,
|
|
5516
|
+
pda: {
|
|
5517
|
+
seeds: [
|
|
5518
|
+
{
|
|
5519
|
+
kind: "const",
|
|
5520
|
+
value: [
|
|
5521
|
+
98,
|
|
5522
|
+
111,
|
|
5523
|
+
110,
|
|
5524
|
+
100,
|
|
5525
|
+
105,
|
|
5526
|
+
110,
|
|
5527
|
+
103,
|
|
5528
|
+
45,
|
|
5529
|
+
99,
|
|
5530
|
+
117,
|
|
5531
|
+
114,
|
|
5532
|
+
118,
|
|
5533
|
+
101
|
|
5534
|
+
]
|
|
5535
|
+
},
|
|
5536
|
+
{
|
|
5537
|
+
kind: "account",
|
|
5538
|
+
path: "mint"
|
|
5539
|
+
}
|
|
5540
|
+
]
|
|
5541
|
+
}
|
|
5542
|
+
},
|
|
5543
|
+
{
|
|
5544
|
+
name: "token_program",
|
|
5545
|
+
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
|
|
5546
|
+
},
|
|
5547
|
+
{
|
|
5548
|
+
name: "event_authority",
|
|
5549
|
+
pda: {
|
|
5550
|
+
seeds: [
|
|
5551
|
+
{
|
|
5552
|
+
kind: "const",
|
|
5553
|
+
value: [
|
|
5554
|
+
95,
|
|
5555
|
+
95,
|
|
5556
|
+
101,
|
|
5557
|
+
118,
|
|
5558
|
+
101,
|
|
5559
|
+
110,
|
|
5560
|
+
116,
|
|
5561
|
+
95,
|
|
5562
|
+
97,
|
|
5563
|
+
117,
|
|
5564
|
+
116,
|
|
5565
|
+
104,
|
|
5566
|
+
111,
|
|
5567
|
+
114,
|
|
5568
|
+
105,
|
|
5569
|
+
116,
|
|
5570
|
+
121
|
|
5571
|
+
]
|
|
5572
|
+
}
|
|
5573
|
+
]
|
|
5574
|
+
}
|
|
5575
|
+
},
|
|
5576
|
+
{
|
|
5577
|
+
name: "program"
|
|
5578
|
+
}
|
|
5579
|
+
],
|
|
5580
|
+
args: []
|
|
5581
|
+
},
|
|
5362
5582
|
{
|
|
5363
5583
|
name: "set_metaplex_creator",
|
|
5364
5584
|
docs: [
|
|
@@ -6410,6 +6630,19 @@ var pump_default = {
|
|
|
6410
6630
|
207,
|
|
6411
6631
|
247
|
|
6412
6632
|
]
|
|
6633
|
+
},
|
|
6634
|
+
{
|
|
6635
|
+
name: "UpdateMayhemVirtualParamsEvent",
|
|
6636
|
+
discriminator: [
|
|
6637
|
+
117,
|
|
6638
|
+
123,
|
|
6639
|
+
228,
|
|
6640
|
+
182,
|
|
6641
|
+
161,
|
|
6642
|
+
168,
|
|
6643
|
+
220,
|
|
6644
|
+
214
|
|
6645
|
+
]
|
|
6413
6646
|
}
|
|
6414
6647
|
],
|
|
6415
6648
|
errors: [
|
|
@@ -7519,6 +7752,10 @@ var pump_default = {
|
|
|
7519
7752
|
{
|
|
7520
7753
|
name: "ix_name",
|
|
7521
7754
|
type: "string"
|
|
7755
|
+
},
|
|
7756
|
+
{
|
|
7757
|
+
name: "mayhem_mode",
|
|
7758
|
+
type: "bool"
|
|
7522
7759
|
}
|
|
7523
7760
|
]
|
|
7524
7761
|
}
|
|
@@ -7547,6 +7784,46 @@ var pump_default = {
|
|
|
7547
7784
|
]
|
|
7548
7785
|
}
|
|
7549
7786
|
},
|
|
7787
|
+
{
|
|
7788
|
+
name: "UpdateMayhemVirtualParamsEvent",
|
|
7789
|
+
type: {
|
|
7790
|
+
kind: "struct",
|
|
7791
|
+
fields: [
|
|
7792
|
+
{
|
|
7793
|
+
name: "timestamp",
|
|
7794
|
+
type: "i64"
|
|
7795
|
+
},
|
|
7796
|
+
{
|
|
7797
|
+
name: "mint",
|
|
7798
|
+
type: "pubkey"
|
|
7799
|
+
},
|
|
7800
|
+
{
|
|
7801
|
+
name: "virtual_token_reserves",
|
|
7802
|
+
type: "u64"
|
|
7803
|
+
},
|
|
7804
|
+
{
|
|
7805
|
+
name: "virtual_sol_reserves",
|
|
7806
|
+
type: "u64"
|
|
7807
|
+
},
|
|
7808
|
+
{
|
|
7809
|
+
name: "new_virtual_token_reserves",
|
|
7810
|
+
type: "u64"
|
|
7811
|
+
},
|
|
7812
|
+
{
|
|
7813
|
+
name: "new_virtual_sol_reserves",
|
|
7814
|
+
type: "u64"
|
|
7815
|
+
},
|
|
7816
|
+
{
|
|
7817
|
+
name: "real_token_reserves",
|
|
7818
|
+
type: "u64"
|
|
7819
|
+
},
|
|
7820
|
+
{
|
|
7821
|
+
name: "real_sol_reserves",
|
|
7822
|
+
type: "u64"
|
|
7823
|
+
}
|
|
7824
|
+
]
|
|
7825
|
+
}
|
|
7826
|
+
},
|
|
7550
7827
|
{
|
|
7551
7828
|
name: "UserVolumeAccumulator",
|
|
7552
7829
|
type: {
|
|
@@ -8242,6 +8519,15 @@ var PumpSdk = class {
|
|
|
8242
8519
|
}
|
|
8243
8520
|
decodeBondingCurveNullable(accountInfo) {
|
|
8244
8521
|
try {
|
|
8522
|
+
let data = accountInfo.data;
|
|
8523
|
+
if (data.length < 82) {
|
|
8524
|
+
const padded = Buffer.alloc(82);
|
|
8525
|
+
data.copy(padded);
|
|
8526
|
+
accountInfo = {
|
|
8527
|
+
...accountInfo,
|
|
8528
|
+
data: padded
|
|
8529
|
+
};
|
|
8530
|
+
}
|
|
8245
8531
|
return this.decodeBondingCurve(accountInfo);
|
|
8246
8532
|
} catch (e) {
|
|
8247
8533
|
console.warn("Failed to decode bonding curve", e);
|
|
@@ -8326,7 +8612,12 @@ var PumpSdk = class {
|
|
|
8326
8612
|
})
|
|
8327
8613
|
);
|
|
8328
8614
|
}
|
|
8329
|
-
const associatedUser = getAssociatedTokenAddressSync2(
|
|
8615
|
+
const associatedUser = getAssociatedTokenAddressSync2(
|
|
8616
|
+
mint,
|
|
8617
|
+
user,
|
|
8618
|
+
true,
|
|
8619
|
+
tokenProgram
|
|
8620
|
+
);
|
|
8330
8621
|
if (!associatedUserAccountInfo) {
|
|
8331
8622
|
instructions.push(
|
|
8332
8623
|
createAssociatedTokenAccountIdempotentInstruction(
|
|
@@ -8366,9 +8657,22 @@ var PumpSdk = class {
|
|
|
8366
8657
|
solAmount,
|
|
8367
8658
|
mayhemMode
|
|
8368
8659
|
}) {
|
|
8369
|
-
const associatedUser = getAssociatedTokenAddressSync2(
|
|
8660
|
+
const associatedUser = getAssociatedTokenAddressSync2(
|
|
8661
|
+
mint,
|
|
8662
|
+
user,
|
|
8663
|
+
true,
|
|
8664
|
+
TOKEN_2022_PROGRAM_ID2
|
|
8665
|
+
);
|
|
8370
8666
|
return [
|
|
8371
|
-
await this.createV2Instruction({
|
|
8667
|
+
await this.createV2Instruction({
|
|
8668
|
+
mint,
|
|
8669
|
+
name,
|
|
8670
|
+
symbol,
|
|
8671
|
+
uri,
|
|
8672
|
+
creator,
|
|
8673
|
+
user,
|
|
8674
|
+
mayhemMode
|
|
8675
|
+
}),
|
|
8372
8676
|
await this.extendAccountInstruction({
|
|
8373
8677
|
account: bondingCurvePda(mint),
|
|
8374
8678
|
user
|
|
@@ -8512,11 +8816,26 @@ var PumpSdk = class {
|
|
|
8512
8816
|
tokenProgram = TOKEN_PROGRAM_ID2
|
|
8513
8817
|
}) {
|
|
8514
8818
|
const bondingCurve = bondingCurvePda(mint);
|
|
8515
|
-
const associatedBondingCurve = getAssociatedTokenAddressSync2(
|
|
8819
|
+
const associatedBondingCurve = getAssociatedTokenAddressSync2(
|
|
8820
|
+
mint,
|
|
8821
|
+
bondingCurve,
|
|
8822
|
+
true,
|
|
8823
|
+
tokenProgram
|
|
8824
|
+
);
|
|
8516
8825
|
const poolAuthority = pumpPoolAuthorityPda(mint);
|
|
8517
|
-
const poolAuthorityMintAccount = getAssociatedTokenAddressSync2(
|
|
8826
|
+
const poolAuthorityMintAccount = getAssociatedTokenAddressSync2(
|
|
8827
|
+
mint,
|
|
8828
|
+
poolAuthority,
|
|
8829
|
+
true,
|
|
8830
|
+
tokenProgram
|
|
8831
|
+
);
|
|
8518
8832
|
const pool = canonicalPumpPoolPda(mint);
|
|
8519
|
-
const poolBaseTokenAccount = getAssociatedTokenAddressSync2(
|
|
8833
|
+
const poolBaseTokenAccount = getAssociatedTokenAddressSync2(
|
|
8834
|
+
mint,
|
|
8835
|
+
pool,
|
|
8836
|
+
true,
|
|
8837
|
+
tokenProgram
|
|
8838
|
+
);
|
|
8520
8839
|
return this.offlinePumpProgram.methods.migrate().accountsPartial({
|
|
8521
8840
|
mint,
|
|
8522
8841
|
user,
|
|
@@ -8565,7 +8884,12 @@ var PumpSdk = class {
|
|
|
8565
8884
|
}) {
|
|
8566
8885
|
return await this.getBuyInstructionInternal({
|
|
8567
8886
|
user,
|
|
8568
|
-
associatedUser: getAssociatedTokenAddressSync2(
|
|
8887
|
+
associatedUser: getAssociatedTokenAddressSync2(
|
|
8888
|
+
mint,
|
|
8889
|
+
user,
|
|
8890
|
+
true,
|
|
8891
|
+
tokenProgram
|
|
8892
|
+
),
|
|
8569
8893
|
mint,
|
|
8570
8894
|
creator,
|
|
8571
8895
|
feeRecipient,
|
|
@@ -8623,7 +8947,12 @@ var PumpSdk = class {
|
|
|
8623
8947
|
return await this.offlinePumpProgram.methods.sell(amount, solAmount).accountsPartial({
|
|
8624
8948
|
feeRecipient,
|
|
8625
8949
|
mint,
|
|
8626
|
-
associatedUser: getAssociatedTokenAddressSync2(
|
|
8950
|
+
associatedUser: getAssociatedTokenAddressSync2(
|
|
8951
|
+
mint,
|
|
8952
|
+
user,
|
|
8953
|
+
true,
|
|
8954
|
+
tokenProgram
|
|
8955
|
+
),
|
|
8627
8956
|
user,
|
|
8628
8957
|
creatorVault: creatorVaultPda(creator),
|
|
8629
8958
|
tokenProgram
|
|
@@ -8633,7 +8962,10 @@ var PumpSdk = class {
|
|
|
8633
8962
|
var PUMP_SDK = new PumpSdk();
|
|
8634
8963
|
function getFeeRecipient(global, mayhemMode) {
|
|
8635
8964
|
if (mayhemMode) {
|
|
8636
|
-
const feeRecipients = [
|
|
8965
|
+
const feeRecipients = [
|
|
8966
|
+
global.reservedFeeRecipient,
|
|
8967
|
+
...global.reservedFeeRecipients
|
|
8968
|
+
];
|
|
8637
8969
|
return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
|
|
8638
8970
|
} else {
|
|
8639
8971
|
const feeRecipients = [global.feeRecipient, ...global.feeRecipients];
|