Skip to content

Commit 7ae8b56

Browse files
authored
feat(pumpswap): update pool account to writable for buy/sell instructions (#146)
1 parent b6928d1 commit 7ae8b56

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

idl/pump_swap_idl.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@
302302
],
303303
"accounts": [
304304
{
305-
"name": "pool"
305+
"name": "pool",
306+
"writable": true
306307
},
307308
{
308309
"name": "user",
@@ -730,7 +731,8 @@
730731
],
731732
"accounts": [
732733
{
733-
"name": "pool"
734+
"name": "pool",
735+
"writable": true
734736
},
735737
{
736738
"name": "user",
@@ -2465,7 +2467,8 @@
24652467
],
24662468
"accounts": [
24672469
{
2468-
"name": "pool"
2470+
"name": "pool",
2471+
"writable": true
24692472
},
24702473
{
24712474
"name": "user",

learning-examples/pumpswap/manual_buy_pumpswap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ async def buy_pump_swap(
318318

319319
# Define all accounts needed for the buy instruction
320320
accounts = [
321-
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=False),
321+
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=True),
322322
AccountMeta(pubkey=payer.pubkey(), is_signer=True, is_writable=True),
323323
AccountMeta(pubkey=PUMP_SWAP_GLOBAL_CONFIG, is_signer=False, is_writable=False),
324324
AccountMeta(pubkey=base_mint, is_signer=False, is_writable=False),
@@ -365,6 +365,7 @@ async def buy_pump_swap(
365365
BUY_DISCRIMINATOR
366366
+ struct.pack("<Q", base_amount_out)
367367
+ struct.pack("<Q", max_sol_input)
368+
+ struct.pack("<B", 1) # track_volume: 1 = true (enable volume tracking)
368369
)
369370

370371
compute_limit_ix = set_compute_unit_limit(COMPUTE_UNIT_BUDGET)

learning-examples/pumpswap/manual_sell_pumpswap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ async def sell_pump_swap(
308308

309309
# Define all accounts needed for the sell instruction
310310
accounts = [
311-
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=False),
311+
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=True),
312312
AccountMeta(pubkey=payer.pubkey(), is_signer=True, is_writable=True),
313313
AccountMeta(pubkey=PUMP_SWAP_GLOBAL_CONFIG, is_signer=False, is_writable=False),
314314
AccountMeta(pubkey=base_mint, is_signer=False, is_writable=False),

0 commit comments

Comments
 (0)