feat(pumpswap): update pool account to writable for buy/sell instructions (#146)

This commit is contained in:
Anton Sauchyk
2025-11-04 17:06:22 +01:00
committed by GitHub
parent b6928d1f5f
commit 7ae8b560bd
3 changed files with 9 additions and 5 deletions
+6 -3
View File
@@ -302,7 +302,8 @@
],
"accounts": [
{
"name": "pool"
"name": "pool",
"writable": true
},
{
"name": "user",
@@ -730,7 +731,8 @@
],
"accounts": [
{
"name": "pool"
"name": "pool",
"writable": true
},
{
"name": "user",
@@ -2465,7 +2467,8 @@
],
"accounts": [
{
"name": "pool"
"name": "pool",
"writable": true
},
{
"name": "user",
@@ -318,7 +318,7 @@ async def buy_pump_swap(
# Define all accounts needed for the buy instruction
accounts = [
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=False),
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=True),
AccountMeta(pubkey=payer.pubkey(), is_signer=True, is_writable=True),
AccountMeta(pubkey=PUMP_SWAP_GLOBAL_CONFIG, is_signer=False, is_writable=False),
AccountMeta(pubkey=base_mint, is_signer=False, is_writable=False),
@@ -365,6 +365,7 @@ async def buy_pump_swap(
BUY_DISCRIMINATOR
+ struct.pack("<Q", base_amount_out)
+ struct.pack("<Q", max_sol_input)
+ struct.pack("<B", 1) # track_volume: 1 = true (enable volume tracking)
)
compute_limit_ix = set_compute_unit_limit(COMPUTE_UNIT_BUDGET)
@@ -308,7 +308,7 @@ async def sell_pump_swap(
# Define all accounts needed for the sell instruction
accounts = [
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=False),
AccountMeta(pubkey=pump_fun_amm_market, is_signer=False, is_writable=True),
AccountMeta(pubkey=payer.pubkey(), is_signer=True, is_writable=True),
AccountMeta(pubkey=PUMP_SWAP_GLOBAL_CONFIG, is_signer=False, is_writable=False),
AccountMeta(pubkey=base_mint, is_signer=False, is_writable=False),