Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
leowvazd opened this issue Dec 18, 2024 · 1 comment

Comments

@leowvazd
Copy link

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?

@chainstacklabs chainstacklabs deleted a comment Dec 18, 2024
@BudBerner
Copy link

I'm getting the same error. ChatGPT keeps telling me it's because I'm incorrectly mixing solana-py and solders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants