@pump-fun/pump-sdk 1.20.0-devnet.1 → 1.20.0-devnet.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 CHANGED
@@ -3920,6 +3920,26 @@ var pump_default = {
3920
3920
  name: "associated_token_program",
3921
3921
  address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
3922
3922
  },
3923
+ {
3924
+ name: "mayhem_program_id",
3925
+ writable: true
3926
+ },
3927
+ {
3928
+ name: "global_params",
3929
+ writable: true
3930
+ },
3931
+ {
3932
+ name: "sol_vault",
3933
+ writable: true
3934
+ },
3935
+ {
3936
+ name: "mayhem_state",
3937
+ writable: true
3938
+ },
3939
+ {
3940
+ name: "mayhem_token_vault",
3941
+ writable: true
3942
+ },
3923
3943
  {
3924
3944
  name: "event_authority",
3925
3945
  pda: {
@@ -3969,6 +3989,10 @@ var pump_default = {
3969
3989
  {
3970
3990
  name: "creator",
3971
3991
  type: "pubkey"
3992
+ },
3993
+ {
3994
+ name: "is_mayhem_mode",
3995
+ type: "bool"
3972
3996
  }
3973
3997
  ]
3974
3998
  },
@@ -5466,6 +5490,90 @@ var pump_default = {
5466
5490
  }
5467
5491
  ]
5468
5492
  },
5493
+ {
5494
+ name: "set_reserved_fee_recipient",
5495
+ discriminator: [
5496
+ 207,
5497
+ 189,
5498
+ 178,
5499
+ 71,
5500
+ 167,
5501
+ 122,
5502
+ 68,
5503
+ 180
5504
+ ],
5505
+ accounts: [
5506
+ {
5507
+ name: "global",
5508
+ writable: true,
5509
+ pda: {
5510
+ seeds: [
5511
+ {
5512
+ kind: "const",
5513
+ value: [
5514
+ 103,
5515
+ 108,
5516
+ 111,
5517
+ 98,
5518
+ 97,
5519
+ 108
5520
+ ]
5521
+ }
5522
+ ]
5523
+ }
5524
+ },
5525
+ {
5526
+ name: "authority",
5527
+ writable: true,
5528
+ signer: true,
5529
+ relations: [
5530
+ "global"
5531
+ ]
5532
+ },
5533
+ {
5534
+ name: "event_authority",
5535
+ pda: {
5536
+ seeds: [
5537
+ {
5538
+ kind: "const",
5539
+ value: [
5540
+ 95,
5541
+ 95,
5542
+ 101,
5543
+ 118,
5544
+ 101,
5545
+ 110,
5546
+ 116,
5547
+ 95,
5548
+ 97,
5549
+ 117,
5550
+ 116,
5551
+ 104,
5552
+ 111,
5553
+ 114,
5554
+ 105,
5555
+ 116,
5556
+ 121
5557
+ ]
5558
+ }
5559
+ ]
5560
+ }
5561
+ },
5562
+ {
5563
+ name: "program"
5564
+ }
5565
+ ],
5566
+ args: [
5567
+ {
5568
+ name: "reserved_fee_recipient",
5569
+ type: "pubkey"
5570
+ },
5571
+ {
5572
+ name: "whitelist_pda",
5573
+ type: "pubkey"
5574
+ }
5575
+ ]
5576
+ },
5469
5577
  {
5470
5578
  name: "sync_user_volume_accumulator",
5471
5579
  discriminator: [
@@ -5674,6 +5782,86 @@ var pump_default = {
5674
5782
  }
5675
5783
  ]
5676
5784
  },
5785
+ {
5786
+ name: "toggle_mayhem_mode",
5787
+ discriminator: [
5788
+ 1,
5789
+ 9,
5790
+ 111,
5791
+ 208,
5792
+ 100,
5793
+ 31,
5794
+ 255,
5795
+ 163
5796
+ ],
5797
+ accounts: [
5798
+ {
5799
+ name: "global",
5800
+ writable: true,
5801
+ pda: {
5802
+ seeds: [
5803
+ {
5804
+ kind: "const",
5805
+ value: [
5806
+ 103,
5807
+ 108,
5808
+ 111,
5809
+ 98,
5810
+ 97,
5811
+ 108
5812
+ ]
5813
+ }
5814
+ ]
5815
+ }
5816
+ },
5817
+ {
5818
+ name: "authority",
5819
+ writable: true,
5820
+ signer: true,
5821
+ relations: [
5822
+ "global"
5823
+ ]
5824
+ },
5825
+ {
5826
+ name: "event_authority",
5827
+ pda: {
5828
+ seeds: [
5829
+ {
5830
+ kind: "const",
5831
+ value: [
5832
+ 95,
5833
+ 95,
5834
+ 101,
5835
+ 118,
5836
+ 101,
5837
+ 110,
5838
+ 116,
5839
+ 95,
5840
+ 97,
5841
+ 117,
5842
+ 116,
5843
+ 104,
5844
+ 111,
5845
+ 114,
5846
+ 105,
5847
+ 116,
5848
+ 121
5849
+ ]
5850
+ }
5851
+ ]
5852
+ }
5853
+ },
5854
+ {
5855
+ name: "program"
5856
+ }
5857
+ ],
5858
+ args: [
5859
+ {
5860
+ name: "enabled",
5861
+ type: "bool"
5862
+ }
5863
+ ]
5864
+ },
5677
5865
  {
5678
5866
  name: "update_global_authority",
5679
5867
  discriminator: [
@@ -6264,6 +6452,14 @@ var pump_default = {
6264
6452
  {
6265
6453
  code: 6046,
6266
6454
  name: "CreateV2Disabled"
6455
+ },
6456
+ {
6457
+ code: 6047,
6458
+ name: "CpitializeMayhemFailed"
6459
+ },
6460
+ {
6461
+ code: 6048,
6462
+ name: "MayhemModeDisabled"
6267
6463
  }
6268
6464
  ],
6269
6465
  types: [
@@ -6379,6 +6575,10 @@ var pump_default = {
6379
6575
  {
6380
6576
  name: "creator",
6381
6577
  type: "pubkey"
6578
+ },
6579
+ {
6580
+ name: "is_mayhem_mode",
6581
+ type: "bool"
6382
6582
  }
6383
6583
  ]
6384
6584
  }
@@ -6587,6 +6787,10 @@ var pump_default = {
6587
6787
  {
6588
6788
  name: "token_program",
6589
6789
  type: "pubkey"
6790
+ },
6791
+ {
6792
+ name: "is_mayhem_mode",
6793
+ type: "bool"
6590
6794
  }
6591
6795
  ]
6592
6796
  }
@@ -6772,6 +6976,18 @@ var pump_default = {
6772
6976
  {
6773
6977
  name: "create_v2_enabled",
6774
6978
  type: "bool"
6979
+ },
6980
+ {
6981
+ name: "whitelist_pda",
6982
+ type: "pubkey"
6983
+ },
6984
+ {
6985
+ name: "reserved_fee_recipient",
6986
+ type: "pubkey"
6987
+ },
6988
+ {
6989
+ name: "mayhem_mode_enabled",
6990
+ type: "bool"
6775
6991
  }
6776
6992
  ]
6777
6993
  }
@@ -7235,7 +7451,8 @@ function newBondingCurve(global) {
7235
7451
  realSolReserves: new BN2(0),
7236
7452
  tokenTotalSupply: global.tokenTotalSupply,
7237
7453
  complete: false,
7238
- creator: PublicKey2.default
7454
+ creator: PublicKey2.default,
7455
+ isMayhemMode: global.mayhemModeEnabled
7239
7456
  };
7240
7457
  }
7241
7458
  function getBuySolAmountFromTokenAmountQuote({
@@ -7389,7 +7606,7 @@ function bondingCurveMarketCap({
7389
7606
 
7390
7607
  // src/pda.ts
7391
7608
  import { PublicKey as PublicKey5 } from "@solana/web3.js";
7392
- import { NATIVE_MINT as NATIVE_MINT2 } from "@solana/spl-token";
7609
+ import { getAssociatedTokenAddressSync as getAssociatedTokenAddressSync3, NATIVE_MINT as NATIVE_MINT2, TOKEN_2022_PROGRAM_ID as TOKEN_2022_PROGRAM_ID3 } from "@solana/spl-token";
7393
7610
  import { poolPda, pumpFeePda, pumpPda } from "@pump-fun/pump-swap-sdk";
7394
7611
 
7395
7612
  // src/sdk.ts
@@ -7774,10 +7991,13 @@ var PUMP_PROGRAM_ID = new PublicKey4(
7774
7991
  var PUMP_AMM_PROGRAM_ID = new PublicKey4(
7775
7992
  "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"
7776
7993
  );
7994
+ var MAYHEM_PROGRAM_ID = new PublicKey4(
7995
+ "MAyhSmzXzV1pTf7LsNkrNwkWKTo4ougAJ1PPg47MD4e"
7996
+ );
7777
7997
  var PUMP_FEE_PROGRAM_ID = new PublicKey4(
7778
7998
  "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ"
7779
7999
  );
7780
- var BONDING_CURVE_NEW_SIZE = 150;
8000
+ var BONDING_CURVE_NEW_SIZE = 151;
7781
8001
  var PUMP_TOKEN_MINT = new PublicKey4(
7782
8002
  "pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn"
7783
8003
  );
@@ -7854,12 +8074,18 @@ var PumpSdk = class {
7854
8074
  symbol,
7855
8075
  uri,
7856
8076
  creator,
7857
- user
8077
+ user,
8078
+ mayhemMode
7858
8079
  }) {
7859
- return await this.offlinePumpProgram.methods.createV2(name, symbol, uri, creator).accountsPartial({
8080
+ return await this.offlinePumpProgram.methods.createV2(name, symbol, uri, creator, mayhemMode).accountsPartial({
7860
8081
  mint,
7861
8082
  user,
7862
- tokenProgram: TOKEN_2022_PROGRAM_ID2
8083
+ tokenProgram: TOKEN_2022_PROGRAM_ID2,
8084
+ mayhemProgramId: MAYHEM_PROGRAM_ID,
8085
+ globalParams: getGlobalParamsPda(),
8086
+ solVault: getSolVaultPda(),
8087
+ mayhemState: getMayhemStatePda(mint),
8088
+ mayhemTokenVault: getTokenVaultPda(mint)
7863
8089
  }).instruction();
7864
8090
  }
7865
8091
  async buyInstructions({
@@ -7905,7 +8131,8 @@ var PumpSdk = class {
7905
8131
  amount,
7906
8132
  solAmount,
7907
8133
  slippage,
7908
- tokenProgram
8134
+ tokenProgram,
8135
+ mayhemMode: bondingCurve.isMayhemMode
7909
8136
  })
7910
8137
  );
7911
8138
  return instructions;
@@ -7919,11 +8146,12 @@ var PumpSdk = class {
7919
8146
  creator,
7920
8147
  user,
7921
8148
  amount,
7922
- solAmount
8149
+ solAmount,
8150
+ mayhemMode
7923
8151
  }) {
7924
8152
  const associatedUser = getAssociatedTokenAddressSync2(mint, user, true, TOKEN_2022_PROGRAM_ID2);
7925
8153
  return [
7926
- await this.createV2Instruction({ mint, name, symbol, uri, creator, user }),
8154
+ await this.createV2Instruction({ mint, name, symbol, uri, creator, user, mayhemMode }),
7927
8155
  await this.extendAccountInstruction({
7928
8156
  account: bondingCurvePda(mint),
7929
8157
  user
@@ -7996,14 +8224,15 @@ var PumpSdk = class {
7996
8224
  amount,
7997
8225
  solAmount,
7998
8226
  slippage,
7999
- tokenProgram
8227
+ tokenProgram,
8228
+ mayhemMode = false
8000
8229
  }) {
8001
8230
  return await this.getBuyInstructionInternal({
8002
8231
  user,
8003
8232
  associatedUser,
8004
8233
  mint,
8005
8234
  creator,
8006
- feeRecipient: getFeeRecipient(global),
8235
+ feeRecipient: getFeeRecipient(global, mayhemMode),
8007
8236
  amount,
8008
8237
  solAmount: solAmount.add(
8009
8238
  solAmount.mul(new BN5(Math.floor(slippage * 10))).div(new BN5(1e3))
@@ -8020,7 +8249,8 @@ var PumpSdk = class {
8020
8249
  amount,
8021
8250
  solAmount,
8022
8251
  slippage,
8023
- tokenProgram = TOKEN_PROGRAM_ID2
8252
+ tokenProgram = TOKEN_PROGRAM_ID2,
8253
+ mayhemMode = false
8024
8254
  }) {
8025
8255
  const instructions = [];
8026
8256
  if (bondingCurveAccountInfo.data.length < BONDING_CURVE_NEW_SIZE) {
@@ -8036,7 +8266,7 @@ var PumpSdk = class {
8036
8266
  user,
8037
8267
  mint,
8038
8268
  creator: bondingCurve.creator,
8039
- feeRecipient: getFeeRecipient(global),
8269
+ feeRecipient: getFeeRecipient(global, mayhemMode),
8040
8270
  amount,
8041
8271
  solAmount: solAmount.sub(
8042
8272
  solAmount.mul(new BN5(Math.floor(slippage * 10))).div(new BN5(1e3))
@@ -8181,9 +8411,13 @@ var PumpSdk = class {
8181
8411
  }
8182
8412
  };
8183
8413
  var PUMP_SDK = new PumpSdk();
8184
- function getFeeRecipient(global) {
8185
- const feeRecipients = [global.feeRecipient, ...global.feeRecipients];
8186
- return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
8414
+ function getFeeRecipient(global, mayhemMode) {
8415
+ if (!mayhemMode) {
8416
+ const feeRecipients = [global.feeRecipient, ...global.feeRecipients];
8417
+ return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
8418
+ } else {
8419
+ return global.reservedFeeRecipient;
8420
+ }
8187
8421
  }
8188
8422
 
8189
8423
  // src/pda.ts
@@ -8220,6 +8454,32 @@ function canonicalPumpPoolPda(mint) {
8220
8454
  function userVolumeAccumulatorPda(user) {
8221
8455
  return pumpPda([import_buffer.Buffer.from("user_volume_accumulator"), user.toBuffer()]);
8222
8456
  }
8457
+ var getGlobalParamsPda = () => {
8458
+ return PublicKey5.findProgramAddressSync(
8459
+ [import_buffer.Buffer.from("global-params")],
8460
+ MAYHEM_PROGRAM_ID
8461
+ )[0];
8462
+ };
8463
+ var getMayhemStatePda = (mint) => {
8464
+ return PublicKey5.findProgramAddressSync(
8465
+ [import_buffer.Buffer.from("mayhem-state"), mint.toBuffer()],
8466
+ MAYHEM_PROGRAM_ID
8467
+ )[0];
8468
+ };
8469
+ var getSolVaultPda = () => {
8470
+ return PublicKey5.findProgramAddressSync(
8471
+ [import_buffer.Buffer.from("sol-vault")],
8472
+ MAYHEM_PROGRAM_ID
8473
+ )[0];
8474
+ };
8475
+ var getTokenVaultPda = (mintPubkey) => {
8476
+ return getAssociatedTokenAddressSync3(
8477
+ mintPubkey,
8478
+ getSolVaultPda(),
8479
+ true,
8480
+ TOKEN_2022_PROGRAM_ID3
8481
+ );
8482
+ };
8223
8483
  export {
8224
8484
  BONDING_CURVE_NEW_SIZE,
8225
8485
  CANONICAL_POOL_INDEX,
@@ -8238,8 +8498,12 @@ export {
8238
8498
  currentDayTokens,
8239
8499
  getBuySolAmountFromTokenAmount,
8240
8500
  getBuyTokenAmountFromSolAmount,
8501
+ getGlobalParamsPda,
8502
+ getMayhemStatePda,
8241
8503
  getPumpProgram,
8242
8504
  getSellSolAmountFromTokenAmount,
8505
+ getSolVaultPda,
8506
+ getTokenVaultPda,
8243
8507
  newBondingCurve,
8244
8508
  pump_default as pumpIdl,
8245
8509
  pumpPoolAuthorityPda,