Add mayhem mode support and Token2022 integration (#149)
* feat: mayhem update in idl * feat(examples): update bonding curve scripts * feat(example): update listen_blocksubscribe * feat(examples): update geyser listener * feat(examples): update all new token listeners * feat(examples): add comments, fix printing, formatting * feat(examples): pumpswap buy and sell update with mayhem mode * fix(examples): sell pump amm fee recipient * feat(examples): update decode scripts * feat(examples): update fetch price * feat(examples): buy and sell bonding curve scripts * feat(examples): add mint with mayhem mode enabled * feat(examples): improve listening to wallet txs * feat(examples): migration listener improvements * feat(examples): global vol accumulator is not writable * feat(examples): support token/token2022 programs in buy instructions * feat(examples): token/token2022 for pumpswap buy * feat(examples): token/token2022 supprot for sell instructions * feat(bot): support create_v2 with token2022, mayhem mode, other fixes * fix(bot): support only token2022 in logs and pumportal listeners * feat(bot): token2022 support in cleanup flow * fix(bot): update token program handling and improve price validation in trading logic * feat(bot): enhance token program handling for LetsBonk integration
This commit is contained in:
@@ -19,6 +19,10 @@ PRIVATE_KEY = os.getenv("SOLANA_PRIVATE_KEY")
|
||||
# Update this address to MINT address of a token you want to close
|
||||
MINT_ADDRESS = Pubkey.from_string("9WHpYbqG6LJvfCYfMjvGbyo1wHXgroCrixPb33s2pump")
|
||||
|
||||
# Token program for the mint - use TOKEN_PROGRAM for legacy SPL tokens, TOKEN_2022_PROGRAM for Token-2022
|
||||
# This must match the actual token's program to derive the correct ATA address
|
||||
TOKEN_PROGRAM = SystemAddresses.TOKEN_PROGRAM
|
||||
|
||||
|
||||
async def close_account_if_exists(
|
||||
client: SolanaClient, wallet: Wallet, account: Pubkey, mint: Pubkey
|
||||
@@ -41,7 +45,7 @@ async def close_account_if_exists(
|
||||
mint=mint,
|
||||
owner=wallet.pubkey,
|
||||
amount=balance,
|
||||
program_id=SystemAddresses.TOKEN_PROGRAM,
|
||||
program_id=TOKEN_PROGRAM,
|
||||
)
|
||||
)
|
||||
await client.build_and_send_transaction([burn_ix], wallet.keypair)
|
||||
@@ -54,7 +58,7 @@ async def close_account_if_exists(
|
||||
account=account,
|
||||
dest=wallet.pubkey,
|
||||
owner=wallet.pubkey,
|
||||
program_id=SystemAddresses.TOKEN_PROGRAM,
|
||||
program_id=TOKEN_PROGRAM,
|
||||
)
|
||||
ix = close_account(close_params)
|
||||
|
||||
@@ -78,7 +82,7 @@ async def main():
|
||||
wallet = Wallet(PRIVATE_KEY)
|
||||
|
||||
# Get user's ATA for the token
|
||||
ata = wallet.get_associated_token_address(MINT_ADDRESS)
|
||||
ata = wallet.get_associated_token_address(MINT_ADDRESS, TOKEN_PROGRAM)
|
||||
await close_account_if_exists(client, wallet, ata, MINT_ADDRESS)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user