Skip to content

'solders.transaction.Transaction' object has no attribute 'recent_blockhash' #24

@leowvazd

Description

@leowvazd

Hi guys! I'm tryng to run the bot, but i got this error on create ATA tx using Transaction from solders:

Attempt 1 to create associated token account (ATA) failed: 'solders.transaction.Transaction' object has no attribute 'recent_blockhash'

My current code snippet is this:

                    print(f"Creating associated token account (Attempt {ata_attempt + 1})...")
                    create_ata_ix = spl_token.create_associated_token_account(
                        payer=payer.pubkey(),
                        owner=payer.pubkey(),
                        mint=mint
                    )

                    blockhash_response = await client.get_latest_blockhash()
                    rct_blockhash = blockhash_response.value.blockhash

                    msg = Message([create_ata_ix], payer.pubkey())
                    
                    tx_ata = await client.send_transaction(
                        Transaction([payer], msg, rct_blockhash),
                        opts=TxOpts(skip_preflight=True, preflight_commitment=Confirmed)
                    )
                    
                    await client.confirm_transaction(tx_ata.value, commitment="confirmed")

                    print("Associated token account created.")
                    print(f"Associated token account address: {associated_token_account}")
                    break

I've tried a few things like changing the versions of the solana and solders libraries, reinstalling python, changing rpc and wss but all without success.

Does anyone have a solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions